forked from MetaMask/api-specs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
openrpc.yaml
1051 lines (1035 loc) · 37.3 KB
/
openrpc.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
openrpc: 1.2.4
info:
title: JSON-RPC API
version: 1.0.0
description: >-
This section provides an interactive reference for the JSON-RPC API of
MetaMask's [Wallet API](/wallet/concepts/wallet-api). The API builds on a
set of standard Ethereum methods with MetaMask-specific enhancements, and is
designed for seamless integration into dapps.
View the JSON-RPC API methods by selecting a method in the left sidebar. You
can test the methods directly in the page using the API playground, with
pre-configured examples or custom parameters. You can also save URLs with
custom parameters using your browser's bookmarks.
Each method may have one or more of the following labels:
- **MetaMask** - The functionalities of these methods are specific to
MetaMask, and may or may not be supported by other wallets.
- **Restricted** - These methods are restricted and require requesting
permission using [`wallet_requestPermissions`](/wallet/reference/wallet_requestpermissions).
- **Mobile** - These methods are only available on MetaMask Mobile.
- **Experimental** - These methods are experimental and may be changed in
the future.
- **Deprecated** - These methods are deprecated and may be removed in the
future.
- **Ethereum API** - These are standard Ethereum JSON-RPC API methods. See
the [Ethereum wiki](https://eth.wiki/json-rpc/API#json-rpc-methods) for more
information about these methods.
methods:
- name: wallet_addEthereumChain
tags:
- $ref: '#/components/tags/MetaMask'
summary: Adds an Ethereum chain to the wallet.
description: >-
Creates a confirmation asking the user to add the specified chain to the
wallet application. The caller must specify a chain ID and some chain
metadata. The wallet application may refuse or accept the request. `null`
is returned if the chain is added, and an error otherwise. Introduced by
[EIP-3085](https://eips.ethereum.org/EIPS/eip-3085).
params:
- name: AddEthereumChainParameter
schema:
$ref: '#/components/schemas/AddEthereumChainParameter'
errors:
- code: -32602
message: >-
Expected null or array with at least one valid string HTTPS URL
'blockExplorerUrl'. Received: ${blockExplorerUrls}
- code: -32602
message: >-
Expected 0x-prefixed, unpadded, non-zero hexadecimal string 'chainId'.
Received:
${chainId}
- code: -32602
message: >-
Invalid chain ID "${_chainId}": numerical value greater than max safe
value. Received:
${chainId}
- code: -32602
message: May not specify default MetaMask chain.
- code: -32602
message: |-
Expected 2-6 character string 'nativeCurrency.symbol'. Received:
${ticker}
- code: -32602
message: >-
nativeCurrency.symbol does not match currency symbol for a network the
user already has added with the same chainId. Received:
${ticker}
result:
name: AddEthereumChainResult
schema:
type: 'null'
examples:
- name: wallet_addEthereumChain example
params:
- name: AddEthereumChainParameter
value:
chainId: '0x64'
chainName: Gnosis
rpcUrls:
- 'https://rpc.gnosischain.com'
iconUrls:
- 'https://xdaichain.com/fake/example/url/xdai.svg'
- 'https://xdaichain.com/fake/example/url/xdai.png'
nativeCurrency:
name: XDAI
symbol: XDAI
decimals: 18
blockExplorerUrls:
- 'https://blockscout.com/poa/xdai/'
result:
name: wallet_addEthereumChainExampleResult
value: 'null'
- name: wallet_switchEthereumChain
tags:
- $ref: '#/components/tags/MetaMask'
summary: Switches the wallet's active Ethereum chain.
description: >-
Requests that the wallet switches its active Ethereum chain. Introduced by
[EIP-3326](https://ethereum-magicians.org/t/eip-3326-wallet-switchethereumchain).
params:
- name: SwitchEthereumChainParameter
schema:
title: SwitchEthereumChainParameter
type: object
required:
- chainId
properties:
chainId:
description: >-
The chain ID as a `0x`-prefixed hexadecimal string, per the
`eth_chainId` method.
type: string
result:
name: SwitchEthereumChainResult
schema:
type: 'null'
errors:
- code: 4902
message: >-
Unrecognized chain ID. Try adding the chain using
wallet_addEthereumChain first.
examples:
- name: wallet_switchEthereumChain example
params:
- name: SwitchEthereumChainParameter
value:
chainId: '0x64'
result:
name: wallet_switchEthereumChainExampleResult
value: 'null'
- name: wallet_getPermissions
tags:
- $ref: '#/components/tags/MetaMask'
summary: Gets the user's permissions.
description: >-
Gets the user's permissions. Introduced by
[EIP-2255](https://eips.ethereum.org/EIPS/eip-2255).
params: []
result:
name: PermissionsList
schema:
$ref: '#/components/schemas/PermissionsList'
- name: wallet_requestPermissions
tags:
- $ref: '#/components/tags/MetaMask'
summary: Requests additional permissions.
description: >-
Requests additional permissions from the user. Introduced by
[EIP-2255](https://eips.ethereum.org/EIPS/eip-2255).
params:
- name: requestPermissionsObject
required: true
schema:
$ref: '#/components/schemas/PermissionObject'
result:
name: PermissionsList
schema:
$ref: '#/components/schemas/PermissionsList'
examples:
- name: >-
wallet_requestPermissions example of requesting the eth_accounts
permission
params:
- name: requestPermissionObject
value:
eth_accounts: {}
result:
name: permissionList
value:
eth_accounts: {}
errors:
- $ref: '#/components/errors/UserRejected'
- name: wallet_revokePermissions
tags:
- $ref: '#/components/tags/MetaMask'
- $ref: '#/components/tags/Experimental'
summary: Revokes the current dapp permissions.
description: >-
Revokes previously granted permissions for the current dapp identified by its
origin. This method is specified by
[MIP-2](https://github.com/MetaMask/metamask-improvement-proposals/blob/main/MIPs/mip-2.md)
and is only available for the browser extension.
params:
- name: revokePermissionObject
required: true
schema:
$ref: '#/components/schemas/PermissionObject'
result:
name: RevokePermissionsResult
schema:
type: 'null'
errors: []
examples:
- name: >-
wallet_revokePermissions example of revoking the eth_accounts
permission
params:
- name: revokePermissionObject
value:
eth_accounts: {}
result:
name: RevokePermissionsResult
value: null
- name: personal_sign
tags:
- $ref: '#/components/tags/MetaMask'
- $ref: '#/components/tags/Restricted'
summary: Presents a plain text signature challenge to the user.
description: >-
Presents a plain text signature challenge to the user and returns the
signed response. Equivalent to `eth_sign` on some other wallets, and
prepends a safe prefix to the signed message to prevent the challenge
tricking users into signing a financial transaction.
This method requires that the user has granted permission to interact
with their account first, so make sure to call `eth_requestAccounts` (recommended)
or `wallet_requestPermissions` first.
deprecated: false
params:
- name: Challenge
required: true
description: >-
A hex-encoded UTF-8 string to present to the user. See how to encode a
string like this in the
[`browser-string-hexer`](https://github.com/danfinlay/browser-string-hexer)
module.
schema:
type: string
pattern: '^0x[a-fA-F\d]+$'
- name: Address
required: true
description: The address of the requested signing account.
schema:
$ref: '#/components/schemas/address'
result:
name: Signature
description: A hex-encoded 65-byte array starting with `0x`.
schema:
$ref: '#/components/schemas/bytes'
examples:
- name: personal_sign example
params:
- name: Challenge
value: '0x506c65617365207369676e2074686973206d65737361676520746f20636f6e6669726d20796f7572206964656e746974792e'
- name: Address
value: '0x4B0897b0513FdBeEc7C469D9aF4fA6C0752aBea7'
result:
name: personal_signExampleResult
value: '0x43d7215ebe96c09a5adac69fc76dea5647286b501954ea273e417cf65e6c80e1db4891826375a7de02467a3e01caf125f64c851a8e9ee9467fd6f7e83523b2115bed8e79d527a85e28a36807d79b85fc551b5c15c1ead2e43456c31f565219203db2aed86cb3601b33ec3b410836d4be7718c6148dc9ac82ecc0a04c5edecd8914'
- name: eth_signTypedData_v4
tags:
- $ref: '#/components/tags/MetaMask'
- $ref: '#/components/tags/Restricted'
summary: Presents a structured data message for the user to sign.
description: >-
Presents a data message for the user to sign in a structured and readable
format and returns the signed response. Introduced by
[EIP-712](https://eips.ethereum.org/EIPS/eip-712).
This method requires that the user has granted permission to interact with their account first,
so make sure to call `eth_requestAccounts` (recommended) or `wallet_requestPermissions` first.
params:
- name: Address
required: true
description: The address of the requested signing account.
schema:
$ref: '#/components/schemas/address'
- name: TypedData
required: true
schema:
$ref: '#/components/schemas/TypedData'
result:
name: Signature
schema:
$ref: '#/components/schemas/bytes'
examples:
- name: eth_SignTypedData_v4 example
params:
- name: Address
value: '0x0000000000000000000000000000000000000000'
- name: TypedData
value:
types:
EIP712Domain:
- name: name
type: string
- name: version
type: string
- name: chainId
type: uint256
- name: verifyingContract
type: address
Person:
- name: name
type: string
- name: wallet
type: address
Mail:
- name: from
type: Person
- name: to
type: Person
- name: contents
type: string
primaryType: Mail
domain:
name: Ether Mail
version: '1'
chainId: 1
verifyingContract: '0xCcCCccccCCCCcCCCCCCcCcCccCcCCCcCcccccccC'
message:
from:
name: Cow
wallet: '0xCD2a3d9F938E13CD947Ec05AbC7FE734Df8DD826'
to:
name: Bob
wallet: '0xbBbBBBBbbBBBbbbBbbBbbbbBBbBbbbbBbBbbBBbB'
contents: 'Hello, Bob!'
result:
name: Signature
value: >-
0x4355c47d63924e8a72e509b65029052eb6c299d53a04e167c5775fd466751c9d07299936d304c153f6443dfa05f40ff007d72911b6f72307f996231605b915621c
- name: wallet_registerOnboarding
tags:
- $ref: '#/components/tags/MetaMask'
summary: Redirects the user back to the site after onboarding.
description: >-
Registers the requesting site with MetaMask as the initiator of
onboarding, enabling MetaMask to redirect the user back to the site after
onboarding. Returns a promise that resolves to `true`, or rejects if
there's an error. Instead of calling this method directly, you should use
the
[`@metamask/onboarding`](https://github.com/MetaMask/metamask-onboarding)
library.
params: []
result:
name: RegisterOnboardingResult
description: '`true` if the request was successful, `false` otherwise.'
schema:
type: boolean
- name: wallet_watchAsset
tags:
- $ref: '#/components/tags/MetaMask'
- $ref: '#/components/tags/Experimental'
summary: Tracks a token in MetaMask.
description: >-
Requests that the user track the specified token in MetaMask. Returns a
boolean indicating if the token was successfully added. Once added, the
token is indistinguishable from those added using legacy methods, such as
a centralized registry. Introduced by
[EIP-747](https://eips.ethereum.org/EIPS/eip-747).
paramStructure: by-name
params:
- name: type
schema:
type: string
description: >-
Supports ERC-20, ERC-721, and ERC-1155 tokens. Support for ERC-721
and ERC-1155 tokens is experimental and currently only available on
the extension (not on mobile). See
[MIP-1](https://github.com/MetaMask/metamask-improvement-proposals/blob/main/MIPs/mip-1.md)
and [MIP proposal
lifecycle](https://github.com/MetaMask/metamask-improvement-proposals/blob/main/PROCESS-GUIDE.md#proposal-lifecycle)
for more information.
enum:
- ERC20
- ERC721
- ERC1155
required: true
- name: options
schema:
title: WatchAssetOptions
type: object
required:
- address
properties:
address:
description: The address of the token contract.
type: string
symbol:
description: >-
A ticker symbol or shorthand, up to 11 characters (optional for
ERC-20 tokens).
minLength: 2
maxLength: 11
type: string
decimals:
description: The number of token decimals (optional for ERC-20 tokens).
type: number
image:
description: A string URL of the token logo (optional for ERC-20 tokens).
type: string
tokenId:
description: >-
The unique identifier of the NFT (required for ERC-721 and
ERC-1155 tokens).
type: string
errors:
- code: -32602
message: 'Must specify address, symbol, and decimals.'
- code: -32602
message: 'Invalid symbol: not a string.'
- code: -32602
message: 'Invalid symbol ''${symbol}'': longer than 11 characters.'
- code: -32602
message: 'Invalid decimals ''${decimals}'': must be 0 <= 36.'
- code: -32602
message: 'Invalid address ''${address}''.'
- code: -32602
message: Asset type is required.
- code: -32602
message: Both address and tokenId are required.
- code: -32602
message: Invalid address.
- code: -32000
message: Suggested NFT is not owned by the selected account.
- code: -32000
message: >-
Suggested NFT of type ${standard} does not match received type
${type}.
- code: -32002
message: >-
Unable to verify ownership. Possibly because the standard is not
supported or the user's currently selected network does not match the
chain of the asset in question.
result:
name: WatchAssetResult
description: '`true` if the token was added, `false` otherwise.'
schema:
type: boolean
examples:
- name: wallet_watchAsset ERC-20 example
params:
- name: type
value: ERC20
- name: options
value:
address: '0xb60e8dd61c5d32be8058bb8eb970870f07233155'
symbol: FOO
decimals: 18
image: 'https://foo.io/token-image.svg'
result:
name: wallet_watchAssetExampleResult
value: true
- name: wallet_watchAsset ERC-721 example
params:
- name: type
value: ERC721
- name: options
value:
address: '0x123456789abcdef0123456789abcdef01234567'
tokenId: '42'
result:
name: wallet_watchAssetERC721ExampleResult
value: true
- name: wallet_watchAsset ERC-1155 example
params:
- name: type
value: ERC1155
- name: options
value:
address: '0xabcdef0123456789abcdef0123456789abcdef01'
tokenId: '1337'
result:
name: wallet_watchAssetERC1155ExampleResult
value: true
- name: wallet_scanQRCode
tags:
- $ref: '#/components/tags/MetaMask'
- $ref: '#/components/tags/Mobile'
summary: Requests that the user scan a QR code.
description: >-
Requests that the user scan a QR code using their device camera.
Introduced by [EIP-945](https://github.com/ethereum/EIPs/issues/945).
params:
- name: regex
required: false
description: >-
A regular expression (regex) string for matching arbitrary QR code
strings.
schema:
type: string
title: regex
result:
name: ScanQRCodeResult
description: >-
A string corresponding to the scanned QR code. If a regex string is
provided, the resulting string matches it. If no regex string is
provided, the resulting string matches an Ethereum address. If neither
condition is met, the method returns an error.
schema:
type: string
title: ScanQRCodeResult
- name: eth_requestAccounts
tags:
- $ref: '#/components/tags/MetaMask'
description: >-
Requests that the user provide an Ethereum address to be identified by.
This method is specified by
[EIP-1102](https://eips.ethereum.org/EIPS/eip-1102). Internally, this
method calls `wallet_requestPermissions` for permission to call
`eth_accounts`.
summary: Requests that the user provide an Ethereum address.
params: []
result:
name: AddressList
schema:
type: array
items:
$ref: '#/components/schemas/address'
errors:
- $ref: '#/components/errors/UserRejected'
examples:
- name: eth_requestAccounts example
params: []
result:
name: eth_requestAccountsExampleResult
value: '0xa77392123a1085f75e62eec7dea7e0e1e5142d5f'
- name: eth_accounts
tags:
- $ref: '#/components/tags/MetaMask'
- $ref: '#/components/tags/Restricted'
description: >-
Returns a list of addresses for the accounts owned by the user.
This method requires calling `wallet_requestPermissions` for permission.
We recommend using `eth_requestAccounts`, which internally calls `wallet_requestPermission`.
summary: Gets a list of addresses for the user's accounts.
params: []
result:
name: AddressList
schema:
type: array
items:
$ref: '#/components/schemas/address'
examples:
- name: eth_accounts example
params: []
result:
name: eth_accountsExampleResult
value: '0xa77392123a1085f75e62eec7dea7e0e1e5142d5f'
- name: eth_sendTransaction
tags:
- $ref: '#/components/tags/MetaMask'
- $ref: '#/components/tags/Restricted'
description: >-
Creates a new wallet confirmation to make an Ethereum transaction from the
user's account. This method requires that the user has granted permission
to interact with their account first, so make sure to call `eth_requestAccounts` (recommended)
or `wallet_requestPermissions` first.
summary: Initiates a new transaction.
params:
- name: Transaction
required: true
description: The transaction object to sign and send.
schema:
type: object
title: Transaction
description: >-
The parameters to customize a transaction. If a `to` address is not
provided, it will be assumed that the transaction is a contract
creation transaction, and the `data` field of the transaction will
be used as the contract initialization code. `gasPrice` cannot be
used together with `maxPriorityFeePerGas` and `maxFeePerGas`.
required:
- from
if:
properties:
to:
not:
type: string
then:
required:
- data
properties:
to:
title: to address
$ref: '#/components/schemas/address'
from:
title: from address
$ref: '#/components/schemas/address'
gas:
title: gas limit
$ref: '#/components/schemas/uint'
value:
title: value
$ref: '#/components/schemas/uint'
data:
title: data
$ref: '#/components/schemas/bytes'
gasPrice:
title: gas price
description: >-
The gas price the sender is willing to pay to miners in wei.
Used in pre-1559 transactions.
$ref: '#/components/schemas/uint'
maxPriorityFeePerGas:
title: max priority fee per gas
description: >-
Maximum fee per gas the sender is willing to pay to miners in
wei. Used in 1559 transactions.
$ref: '#/components/schemas/uint'
maxFeePerGas:
title: max fee per gas
description: >-
The maximum total fee per gas the sender is willing to pay
(includes the network / base fee and miner / priority fee) in
wei. Used in 1559 transactions.
$ref: '#/components/schemas/uint'
result:
name: TransactionHash
description: The transaction hash of the sent transaction.
schema:
$ref: '#/components/schemas/bytes32'
errors:
- code: 4100
message: >-
The requested account and/or method has not been authorized by the user.
examples:
- name: sendTransaction
params:
- name: Transaction
value:
to: '0x4B0897b0513FdBeEc7C469D9aF4fA6C0752aBea7'
from: '0xDeaDbeefdEAdbeefdEadbEEFdeadbeefDEADbEEF'
gas: '0x76c0'
value: '0x8ac7230489e80000'
data: '0x'
gasPrice: '0x4a817c800'
result:
name: eth_sendTransactionExampleResult
value: '0x4e306b5a5a37532e1734503f7d2427a86f2c992fbe471f5be403b9f734e667c8'
- name: eth_decrypt
tags:
- $ref: '#/components/tags/MetaMask'
- $ref: '#/components/tags/Restricted'
- $ref: '#/components/tags/Deprecated'
summary: Decrypts an encrypted message.
description: |-
This method is deprecated and may be removed in the future.
Requests that MetaMask decrypt the specified encrypted message.
The message must have been encrypted using the public encryption key of the specified Ethereum address.
Returns a promise that resolves to the decrypted message, or rejects if the decryption attempt fails.
params:
- name: EncryptedMessage
required: true
description: The encrypted message to decrypt.
schema:
type: string
- name: Address
required: true
description: The address of the Ethereum account that can decrypt the message.
schema:
$ref: '#/components/schemas/address'
result:
name: PermissionsList
schema:
$ref: '#/components/schemas/PermissionsList'
errors:
- code: 4100
message: >-
The requested account and/or method has not been authorized by the user.
examples:
- name: decryptExample
params:
- name: EncryptedMessage
value: '0x7b2276657273696f6e223a227832353531392d7873616c736132302d706f6c7931333035222c226e6f6e6365223a2243533967507076467071765358704655416679726a7179774e35302b7a747766222c22657068656d5075626c69634b6579223a224372774b61456d2f4b356d6d714239764c376f5872636d6441417757764479324f784c3333527135576e553d222c2263697068657274657874223a2248347a65336e7177572b753174663956343945506167454e343872774f766b6952676244566e47587a38493d227d'
- name: Address
value: '0xD1F5279BE4B4dD94133A23deE1B23F5bfC0Db1d0'
result:
name: eth_decryptExampleResult
value: 'Hello, Ethereum!'
- name: eth_getEncryptionPublicKey
tags:
- $ref: '#/components/tags/MetaMask'
- $ref: '#/components/tags/Restricted'
- $ref: '#/components/tags/Deprecated'
summary: Gets a public key used for encryption.
description: |-
This method is deprecated and may be removed in the future.
Requests that the user share their public encryption key.
Returns a public encryption key, or rejects if the user denies the request.
The public key is computed from entropy associated with the specified user account, using the NaCl implementation of the `X25519_XSalsa20_Poly1305` algorithm.
params:
- name: Address
required: true
description: The address of the Ethereum account that can decrypt the message.
schema:
$ref: '#/components/schemas/address'
result:
name: EncryptionKey
schema:
type: string
examples:
- name: eth_getEncryptionPublicKey
params:
- name: Address
value: '0x4B0897b0513FdBeEc7C469D9aF4fA6C0752aBea7'
result:
name: eth_getEncryptionPublicKeyExampleResult
value: '0x04bfcab3b7ca7e8b3f3b62b2f7f77e9e4b68080bbf8f0f4a1c8f890864d2c7c1d3c45d8b2e3f5f1c27dfeea4c2f5733e90bfc7484e2a690aa9b8ac4559d2e6a8d7'
- name: web3_clientVersion
tags:
- $ref: '#/components/tags/Ethereum'
description: >-
Returns the current MetaMask client version. This differs slightly per
client. For example, the browser extension returns a string like
`MetaMask/v10.33.1`, while the mobile app returns a string like
`MetaMask/8.1.2/Mobile`.
summary: Current client version.
params: []
examples:
- name: MetaMaskClientVersionExample
description: Example version response from MetaMask.
params: []
result:
name: MetaMaskClientVersion
description: The current client version.
value: MetaMask/v10.33.1
- name: MetaMaskMobileClientVersionExample
description: Example version response from MetaMask Mobile.
params: []
result:
name: MetaMaskClientVersion
description: The current client version.
value: MetaMask/8.1.2/Mobile
result:
name: CurrentVersion
description: The current client version.
schema:
title: CurrentClientVersion
type: string
- name: eth_subscribe
tags:
- $ref: '#/components/tags/Ethereum'
summary: >-
Subscribes to specific Ethereum events, returning a subscription ID used
to receive notifications.
description: >-
Subscribes to specific events on the Ethereum network, such as new blocks,
or logs. When an event occurs, a notification is sent to the client with the corresponding
data. To stop receiving notifications, the client can unsubscribe using
`eth_unsubscribe`.
params:
- name: subscriptionType
required: true
schema:
title: subscriptionType
type: string
enum:
- newHeads
- logs
description: |-
The type of subscription to create. Must be one of the following:
1. `newHeads` - New block headers.
2. `logs` - Logs matching a filter object.
- name: filterOptions
required: false
schema:
title: filterOptions
type: object
description: >-
(Optional) An object containing filter options specific to the
subscription type. Only applicable for the `logs` subscription type.
required:
- topics
properties:
address:
type: string
description: >-
(Optional) A single address or an array of addresses to filter
the logs by.
topics:
type: array
description: An array of topics to filter the logs by.
items:
type: string
result:
name: subscriptionId
schema:
type: string
description: >-
A unique subscription ID that can be used to unsubscribe or identify
incoming notifications.
examples:
- name: eth_subscribe example
params:
- name: subscriptionType
value: newHeads
result:
name: eth_subscribeExampleResult
value: '0x1b84f2cdf29a204b79e450c1939b30c1'
- name: eth_unsubscribe
tags:
- $ref: '#/components/tags/Ethereum'
summary: >-
Unsubscribes from a specific Ethereum event, using the subscription ID
provided by `eth_subscribe`.
description: >-
Unsubscribes from specific events on the Ethereum network, to which the
client has been previously subscribed using `eth_subscribe`. The client
must provide the subscription ID obtained from `eth_subscribe` to stop
receiving notifications for the corresponding event.
params:
- name: subscriptionId
required: true
schema:
type: string
description: >-
The unique subscription ID obtained from `eth_subscribe`, used to
identify the subscription to be unsubscribed.
result:
name: unsubscribed
schema:
type: boolean
description: A boolean value indicating whether the unsubscription was successful.
examples:
- name: eth_unsubscribe example
params:
- name: subscriptionId
value: '0x1b84f2cdf29a204b79e450c1939b30c1'
result:
name: eth_unsubscribeExampleResult
value: true
components:
schemas:
TypedData:
title: TypedData
type: object
required:
- types
- primaryType
- domain
- message
properties:
types:
type: object
required:
- EIP712Domain
properties:
EIP712Domain:
type: array
items:
type: object
properties:
name:
type: string
type:
type: string
description: >-
An array specifying one or more of the following domain
separator values: 1) `name` - The user-readable name of the signing
domain, that is, the name of the dapp or the protocol. 2) `version`
- The current major version of the signing domain. 3) `chainId`
- The chain ID of the network. 4) `verifyingContract` - The
address of the contract that will verify the signature. 5)
`salt` - A disambiguating salt for the protocol.
additionalProperties:
type: array
required:
- name
- type
items:
type: object
properties:
name:
type: string
type:
type: string
domain:
type: object
description: >-
Contains the domain separator values specified in the `EIP712Domain`
type.
primaryType:
type: string
message:
type: object
description: The message you're proposing the user to sign.
AddEthereumChainParameter:
title: AddEthereumChainParameter
type: object
required:
- chainId
- chainName
- nativeCurrency
- rpcUrls
properties:
chainId:
description: >-
The chain ID as a `0x`-prefixed hexadecimal string, per the
`eth_chainId` method. MetaMask compares this chain ID value with the
`eth_chainId` return value. If these values aren't identical,
MetaMask rejects the request.
type: string
blockExplorerUrls:
description: >-
(Optional) One or more URLs pointing to block explorer sites for the
chain.
type: array
items:
type: string
chainName:
description: A human-readable name for the chain.
type: string
iconUrls:
description: >-
(Optional) One or more URLs pointing to reasonably sized images that
can be used to visually identify the chain. NOTE: MetaMask will not
currently display these images. Values can still be included so
that they are utilized if MetaMask incorporates them into the display
of custom networks in the future.
type: array
items:
format: uri
type: string
nativeCurrency:
$ref: '#/components/schemas/NativeCurrency'
rpcUrls:
description: >-
One or more URLs pointing to RPC endpoints that can be used to
communicate with the chain. At least one item is required, and only
the first item is used.
type: array
minItems: 1
items:
format: uri
type: string
NativeCurrency:
title: NativeCurrency
type: object
description: >-
Describes the native currency of the chain using the name, symbol, and
decimals fields.
required:
- decimals
- symbol
properties:
decimals:
description: A non-negative integer.
minimum: 0
type: integer
name:
description: A human-readable name.
type: string
symbol:
description: A human-readable symbol.
type: string
Caveats:
title: Caveats
description: >-
A capability document modifies the caveat property to specify usage
restrictions. Capabilities inherit restrictions from the caveat
properties of their parent documents and can add new caveats in addition
to those inherited from their parents.
type: array
items:
title: Caveat
type: object
properties:
type:
title: Type
type: string
description: Type of caveat.
value:
title: CaveatValue
description: Value of the caveat.
name:
title: Name
type: string
description: Name of the caveat.
PermissionObject:
type: object
title: PermissionObject
additionalProperties:
type: object
additionalProperties: true
properties:
permission:
description: The requested permission.
type: object
additionalProperties: true
Permission:
title: Permission
type: object
properties:
id: