Repository navigation
Expand file tree
/
Copy pathapi-server.yaml
More file actions
1702 lines (1682 loc) · 56.8 KB
/
Copy pathapi-server.yaml
File metadata and controls
1702 lines (1682 loc) · 56.8 KB
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
openapi: 3.1.0
info:
title: Canton Middleware API Server
version: 0.9.0
summary: Ethereum JSON-RPC facade and REST API for CIP-56 tokens on Canton.
description: |
The API server exposes Canton Network CIP-56 tokens to Ethereum tooling. It provides:
- an Ethereum JSON-RPC endpoint (`/eth`) for wallets, dApps and libraries;
- user registration, which allocates a Canton external party for an EVM address;
- a transfer API for custodial and non-custodial (external-key) users;
- SIWE login, which issues JWTs for the read endpoints;
- a Splice Registry endpoint and an admin whitelist API.
## Authentication
| Class | Endpoints | Mechanism |
|---|---|---|
| Public | `/health`, `/ready`, `/tokens`, `/eth`, `/registry/...`, `/auth/nonce`, `/.well-known/jwks.json` | None |
| Self-authenticating | `/register`, `/register/prepare-topology` | EIP-191 signature in the body (or the `X-Signature` / `X-Message` headers) |
| Signed request | Transfer writes under `/api/v2/transfer` | `X-Signature` and `X-Message` headers. The message must end with `:<unix-seconds>` and is accepted for 5 minutes |
| Bearer JWT | `/profile`, `/api/v2/transfer/{incoming,outgoing,completed}` | RS256 token from `/auth/login` |
| Admin token | `/admin/whitelist` | Static bearer token from configuration |
Some routes are mounted only when configured: `/auth/*` and the JWKS endpoint require the `auth`
block, `/admin/*` requires `admin.enabled`, and `/eth` requires `eth_rpc.enabled`. Without the `auth`
block the read endpoints are not access-controlled and identify the caller from the `address` query
parameter. See `docs/SECURITY_AND_PRIVACY_MODEL.md`.
## Errors
REST endpoints return errors as `{"error": "<message>", "code": <http status>}`. The registry
endpoint returns `{"error": "<message>"}`. JSON-RPC errors are JSON-RPC 2.0 error objects returned
with HTTP 200.
license:
name: Apache-2.0
identifier: Apache-2.0
servers:
- url: http://localhost:8081
description: Local devstack (docker-compose default)
- url: '{baseUrl}'
description: Any deployment
variables:
baseUrl:
default: https://middleware.example.com
tags:
- name: Health
description: Liveness.
- name: Tokens
description: Supported token metadata.
- name: Authentication
description: SIWE (EIP-4361) login and JWT key discovery.
- name: Registration
description: User registration and profile.
- name: Transfers
description: Custodial and non-custodial (external-key) token transfers, offers and history.
- name: Registry
description: Splice Registry transfer-factory discovery for Canton wallets.
- name: Admin
description: Registration whitelist management.
- name: JSON-RPC
description: Ethereum JSON-RPC facade.
paths:
/health:
get:
tags: [Health]
operationId: getHealth
summary: Liveness check
description: >-
Returns `OK` while the server is running. The path is configurable
(`monitoring.health_check_url`, default `/health`).
security: []
responses:
'200':
description: Server is running.
content:
text/plain:
schema:
type: string
const: OK
/ready:
get:
tags: [Health]
operationId: getReadiness
summary: Readiness check
description: >-
Ready when the database answers a ping and the Canton Ledger API answers
`GetLedgerEnd` with the configured credentials.
security: []
responses:
'200':
description: Ready.
content:
text/plain:
schema:
type: string
const: READY
'503':
description: Not ready. The body names the first failing check; the error is logged.
content:
text/plain:
schema:
type: string
example: 'NOT_READY: ledger'
/tokens:
get:
tags: [Tokens]
operationId: listTokens
summary: List supported tokens
description: >-
Returns the ERC-20 view of every token the server is configured to support, sorted by
address, with cursor pagination.
security: []
parameters:
- $ref: '#/components/parameters/Cursor'
- $ref: '#/components/parameters/CursorLimit'
responses:
'200':
description: A page of supported tokens.
content:
application/json:
schema:
$ref: '#/components/schemas/TokensPage'
example:
items:
- address: '0xDE30000000000000000000000000000000000001'
name: Demo Token
symbol: DEMO
decimals: 18
- address: '0xc1A0000000000000000000000000000000000001'
name: USD Coin
symbol: USDCx
decimals: 6
has_more: false
'400':
$ref: '#/components/responses/BadRequest'
/auth/nonce:
get:
tags: [Authentication]
operationId: getLoginNonce
summary: Issue a SIWE login nonce
description: >-
Issues a single-use nonce for the given address, to be embedded in a SIWE (EIP-4361)
message. Repeated requests for the same address return the same nonce while it is live; its lifetime
is `auth.nonce_ttl`. Mounted only when the `auth` block is configured.
security: []
parameters:
- name: address
in: query
required: true
description: EVM address that will sign the SIWE message.
schema:
$ref: '#/components/schemas/EvmAddress'
responses:
'200':
description: Nonce issued.
content:
application/json:
schema:
$ref: '#/components/schemas/NonceResponse'
'400':
$ref: '#/components/responses/BadRequest'
'500':
$ref: '#/components/responses/InternalError'
/auth/login:
post:
tags: [Authentication]
operationId: login
summary: Exchange a signed SIWE message for a JWT
description: |
Verifies a SIWE (EIP-4361) message and its EIP-191 signature and returns an RS256 JWT for the read
endpoints. The message must:
- use the configured domain, URI and chain ID (`auth.domain`, `auth.uri`, `auth.chain_id`);
- carry a live nonce from `/auth/nonce`, which is consumed on use;
- be signed by a registered address.
The token's `sub` claim is the caller's Canton party ID; it also carries `evm_address` and
`canton_party_id`. Mounted only when the `auth` block is configured.
security: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/LoginRequest'
responses:
'200':
description: Login succeeded.
content:
application/json:
schema:
$ref: '#/components/schemas/LoginResponse'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'500':
$ref: '#/components/responses/InternalError'
/.well-known/jwks.json:
get:
tags: [Authentication]
operationId: getJwks
summary: JWT signing keys
description: >-
Public keys for verifying tokens issued by `/auth/login`. Mounted only when the `auth` block
is configured.
security: []
responses:
'200':
description: JSON Web Key Set.
content:
application/json:
schema:
$ref: '#/components/schemas/Jwks'
/register:
post:
tags: [Registration]
operationId: register
summary: Register a user
description: |
Registers an EVM address and allocates a Canton external party for it. Three modes are supported:
- **Custodial (web3):** `signature` and `message` (EIP-191). The server generates and stores the
Canton key, encrypted at rest.
- **External (non-custodial):** step 2 of the two-step flow, after `/register/prepare-topology`. The
request adds `key_mode: external`, `canton_public_key`, `registration_token` and
`topology_signature`; the server never sees the private key.
- **Canton native:** `canton_party_id`, `canton_signature` and `message`, for an existing Canton
party (for example a Loop wallet).
For the web3 modes, `signature` and `message` may be sent in the `X-Signature` and `X-Message`
headers instead of the body. The address must be on the registration whitelist.
security:
- {}
- EIP191Signature: []
EIP191Message: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/RegisterRequest'
examples:
custodial:
summary: Custodial (web3) registration
value:
signature: '0xa1b2c3d4a1b2c3d4a1b2c3d4a1b2c3d4a1b2c3d4a1b2c3d4a1b2c3d4a1b2c3d4a1b2c3d4a1b2c3d4a1b2c3d4a1b2c3d4a1b2c3d4a1b2c3d4a1b2c3d4a1b2c3d41b'
message: Register for Canton EVM Middleware
external:
summary: External-key registration, step 2
value:
signature: '0xa1b2c3d4a1b2c3d4a1b2c3d4a1b2c3d4a1b2c3d4a1b2c3d4a1b2c3d4a1b2c3d4a1b2c3d4a1b2c3d4a1b2c3d4a1b2c3d4a1b2c3d4a1b2c3d4a1b2c3d4a1b2c3d41b'
message: Register for Canton EVM Middleware
key_mode: external
canton_public_key: '024f3c2b1a4f3c2b1a4f3c2b1a4f3c2b1a4f3c2b1a4f3c2b1a4f3c2b1a4f3c2b1a'
registration_token: 6b1f0c1e-3c0a-4d0e-9f0a-2d6f3c9b8e7a
topology_signature: '30450221008a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a8a02203b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b3b'
responses:
'200':
description: Registered.
content:
application/json:
schema:
$ref: '#/components/schemas/RegisterResponse'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'409':
$ref: '#/components/responses/Conflict'
'500':
$ref: '#/components/responses/InternalError'
'502':
$ref: '#/components/responses/BadGateway'
/register/prepare-topology:
post:
tags: [Registration]
operationId: prepareTopology
summary: Prepare external-party registration (step 1)
description: >-
Generates the Canton external-party topology for the supplied public key. Sign
`topology_hash` with the corresponding private key and submit it to `/register` with
`key_mode: external` and the returned `registration_token`. Requires an EIP-191 signature from a
whitelisted address.
security:
- {}
- EIP191Signature: []
EIP191Message: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PrepareTopologyRequest'
responses:
'200':
description: Topology prepared.
content:
application/json:
schema:
$ref: '#/components/schemas/PrepareTopologyResponse'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'409':
$ref: '#/components/responses/Conflict'
'502':
$ref: '#/components/responses/BadGateway'
/profile:
get:
tags: [Registration]
operationId: getProfile
summary: Get the caller's profile
description: >-
With read authentication enabled, the caller is the token's identity, and an `address`
that does not match it is rejected with 403. With authentication disabled, `address` is required.
security:
- SiweJwt: []
- {}
parameters:
- $ref: '#/components/parameters/CallerAddress'
responses:
'200':
description: The caller's registration.
content:
application/json:
schema:
$ref: '#/components/schemas/Profile'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
/api/v2/transfer/prepare:
post:
tags: [Transfers]
operationId: prepareTransfer
summary: Prepare a non-custodial transfer
description: |
Builds a transfer for an external-key user and returns the prepared transaction hash to sign. The
recipient is either a registered user's EVM address (`to`) or any Canton party (`to_party_id`); set
exactly one. Tokens that settle through offers create an offer valid for `validity_seconds`.
Sign `transaction_hash` with the user's registered key: ECDSA secp256k1 over SHA-256 of the hash
bytes, DER-encoded and hex-encoded. Then call `/api/v2/transfer/execute` before `expires_at`.
Custodial users receive 400.
security:
- EIP191Signature: []
EIP191Message: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PrepareTransferRequest'
example:
to: '0x2222222222222222222222222222222222222222'
amount: '10.5'
token: DEMO
validity_seconds: 3600
responses:
'200':
description: Transfer prepared.
content:
application/json:
schema:
$ref: '#/components/schemas/PrepareResponse'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'502':
$ref: '#/components/responses/BadGateway'
/api/v2/transfer/execute:
post:
tags: [Transfers]
operationId: executeTransfer
summary: Execute a prepared transfer
description: >-
Submits a prepared transfer with the client's signature. `signed_by` must be the
fingerprint of the key registered for the caller.
security:
- EIP191Signature: []
EIP191Message: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ExecuteRequest'
responses:
'200':
description: Transfer completed.
content:
application/json:
schema:
$ref: '#/components/schemas/ExecuteResponse'
example:
status: completed
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/Conflict'
'502':
$ref: '#/components/responses/BadGateway'
/api/v2/transfer/custodial:
post:
tags: [Transfers]
operationId: sendCustodialTransfer
summary: Send a custodial transfer to a Canton party
description: >-
Single-call transfer for custodial users to any Canton party. The server signs with the
user's custodial key. External-key users receive 400.
security:
- EIP191Signature: []
EIP191Message: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/CustodialTransferRequest'
responses:
'200':
description: Transfer submitted.
content:
application/json:
schema:
$ref: '#/components/schemas/ExecuteResponse'
example:
status: submitted
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'409':
$ref: '#/components/responses/Conflict'
'502':
$ref: '#/components/responses/BadGateway'
/api/v2/transfer/incoming:
get:
tags: [Transfers]
operationId: listIncomingTransfers
summary: List pending incoming offers
description: Offers sent to the caller that are waiting for acceptance.
security:
- SiweJwt: []
- {}
parameters:
- $ref: '#/components/parameters/CallerAddress'
- $ref: '#/components/parameters/Page'
- $ref: '#/components/parameters/PageLimit'
responses:
'200':
description: A page of incoming offers.
content:
application/json:
schema:
$ref: '#/components/schemas/IncomingTransfersList'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'502':
$ref: '#/components/responses/BadGateway'
/api/v2/transfer/outgoing:
get:
tags: [Transfers]
operationId: listOutgoingTransfers
summary: List outgoing offers
description: Offers the caller sent, optionally filtered by status.
security:
- SiweJwt: []
- {}
parameters:
- $ref: '#/components/parameters/CallerAddress'
- name: status
in: query
required: false
description: Status filter. `accepted` is an alias for `completed`.
schema:
type: string
enum: [all, pending, expired, completed, accepted, canceled, rejected]
default: all
- $ref: '#/components/parameters/Page'
- $ref: '#/components/parameters/PageLimit'
responses:
'200':
description: A page of outgoing offers.
content:
application/json:
schema:
$ref: '#/components/schemas/OutgoingTransfersList'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'502':
$ref: '#/components/responses/BadGateway'
/api/v2/transfer/completed:
get:
tags: [Transfers]
operationId: listCompletedTransfers
summary: List completed transfers
description: The caller's settled transfers across all tokens, both direct and offer-based.
security:
- SiweJwt: []
- {}
parameters:
- $ref: '#/components/parameters/CallerAddress'
- $ref: '#/components/parameters/Page'
- $ref: '#/components/parameters/PageLimit'
responses:
'200':
description: A page of completed transfers.
content:
application/json:
schema:
$ref: '#/components/schemas/CompletedTransfersList'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'502':
$ref: '#/components/responses/BadGateway'
/api/v2/transfer/incoming/{contractID}/prepare:
post:
tags: [Transfers]
operationId: prepareAcceptOffer
summary: Prepare accepting an incoming offer
description: >-
For external-key receivers. Returns the hash to sign; complete with
`/api/v2/transfer/incoming/{contractID}/execute`. Custodial receivers' offers are accepted
automatically.
security:
- EIP191Signature: []
EIP191Message: []
parameters:
- $ref: '#/components/parameters/ContractID'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/PrepareAcceptRequest'
responses:
'200':
description: Accept prepared.
content:
application/json:
schema:
$ref: '#/components/schemas/PrepareResponse'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'502':
$ref: '#/components/responses/BadGateway'
/api/v2/transfer/incoming/{contractID}/execute:
post:
tags: [Transfers]
operationId: executeAcceptOffer
summary: Execute accepting an incoming offer
description: Submits a prepared accept. The prepared transaction is identified by `transfer_id`.
security:
- EIP191Signature: []
EIP191Message: []
parameters:
- $ref: '#/components/parameters/ContractID'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ExecuteRequest'
responses:
'200':
description: Offer accepted.
content:
application/json:
schema:
$ref: '#/components/schemas/ExecuteResponse'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/Conflict'
'502':
$ref: '#/components/responses/BadGateway'
/api/v2/transfer/outgoing/{contractID}/withdraw/prepare:
post:
tags: [Transfers]
operationId: prepareWithdrawOffer
summary: Prepare claiming back an outgoing offer
description: >-
For external-key senders. Reclaims a pending or expired offer the caller sent. Returns the
hash to sign; complete with `/api/v2/transfer/outgoing/{contractID}/withdraw/execute`.
security:
- EIP191Signature: []
EIP191Message: []
parameters:
- $ref: '#/components/parameters/ContractID'
responses:
'200':
description: Withdraw prepared.
content:
application/json:
schema:
$ref: '#/components/schemas/PrepareResponse'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/Conflict'
'502':
$ref: '#/components/responses/BadGateway'
/api/v2/transfer/outgoing/{contractID}/withdraw/execute:
post:
tags: [Transfers]
operationId: executeWithdrawOffer
summary: Execute claiming back an outgoing offer
description: Submits a prepared withdraw. The prepared transaction is identified by `transfer_id`.
security:
- EIP191Signature: []
EIP191Message: []
parameters:
- $ref: '#/components/parameters/ContractID'
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/ExecuteRequest'
responses:
'200':
description: Offer claimed back.
content:
application/json:
schema:
$ref: '#/components/schemas/ExecuteResponse'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/Conflict'
'502':
$ref: '#/components/responses/BadGateway'
/api/v2/transfer/outgoing/{contractID}/withdraw/custodial:
post:
tags: [Transfers]
operationId: withdrawOfferCustodial
summary: Claim back an outgoing offer (custodial)
description: >-
Single-call claim-back of a pending or expired offer for custodial senders, signed by the
server.
security:
- EIP191Signature: []
EIP191Message: []
parameters:
- $ref: '#/components/parameters/ContractID'
responses:
'200':
description: Claim-back submitted.
content:
application/json:
schema:
$ref: '#/components/schemas/ExecuteResponse'
example:
status: submitted
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'403':
$ref: '#/components/responses/Forbidden'
'404':
$ref: '#/components/responses/NotFound'
'409':
$ref: '#/components/responses/Conflict'
'502':
$ref: '#/components/responses/BadGateway'
/registry/transfer-instruction/v1/transfer-factory:
post:
tags: [Registry]
operationId: getTransferFactory
summary: Discover the active TransferFactory
description: >-
Returns the active CIP-56 `TransferFactory` contract and its created-event blob for
explicit disclosure. The request body is ignored. The response uses a middleware-specific shape
rather than the Splice `TransferFactoryWithChoiceContext` schema. Methods other than POST return 405.
security: []
requestBody:
required: false
content:
application/json:
schema:
type: object
responses:
'200':
description: Active TransferFactory.
content:
application/json:
schema:
$ref: '#/components/schemas/TransferFactoryResponse'
'404':
description: No active TransferFactory contract.
content:
application/json:
schema:
$ref: '#/components/schemas/RegistryError'
'405':
description: Method not allowed.
content:
application/json:
schema:
$ref: '#/components/schemas/RegistryError'
'500':
description: Lookup failed.
content:
application/json:
schema:
$ref: '#/components/schemas/RegistryError'
/admin/whitelist:
post:
tags: [Admin]
operationId: addWhitelistEntry
summary: Whitelist an address
description: >-
Adds an address to the registration whitelist, or updates its note. Idempotent. Mounted
only when `admin.enabled` is set.
security:
- AdminToken: []
requestBody:
required: true
content:
application/json:
schema:
$ref: '#/components/schemas/WhitelistAddRequest'
responses:
'200':
description: Address whitelisted.
content:
application/json:
schema:
$ref: '#/components/schemas/StatusResponse'
example:
status: whitelisted
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
get:
tags: [Admin]
operationId: listWhitelist
summary: List whitelisted addresses
security:
- AdminToken: []
parameters:
- $ref: '#/components/parameters/Cursor'
- $ref: '#/components/parameters/CursorLimit'
responses:
'200':
description: A page of whitelist entries.
content:
application/json:
schema:
$ref: '#/components/schemas/WhitelistPage'
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
/admin/whitelist/{address}:
delete:
tags: [Admin]
operationId: removeWhitelistEntry
summary: Remove a whitelisted address
security:
- AdminToken: []
parameters:
- name: address
in: path
required: true
schema:
$ref: '#/components/schemas/EvmAddress'
responses:
'200':
description: Address removed.
content:
application/json:
schema:
$ref: '#/components/schemas/StatusResponse'
example:
status: removed
'400':
$ref: '#/components/responses/BadRequest'
'401':
$ref: '#/components/responses/Unauthorized'
'404':
$ref: '#/components/responses/NotFound'
/eth:
post:
tags: [JSON-RPC]
operationId: ethJsonRpc
summary: Ethereum JSON-RPC
description: |
Ethereum JSON-RPC 2.0, single or batch, served by go-ethereum's RPC server. Responses are always HTTP
200; failures are JSON-RPC error objects. Mounted only when `eth_rpc.enabled` is set.
| Method | Params | Result |
|---|---|---|
| `eth_chainId` | none | Chain ID |
| `eth_blockNumber` | none | Latest facade block number |
| `eth_gasPrice` | none | `0x0` |
| `eth_maxPriorityFeePerGas` | none | Priority fee |
| `eth_estimateGas` | call object, block (optional) | Gas estimate |
| `eth_getBalance` | address, block | Native balance, which is zero; token balances use `eth_call` |
| `eth_getTransactionCount` | address, block | Next nonce for the address |
| `eth_getCode` | address, block | Non-empty code for supported token addresses, otherwise `0x` |
| `eth_syncing` | none | `false` |
| `eth_call` | call object, block | ERC-20 read result |
| `eth_sendRawTransaction` | signed transaction | Transaction hash |
| `eth_getTransactionReceipt` | transaction hash | Receipt or `null` |
| `eth_getTransactionByHash` | transaction hash | Transaction or `null` |
| `eth_getLogs` | filter | Logs |
| `eth_getBlockByNumber` | block, full transactions | Block |
| `eth_getBlockByHash` | block hash, full transactions | Block |
| `net_version` | none | Chain ID as a decimal string |
| `net_listening` | none | `true` |
| `net_peerCount` | none | `0x0` |
| `web3_clientVersion` | none | `canton-middleware/<release tag>-<commit sha>` (`dev` for local builds) |
| `web3_sha3` | data | Keccak-256 of the data |
| `rpc_modules` | none | Enabled modules |
**ERC-20 reads (`eth_call`).** Supported on configured token addresses:
- `balanceOf(address)` (`0x70a08231`)
- `totalSupply()` (`0x18160ddd`)
- `decimals()` (`0x313ce567`)
- `symbol()` (`0x95d89b41`)
- `name()` (`0x06fdde03`)
- `allowance(address,address)` (`0xdd62ed3e`), which always returns zero
Other selectors return an error, and unknown token addresses return `-32602`. Balances and supply are
read from the indexer or the ledger, depending on `token_provider.mode`.
**Transfers (`eth_sendRawTransaction`).** The facade accepts only `transfer(address,uint256)`
(`0xa9059cbb`) to a configured token address, signed by a whitelisted, registered sender; the sender
is recovered from the signature.
- The call returns the hash immediately and the transfer executes on Canton asynchronously.
- Poll `eth_getTransactionReceipt` for the result.
- A failed transfer is mined with status `0x0`, and its receipt carries `revertReason`.
- A successful transfer's receipt carries `cantonUpdateId`, the Canton update that settled it.
It is omitted for transfers made before the field was introduced.
- `approve` and `transferFrom` are not supported.
**Block selectors.** They accept `latest`, `earliest`, `pending`, a hex number or a block hash,
except in `eth_getLogs`.
**Known limitations.**
- `eth_getLogs` needs hex `fromBlock` and `toBlock` (no tags), a single `address`, and exact-match
topics.
- Blocks returned by `eth_getBlockBy*` are synthetic: they have empty transaction lists, empty-list
roots and a timestamp of block number × 12 seconds. Receipts and logs carry the real block and time.
security: []
requestBody:
required: true
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/JsonRpcRequest'
- type: array
minItems: 1
items:
$ref: '#/components/schemas/JsonRpcRequest'
examples:
chainId:
summary: eth_chainId
value:
jsonrpc: '2.0'
id: 1
method: eth_chainId
params: []
balanceOf:
summary: ERC-20 balanceOf through eth_call
value:
jsonrpc: '2.0'
id: 2
method: eth_call
params:
- to: '0xDE30000000000000000000000000000000000001'
data: '0x70a082310000000000000000000000001111111111111111111111111111111111111111'
- latest
sendRawTransaction:
summary: ERC-20 transfer
value:
jsonrpc: '2.0'
id: 3
method: eth_sendRawTransaction
params:
- 0x02f8b0...
getLogs:
summary: Transfer logs for a token
value:
jsonrpc: '2.0'
id: 4
method: eth_getLogs
params:
- fromBlock: '0x0'
toBlock: '0x20'
address: '0xc1A0000000000000000000000000000000000001'
responses:
'200':
description: JSON-RPC response (or array of responses for a batch).
content:
application/json:
schema:
oneOf:
- $ref: '#/components/schemas/JsonRpcResponse'
- type: array
items:
$ref: '#/components/schemas/JsonRpcResponse'
examples:
chainId:
summary: eth_chainId result
value:
jsonrpc: '2.0'
id: 1
result: '0x7a69'
unsupportedToken:
summary: Unknown token address
value:
jsonrpc: '2.0'
id: 2
error:
code: -32602
message: 'token not supported: 0x9000000000000000000000000000000000000001'
options:
tags: [JSON-RPC]
operationId: ethJsonRpcPreflight
summary: CORS preflight
security: []
responses:
'200':
description: Preflight accepted.
components: