Skip to content

API ReferenceReact provider and hooksFunction

useVaultDepositAuthorizationWorkflow()

function useVaultDepositAuthorizationWorkflow(): UseVaultDepositAuthorizationWorkflowResult;

Validates and prepares a signed authorization permitting a collateralizable contract to deposit into the CollateralVault on the signer’s behalf.

The prepared workflow signs; it broadcasts no transaction. The bound nonce defaults to the signer’s next on-chain nonce, so a long-held workflow must be rebuilt if that nonce is consumed before signing.

Returns

UseVaultDepositAuthorizationWorkflowResult

The canonical preparation envelope. validate reports a verdict without building anything; prepareWorkflow validates and then builds, resolving to prepared, invalid, failed, or cancelled; workflow, issues, error, and isPreparing mirror the latest request; and reset discards it. No wallet is prompted until workflow.execute().

Throws

Error when rendered outside <AnvilProvider>, by way of useAnvilSDK. Nothing else throws: a rejected validation or build is reported as a failed result, not as an exception.

Example

export function AuthorizeVaultDepositButton() {
const authorization = useVaultDepositAuthorizationWorkflow();
async function authorize() {
// Signature only -- no transaction is broadcast by this workflow.
const result = await authorization.prepareWorkflow({
collateralizableAddress: COLLATERALIZABLE,
tokenAddress: USDC,
depositAmount: 1_000_000_000n,
});
if (result.status === 'prepared') await result.workflow.execute();
}
return (
<button onClick={authorize} disabled={authorization.isPreparing}>
Authorize deposit
</button>
);
}