-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
295 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
/node_modules | ||
/docs/dist | ||
|
||
gitconfig |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
# Update an Existing Project | ||
|
||
## Direct dependency | ||
Follow the [installation instructions](/sdk/install). | ||
Follow the [installation instructions](/sdk/getting-started). | ||
|
||
## Wagmi | ||
1. Upgrade Wagmi to version `2.9.5` or higher. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import SdkParameters from './snippets/sdk-paramaters.mdx' | ||
|
||
# createCoinbaseWalletSDK | ||
Creates a new `sdk` object for getting a `CoinbaseWalletProvider` instance. | ||
|
||
## Usage | ||
:::code-group | ||
```ts twoslash [provider.ts] | ||
import { sdk } from './setup' | ||
|
||
// Create provider | ||
export const provider = sdk.getProvider(); | ||
// Use provider | ||
const addresses = provider.request({method: 'eth_requestAccounts'}); | ||
``` | ||
```ts twoslash [setup.ts] filename="setup.ts" | ||
// @ts-expect-error - TODO: update when the SDK is released | ||
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, | ||
} | ||
}, | ||
}); | ||
``` | ||
::: | ||
|
||
## Returns | ||
An object with related SDK methods | ||
|
||
<SdkParameters /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import SdkParameters from './snippets/sdk-paramaters.mdx' | ||
|
||
# Getting Started | ||
|
||
*Note: If your app is still using the `CoinbaseWalletSDK` class. You can follow the Legacy Setup guide [here](/sdk/legacy-setup).* | ||
|
||
::::steps | ||
|
||
## Install `@coinbase/wallet-sdk` | ||
|
||
:::code-group | ||
```bash [npm] | ||
npm i @coinbase/wallet-sdk | ||
``` | ||
```bash [pnpm] | ||
pnpm i @coinbase/wallet-sdk | ||
``` | ||
```bash [yarn] | ||
yarn add @coinbase/wallet-sdk | ||
``` | ||
```bash [bun] | ||
bun i @coinbase/wallet-sdk | ||
``` | ||
::: | ||
|
||
## Create a new sdk object | ||
|
||
```ts twoslash [setup.ts] | ||
// @ts-expect-error - TODO: update when the SDK is released | ||
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 | ||
|
||
:::code-group | ||
```ts twoslash [provider.ts] | ||
import { sdk } from './setup' | ||
|
||
// Create provider | ||
export const provider = sdk.getProvider(); | ||
// Use provider | ||
const addresses = provider.request({method: 'eth_requestAccounts'}); | ||
``` | ||
```ts twoslash [setup.ts] filename="setup.ts" | ||
// @ts-expect-error - TODO: update when the SDK is released | ||
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, | ||
} | ||
}, | ||
}); | ||
``` | ||
::: | ||
|
||
:::: | ||
|
||
<SdkParameters /> |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
import SdkParameters from './snippets/sdk-paramaters.mdx' | ||
|
||
# Getting Started (V4.0.0+) | ||
|
||
::::steps | ||
|
||
## Install `@coinbase/wallet-sdk` | ||
|
||
:::code-group | ||
```bash [npm] | ||
npm i @coinbase/wallet-sdk | ||
``` | ||
|
||
```bash [pnpm] | ||
pnpm i @coinbase/wallet-sdk | ||
``` | ||
|
||
```bash [yarn] | ||
yarn add @coinbase/wallet-sdk | ||
``` | ||
|
||
```bash [bun] | ||
bun i @coinbase/wallet-sdk | ||
``` | ||
::: | ||
|
||
## Create an SDK Instance | ||
|
||
```ts twoslash [setup.ts] | ||
import { CoinbaseWalletSDK } from '@coinbase/wallet-sdk'; | ||
|
||
export const sdk = new CoinbaseWalletSDK({ | ||
appName: "My App", | ||
appLogoUrl: "https://example.com/logo.png", | ||
appChainIds: [8453], | ||
}); | ||
``` | ||
|
||
## Create a Provider | ||
:::code-group | ||
```ts twoslash [provider.ts] | ||
import { sdk } from './setup' | ||
|
||
// see the makeWeb3Provider page for more information | ||
const preference = { | ||
options: "smartWalletOnly", | ||
attribution: { | ||
auto: true, | ||
} | ||
}; | ||
// @errors: 2307 | ||
// Create provider | ||
export const provider = sdk.makeWeb3Provider(preference); | ||
// Use provider | ||
const addresses = provider.request({method: 'eth_requestAccounts'}); | ||
``` | ||
```ts twoslash [setup.ts] filename="setup.ts" | ||
import { CoinbaseWalletSDK } from '@coinbase/wallet-sdk'; | ||
|
||
export const sdk = new CoinbaseWalletSDK({ | ||
appName: "My App", | ||
appLogoUrl: "https://example.com/logo.png", | ||
appChainIds: [8453], | ||
}); | ||
``` | ||
::: | ||
|
||
:::: | ||
|
||
<SdkParameters /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
|
||
### preference (optional) | ||
|
||
- Type `Preference` | ||
|
||
```ts twoslash | ||
type Attribution = { | ||
auto: boolean; | ||
dataSuffix?: never; | ||
} | { | ||
auto?: never; | ||
dataSuffix: `0x${string}`; | ||
} | ||
|
||
type Preference = { | ||
options?: 'all' | 'smartWalletOnly' | 'eoaOnly'; | ||
attribution?: Attribution; | ||
} | ||
``` | ||
#### `preference.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. | ||
:::info | ||
If a user is using a browser with Coinbase Wallet Extension installed, they will be taken straight to the | ||
Coinbase Wallet Extension and not see any choice. | ||
::: | ||
##### `smartWalletOnly` | ||
With this option, users will only see an option to create a Smart Wallet or sign into their Smart Wallet. | ||
##### `eoaOnly` | ||
With this option, users will only see an option to connect with their EOA. | ||
#### `preference.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. | ||
```ts twoslash | ||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters