Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add RPC docs #1862

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# wallet_addSubAccount

Experimental RPC Defined in [EIP-XXXX](https://eips.ethereum.org/EIPS/eip-XXXX)

> Requests that the wallet adds the specified sub-account to the wallet.

## Parameters

`Array<AddSubAccountParameter>`

```ts
type AccountCreate = {
type: 'create';
keys: {
type: 'address' | 'p256' | 'webcrypto-p256' | 'webauthn-p256';
key: `0x${string}`;
}[];
};

type AccountDeployed = {
type: 'deployed';
address: Address;
};

type AccountUndeployed = {
type: 'undeployed';
address?: Address;
factory?: Address;
factoryData?: Hex;
chainId?: Hex;
};

type AddSubAccountParameter = {
version: '1';
account: AddSubAccountAccount;
};
```

## Returns

```ts
type AddSubAccountResponse = {
address: Address;
chainId?: Hex;
factory?: Address;
factoryData?: Hex;
};
```

Returns null if the request was successful.

## Errors

| Code | Message |
| ---- | ------------------------------ |
| 4001 | User rejected the request |
| 4100 | Requested method not supported |
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# wallet_connect

Experimental RPC defined in [ERC-7846](https://github.com/ethereum/ERCs/pull/779)

> Requests that the wallet connects to the specified provider with an emphasis on extensibility.

## Parameters

`Array<ConnectParameter>`

```ts
type SignInWithEthereumCapabilityRequest = {
nonce: string;
chainId: string; // EIP-155 hex-encoded
version?: string;
scheme?: string;
domain?: string;
uri?: string;
statement?: string;
issuedAt?: string;
expirationTime?: string;
notBefore?: string;
requestId?: string;
resources?: string[];
};

type SpendPermissionsCapabilityRequest = {
token: `0x${string}`;
allowance: string;
period: number;
salt?: `0x${string}`;
extraData?: `0x${string}`;
};

type AddSubAccountCapabilityRequest = {
// See wallet_addSubAccount
account: AddSubAccountAccount;
};

type ConnectParameter = {
version: string;
// Optional capabilities to request (e.g. Sign In With Ethereum).
capabilities?: {
addSubAccount?: AddSubAccountCapabilityRequest;
getSubAccounts?: boolean;
spendPermissions?: SpendPermissionsCapabilityRequest;
signInWithEthereum?: SignInWithEthereumCapabilityRequest;
};
};

```

## Returns

```ts
type SignInWithEthereumCapabilityResponse = {
message: string;
signature: `0x${string}`;
};

type SpendPermissionsCapabilityResponse = {
signature: `0x${string}`;
};

type AddSubAccountCapabilityResponse = {
address: `0x${string}`;
chainId?: `0x${string}`;
factory?: `0x${string}`;
factoryData?: `0x${string}`;
};

type ConnectResponse = {
accounts: {
// Address of the connected account.
address: `0x${string}`;
// Capabilities granted that is associated with this account.
capabilities?: {
addSubAccount?: AddSubAccountCapabilityResponse | SerializedEthereumRpcError;
getSubAccounts?: AddSubAccountCapabilityResponse[];
spendPermissions?: SpendPermissionsCapabilityResponse | SerializedEthereumRpcError;
signInWithEthereum?: SignInWithEthereumCapabilityResponse | SerializedEthereumRpcError;
};
}[];
};
```

Returns null if the request was successful.

## Errors

| Code | Message |
| ---- | ------------------------------ |
| 4001 | User rejected the request |
| 4100 | Requested method not supported |
76 changes: 40 additions & 36 deletions apps/base-docs/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -645,10 +645,6 @@ export const sidebar: Sidebar = [
{
text: 'SDK',
items: [
{
text: 'createCoinbaseWalletSDK',
link: '/identity/smart-wallet/sdk/create-coinbase-wallet-sdk',
},
{
text: 'Install',
link: '/identity/smart-wallet/sdk/install',
Expand Down Expand Up @@ -680,30 +676,14 @@ export const sidebar: Sidebar = [
text: 'Overview',
link: '/identity/smart-wallet/sdk/coinbasewalletprovider/request/overview',
},
{
text: 'eth_sendTransaction',
link: '/identity/smart-wallet/sdk/coinbasewalletprovider/request/eth_sendTransaction',
},
{
text: 'eth_signTypedData_v4',
link: '/identity/smart-wallet/sdk/coinbasewalletprovider/request/eth_signTypedData_v4',
},
{
text: 'personal_sign',
link: '/identity/smart-wallet/sdk/coinbasewalletprovider/request/personal_sign',
},
{
text: 'wallet_addEthereumChain',
link: '/identity/smart-wallet/sdk/coinbasewalletprovider/request/wallet_addEthereumChain',
},
{
text: 'wallet_watchAsset',
link: '/identity/smart-wallet/sdk/coinbasewalletprovider/request/wallet_watchAsset',
},
{
text: 'eth_accounts',
link: '/identity/smart-wallet/sdk/coinbasewalletprovider/request/eth_accounts',
},
{
text: 'eth_blockNumber',
link: '/identity/smart-wallet/sdk/coinbasewalletprovider/request/eth_blockNumber',
},
{
text: 'eth_chainId',
link: '/identity/smart-wallet/sdk/coinbasewalletprovider/request/eth_chainId',
Expand All @@ -712,18 +692,6 @@ export const sidebar: Sidebar = [
text: 'eth_coinbase',
link: '/identity/smart-wallet/sdk/coinbasewalletprovider/request/eth_coinbase',
},
{
text: 'eth_requestAccounts',
link: '/identity/smart-wallet/sdk/coinbasewalletprovider/request/eth_requestAccounts',
},
{
text: 'wallet_switchEthereumChain',
link: '/identity/smart-wallet/sdk/coinbasewalletprovider/request/wallet_switchEthereumChain',
},
{
text: 'eth_blockNumber',
link: '/identity/smart-wallet/sdk/coinbasewalletprovider/request/eth_blockNumber',
},
{
text: 'eth_estimateGas',
link: '/identity/smart-wallet/sdk/coinbasewalletprovider/request/eth_estimateGas',
Expand Down Expand Up @@ -800,10 +768,46 @@ export const sidebar: Sidebar = [
text: 'eth_getUncleCountByBlockNumber',
link: '/identity/smart-wallet/sdk/coinbasewalletprovider/request/eth_getUncleCountByBlockNumber',
},
{
text: 'eth_requestAccounts',
link: '/identity/smart-wallet/sdk/coinbasewalletprovider/request/eth_requestAccounts',
},
{
text: 'eth_sendRawTransaction',
link: '/identity/smart-wallet/sdk/coinbasewalletprovider/request/eth_sendRawTransaction',
},
{
text: 'eth_sendTransaction',
link: '/identity/smart-wallet/sdk/coinbasewalletprovider/request/eth_sendTransaction',
},
{
text: 'eth_signTypedData_v4',
link: '/identity/smart-wallet/sdk/coinbasewalletprovider/request/eth_signTypedData_v4',
},
{
text: 'personal_sign',
link: '/identity/smart-wallet/sdk/coinbasewalletprovider/request/personal_sign',
},
{
text: 'wallet_addEthereumChain',
link: '/identity/smart-wallet/sdk/coinbasewalletprovider/request/wallet_addEthereumChain',
},
{
text: 'wallet_addSubAccount',
link: '/identity/smart-wallet/sdk/coinbasewalletprovider/request/wallet_addSubAccount',
},
{
text: 'wallet_connect',
link: '/identity/smart-wallet/sdk/coinbasewalletprovider/request/wallet_connect',
},
{
text: 'wallet_switchEthereumChain',
link: '/identity/smart-wallet/sdk/coinbasewalletprovider/request/wallet_switchEthereumChain',
},
{
text: 'wallet_watchAsset',
link: '/identity/smart-wallet/sdk/coinbasewalletprovider/request/wallet_watchAsset',
},
{
text: 'web3_clientVersion',
link: '/identity/smart-wallet/sdk/coinbasewalletprovider/request/web3_clientVersion',
Expand Down