Defined in the Base Account SDK
Returns all permissions available to a given spender
for a user’s Base
Account on a specific chain.
Parameters
User’s Base Account address to query.
Spender address you intend to use for spending.
EIP-1193 compliant Ethereum provider instance. Get this from sdk.getProvider()
.
Returns
Array of spend permissions matching the query.Show SpendPermission properties
Deterministic EIP-712 hash of the permission.
Signature for the EIP-712 payload.
Underlying permission fields.
Unix timestamp (seconds).
Unix timestamp (seconds).
import { fetchPermissions } from "@base-org/account/spend-permission";
import { createBaseAccountSDK } from "@base-org/account";
const sdk = createBaseAccountSDK({
appName: 'My App',
appLogoUrl: 'https://example.com/logo.png',
appChainIds: [84532],
});
const permissions = await fetchPermissions({
account: "0xUserBaseAccountAddress",
chainId: 84532,
spender: "0xAppSpenderAddress",
provider: sdk.getProvider(),
});
Error Handling
Always wrap the call in a try-catch block to handle these errors gracefully.