Skip to content

API ReferenceLOC lifecycleType Alias

CancelLOCsParams

type CancelLOCsParams = object;

Parameters for cancelling several LOCs atomically through Multicall.

Every unexpired LOC requires beneficiary authorization because Multicall, rather than the transaction signer, calls cancelLOC. Expired LOCs require no authorization. The example authorizes two cancellations with sequential nonces, then submits them atomically from a delegate wallet.

Example

const beneficiary = await beneficiarySDK.getSignerAddress();
let nonce = await getSignatureNonce(beneficiarySDK, {
account: beneficiary,
signatureType: AnvilSignatureType.CancelLOC,
});
const cancelCalls: CancelLOCsParams['cancelCalls'] = [];
// Nonces advance independently per beneficiary in batch call order. Read
// once, then bind each signature to its explicit sequential nonce.
for (const id of [42n, 43n]) {
const authorizationWorkflow =
await beneficiarySDK.loc.buildCancelAuthorizationWorkflow({
id,
expectedSigner: beneficiary,
nonce,
});
const execution = await authorizationWorkflow.execute();
if (execution.status !== 'executed') {
throw new Error(`preflight ended as ${execution.status}`);
}
const [authorization] = execution.operations;
if (
authorization?.status !== WalletOperationStatus.Signed ||
!authorization.signature
) {
throw new Error(`beneficiary did not authorize LOC ${id}`);
}
cancelCalls.push({
id,
beneficiaryAuthorization: authorization.signature,
});
nonce += 1n;
}
// The delegate wallet validates and submits one atomic Multicall batch.
const params: CancelLOCsParams = { cancelCalls };
const issues = await delegateSDK.loc.validateCancelMany(params);
if (issues.length > 0) throw new Error(safeStringify(issues));
const workflow = await delegateSDK.loc.buildCancelManyWorkflow(params);
const cancellationExecution = await workflow.execute();
if (cancellationExecution.status !== 'executed') {
throw new Error(`preflight: ${cancellationExecution.status}`);
}
const [cancellation] = cancellationExecution.operations;
if (cancellation?.status !== WalletOperationStatus.Confirmed) {
throw new Error(`batch cancellation ended as ${cancellation?.status}`);
}

Properties

cancelCalls

cancelCalls: CancelLOCParams[];

Cancellation calls in execution order. LOC ids must be unique. See CancelLOCParams.beneficiaryAuthorization for the authorization difference between direct and Multicall-based cancellation.