Transactions, wallets, and signatures
Run the multi-step workflow every write returns, and follow each step’s status.
Every write the SDK performs comes back as a
WalletOperationWorkflow: the
ordered steps a change takes, built and checked before a wallet is involved. An approve before a
deposit, or a deposit before a LOC, arrives as one object you execute together.
workflow.operations lists each step as a
WalletOperation, a transaction or an
EIP-712 signature, so your app can show the user everything they’re about to approve.
workflow.execute() runs the steps in order, reports each one’s
WalletOperationStatus as it
changes, and checks an optional cancellation callback between steps. It resolves to a
WorkflowExecutionResult:
invalid input, a failed step, and a cancellation each come back as a status you branch on.
The workflows themselves come from the methods in LOC lifecycle and Vaults, collateral, and risk.
A deposit, built, executed, and checked:
// Every build*Workflow method returns the same shape: the steps the user// will be asked to approve, and one execute() that runs them in order.const workflow = await sdk.vault.buildDepositWorkflow({ tokenAmounts: [{ tokenAddress: USDC, amount: 1_000_000_000n }],});console.log(workflow.operations.map(op => op.type)); // approve, deposit
const result = await workflow.execute(operations => { for (const op of operations) console.log(op.type, op.status);});// Invalid input and wallet failures come back as values, not throws.if (result.status === 'invalid') { throw new Error(JSON.stringify(result.issues));}if (result.status === 'failed') throw result.error;Primary APIs
Interfaces
WalletOperationWorkflow— The ordered wallet steps that together complete one protocol action, and theexecutefunction that runs them.
Type aliases
WalletOperation— One step of a WalletOperationWorkflow: the protocol action it performs, the inputs it runs with, its current status, and its result once it…WorkflowExecutionResult— What one call to WalletOperationWorkflow.execute resolved with.
Enumerations
WalletOperationStatus— Lifecycle state of a single WalletOperation.