From da48643d2da7c6f3d2dba9d295f8f58861590783 Mon Sep 17 00:00:00 2001 From: Wilson Cusack Date: Wed, 1 May 2024 11:41:01 -0400 Subject: [PATCH] improve code snippets --- .../request/overview.mdx | 29 ------------------- docs/pages/sdk/makeWeb3Provider.mdx | 8 +++-- docs/pages/sdk/setup.mdx | 2 +- 3 files changed, 6 insertions(+), 33 deletions(-) delete mode 100644 docs/pages/sdk/coinbaseWalletProvider/request/overview.mdx diff --git a/docs/pages/sdk/coinbaseWalletProvider/request/overview.mdx b/docs/pages/sdk/coinbaseWalletProvider/request/overview.mdx deleted file mode 100644 index e173f56..0000000 --- a/docs/pages/sdk/coinbaseWalletProvider/request/overview.mdx +++ /dev/null @@ -1,29 +0,0 @@ -# Overview - -`CoinbaseWalletProvider` is an [EIP-1193](https://eips.ethereum.org/EIPS/eip-1193) compliant Ethereum Javascript provider. -It handles requests via its `request` method. For example -:::code-group -``` typescript [example.ts] -const provider = sdk.makeWeb3Provider(); -const addresses = provider.request('eth_requestAccounts'); -provider.request('personal_sign', [ - `0x${Buffer.from('test message', 'utf8').toString('hex')}`, - addresses[0], -]); -``` -``` typescript [setup.ts] -import { CoinbaseWalletSDK } from '@coinbase/wallet-sdk' - -const sdk = new CoinbaseWalletSDK({ - appName: 'My App Name', - appChainIds: [8453] -}); -``` -::: - -Please see the EIP for detailed specifications of request and response format. - -We will not document all requests that can be made with this method. -There is good documentation of this [elsewhere](https://docs.metamask.io/wallet/reference/json-rpc-api/). -We will, however, document a few new RPCs that can be uniquely used with Smart Wallet. - diff --git a/docs/pages/sdk/makeWeb3Provider.mdx b/docs/pages/sdk/makeWeb3Provider.mdx index 1529ce5..ff3b5de 100644 --- a/docs/pages/sdk/makeWeb3Provider.mdx +++ b/docs/pages/sdk/makeWeb3Provider.mdx @@ -3,16 +3,18 @@ Creates a new `CoinbaseWalletProvider` instance using a `CoinbaseWalletSDK` inst ## Usage :::code-group -``` typescript [provider.ts] +```ts twoslash [provider.ts] +import {sdk} from "./setup"; + // Create provider const provider = sdk.makeWeb3Provider({options: 'smartWalletOnly'}); // Use provider const addresses = provider.request('eth_requestAccounts'); ``` -``` typescript [setup.ts] +```ts twoslash [setup.ts] filename="setup.ts" import { CoinbaseWalletSDK } from '@coinbase/wallet-sdk' -const sdk = new CoinbaseWalletSDK({ +export const sdk = new CoinbaseWalletSDK({ appName: 'My App Name', appChainIds: [8453] }); diff --git a/docs/pages/sdk/setup.mdx b/docs/pages/sdk/setup.mdx index ba3547b..cfa4983 100644 --- a/docs/pages/sdk/setup.mdx +++ b/docs/pages/sdk/setup.mdx @@ -1,7 +1,7 @@ # Setup Create a new `CoinbaseWalletSDK` instance. -```typescript +```ts twoslash import { CoinbaseWalletSDK } from '@coinbase/wallet-sdk' const sdk = new CoinbaseWalletSDK({