-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathopenrpc.json
928 lines (928 loc) · 27.7 KB
/
openrpc.json
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
{
"openrpc": "1.2.6",
"info": {
"version": "1.0.0",
"title": "Wallet API"
},
"methods": [
{
"name": "session.connect_wallet",
"summary": "Initiates a connection between a wallet and a third-party application.",
"description": "This method initiates a connection between a wallet and a third-party application.\n\nThe client has to review the request, and, if they accept it, select the wallet they want to use for this connection.\n\nA connection token is generated and returned to the third-party application. This token is meant to be used in protected methods.\n\n**Supported connections:**\n- Multiple wallets connected for the same hostname. Each connection will have a different token.\n- A single wallet connected to multiple hostnames. Each connection will have a different token.\n- Combination of the above setups.\n\nHowever, it's not possible to have multiple connections on the same wallet for the same hostname. The previous connection will be terminated and a new token will be generated.\n\nThis method should be the entry point of every third-party application. Once connected, see the method `get_permissions`.",
"tags": [
{
"name": "connection"
}
],
"paramStructure": "by-name",
"params": [
{
"name": "hostname",
"description": "The name of the third-party application initiating the connection.",
"required": true,
"schema": {
"type": "string"
}
}
],
"result": {
"name": "token",
"schema": {
"$ref": "#/components/schemas/token"
}
},
"errors": [
{
"$ref": "#/components/errors/connection_closed"
},
{
"$ref": "#/components/errors/request_rejected"
},
{
"$ref": "#/components/errors/request_interrupted"
}
],
"examples": [
{
"name": "Accepting a connection from \"vega.xyz\"",
"description": "The third-party application \"vega.xyz\" requests a connection to a wallet and the client accepts.",
"params": [
{
"name": "hostname",
"value": "vega.xyz"
}
],
"result": {
"name": "Success",
"value": {
"token": "hZKSx0snBvikp2NGMJdKPHU5qvloSeqpqbJg6BsMwCcqX4iZvvy99BV2l13oeyEG"
}
}
}
]
},
{
"name": "session.disconnect_wallet",
"summary": "Ends the connection between the third-party application and the wallet.",
"description": "This method ends the connection between the third-party application and the wallet. The token is, then, no longer valid.\n\nCalling this method with an invalid token doesn't fail.",
"tags": [
{
"name": "connection"
}
],
"paramStructure": "by-name",
"params": [
{
"name": "token",
"required": true,
"schema": {
"$ref": "#/components/schemas/token"
}
}
],
"result": {
"name": "No result",
"schema": {}
},
"examples": [
{
"name": "Disconnection from \"vega.xyz\"",
"description": "The third-party application \"vega.xyz\" requests a disconnection to a wallet using a valid token.",
"params": [
{
"name": "token",
"value": "hZKSx0snBvikp2NGMJdKPHU5qvloSeqpqbJg6BsMwCcqX4iZvvy99BV2l13oeyEG"
}
],
"result": {
"name": "Success",
"value": null
}
}
]
},
{
"name": "session.get_permissions",
"summary": "Returns the permissions set on the wallet for the third-party application.",
"description": "This method returns the permissions set on the wallet for the third-party application.\n\nThis method should be called, by the third-party application, right after it successfully connected to a wallet, to ensure it has sufficient permissions to call the method it relies on. If the third-party application doesn't have enough permissions, see the method `request_permissions`.",
"tags": [
{
"name": "permissions"
}
],
"paramStructure": "by-name",
"params": [
{
"name": "token",
"required": true,
"schema": {
"$ref": "#/components/schemas/token"
}
}
],
"result": {
"name": "permissions",
"schema": {
"$ref": "#/components/schemas/permissions"
}
},
"examples": [
{
"name": "Get permissions set for \"vega.xyz\"",
"description": "The third-party application \"vega.xyz\" wants to know the permissions that have been set on the wallet in use.",
"params": [
{
"name": "token",
"value": "hZKSx0snBvikp2NGMJdKPHU5qvloSeqpqbJg6BsMwCcqX4iZvvy99BV2l13oeyEG"
}
],
"result": {
"name": "Success",
"value": {
"public_keys": "read"
}
}
}
]
},
{
"name": "session.request_permissions",
"summary": "Requests permissions update for the third-party application.",
"description": "This method allows a third-party application to request new permissions to access the methods it requires.\n\nAll permissions the third-party relies on have to be specified. If a permission is omitted, it will be considered as no longer required and, as a result, be automatically revoked.\n\nThe client has to review the permissions.",
"tags": [
{
"name": "permissions"
}
],
"paramStructure": "by-name",
"params": [
{
"name": "token",
"required": true,
"schema": {
"$ref": "#/components/schemas/token"
}
},
{
"name": "requestedPermissions",
"required": true,
"schema": {
"$ref": "#/components/schemas/permissions"
}
}
],
"result": {
"name": "permissions",
"schema": {
"$ref": "#/components/schemas/permissions"
}
},
"errors": [
{
"$ref": "#/components/errors/connection_closed"
},
{
"$ref": "#/components/errors/request_rejected"
},
{
"$ref": "#/components/errors/request_interrupted"
}
],
"examples": [
{
"name": "Updating permissions for \"vega.xyz\"",
"description": "The third-party application \"vega.xyz\" requests an update of its permissions and the client accepts.",
"params": [
{
"name": "token",
"value": "hZKSx0snBvikp2NGMJdKPHU5qvloSeqpqbJg6BsMwCcqX4iZvvy99BV2l13oeyEG"
},
{
"name": "requestedPermissions",
"value": {
"public_keys": "read"
}
}
],
"result": {
"name": "Success",
"value": {
"permissions": {
"public_keys": "read"
}
}
}
},
{
"name": "Updating permissions for \"vega.xyz\" with omitted permission",
"description": "The third-party application \"vega.xyz\" omits a permission during the update and the client accepts. This automatically marks the omitted permission as revoked.",
"params": [
{
"name": "token",
"value": "hZKSx0snBvikp2NGMJdKPHU5qvloSeqpqbJg6BsMwCcqX4iZvvy99BV2l13oeyEG"
},
{
"name": "requestedPermissions",
"value": {}
}
],
"result": {
"name": "Success",
"value": {
"permissions": {
"public_keys": "none"
}
}
}
}
]
},
{
"name": "session.list_keys",
"summary": "Returns the keys the client has allowed the third-party application to have access to.",
"description": "This method returns the keys the client has allowed the third-party application to have access to.\n\nIt requires a `read` access on `public_keys`.",
"paramStructure": "by-name",
"params": [
{
"name": "token",
"required": true,
"schema": {
"$ref": "#/components/schemas/token"
}
}
],
"result": {
"name": "keys",
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
},
"errors": [
{
"$ref": "#/components/errors/read_access_public_keys"
}
],
"examples": [
{
"name": "List keys allowed on \"vega.xyz\"",
"description": "The third-party application \"vega.xyz\" wants to list the public keys it has access to.",
"params": [
{
"name": "token",
"value": "hZKSx0snBvikp2NGMJdKPHU5qvloSeqpqbJg6BsMwCcqX4iZvvy99BV2l13oeyEG"
}
],
"result": {
"name": "Success",
"value": [
"0xdeadbeef",
"0xcafedude"
]
}
}
]
},
{
"name": "session.send_transaction",
"summary": "Send a transaction to the network.",
"description": "This method sends a transaction to the network.\n\nThe client has to review the transaction.",
"tags": [
{
"name": "transaction"
}
],
"paramStructure": "by-name",
"params": [
{
"name": "token",
"required": true,
"schema": {
"$ref": "#/components/schemas/token"
}
},
{
"name": "publicKey",
"required": true,
"schema": {
"$ref": "#/components/schemas/public_key"
}
},
{
"name": "sendingMode",
"required": true,
"description": "The chosen mode to send the transaction:\n- `TYPE_SYNC` returns the result of running the transaction.\n- `TYPE_ASYNC` returns right away without waiting to hear if the transaction is even valid.\n- `TYPE_COMMIT` waits until the transaction is committed in a block or until some timeout is reached or returns return right away if the transaction is not valid.",
"schema": {
"type": "string",
"enum": [
"TYPE_SYNC",
"TYPE_ASYNC",
"TYPE_COMMIT"
]
}
},
{
"name": "encodedTransaction",
"required": true,
"schema": {
"$ref": "#/components/schemas/encoded_transaction"
}
}
],
"result": {
"name": "transaction_status",
"schema": {
"type": "object",
"properties": {
"receivedAt": {
"type": "string",
"description": "The date when the API received the request to send the transaction.\n\nThe time is a quoted string in RFC 3339 format, with sub-second precision added if present.",
"examples": [
"2021-02-18T21:54:42.123Z"
]
},
"sentAt": {
"type": "string",
"description": "The date when the transaction has been sent to the network.\n\nThe time is a quoted string in RFC 3339 format, with sub-second precision added if present.",
"examples": [
"2021-02-18T21:54:42.123Z"
]
},
"transactionHash": {
"type": "string",
"description": "The hash of the transaction. It's used to uniquely identify the transaction and can be used in the block explorer to retrieve it."
}
}
}
},
"errors": [
{
"$ref": "#/components/errors/no_healthy_node"
},
{
"$ref": "#/components/errors/could_not_get_last_block"
},
{
"$ref": "#/components/errors/transaction_failed"
},
{
"$ref": "#/components/errors/public_key_not_allowed"
},
{
"$ref": "#/components/errors/connection_closed"
},
{
"$ref": "#/components/errors/request_rejected"
},
{
"$ref": "#/components/errors/request_interrupted"
}
],
"examples": [
{
"name": "Sending a transaction for \"vega.xyz\"",
"description": "The third-party application \"vega.xyz\" requests to send a transaction and the client accepts.",
"params": [
{
"name": "token",
"value": "hZKSx0snBvikp2NGMJdKPHU5qvloSeqpqbJg6BsMwCcqX4iZvvy99BV2l13oeyEG"
},
{
"name": "publicKey",
"value": "3fd42fd5ceb22d99ac45086f1d82d516118a5cb7ad9a2e096cd78ca2c8960c80"
},
{
"name": "sendingMode",
"value": "TYPE_SYNC"
},
{
"name": "encodedTransaction",
"value": "ewogICAgInZvdGVTdWJtaXNzaW9uIjogewogICAgICAgICJwcm9wb3NhbElkIjogImViMmQzOTAyZmRkYTljM2ViNmUzNjlmMjIzNTY4OWI4NzFjNzMyMmNmM2FiMjg0ZGRlM2U5ZGZjMTM4NjNhMTciLAogICAgICAgICJ2YWx1ZSI6ICJWQUxVRV9ZRVMiCiAgICB9Cn0K"
}
],
"result": {
"name": "Success",
"value": {
"receivedAt": "2021-02-18T21:54:42.123Z",
"sentAt": "2021-02-18T21:54:42.123Z",
"txHash": "E8C167126D1FC8D92898AB9C07C318161DF68753A1316A69ABDC9ADC557723B3"
}
}
}
]
},
{
"name": "session.get_chain_id",
"summary": "Returns the chain ID of the network in use.",
"description": "This method returns the chain ID of the network in use.\n\nIt should be called by every third-party application to know from which network it should fetch data.",
"paramStructure": "by-name",
"params": [],
"result": {
"name": "chainID",
"schema": {
"type": "object",
"properties": {
"chainID": {
"type": "string",
"description": "The identifier for the chain",
"examples": [
"test-chain-Thz9c6"
]
}
}
}
},
"errors": [
{
"$ref": "#/components/errors/no_healthy_node"
},
{
"$ref": "#/components/errors/could_not_get_last_block"
}
],
"examples": [
{
"name": "Fetching the chain ID",
"description": "An example of requesting the chain's ID",
"params": [],
"result": {
"name": "Success",
"value": {
"chainID": "test-chain-Thz9c6"
}
}
}
]
},
{
"name": "admin.create_wallet",
"summary": "Creates a wallet with its first key-pair.",
"description": "This method creates a HD wallet (version 2) and generates its first key-pair the cryptographic algorithm ed25519.\n\nThe passphrase will be used to encrypt the wallet and its keys.\n\nIf successful, the wallet is ready to use for sending transaction.",
"paramStructure": "by-name",
"params": [
{
"name": "wallet",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "passphrase",
"required": true,
"schema": {
"type": "string"
}
}
],
"result": {
"name": "Success",
"schema": {
"type": "object",
"properties": {
"wallet": {
"type": "object",
"description": "the newly generated wallet",
"properties": {
"name": {
"type": "string"
},
"version": {
"type": "number"
},
"recoveryPhrase": {
"type": "string"
},
"filePath": {
"type": "string"
}
}
},
"key": {
"type": "object",
"description": "the first public key generated",
"properties": {
"publicKey": {
"type": "string"
},
"algorithm": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"version": {
"type": "string"
}
}
},
"meta": {
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"value": {
"type": "string"
}
}
}
}
}
}
}
}
},
"examples": [
{
"name": "Creating a wallet",
"params": [
{
"name": "wallet",
"value": "my-wallet"
},
{
"name": "passphrase",
"value": "this-is-not-a-good-passphrase"
}
],
"result": {
"name": "Success",
"value": {
"wallet": {
"name": "my-wallet",
"version": 2,
"recoveryPhrase": "swing ceiling chaos green put insane ripple desk match tip melt usual shrug turkey renew icon parade veteran lens govern path rough page render",
"filePath": "some/path/to/my-wallet"
},
"key": {
"publicKey": "b5fd9d3c4ad553cb3196303b6e6df7f484cf7f5331a572a45031239fd71ad8a0",
"algorithm": {
"name": "vega/ed25519",
"version": 1
},
"meta": [
{
"key": "name",
"value": "my-wallet key 1"
}
]
}
}
}
}
]
},
{
"name": "admin.import_wallet",
"summary": "Import a wallet with its first key-pair with a recovery phrase and a version.",
"description": "This method imports a wallet using the specified recovery phrase and wallet version, and generates its first key-pair.\n\nThe passphrase will be used to encrypt the wallet and its keys.\n\nIf successful, the wallet is ready to use for sending transaction.",
"paramStructure": "by-name",
"params": [
{
"name": "wallet",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "passphrase",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "recoveryPhrase",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "version",
"required": true,
"schema": {
"type": "number"
}
}
],
"result": {
"name": "Success",
"schema": {
"type": "object",
"properties": {
"wallet": {
"type": "object",
"description": "the imported wallet",
"properties": {
"name": {
"type": "string"
},
"version": {
"type": "number"
},
"filePath": {
"type": "string"
}
}
},
"key": {
"type": "object",
"description": "the first public key generated",
"properties": {
"publicKey": {
"type": "string"
},
"algorithm": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"version": {
"type": "string"
}
}
},
"meta": {
"type": "array",
"items": {
"type": "object",
"properties": {
"key": {
"type": "string"
},
"value": {
"type": "string"
}
}
}
}
}
}
}
}
},
"examples": [
{
"name": "Importing a wallet",
"params": [
{
"name": "wallet",
"value": "my-wallet"
},
{
"name": "passphrase",
"value": "this-is-not-a-good-passphrase"
},
{
"name": "recoveryPhrase",
"value": "swing ceiling chaos green put insane ripple desk match tip melt usual shrug turkey renew icon parade veteran lens govern path rough page render"
},
{
"name": "version",
"value": "2"
}
],
"result": {
"name": "Success",
"value": {
"wallet": {
"name": "my-wallet",
"version": 2,
"filePath": "some/path/to/my-wallet"
},
"key": {
"publicKey": "b5fd9d3c4ad553cb3196303b6e6df7f484cf7f5331a572a45031239fd71ad8a0",
"algorithm": {
"name": "vega/ed25519",
"version": 1
},
"meta": [
{
"key": "name",
"value": "my-wallet key 1"
}
]
}
}
}
}
]
},
{
"name": "admin.describe_wallet",
"summary": "Returns the wallet base information.",
"description": "This method returns the wallet base information such as its name, ID, type and version. It doesn't return the keys nor the permissions.",
"paramStructure": "by-name",
"params": [
{
"name": "wallet",
"required": true,
"schema": {
"type": "string"
}
},
{
"name": "passphrase",
"required": true,
"schema": {
"type": "string"
}
}
],
"result": {
"name": "Success",
"schema": {
"type": "object",
"properties": {
"name": {
"type": "string"
},
"version": {
"type": "number"
},
"id": {
"type": "string"
},
"type": {
"type": "string"
}
}
}
},
"examples": [
{
"name": "Getting wallet base information",
"params": [
{
"name": "wallet",
"value": "my-wallet"
},
{
"name": "passphrase",
"value": "this-is-not-a-good-passphrase"
}
],
"result": {
"name": "Success",
"value": {
"name": "my-wallet",
"version": 2,
"type": "HD Wallet",
"ID": "7ffa36b2fb99d8404e9448f0d2ce944055e64c36d895d1fde044c867bfdf779f"
}
}
}
]
},
{
"name": "admin.list_wallets",
"summary": "Returns the list of the wallets present on the computer.",
"description": "This method returns the list of the wallets present on the computer. It is alphabetically sorted.",
"params": [],
"result": {
"name": "Success",
"schema": {
"type": "array",
"items": {
"type": "string"
}
}
},
"examples": [
{
"name": "Getting the list of wallets",
"params": [],
"result": {
"name": "Success",
"value": {
"wallets": [
"wallet-1",
"wallet-2"
]
}
}
}
]
},
{
"name": "admin.remove_wallet",
"summary": "Removes a wallet from the computer.",
"description": "This method removes a wallet from the computer.",
"paramStructure": "by-name",
"params": [
{
"name": "wallet",
"required": true,
"schema": {
"type": "string"
}
}
],
"result": {
"name": "Success",
"schema": {
"type": "null"
}
},
"examples": [
{
"name": "Remove a wallet",
"params": [
{
"name": "wallet",
"value": "my-wallet"
}
],
"result": {
"name": "Success",
"value": {}
}
}
]
}
],
"components": {
"schemas": {
"token": {
"type": "string",
"description": "A unique connection token randomly generated for each new connection. It's used to access the protected methods."
},
"public_key": {
"type": "string",
"description": "The Vega public key to use."
},
"encoded_transaction": {
"type": "string",
"description": "The transaction encoded using base-64."
},
"access_mode": {
"type": "string",
"description": "The different access modes a permission can have.",
"enum": [
"read",
"write",
"none"
]
},
"permissions": {
"type": "object",
"description": "The description of the permissions a third-party application has.",
"properties": {
"public_keys": {
"$ref": "#/components/schemas/access_mode"
}
}
}
},
"errors": {
"no_healthy_node": {
"code": 1000,
"message": "Network error",
"data": "no healthy node available"
},
"could_not_get_last_block": {
"code": 1000,
"message": "Network error",
"data": "could not get information about the last block on the network"
},
"transaction_failed": {
"code": 1000,
"message": "Network error",
"data": "the transaction failed"
},
"read_access_public_keys": {
"code": 2000,
"message": "Application error",
"data": "a \"read\" access on public keys is required"
},
"public_key_not_allowed": {
"code": 2000,
"message": "Application error",
"data": "the public key is not allowed to be used"
},
"connection_closed": {
"code": 3000,
"message": "Client error",
"data": "the client closed the connection"
},
"request_rejected": {
"code": 3001,
"message": "Client error",
"data": "the client rejected the request"
},
"request_interrupted": {
"code": -32001,
"message": "Server error",
"data": "the request has been interrupted"
}
}
}
}