Skip to content

Commit bc085f7

Browse files
Add EIP-5792 methods (#284)
* Add EIP-5792 methods * fixes * minor edits * minor edits * update wallet_getCapabilities * Remove wallet_showCallsStatus * 5792 updates * atomicity updates * error codes and other updates * minor fix * fixes * updates * address reviewer comments
1 parent b69ceaf commit bc085f7

File tree

1 file changed

+331
-0
lines changed

1 file changed

+331
-0
lines changed

openrpc.yaml

Lines changed: 331 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -521,6 +521,266 @@ methods:
521521
schema:
522522
type: string
523523
title: QR code string
524+
- name: wallet_sendCalls
525+
tags:
526+
- $ref: '#/components/tags/MetaMask'
527+
summary: Sends a batch of calls.
528+
description: >-
529+
Requests that the wallet submits a batch of calls. Specified by
530+
[EIP-5792](https://eips.ethereum.org/EIPS/eip-5792).
531+
params:
532+
- name: Calls
533+
required: true
534+
schema:
535+
$ref: '#/components/schemas/SendCallsParameter'
536+
result:
537+
name: Batch result
538+
schema:
539+
description: An object containing information about the sent batch.
540+
type: object
541+
properties:
542+
id:
543+
description: The ID of the batch of calls.
544+
type: string
545+
capabilities:
546+
description: >-
547+
Wallets can use this object to attach capability-specific metadata.
548+
type: object
549+
errors:
550+
- $ref: '#/components/errors/InvalidParams'
551+
- code: -32000
552+
message: Version not supported.
553+
- $ref: '#/components/errors/UserRejected'
554+
- $ref: '#/components/errors/Unauthorized'
555+
- code: 5700
556+
message: >-
557+
The wallet does not support a capability that was not marked as optional.
558+
- code: 5710
559+
message: EIP-7702 not supported on the specified chain ID.
560+
- code: 5720
561+
message: There is already a batch submitted with the specified batch ID.
562+
- code: 5740
563+
message: The batch is too large for the wallet to process.
564+
- code: 5750
565+
message: EIP-7702 upgrade rejected for this chain and account.
566+
examples:
567+
- name: wallet_sendCalls example
568+
params:
569+
- name: Calls
570+
value:
571+
version: '2.0.0'
572+
from: '0xd46e8dd67c5d32be8058bb8eb970870f07244567'
573+
chainId: '0xaa36a7'
574+
atomicRequired: true
575+
calls:
576+
- to: '0x54f1C1965B355e1AB9ec3465616136be35bb5Ff7'
577+
value: '0x0'
578+
- to: '0x2D48e6f5Ae053e4E918d2be53570961D880905F2'
579+
value: '0x0'
580+
result:
581+
name: Batch result
582+
value:
583+
id: '0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331'
584+
- name: wallet_getCallsStatus
585+
tags:
586+
- $ref: '#/components/tags/MetaMask'
587+
summary: Gets the status of a call batch.
588+
description: >-
589+
Gets the status of a batch of calls that was previously sent using
590+
`wallet_sendCalls`. Specified by
591+
[EIP-5792](https://eips.ethereum.org/EIPS/eip-5792).
592+
params:
593+
- name: Batch ID
594+
required: true
595+
description: >-
596+
The ID of a batch of calls (the `id` value returned by `wallet_sendCalls`).
597+
schema:
598+
type: string
599+
result:
600+
name: Batch status
601+
schema:
602+
description: >-
603+
An object containing status information of the batch of calls.
604+
type: object
605+
properties:
606+
version:
607+
description: The version of the API format.
608+
type: string
609+
id:
610+
description: The ID of the batch of calls.
611+
$ref: '#/components/schemas/uint'
612+
chainId:
613+
description: The chain ID of the calls.
614+
$ref: '#/components/schemas/uint'
615+
status:
616+
description: >-
617+
The status code of the batch of calls. Possible values are:
618+
<br>
619+
<ul>
620+
<li>`100` - Pending</li>
621+
<li>`200` - Confirmed</li>
622+
<li>`400` - Failed offchain</li>
623+
<li>`500` - Reverted</li>
624+
<li>`600` - Partially reverted</li>
625+
</ul>
626+
type: number
627+
atomic:
628+
description: >-
629+
`true` if the wallet executed the calls atomically. `false` if the
630+
wallet executed the calls non-atomically.
631+
type: boolean
632+
receipts:
633+
description: >-
634+
An array of transaction receipts. If the wallet executed the calls
635+
atomically, a single receipt or an array of receipts may be returned,
636+
corresponding to how the batch of calls were included onchain.
637+
type: array
638+
items:
639+
title: Receipt
640+
description: A transaction receipt object.
641+
type: object
642+
properties:
643+
logs:
644+
description: An array of log objects.
645+
type: array
646+
items:
647+
title: Log
648+
description: An object containing information about the log.
649+
type: object
650+
properties:
651+
address:
652+
description: The address that generated the log.
653+
type: string
654+
pattern: '^0x[0-9a-fA-F]{40}$'
655+
data:
656+
description: The data of the log.
657+
type: string
658+
pattern: '^0x[0-9a-f]*$'
659+
topics:
660+
description: An array of log topics.
661+
type: array
662+
items:
663+
title: Topic
664+
description: A log topic.
665+
type: string
666+
pattern: '^0x[0-9a-f]*$'
667+
status:
668+
description: >-
669+
The status of the transaction. `0x1` indicates success, and `0x0`
670+
indicates failure.
671+
type: string
672+
pattern: '^0x[0-1]$'
673+
blockHash:
674+
description: The hash of the block containing the transaction.
675+
type: string
676+
pattern: '^0x[0-9a-f]{64}$'
677+
blockNumber:
678+
description: The number of the block containing the transaction.
679+
type: string
680+
pattern: '^0x([1-9a-f]+[0-9a-f]*|0)$'
681+
gasUsed:
682+
description: The amount of gas used by the transaction.
683+
type: string
684+
pattern: '^0x([1-9a-f]+[0-9a-f]*|0)$'
685+
transactionHash:
686+
description: The hash of the transaction.
687+
type: string
688+
pattern: '^0x[0-9a-f]{64}$'
689+
additionalProperties: true
690+
capabilities:
691+
description: Capabilities associated with the batch of calls.
692+
type: object
693+
additionalProperties: true
694+
errors:
695+
- $ref: '#/components/errors/InvalidParams'
696+
- $ref: '#/components/errors/Unauthorized'
697+
- code: 5730
698+
message: No matching bundle found.
699+
examples:
700+
- name: wallet_getCallsStatus example
701+
params:
702+
- name: Batch ID
703+
value: '0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331'
704+
result:
705+
name: Batch status
706+
value:
707+
version: '2.0.0'
708+
chainId: '0xaa36a7'
709+
id: '0xe670ec64341771606e55d6b4ca35a1a6b75ee3d5145a99d05921026d1527331'
710+
status: 200
711+
atomic: true
712+
receipts:
713+
- logs:
714+
- address: '0xa922b54716264130634d6ff183747a8ead91a40b'
715+
topics:
716+
- '0x5a2a90727cc9d000dd060b1132a5c977c9702bb3a52afe360c9c22f0e9451a68'
717+
data: '0xabcd'
718+
status: '0x1'
719+
blockHash: '0xf19bbafd9fd0124ec110b848e8de4ab4f62bf60c189524e54213285e7f540d4a'
720+
blockNumber: '0xabcd'
721+
gasUsed: '0xdef'
722+
transactionHash: '0x9b7bb827c2e5e3c1a0a44dc53e573aa0b3af3bd1f9f5ed03071b100bb039eaff'
723+
- name: wallet_getCapabilities
724+
tags:
725+
- $ref: '#/components/tags/MetaMask'
726+
summary: Gets the capabilities of the wallet.
727+
description: >-
728+
Returns information about the wallet's support for the `atomic`
729+
capability. The `atomic` capability specifies how the wallet will
730+
execute batches of transactions sent using `wallet_sendCalls`.
731+
`wallet_getCapabilities` is specified by
732+
[EIP-5792](https://eips.ethereum.org/EIPS/eip-5792).
733+
params:
734+
- name: Address
735+
description: A wallet address.
736+
required: true
737+
schema:
738+
type: string
739+
pattern: '^0x[0-9a-fA-F]{40}$'
740+
- name: Chain IDs
741+
description: An array of chain IDs to get capabilities for.
742+
schema:
743+
type: array
744+
items:
745+
title: Chain ID
746+
description: >-
747+
An [EIP-155](https://eips.ethereum.org/EIPS/eip-155)
748+
chain ID in hexadecimal format.
749+
$ref: '#/components/schemas/uint'
750+
result:
751+
name: Capabilities
752+
schema:
753+
description: >-
754+
An object specifying the status of the `atomic` capability for
755+
specific [EIP-155](https://eips.ethereum.org/EIPS/eip-155) chain IDs.
756+
For each chain, the `atomic` capability can have a `status` of:
757+
<br>
758+
<ul>
759+
<li>`supported` - The wallet will execute calls sent using
760+
`wallet_sendCalls` atomically.</li>
761+
<li>`ready` - The wallet can upgrade to `supported` pending user
762+
approval to upgrade their account via EIP-7702.</li>
763+
</ul>
764+
If the `atomic` capability is not `supported` or `ready` for a
765+
specified chain ID, the wallet will not return anything for that chain ID.
766+
type: object
767+
errors:
768+
- $ref: '#/components/errors/InvalidParams'
769+
- $ref: '#/components/errors/Unauthorized'
770+
examples:
771+
- name: wallet_getCapabilities example
772+
params:
773+
- name: Address
774+
value: '0xd46e8dd67c5d32be8058bb8eb970870f07244567'
775+
- name: Chain IDs
776+
value:
777+
- '0xaa36a7'
778+
result:
779+
name: Capabilities
780+
value:
781+
'0xaa36a7':
782+
atomic:
783+
status: ready
524784
- name: eth_requestAccounts
525785
tags:
526786
- $ref: '#/components/tags/MetaMask'
@@ -937,6 +1197,71 @@ components:
9371197
message:
9381198
type: object
9391199
description: The message you're proposing the user to sign.
1200+
SendCallsParameter:
1201+
title: Calls
1202+
description: An object containing information about a batch of calls.
1203+
type: object
1204+
required:
1205+
- version
1206+
- from
1207+
- chainId
1208+
- atomicRequired
1209+
- calls
1210+
properties:
1211+
version:
1212+
description: >-
1213+
The version of the API format. This must be `2.0.0`.
1214+
type: string
1215+
id:
1216+
description: The ID of the batch of calls.
1217+
type: string
1218+
from:
1219+
description: The sender's address.
1220+
type: string
1221+
pattern: '^0x[0-9a-fA-F]{40}$'
1222+
chainId:
1223+
description: >-
1224+
The [EIP-155](https://eips.ethereum.org/EIPS/eip-155) chain ID
1225+
of the calls. This must match the currently selected network in
1226+
the wallet.
1227+
type: string
1228+
pattern: '^0x([1-9a-f]+[0-9a-f]*|0)$'
1229+
atomicRequired:
1230+
description: >-
1231+
`true` if the wallet must execute all calls atomically. If `false`, the
1232+
wallet may execute the calls sequentially without atomicity. If `false`
1233+
and the wallet is capable of executing the calls atomically, it may do so.
1234+
type: boolean
1235+
calls:
1236+
type: array
1237+
description: An array of call objects.
1238+
items:
1239+
title: Call
1240+
description: An object containing information about the call.
1241+
type: object
1242+
properties:
1243+
to:
1244+
description: The address of the call's recipient.
1245+
type: string
1246+
pattern: '^0x[0-9a-fA-F]{40}$'
1247+
data:
1248+
description: The data to send with the call.
1249+
type: string
1250+
pattern: '^0x[0-9a-f]*$'
1251+
value:
1252+
description: The value to send with the call.
1253+
type: string
1254+
pattern: '^0x([1-9a-f]+[0-9a-f]*|0)$'
1255+
capabilities:
1256+
description: >-
1257+
Dapps can use this object to communicate with the wallet about
1258+
supported capabilities.
1259+
type: object
1260+
capabilities:
1261+
description: >-
1262+
Dapps can use this object to communicate with the wallet about
1263+
supported capabilities.
1264+
type: object
9401265
AddEthereumChainParameter:
9411266
title: Chain
9421267
description: Object containing information about the chain to add.
@@ -1086,3 +1411,9 @@ components:
10861411
UserRejected:
10871412
code: 4001
10881413
message: User rejected the request.
1414+
InvalidParams:
1415+
code: -32602
1416+
message: The wallet cannot parse the request.
1417+
Unauthorized:
1418+
code: 4100
1419+
message: The requested account and/or method has not been authorized by the user.

0 commit comments

Comments
 (0)