Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions apps/base-docs/docs/components/smart-wallet/SubAccount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ export default function SubAccount() {
keysUrl: 'https://keys-dev.coinbase.com/connect',
options: 'smartWalletOnly',
},
subaccount: {
getSigner: getCryptoKeyAccount,
subAccounts: {
toOwnerAccount: getCryptoKeyAccount,
},
}).getProvider();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,17 +36,20 @@ Creates a new `CoinbaseWalletProvider` instance using a `CoinbaseWalletSDK` inst
import {sdk} from "./setup";

// Create provider
const provider = sdk.makeWeb3Provider({options: 'smartWalletOnly'});
const provider = sdk.getProvider();
// Use provider
const addresses = provider.request({method: 'eth_requestAccounts'});
const addresses = provider.request({ method: 'eth_requestAccounts' });
```

```ts twoslash [setup.ts] filename="setup.ts"
import { CoinbaseWalletSDK } from '@coinbase/wallet-sdk'
import { createCoinbaseWalletSDK } from '@coinbase/wallet-sdk'

export const sdk = new CoinbaseWalletSDK({
export const sdk = createCoinbaseWalletSDK({
appName: 'My App Name',
appChainIds: [8453]
appChainIds: [8453],
preference: {
options: 'smartWalletOnly',
},
});
```

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,15 @@ import { createCoinbaseWalletSDK, getCryptoKeyAccount } from '@coinbase/wallet-s
const sdk = createCoinbaseWalletSDK({
appName: 'My Dapp',
appLogoUrl: 'https://example.com/logo.png',
paymasterUrls: {
84532: 'https://<base-paymaster-url>',
},
// Set up Sub Account support with a signer function
toSubAccountSigner: async () => {
// Return a signer that can be used to authenticate operations
return await getCryptoKeyAccount();
subAccounts: {
toOwnerAccount: async () => {
// Return a signer that can be used to authenticate operations
return await getCryptoKeyAccount();
},
},
});

Expand Down Expand Up @@ -108,7 +113,9 @@ const signature = await provider.request({
createCoinbaseWalletSDK({
appName: string,
appLogoUrl: string,
toSubAccountSigner: () => Promise<{ account: { publicKey: string; address?: string } }>,
subAccount: {
toOwnerAccount: () => Promise<{ account: { publicKey: string; address?: string } }>,
},
});
```

Expand Down Expand Up @@ -147,13 +154,13 @@ Parameters:

Returns: `Promise<string>` - Response from the smart contract call

#### `sdk.subaccount.setSigner(toSubAccountSigner)`
#### `sdk.subaccount.setToOwnerAccount(toOwnerAccount)`

Sets the signer function for Sub Account operations.

Parameters:

- `toSubAccountSigner`: Function that returns a Promise resolving to a signer object
- `toOwnerAccount`: Function that returns a Promise resolving to a signer object

## Technical Details

Expand Down