Creates a Spark invoice for receiving a tokens payment on Spark.
Method Signature
async createTokensInvoice({
amount,
tokenIdentifier,
memo,
senderSparkAddress,
expiryTime,
}: {
tokenIdentifier?: Bech32mTokenIdentifier;
amount?: bigint;
memo?: string;
senderSparkAddress?: SparkAddressFormat;
expiryTime?: Date;
}): Promise<SparkAddressFormat>
Parameters
The Bech32m token identifier (e.g., btkn1...)
The amount of tokens to receive. Max: 2^128 - 1.
Optional memo/description for the payment
Optional Spark address of the expected sender
Optional expiry time for the invoice
Returns
invoice
SparkAddressFormat
required
A Spark address/invoice that can be paid by another Spark wallet
Example
const invoice = await wallet.createTokensInvoice({
tokenIdentifier: "btkn1...",
amount: 1000n,
memo: "Token payment"
});
console.log("Token invoice:", invoice);