FFiber WebLN
API / Provider / provider.makeInvoice

provider.makeInvoice

Core

Create a Fiber invoice that another node can pay.

Signature

function makeInvoice(args: MakeInvoiceArgs): Promise<MakeInvoiceResult>
PERMISSION

Requires enable(). Current reference providers do not show a second confirmation prompt for invoice creation.

Parameters

NameTypeDescription
args.amountrequiredHex

Amount in the asset's smallest unit, encoded as 0x-prefixed hex.

args.currency"Fibb" | "Fibt" | "Fibd"

Fiber invoice network tag. Defaults to Fibt in the reference providers.

args.descriptionstring

Human-readable payment description embedded in the invoice.

args.expiryHex

Invoice expiry value accepted by the underlying Fiber node.

Response

NameTypeDescription
invoicerequiredstring

Encoded Fiber invoice address.

paymentHashrequiredHex

Hash associated with the provider-generated payment preimage.

Example

const created = await fiber.makeInvoice({
  amount: "0x5f5e100", // 1 CKB in shannons
  currency: "Fibt",
  description: "Coffee"
});

console.log(created.invoice);

Provider behavior

W

WASM node

Generates a random preimage and maps the request to fiber-js newInvoice().

R

Remote fnn

Generates a random preimage in the extension and calls fnn new_invoice over JSON-RPC.

Notes

  • The current public arguments model native invoice currency; richer UDT invoice typing is still evolving.

Errors