diff --git a/openrpc.yaml b/openrpc.yaml index ad18203..20ce8e4 100644 --- a/openrpc.yaml +++ b/openrpc.yaml @@ -521,6 +521,266 @@ methods: schema: type: string title: QR code string + - name: wallet_sendCalls + tags: + - $ref: '#/components/tags/MetaMask' + summary: Sends a batch of calls. + description: >- + Requests that the wallet submits a batch of calls. Specified by + [EIP-5792](https://eips.ethereum.org/EIPS/eip-5792). + params: + - name: Calls + required: true + schema: + $ref: '#/components/schemas/SendCallsParameter' + result: + name: Batch result + schema: + description: An object containing information about the sent batch. + type: object + properties: + id: + description: The ID of the batch of calls. + type: string + capabilities: + description: >- + Wallets can use this object to attach capability-specific metadata. + type: object + errors: + - $ref: '#/components/errors/InvalidParams' + - code: -32000 + message: Version not supported. + - $ref: '#/components/errors/UserRejected' + - $ref: '#/components/errors/Unauthorized' + - code: 5700 + message: >- + The wallet does not support a capability that was not marked as optional. + - code: 5710 + message: EIP-7702 not supported on the specified chain ID. + - code: 5720 + message: There is already a batch submitted with the specified batch ID. + - code: 5740 + message: The batch is too large for the wallet to process. + - code: 5750 + message: EIP-7702 upgrade rejected for this chain and account. + examples: + - name: wallet_sendCalls example + params: + - name: Calls + value: + version: '2.0.0' + from: '0xd46e8dd67c5d32be8058bb8eb970870f07244567' + chainId: '0xaa36a7' + atomicRequired: true + calls: + - to: '0x54f1C1965B355e1AB9ec3465616136be35bb5Ff7' + value: '0x0' + - to: '0x2D48e6f5Ae053e4E918d2be53570961D880905F2' + value: '0x0' + result: + name: Batch result + value: + id: '0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331' + - name: wallet_getCallsStatus + tags: + - $ref: '#/components/tags/MetaMask' + summary: Gets the status of a call batch. + description: >- + Gets the status of a batch of calls that was previously sent using + `wallet_sendCalls`. Specified by + [EIP-5792](https://eips.ethereum.org/EIPS/eip-5792). + params: + - name: Batch ID + required: true + description: >- + The ID of a batch of calls (the `id` value returned by `wallet_sendCalls`). + schema: + type: string + result: + name: Batch status + schema: + description: >- + An object containing status information of the batch of calls. + type: object + properties: + version: + description: The version of the API format. + type: string + id: + description: The ID of the batch of calls. + $ref: '#/components/schemas/uint' + chainId: + description: The chain ID of the calls. + $ref: '#/components/schemas/uint' + status: + description: >- + The status code of the batch of calls. Possible values are: +
+ + type: number + atomic: + description: >- + `true` if the wallet executed the calls atomically. `false` if the + wallet executed the calls non-atomically. + type: boolean + receipts: + description: >- + An array of transaction receipts. If the wallet executed the calls + atomically, a single receipt or an array of receipts may be returned, + corresponding to how the batch of calls were included onchain. + type: array + items: + title: Receipt + description: A transaction receipt object. + type: object + properties: + logs: + description: An array of log objects. + type: array + items: + title: Log + description: An object containing information about the log. + type: object + properties: + address: + description: The address that generated the log. + type: string + pattern: '^0x[0-9a-fA-F]{40}$' + data: + description: The data of the log. + type: string + pattern: '^0x[0-9a-f]*$' + topics: + description: An array of log topics. + type: array + items: + title: Topic + description: A log topic. + type: string + pattern: '^0x[0-9a-f]*$' + status: + description: >- + The status of the transaction. `0x1` indicates success, and `0x0` + indicates failure. + type: string + pattern: '^0x[0-1]$' + blockHash: + description: The hash of the block containing the transaction. + type: string + pattern: '^0x[0-9a-f]{64}$' + blockNumber: + description: The number of the block containing the transaction. + type: string + pattern: '^0x([1-9a-f]+[0-9a-f]*|0)$' + gasUsed: + description: The amount of gas used by the transaction. + type: string + pattern: '^0x([1-9a-f]+[0-9a-f]*|0)$' + transactionHash: + description: The hash of the transaction. + type: string + pattern: '^0x[0-9a-f]{64}$' + additionalProperties: true + capabilities: + description: Capabilities associated with the batch of calls. + type: object + additionalProperties: true + errors: + - $ref: '#/components/errors/InvalidParams' + - $ref: '#/components/errors/Unauthorized' + - code: 5730 + message: No matching bundle found. + examples: + - name: wallet_getCallsStatus example + params: + - name: Batch ID + value: '0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331' + result: + name: Batch status + value: + version: '2.0.0' + chainId: '0xaa36a7' + id: '0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331' + status: 200 + atomic: true + receipts: + - logs: + - address: '0xa922b54716264130634d6ff183747a8ead91a40b' + topics: + - '0x5a2a90727cc9d000dd060b1132a5c977c9702bb3a52afe360c9c22f0e9451a68' + data: '0xabcd' + status: '0x1' + blockHash: '0xf19bbafd9fd0124ec110b848e8de4ab4f62bf60c189524e54213285e7f540d4a' + blockNumber: '0xabcd' + gasUsed: '0xdef' + transactionHash: '0x9b7bb827c2e5e3c1a0a44dc53e573aa0b3af3bd1f9f5ed03071b100bb039eaff' + - name: wallet_getCapabilities + tags: + - $ref: '#/components/tags/MetaMask' + summary: Gets the capabilities of the wallet. + description: >- + Returns information about the wallet's support for the `atomic` + capability. The `atomic` capability specifies how the wallet will + execute batches of transactions sent using `wallet_sendCalls`. + `wallet_getCapabilities` is specified by + [EIP-5792](https://eips.ethereum.org/EIPS/eip-5792). + params: + - name: Address + description: A wallet address. + required: true + schema: + type: string + pattern: '^0x[0-9a-fA-F]{40}$' + - name: Chain IDs + description: An array of chain IDs to get capabilities for. + schema: + type: array + items: + title: Chain ID + description: >- + An [EIP-155](https://eips.ethereum.org/EIPS/eip-155) + chain ID in hexadecimal format. + $ref: '#/components/schemas/uint' + result: + name: Capabilities + schema: + description: >- + An object specifying the status of the `atomic` capability for + specific [EIP-155](https://eips.ethereum.org/EIPS/eip-155) chain IDs. + For each chain, the `atomic` capability can have a `status` of: +
+ + If the `atomic` capability is not `supported` or `ready` for a + specified chain ID, the wallet will not return anything for that chain ID. + type: object + errors: + - $ref: '#/components/errors/InvalidParams' + - $ref: '#/components/errors/Unauthorized' + examples: + - name: wallet_getCapabilities example + params: + - name: Address + value: '0xd46e8dd67c5d32be8058bb8eb970870f07244567' + - name: Chain IDs + value: + - '0xaa36a7' + result: + name: Capabilities + value: + '0xaa36a7': + atomic: + status: ready - name: eth_requestAccounts tags: - $ref: '#/components/tags/MetaMask' @@ -937,6 +1197,71 @@ components: message: type: object description: The message you're proposing the user to sign. + SendCallsParameter: + title: Calls + description: An object containing information about a batch of calls. + type: object + required: + - version + - from + - chainId + - atomicRequired + - calls + properties: + version: + description: >- + The version of the API format. This must be `2.0.0`. + type: string + id: + description: The ID of the batch of calls. + type: string + from: + description: The sender's address. + type: string + pattern: '^0x[0-9a-fA-F]{40}$' + chainId: + description: >- + The [EIP-155](https://eips.ethereum.org/EIPS/eip-155) chain ID + of the calls. This must match the currently selected network in + the wallet. + type: string + pattern: '^0x([1-9a-f]+[0-9a-f]*|0)$' + atomicRequired: + description: >- + `true` if the wallet must execute all calls atomically. If `false`, the + wallet may execute the calls sequentially without atomicity. If `false` + and the wallet is capable of executing the calls atomically, it may do so. + type: boolean + calls: + type: array + description: An array of call objects. + items: + title: Call + description: An object containing information about the call. + type: object + properties: + to: + description: The address of the call's recipient. + type: string + pattern: '^0x[0-9a-fA-F]{40}$' + data: + description: The data to send with the call. + type: string + pattern: '^0x[0-9a-f]*$' + value: + description: The value to send with the call. + type: string + pattern: '^0x([1-9a-f]+[0-9a-f]*|0)$' + capabilities: + description: >- + Dapps can use this object to communicate with the wallet about + supported capabilities. + type: object + capabilities: + description: >- + Dapps can use this object to communicate with the wallet about + supported capabilities. + type: object AddEthereumChainParameter: title: Chain description: Object containing information about the chain to add. @@ -1086,3 +1411,9 @@ components: UserRejected: code: 4001 message: User rejected the request. + InvalidParams: + code: -32602 + message: The wallet cannot parse the request. + Unauthorized: + code: 4100 + message: The requested account and/or method has not been authorized by the user.