Getting Started
Note: If your app is still using the CoinbaseWalletSDK
class. You can follow the Legacy Setup guide here.
Install @coinbase/wallet-sdk
npm
npm i @coinbase/wallet-sdk
Create a new sdk object
setup.ts
import { createCoinbaseWalletSDK } from '@coinbase/wallet-sdk';
export const sdk = createCoinbaseWalletSDK({
appName: "My App",
appLogoUrl: "https://example.com/logo.png",
appChainIds: [8453],
preference: {
options: "smartWalletOnly",
attribution: {
auto: true,
}
},
});
Create a new provider object
provider.ts
import { sdk } from './setup'
// Create provider
export const provider = sdk.getProvider();
// Use provider
const addresses = provider.request({ method: 'eth_requestAccounts' });
Parameters
appName (optional)
- Type:
string
The app name. This will be displayed to users on connection, transacting, and signing requests.
appChainIds (optional)
- Type:
number[]
Array of chain IDs your app supports. Default value is [1]
.
appLogoUrl (optional)
- Type:
string
App logo image URL. Favicon is used if unspecified.
preference (optional)
- Type
Preference
type Attribution = {
auto: boolean;
dataSuffix?: never;
} | {
auto?: never;
dataSuffix: `0x${string}`;
}
type Preference = {
keysUrl?: string;
options?: 'all' | 'smartWalletOnly' | 'eoaOnly';
attribution?: Attribution;
}