useCards
Hook to interact with the cards of an account and modify their configuration
Import
import { useCards } from '@lawallet/react';
Usage
index.tsx
import { useCards } from '@lawallet/react';
import { config } from './config';
function App() {
const { cards } = useCards({
config,
});
}
Parameters
import { type UseCardsParameters } from '@lawallet/react';
config
Config | undefined
Config
to use instead of retrieving from the from nearest LaWalletConfig
.
import { useCards } from '@lawallet/react';
import { config } from './config';
function App() {
const { transactions } = useCards({
pubkey: '17efe7a5f1...53936f68b',
config,
});
}
Return Type
import { type UseCardsReturns } from '@lawallet/react';
cardsData
Returns the requested cards data
cardsConfig
Returns the requested cards config
toggleCardStatus
(uuid: string) => Promise<boolean>
- Function to switch card status
- It receives as a parameter the uuid (string) of the card whose status you want to change.
updateCardConfig
(uuid: string, config: CardPayload) => Promise<boolean>
See CardPayload
- Function that changes the configuration of a card
- Receives as a parameter the uuid (string) of the card whose status you want to change and the new configuration for this card (CardPayload)
buildDonationEvent
(uuid: string) => Promise<NostrEvent | undefined>
- Function that generates a signed event to transfer the card
- Receives as a parameter the uuid (string) of the card you want to donate