Skip to content

Reference

createTransferOffer

Exercise WalletAppInstall_CreateTransferOffer from the validator wallet install contract to propose an Amulet transfer to another party.

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 whose partyId funds / authors the offer.
  • receiverPartyId (required) — Destination party.
  • amount (required, decimal string) — Amulet quantity (AmuletUnit).
  • description (required) — Stored alongside offer metadata.
  • expiresAt (optional Date) — 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.

See also

Source

src/utils/amulet/offers.ts