import { prepareRevokeCallData } from "@base-org/account/spend-permission";

const revokeCall = await prepareRevokeCallData(permission);

await provider.request({
  method: "wallet_sendCalls",
  params: [
    {
      version: "2.0",
      atomicRequired: true,
      from: spender,
      calls: [revokeCall],
    },
  ],
});
Defined in the Base Account SDK
Builds a single revoke call that your app’s spender account can submit to revoke a permission silently. This requires your app to control a spender account with rights to revoke.

Parameters

permission
SpendPermission
required
The permission to revoke.

Returns

revokeCall
Call
Call data for the revoke transaction.
import { prepareRevokeCallData } from "@base-org/account/spend-permission";

const revokeCall = await prepareRevokeCallData(permission);

await provider.request({
  method: "wallet_sendCalls",
  params: [
    {
      version: "2.0",
      atomicRequired: true,
      from: spender,
      calls: [revokeCall],
    },
  ],
});

Error Handling

Always wrap the call in a try-catch block to handle these errors gracefully.