Public API: C8WalletProvider
Constructor
Creates a new wallet provider instance.Canton network to connect to. Use
"devnet", "testmainnet", or "mainnet". Defaults to "mainnet".connect
Opens the C8 Wallet popup and establishes thepostMessage channel. The user sees a connection approval screen in the wallet.
Call interactive methods from a user gesture, such as a button click, to avoid
POPUP_BLOCKED errors.disconnect
Closes the wallet popup and tears down thepostMessage channel. Emits the disconnected event.
status
Returns the current connection state.getContractsSetupState
Returns the connected account’s registration and validator-managed contract setup transactions, including all statuses.Connected account to query. Defaults to the primary account. The popup provider rejects an unknown party ID before sending a backend request.
Setup transactions with their contract code, command ID, status, and contract ID. The contract ID and timestamps can be
null. Status strings come from the backend.validator.backendApiUrl or an account token, disconnect and reconnect.
This response replaces the deprecated
RegisterStatusResponse. Read the contracts array instead of the old is... flags. Embedded wallet hosts must return PartyContractSetupResponse for this RPC.getInstruments
Returns the list of Canton instruments available in the connected wallet.getActiveContracts
Returns active contracts visible to the connected account. You can filter the Scanner active contract set by template or interface.Account party ID. Defaults to the connected primary account. Direct provider requests can only use the primary account.
Nonnegative signed 64-bit ledger offset for a point-in-time snapshot. Pass the offset as a decimal string.
Whether each contract should include its Base64-encoded created-event blob. Defaults to
false.getLedgerUpdates
Returns one page of ledger updates visible to the connected account. Use the returned cursor to request the next page with the same filters.Account party ID. Defaults to the connected primary account. Direct provider requests can only use the primary account.
Lost history detected before or within the requested range, when present.
An empty page can still return a new cursor. If
gap is present, the result does not represent complete ledger history.getAccounts
Returns accounts and their holdings. IfinstrumentId is provided, filters to accounts holding that instrument.
send
Submits a transfer on the Canton ledger. Opens an approval screen in the wallet popup.createSwapOffer
Creates a multi-leg swap offer and opens the wallet approval UI. Amounts in swap legs are decimal strings.Assets the creator provides. Each leg contains
receiver, instrument, amount, legId, and an optional reason.Assets the acceptor provides. Each leg uses the same shape as a creator leg.
Additional transfer legs supplied by the creator. Pass an empty array when the swap has none.
Application metadata for the swap. Pass an empty object when you have no metadata.
signMessage
Asks the wallet to sign an arbitrary string. You can bind the request to a specific account by passing its party ID.signAndExecute
Signs and executes custom DAML commands via the connected wallet. Use this for templates, choices, and contract workflows beyond the SDK’s high-level methods. See Transactions and signing for the full example.JSON-serialized array of contracts disclosed to the participant to authorize the command.
on
Subscribes to a wallet event. Returns an unsubscribe function. See Events for the full event reference.checkTxStatusById
Polls the Canton ledger for the current status of a previously submitted transaction.Optional connected account whose backend and token the popup provider uses to check the transaction. Defaults to the primary account.
