Skip to content

makeWeb3Provider

Creates a new CoinbaseWalletProvider instance using a CoinbaseWalletSDK instance.

Usage

provider.ts
import {sdk} from "./setup";
 
// Create provider
const provider = sdk.makeWeb3Provider({options: 'smartWalletOnly'});
// Use provider
const addresses = provider.request({method: 'eth_requestAccounts'});

Returns

A new CoinbaseWalletProvider instance, which is an Ethereum Javascript provider provider.

Parameters

options (optional)

  • Type: 'all' | 'smartWalletOnly' | 'eoaOnly'

Determines which connection options users will see. Defaults to all.

all

Users will see Smart Wallet and mobile app connection options.

smartWalletOnly

With this option, users will only see an option to create a Smart Wallet or sign into their Smart Wallet.

eoaOnly

Users will only see the mobile app connection option. If the user is on mobile, they will be taken directly to the Coinbase Wallet app. If the user is using a browser with Coinbase Wallet Extension, they will be taken directly to the Extension.

attribution (optional)

  • Type: Attribution

This option only applies to Coinbase Smart Wallet. When a valid data suffix is supplied, it is appended to the initCode and executeBatch calldata.

type Attribution = {
    auto: boolean;
    dataSuffix?: never;
} | {
    auto?: never;
    dataSuffix: `0x${string}`;
}
auto (optional)
  • Type: boolean

If auto is true, the Smart Wallet will generate a 16 byte hex string from the apps origin.

dataSuffix (optional)
  • Type: 0x${string}

Smart Wallet expects a 16 byte hex string. If the data suffix is not a 16 byte hex string, the Smart Wallet will ignore the property.