createTransferOffer resolves the WalletAppInstall contract ID via EnvLoader for the ledger client’s network, submits WalletAppInstall_CreateTransferOffer as the ledger client’s acting party, and extracts the newly minted TransferOffer contract ID from tree event 1.
Pair with acceptTransferOffer when onboarding wallets programmatically.
Setup
import { createTransferOffer } from '@fairmint/canton-node-sdk';
const canton = new Canton({
network: 'NETWORK_NAME',
partyId: 'FUNDER_PARTY_ID',
});
Minimal example
const transferOfferContractId = await createTransferOffer({
ledgerClient: canton.ledger,
receiverPartyId: 'RECEIVER_PARTY_ID',
amount: 'AMOUNT_DECIMAL_STRING',
description: 'Human-readable memo',
});
console.log(transferOfferContractId);
Parameters
CreateTransferOfferParams:
ledgerClient(required) — Ledger client whosepartyIdfunds / authors the offer.receiverPartyId(required) — Destination party.amount(required, decimal string) — Amulet quantity (AmuletUnit).description(required) — Stored alongside offer metadata.expiresAt(optionalDate) — Defaults to 24 hours ahead.
Returns
Promise<string> — TransferOffer contract ID string created by the submission.
Errors
Throws OperationError TRANSACTION_FAILED when event 1 is not a CreatedTreeEvent.
Throws when EnvLoader lacks WalletAppInstall mapping for the active network — configure validator wallet metadata accordingly.
Auth and party
Acts as ledgerClient.getPartyId() (actAs). Ensure that party’s wallet installation matches Canton splice packaging referenced by EnvLoader.