API ReferenceReact provider and hooksFunction
useModifyVaultAllowanceAuthorizationWorkflow()
function useModifyVaultAllowanceAuthorizationWorkflow(): UseModifyVaultAllowanceAuthorizationWorkflowResult;Validates and prepares a signed authorization adjusting a collateralizable contract’s CollateralVault allowance.
modifyAmount is a signed delta rather than a new total: a negative value revokes allowance. The
prepared workflow signs and broadcasts no transaction.
Returns
UseModifyVaultAllowanceAuthorizationWorkflowResult
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 AuthorizeAllowanceButton() { const authorization = useModifyVaultAllowanceAuthorizationWorkflow();
async function authorize() { // `modifyAmount` is a signed delta: negative reduces the allowance. const result = await authorization.prepareWorkflow({ tokenAddress: USDC, allowedContract: COLLATERALIZABLE, modifyAmount: 1_000_000_000n, }); if (result.status === 'prepared') await result.workflow.execute(); }
return ( <button onClick={authorize} disabled={authorization.isPreparing}> Raise allowance </button> );}