Skip to content

CoinbaseWalletSDK Changes (v3 to v4)

This page details changes between versions 3.x and 4.x of the Coinbase Wallet SDK.

CoinbaseWalletSDK

CoinbaseWalletSDKOptions

// v4
type CoinbaseWalletSDKOptions = {
  appName?: string | undefined;
  appLogoUrl?: string | null | undefined;
  appChainIds?: number[] | undefined;
};

New (v4 only):

  • appChainIds?: number[]
    • An array of chain IDs your dapp supports
    • The first chain in this array will be used as the default chain.
    • Removes the need for non-mainnet dapps to request switching chains before making first request.
    • Default value is [1] (mainnet)

Deprecated (v3 only):

  • enableMobileWalletLink (enabled by default in v4)
  • jsonRpcUrl
  • reloadOnDisconnect
  • uiConstructor
  • overrideIsMetaMask
  • overrideIsCoinbaseWallet
  • diagnosticLogger
  • reloadOnDisconnect
  • headlessMode

Deprecated functions

  • CoinbaseWalletSDK.disconnect() is deprecated
    • dapps should call CoinbaseWalletProvider.disconnect() instead
  • CoinbaseWalletSDK.setAppInfo() is deprecated
    • Dapps should pass in appName and appLogoUrl via CoinbaseWalletSDKOptions

makeWeb3Provider

Signature

// v3
makeWeb3Provider(jsonRpcUrl?: string, chainId?: number): CoinbaseWalletProvider
 
// v4
makeWeb3Provider(preference: Preference = { options: 'all' }): ProviderInterface 

Parameters

interface Preference {
  options: 'all' | 'smartWalletOnly' | 'eoaOnly';
  keysUrl?: string;
}
  • options
    • 'all' (default) show both smart wallet and EOA options
    • 'smartWalletOnly' only show smart wallet option
    • 'eoaOnly' only show EOA option
  • keysUrl
    • You probably don't need this. Use only if you'd like to use a frontend other than "https://keys.coinbase.com/connect" as your connection popup.

Return type

export interface ProviderInterface extends EventEmitter {
  request<T>(args: RequestArguments): Promise<T>;
  disconnect(): Promise<void>;
  on(event: 'connect', listener: (info: ProviderConnectInfo) => void): this;
  on(event: 'disconnect', listener: (error: ProviderRpcError) => void): this;
  on(event: 'chainChanged', listener: (chainId: string) => void): this;
  on(event: 'accountsChanged', listener: (accounts: string[]) => void): this;
  on(event: 'message', listener: (message: ProviderMessage) => void): this;
}

CoinbaseWalletProvider

connect event fix

  • v3 returned chainIdStr instead of chainId.
  • v4 is EIP-1193 compliant.
// v4
interface ProviderConnectInfo { readonly chainId: string; } 
on(event: 'connect', listener: (info: ProviderConnectInfo) => void): this; 

Deprecated functionality

Instance properties

  • isCoinbaseBrowser: boolean
  • qrUrl?: string | null
  • reloadOnDisconnect: boolean

Getter methods

  • selectedAddress
  • networkVersion
  • isWalletLink
  • ismetaMask
  • host

Methods

  • disableReloadOnDisconnect
  • setProviderInfo
  • setAppInfo
  • close
  • send
  • sendAsync
  • scanQRCode
  • genericRequest
  • connectAndSignIn
  • selectProvider
  • supportsSubscriptions
  • subscribe
  • unsubscribe