Skip to content

Transactions, wallets, and signatures

Prepare, sign, submit, and observe blockchain transactions and multi-step wallet workflows.

Every write the SDK performs follows the same three beats: build an unsigned transaction, send it through the configured wallet client, then wait for it to confirm. Anything that takes more than one transaction — an approve before a deposit, a deposit before a LOC — is packaged as a WalletOperationWorkflow: an ordered list of operations you execute together, with a callback that reports each one as its status changes and a cancellation check between steps.

sendTransaction submits, and awaitTransactionConfirmation waits and returns either a receipt or a typed error for the operation you name. isTerminalOperationStatus says when an operation has stopped moving. Not every step is a transaction: some are EIP-712 signatures, which cost no gas and can be handed on. AnvilAuthorization is the inspectable contract for those steps: it carries the expected signer, nonce, chain, verifying contract, semantic payload, and exact typed data before a wallet is prompted. Build a definition directly when another signing component will handle it, or use the module workflow builders and React preparation hooks when the current wallet should sign. Durable or cross-process handoff requires an integration-owned encoding because the SDK does not publish a wire codec for bigint-bearing definitions. The legacy signature helpers remain as compatibility wrappers over the same builders.

Signed authorizations have no explicit deadline. Vault authorization families can be revoked with sdk.vault.buildInvalidateNoncesWorkflow. LOC cancellation and redemption currently have no SDK-supported invalidation operation and remain bounded by nonce consumption plus the applicable LOC state and expiration rules.

The workflows themselves come from the operations in LOC lifecycle and Vaults, collateral, and risk.

Build, send, and confirm one transaction:

// Every write follows build -> send -> await. Here: revoke the vault's
// USDC allowance.
const transaction = await buildERC20RevokeTransaction(sdk, {
erc20Address: USDC,
spender: await sdk.getContractAddress(AnvilContract.CollateralVault),
});
// Throws on wallet rejection, revert, or missing wallet.
const hash = await sendTransaction(sdk, { transaction });
const result = await awaitTransactionConfirmation(
sdk,
{ hash, confirmations: 2 },
AnvilWalletOperationType.ERC20Approve // selects the typed error below
);
if (result.error) throw new Error(JSON.stringify(result.error));
return result.receipt?.status === 'success';

Primary APIs

Functions

  • awaitTransactionConfirmation — Waits for the transaction with the provided hash to be mined and confirmed by the specified number of blocks, then wraps the result in an…
  • sendTransaction — Sends a transaction via the configured walletClient.

Interfaces

  • WalletOperationWorkflow — A workflow of multiple ordered WalletOperations to execute in order to accomplish some logical function.

Type aliases

Supporting types and functions in this group are not listed here; each has its own page, listed with the group in the sidebar.