useZap
Hook to send a zap to a LaWallet user
Import
import { useZap } from '@lawallet/react';Usage
import { useZap } from '@lawallet/react';
import { config } from './config';
 
function App() {
  const userPubkey: string = '9a9787e3e31cfdc95f35d5cfc1eeaead33e693ec59789c20f63546b191e28d59';
 
  const { invoice, createZapInvoice, resetInvoice } = useZap({
    receiverPubkey: userPubkey,
    config,
  });
}Parameters
import { type useZapParameters } from '@lawallet/react';receiverPubkey
String
- Public key of the user to whom you want to send a zap
 
import { useZap } from '@lawallet/react';
 
function App() {
  const { invoice, createZapInvoice, resetInvoice } = useZap({
    receiverPubkey: '17efe7a5f1...53936f68b',
  });
}config
Config | undefined
Config to use instead of retrieving from the from nearest LaWalletProvider.
import { useZap } from '@lawallet/react';
import { config } from './config';
 
function App() {
  const { invoice, createZapInvoice, resetInvoice } = useZap({
    receiverPubkey: '17efe7a5f1...53936f68b',
    config,
  });
}Return Type
import { type useZapReturns } from '@lawallet/react';invoice
Returns the zap invoice information
createZapInvoice
(sats: number) => Promise<string | undefined>
- Function to create the invoice that will invoke the zap receipt when paying it
 - Returns the invoice to be paid in bolt11 format
 
resetInvoice
() => void
- Reset invoice info