diff --git a/examples/testapp/src/pages/auto-sub-account/index.page.tsx b/examples/testapp/src/pages/auto-sub-account/index.page.tsx
index f774c1d997..d57425e0f4 100644
--- a/examples/testapp/src/pages/auto-sub-account/index.page.tsx
+++ b/examples/testapp/src/pages/auto-sub-account/index.page.tsx
@@ -12,7 +12,6 @@ import {
VStack,
} from '@chakra-ui/react';
import { getCryptoKeyAccount } from '@coinbase/wallet-sdk';
-import { SpendPermissionConfig } from '@coinbase/wallet-sdk/dist/core/provider/interface';
import React, { useEffect, useState } from 'react';
import { createPublicClient, http, numberToHex, parseEther } from 'viem';
import { privateKeyToAccount } from 'viem/accounts';
@@ -215,24 +214,6 @@ export default function AutoSubAccount() {
}
};
- const handleSetDefaultSpendPermissions = (value: string) => {
- const defaultSpendPermissions = {
- [baseSepolia.id]: [
- {
- token: '0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE',
- allowance: '0x2386F26FC10000',
- period: 86400,
- } as SpendPermissionConfig,
- ],
- };
-
- if (value === 'true') {
- setSubAccountsConfig((prev) => ({ ...prev, defaultSpendPermissions }));
- } else {
- setSubAccountsConfig((prev) => ({ ...prev, defaultSpendPermissions: {} }));
- }
- };
-
const handleEthSend = async (amount: string) => {
if (!provider || !accounts.length) return;
@@ -326,18 +307,6 @@ export default function AutoSubAccount() {
-
- Default Spend Permissions
-
-
- Enabled
- Disabled
-
-
-
Attribution
diff --git a/packages/wallet-sdk/src/core/provider/interface.ts b/packages/wallet-sdk/src/core/provider/interface.ts
index 51bcf54376..1e8cd316ad 100644
--- a/packages/wallet-sdk/src/core/provider/interface.ts
+++ b/packages/wallet-sdk/src/core/provider/interface.ts
@@ -96,11 +96,6 @@ export type SubAccountOptions = {
* @returns The owner account that will be used to sign the subaccount transactions.
*/
toOwnerAccount?: ToOwnerAccountFn;
- /**
- * Spend permissions requested on app connect if a matching existing one does not exist.
- * Only supports native chain tokens currently.
- */
- defaultSpendPermissions?: Record;
};
export interface ConstructorOptions {
diff --git a/packages/wallet-sdk/src/createCoinbaseWalletSDK.ts b/packages/wallet-sdk/src/createCoinbaseWalletSDK.ts
index 877ba626af..5be7c5edd1 100644
--- a/packages/wallet-sdk/src/createCoinbaseWalletSDK.ts
+++ b/packages/wallet-sdk/src/createCoinbaseWalletSDK.ts
@@ -58,7 +58,6 @@ export function createCoinbaseWalletSDK(params: CreateCoinbaseWalletSDKOptions)
store.subAccountsConfig.set({
toOwnerAccount: params.subAccounts?.toOwnerAccount,
enableAutoSubAccounts: params.subAccounts?.enableAutoSubAccounts,
- defaultSpendPermissions: params.subAccounts?.defaultSpendPermissions,
});
// set the options in the store
diff --git a/packages/wallet-sdk/src/sign/scw/utils.test.ts b/packages/wallet-sdk/src/sign/scw/utils.test.ts
index afb2a5fddb..71ee14f751 100644
--- a/packages/wallet-sdk/src/sign/scw/utils.test.ts
+++ b/packages/wallet-sdk/src/sign/scw/utils.test.ts
@@ -120,9 +120,15 @@ describe('assertGetCapabilitiesParams', () => {
expect(() => assertGetCapabilitiesParams(['0x123'])).toThrow(); // Too short
expect(() => assertGetCapabilitiesParams(['0x123abc'])).toThrow(); // Too short
expect(() => assertGetCapabilitiesParams(['xyz123'])).toThrow(); // No 0x prefix
- expect(() => assertGetCapabilitiesParams(['0x12345678901234567890123456789012345678gg'])).toThrow(); // Invalid hex characters
- expect(() => assertGetCapabilitiesParams(['0x123456789012345678901234567890123456789'])).toThrow(); // Too short (39 chars)
- expect(() => assertGetCapabilitiesParams(['0x12345678901234567890123456789012345678901'])).toThrow(); // Too long (41 chars)
+ expect(() =>
+ assertGetCapabilitiesParams(['0x12345678901234567890123456789012345678gg'])
+ ).toThrow(); // Invalid hex characters
+ expect(() =>
+ assertGetCapabilitiesParams(['0x123456789012345678901234567890123456789'])
+ ).toThrow(); // Too short (39 chars)
+ expect(() =>
+ assertGetCapabilitiesParams(['0x12345678901234567890123456789012345678901'])
+ ).toThrow(); // Too long (41 chars)
});
it('should not throw for valid single parameter (valid Ethereum address)', () => {
@@ -148,7 +154,9 @@ describe('assertGetCapabilitiesParams', () => {
it('should not throw for valid parameters with filter array', () => {
expect(() => assertGetCapabilitiesParams([VALID_ADDRESS_1, []])).not.toThrow();
expect(() => assertGetCapabilitiesParams([VALID_ADDRESS_1, ['0x1']])).not.toThrow();
- expect(() => assertGetCapabilitiesParams([VALID_ADDRESS_1, ['0x1', '0x2', '0x3']])).not.toThrow();
+ expect(() =>
+ assertGetCapabilitiesParams([VALID_ADDRESS_1, ['0x1', '0x2', '0x3']])
+ ).not.toThrow();
expect(() => assertGetCapabilitiesParams([VALID_ADDRESS_1, ['0xabcdef', '0x0']])).not.toThrow();
expect(() => assertGetCapabilitiesParams([VALID_ADDRESS_2, ['0x1', '0xa']])).not.toThrow();
});
diff --git a/packages/wallet-sdk/src/sign/scw/utils.ts b/packages/wallet-sdk/src/sign/scw/utils.ts
index 8be8eb05ab..782493ec57 100644
--- a/packages/wallet-sdk/src/sign/scw/utils.ts
+++ b/packages/wallet-sdk/src/sign/scw/utils.ts
@@ -167,10 +167,6 @@ export async function initSubAccountConfig() {
};
}
- if (config.defaultSpendPermissions) {
- capabilities.spendPermissions = config.defaultSpendPermissions;
- }
-
// Store the owner account and capabilities in the non-persisted config
store.subAccountsConfig.set({
capabilities,
@@ -591,7 +587,8 @@ export async function getCachedWalletConnectResponse(): Promise 0 ? { permissions: spendPermissions } : undefined,
+ spendPermissions:
+ spendPermissions.length > 0 ? { permissions: spendPermissions } : undefined,
},
})
);