Skip to content

LightningLike.receive ​

ts
receive(amount: Amount, description: string): Promise<LnReceiveHandle>

Creates an invoice that the wallet can get paid on.

Parameters

NameTypeDescription
amountAmountThe amount to ask for, in msat (a bigint).
descriptionstringThe text inside the invoice.

Returns. LnReceiveHandle. An object with the invoice to show the payer and the operation to follow.

Throws. InvalidInput, GatewayUnavailable, Recovering, NotSupported, FederationUnreachable, Timeout, Storage, Internal, FederationClosed. InvalidInput means a zero amount, a bad description, or an amount too small for the fee.

Example

example.ts
ts
import type { LightningLike } from '@fedimint/react-native'

declare const ln: LightningLike

const { invoice, operation } = await ln.receive(5000n, 'Coffee') // 5 sats, in msat
console.log(invoice, operation !== undefined)

Used in. Receive, step 03