@cancore/contracts 0.2.0-rc.3 → 0.2.0-rc.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  {
2
- "$comment": "EIP-712 schema of FillProof — the struct CancoreRouter.settle verifies attestor signatures over — and its golden vectors. The contract is the source of truth: test/CancoreRouter.ts checks this file against FILLPROOF_TYPEHASH and hashFillProof. @cancore/contracts mirrors it (sdk: npm run sync) and checks the same vectors with its own encoder. Change the struct here and this repository's test fails at once; the SDK's fails once its `npm run sync` pulls the change (nothing checks the two repositories against each other automatically).",
2
+ "$comment": "EIP-712 schema of the variant A FillProof (twelve fields, CAN-2139; protocol.md §3.3) — the struct attestors sign, CancoreRouter.settle verifies (paying repayTo) and Daml Intent.FillProofVerify verifies on a Canton source — and its golden vectors. Written in @cancore/contracts ahead of the router: CAN-2140 copies this file byte for byte to evm-contracts abi/typed-data/FillProof.json, where test/CancoreRouter.ts checks every vector against FILLPROOF_TYPEHASH and hashFillProof; from then on evm-contracts is the source again and `npm run sync` brings it here. canton-contracts takes the Canton-source vector (typeHash, domainSeparator, structHash, digest) into intent-test AttestationVectors (CAN-2144). Digests by ethers TypedDataEncoder; this package checks them with an encoder of its own.",
3
3
  "primaryType": "FillProof",
4
4
  "domain": {
5
5
  "$comment": "The SOURCE router of the order: settle recomputes the digest in its own domain, so a proof never verifies on another chain or router.",
@@ -12,7 +12,8 @@
12
12
  "verifyingContract"
13
13
  ]
14
14
  },
15
- "typeString": "FillProof(uint8 kind,bytes32 orderHash,bytes32 destination,bytes32 fillRef,bytes32 recipient,bytes32 outputAsset,uint256 amountDelivered,uint64 filledAt,address filler,uint32 attempt,uint32 setId)",
15
+ "typeString": "FillProof(uint8 kind,bytes32 orderHash,bytes32 destination,bytes32 fillRef,bytes32 recipient,bytes32 outputAsset,uint256 amountDelivered,uint64 filledAt,bytes32 fillerId,bytes32 repayTo,uint32 attempt,uint32 setId)",
16
+ "typeHash": "0xc37e18cdd22fbc1e707c1bcc554d9d29c2e6c5a44bb4a9a4dc38e2c28e2419ae",
16
17
  "types": {
17
18
  "FillProof": [
18
19
  {
@@ -48,8 +49,12 @@
48
49
  "type": "uint64"
49
50
  },
50
51
  {
51
- "name": "filler",
52
- "type": "address"
52
+ "name": "fillerId",
53
+ "type": "bytes32"
54
+ },
55
+ {
56
+ "name": "repayTo",
57
+ "type": "bytes32"
53
58
  },
54
59
  {
55
60
  "name": "attempt",
@@ -63,7 +68,7 @@
63
68
  },
64
69
  "vectors": [
65
70
  {
66
- "note": "baseline",
71
+ "note": "baseline: EVM source and destination, fillerId keccak256(\"acme\"), repayTo a padded EVM address",
67
72
  "chainId": 31337,
68
73
  "verifyingContract": "0x00000000000000000000000000000000caFe0001",
69
74
  "message": {
@@ -75,33 +80,39 @@
75
80
  "outputAsset": "0x0000000000000000000000004444444444444444444444444444444444444444",
76
81
  "amountDelivered": "95000000000000000000",
77
82
  "filledAt": "1790000000",
78
- "filler": "0x5555555555555555555555555555555555555555",
83
+ "fillerId": "0xe29dae06ef4c3e336b7538b6d4f52ca1ecec009b1df6fb501320e11b223aeeaf",
84
+ "repayTo": "0x0000000000000000000000005555555555555555555555555555555555555555",
79
85
  "attempt": 1,
80
86
  "setId": 1
81
87
  },
82
- "digest": "0x60710cde56b0ce205921f022e5bbeb6f3e9c016810f9597d5f5d4cd8388de68f"
88
+ "domainSeparator": "0x503f410fe6d9a92cb96e0a70062885290f68a1f72fb40330678e25b874731300",
89
+ "structHash": "0x800e6b4a1224dad7ca66111790954bd1f8eeb719f634932412949ab7534de529",
90
+ "digest": "0xb8567a7df02431d496c14b998f686c050d86c7552939aa67f66612d3602f4b6c"
83
91
  },
84
92
  {
85
- "note": "every integer at its maximum: no field is narrower than the contract says",
93
+ "note": "every integer at its maximum, every word all ones: no field is narrower than the contract says",
86
94
  "chainId": 31337,
87
95
  "verifyingContract": "0x00000000000000000000000000000000caFe0001",
88
96
  "message": {
89
97
  "kind": 255,
90
- "orderHash": "0x1111111111111111111111111111111111111111111111111111111111111111",
91
- "destination": "0x0000000000000000000000000000000000000000000000000000000000aa36a7",
92
- "fillRef": "0x2222222222222222222222222222222222222222222222222222222222222222",
93
- "recipient": "0x0000000000000000000000003333333333333333333333333333333333333333",
94
- "outputAsset": "0x0000000000000000000000004444444444444444444444444444444444444444",
98
+ "orderHash": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
99
+ "destination": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
100
+ "fillRef": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
101
+ "recipient": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
102
+ "outputAsset": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
95
103
  "amountDelivered": "115792089237316195423570985008687907853269984665640564039457584007913129639935",
96
104
  "filledAt": "18446744073709551615",
97
- "filler": "0x5555555555555555555555555555555555555555",
105
+ "fillerId": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
106
+ "repayTo": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
98
107
  "attempt": 4294967295,
99
108
  "setId": 4294967295
100
109
  },
101
- "digest": "0x01ce524359fa8b9b4cc736fc5da949f435071a25c07dd3af691318272c968379"
110
+ "domainSeparator": "0x503f410fe6d9a92cb96e0a70062885290f68a1f72fb40330678e25b874731300",
111
+ "structHash": "0x6d4f2ee32e02ff5cb479dbd8f18fd1306b89a2513db6cfa3da06c69992c96a3f",
112
+ "digest": "0x5850aac6189524d1b34d16b467bce6a3a5f6681255cb4abe83a28147d534fcdb"
102
113
  },
103
114
  {
104
- "note": "zero words and the zero address",
115
+ "note": "zero words",
105
116
  "chainId": 31337,
106
117
  "verifyingContract": "0x00000000000000000000000000000000caFe0001",
107
118
  "message": {
@@ -113,11 +124,14 @@
113
124
  "outputAsset": "0x0000000000000000000000000000000000000000000000000000000000000000",
114
125
  "amountDelivered": "0",
115
126
  "filledAt": "0",
116
- "filler": "0x0000000000000000000000000000000000000000",
127
+ "fillerId": "0x0000000000000000000000000000000000000000000000000000000000000000",
128
+ "repayTo": "0x0000000000000000000000000000000000000000000000000000000000000000",
117
129
  "attempt": 0,
118
130
  "setId": 0
119
131
  },
120
- "digest": "0x149dddd5a7f61b04d9bd11113d684e20464ae92b4c05d13ec039b157224ab723"
132
+ "domainSeparator": "0x503f410fe6d9a92cb96e0a70062885290f68a1f72fb40330678e25b874731300",
133
+ "structHash": "0x51713b6c288966f3e995793ff65a3cec60bfbc51c240bd2aa50ade3da1c284d0",
134
+ "digest": "0x5d5d4907e300a8d705d3d61c23c0b7bf0d34039c85e6e4eadc601fe3fe60e439"
121
135
  },
122
136
  {
123
137
  "note": "same proof, another router: the digest is bound to verifyingContract",
@@ -132,33 +146,39 @@
132
146
  "outputAsset": "0x0000000000000000000000004444444444444444444444444444444444444444",
133
147
  "amountDelivered": "95000000000000000000",
134
148
  "filledAt": "1790000000",
135
- "filler": "0x5555555555555555555555555555555555555555",
149
+ "fillerId": "0xe29dae06ef4c3e336b7538b6d4f52ca1ecec009b1df6fb501320e11b223aeeaf",
150
+ "repayTo": "0x0000000000000000000000005555555555555555555555555555555555555555",
136
151
  "attempt": 1,
137
152
  "setId": 1
138
153
  },
139
- "digest": "0x3c8add09c5e2c9fcdf3329f25bcfd8f2aa5f19ada2647d310df4dd6c2062021c"
154
+ "domainSeparator": "0x282a771d1c663bbda15fa1376f122d013f85569d94bdfa5c681ca6215c7db6b8",
155
+ "structHash": "0x800e6b4a1224dad7ca66111790954bd1f8eeb719f634932412949ab7534de529",
156
+ "digest": "0xce35f3f8838fad5b41bc9ab963682a6965334abf7340ea4618958b0ac26f6712"
140
157
  },
141
158
  {
142
- "note": "a Canton destination and a later attempt under set 2",
159
+ "note": "Canton destination (protocol.md §3.13): destination keccak256(\"canton:mainnet\"), recipient keccak256(party), outputAsset keccak256(abi.encode(\"cancore:instrument:v1\", admin, id)), amount Numeric 10 × 10^10 (1200.25); a later attempt under set 2. The encoder itself is CAN-1935",
143
160
  "chainId": 31337,
144
161
  "verifyingContract": "0x00000000000000000000000000000000caFe0001",
145
162
  "message": {
146
163
  "kind": 1,
147
164
  "orderHash": "0x1111111111111111111111111111111111111111111111111111111111111111",
148
- "destination": "0x0000000000000000000000000000000000000000000000008000000000000003",
165
+ "destination": "0x8d6e3eea79c707a9549bdb1206260cd46ef29e86763e19a8a3f494bc6b499440",
149
166
  "fillRef": "0x2222222222222222222222222222222222222222222222222222222222222222",
150
- "recipient": "0x0000000000000000000000003333333333333333333333333333333333333333",
151
- "outputAsset": "0x0000000000000000000000004444444444444444444444444444444444444444",
152
- "amountDelivered": "95000000000000000000",
167
+ "recipient": "0x8330f18e4203206b15fc33cb80a36595317e2638ec444305e71b9502faa9e628",
168
+ "outputAsset": "0x034bad92a7c82fb0e37b03e7795ae88257786ea0e2cfe2c43b88b420993dc98f",
169
+ "amountDelivered": "12002500000000",
153
170
  "filledAt": "1790000000",
154
- "filler": "0x5555555555555555555555555555555555555555",
171
+ "fillerId": "0x112e2693409c427698100f54d0439fc3593fedb25221fe3a54c4823c0a0ee2d5",
172
+ "repayTo": "0x0000000000000000000000003c44cdddb6a900fa2b585dd299e03d12fa4293bc",
155
173
  "attempt": 3,
156
174
  "setId": 2
157
175
  },
158
- "digest": "0x7c2d541d8b5cb9cea85e2a509b5135cae5b8b23b000a7530e030d3663e8096a5"
176
+ "domainSeparator": "0x503f410fe6d9a92cb96e0a70062885290f68a1f72fb40330678e25b874731300",
177
+ "structHash": "0x3c76a53bbcb8fe01a0902d30794bcabf6948476a85f7be9fc9c178e74af5d272",
178
+ "digest": "0xdebb837668be49db1a9a6a4b0aeb69839b92ce0095dc5016a3b0d541aad346ba"
159
179
  },
160
180
  {
161
- "note": "computed by CancoreRouter.hashFillProof on the local stand (CAN-1776): same proof, chain id 11155111",
181
+ "note": "same proof, another chain (11155111) and router",
162
182
  "chainId": 11155111,
163
183
  "verifyingContract": "0xa5Ca448044cbF78a8b2a3853598b879e2722ce65",
164
184
  "message": {
@@ -170,14 +190,19 @@
170
190
  "outputAsset": "0x0000000000000000000000004444444444444444444444444444444444444444",
171
191
  "amountDelivered": "95000000000000000000",
172
192
  "filledAt": "1790000000",
173
- "filler": "0x5555555555555555555555555555555555555555",
193
+ "fillerId": "0xe29dae06ef4c3e336b7538b6d4f52ca1ecec009b1df6fb501320e11b223aeeaf",
194
+ "repayTo": "0x0000000000000000000000005555555555555555555555555555555555555555",
174
195
  "attempt": 1,
175
196
  "setId": 1
176
197
  },
177
- "digest": "0xdde67a41f980bd1d31af88addcbbd5a08e095816d7acc2fd9323e5dce7d28410"
198
+ "domainSeparator": "0x311d9cdf77fccd430656cbd12f0da889d7c14ab9832dec4dcf90f76557a4e9bf",
199
+ "structHash": "0x800e6b4a1224dad7ca66111790954bd1f8eeb719f634932412949ab7534de529",
200
+ "digest": "0x81c3633199fbeed50c8d6aa235b1fdd5e0fa98d21caf70dc331d47936faced4b"
178
201
  },
179
202
  {
180
- "note": "Canton source (CAN-2061): the delivery of test/vectors/canton-order.json's order, in the domain Daml settles in — chainId CANTON_ORIGIN_ID = 2^63 + 1 (a string: it does not survive a JSON number), verifyingContract CANTON_SOURCE_ANCHOR. Both are the test vector's, not a per-network deployment. The digest is canton-contracts intent-test/daml/Intent/Test/AttestationVectors.daml vDigestExpected (fillProofDigest cantonMainnet (goldenProofOff 0)); no router computes it",
203
+ "note": "Canton source: the delivery of spec/vectors/canton-order.json's order, in the domain Daml settles in — chainId CANTON_ORIGIN_ID = 2^63 + 1 (a string: it does not survive a JSON number), verifyingContract CANTON_SOURCE_ANCHOR; repayTo = keccak256(utf8(partyId)) of the filler party (repayToParty), fillerId keccak256(\"acme-markets\"). Daml FillProofVerify must reproduce typeHash, domainSeparator, structHash and digest",
204
+ "fillerIdString": "acme-markets",
205
+ "repayToParty": "acme-markets::1220acdeacdeacdeacdeacdeacdeacdeacdeacdeacdeacdeacdeacdeacdeacdeacde",
181
206
  "chainId": "9223372036854775809",
182
207
  "verifyingContract": "0x2f37b46Ea93001829498b145985fb53028033701",
183
208
  "message": {
@@ -189,11 +214,14 @@
189
214
  "outputAsset": "0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
190
215
  "amountDelivered": "1246760000",
191
216
  "filledAt": "1789999700",
192
- "filler": "0x5b38da6a701c568545dcfcb03fcb875f56beddc4",
217
+ "fillerId": "0x112e2693409c427698100f54d0439fc3593fedb25221fe3a54c4823c0a0ee2d5",
218
+ "repayTo": "0xe61d35ec4ca48f587165d3138bd11c79b42e52f6de0cec4b9e2d4350017f1e87",
193
219
  "attempt": 1,
194
220
  "setId": 1
195
221
  },
196
- "digest": "0x4f6622ad6a74c4e5e173e9baaa2bfb2b4f32c1ff2e160076df172d4ef557b660"
222
+ "domainSeparator": "0x1f754285aeeb7c329e1107ea7f22092765deea7fd0db2c98bce7e0bda644ec16",
223
+ "structHash": "0xde3d93c38518796a0d639e855b5a875eeccd7e2dc9417b28d4b7c36d04d9f58d",
224
+ "digest": "0xfdc7e00e2d79fb63ee6bcb3c46dbe531ee0c40eaa0a670c371902a862615df80"
197
225
  }
198
226
  ]
199
227
  }
@@ -1,5 +1,5 @@
1
1
  {
2
- "$comment": "PROVISIONAL hand copy of the CancoreRouter.sol struct (evm-contracts f936594) until evm-contracts publishes abi/typed-data for it with its own vectors (follow-up F-1); digests by ethers TypedDataEncoder, checked in this package by the shipped encoder as well.",
2
+ "$comment": "Variant A FillTicket (CAN-2139; protocol.md §3.3): seven fields, written here ahead of CancoreRouter.sol, which takes the same string before its first deployment and pins these vectors with hashTicket (CAN-2140). fillerId = keccak256(utf8(fillerId)); repayTo encoded for the source chain (§3.15). Digests by ethers TypedDataEncoder, checked in this package by the shipped encoder as well.",
3
3
  "primaryType": "FillTicket",
4
4
  "domain": {
5
5
  "name": "CancoreFillTicket",
@@ -9,7 +9,7 @@
9
9
  "version"
10
10
  ]
11
11
  },
12
- "typeString": "FillTicket(bytes32 orderHash,address filler,uint32 attempt,uint64 validFrom,uint64 validUntil)",
12
+ "typeString": "FillTicket(bytes32 orderHash,bytes32 fillerId,address deliveryKey,bytes32 repayTo,uint32 attempt,uint64 validFrom,uint64 validUntil)",
13
13
  "types": {
14
14
  "FillTicket": [
15
15
  {
@@ -17,9 +17,17 @@
17
17
  "type": "bytes32"
18
18
  },
19
19
  {
20
- "name": "filler",
20
+ "name": "fillerId",
21
+ "type": "bytes32"
22
+ },
23
+ {
24
+ "name": "deliveryKey",
21
25
  "type": "address"
22
26
  },
27
+ {
28
+ "name": "repayTo",
29
+ "type": "bytes32"
30
+ },
23
31
  {
24
32
  "name": "attempt",
25
33
  "type": "uint32"
@@ -36,48 +44,72 @@
36
44
  },
37
45
  "vectors": [
38
46
  {
39
- "note": "protocol.md §3.3 hashTicket example: a fixed bytes32 orderHash input (the pre-CAN-1683 golden value)",
47
+ "note": "protocol.md §3.3 hashTicket example: a fixed bytes32 orderHash input, fillerId keccak256(\"acme\"), repayTo the padded delivery key",
40
48
  "message": {
41
49
  "orderHash": "0xe61e980d40d1a666a509d2296c0d2658a40ff681e290c7646a75a550629ce1ad",
42
- "filler": "0x742d35cc6634c0532925a3b844bc454e4438f44e",
50
+ "fillerId": "0xe29dae06ef4c3e336b7538b6d4f52ca1ecec009b1df6fb501320e11b223aeeaf",
51
+ "deliveryKey": "0x742d35cc6634c0532925a3b844bc454e4438f44e",
52
+ "repayTo": "0x000000000000000000000000742d35cc6634c0532925a3b844bc454e4438f44e",
43
53
  "attempt": 0,
44
54
  "validFrom": "1789999000",
45
55
  "validUntil": "1789999180"
46
56
  },
47
- "digest": "0x80a86c8877ddb8c8ff1924b52311c1f2a7000b8d3ee3e69ed4314b2d38cab2c1"
57
+ "digest": "0xb751ce266445dfc74d2a1e7ec2b23f51bf36ccc97706f6d0d73e4be74f9d5c33"
48
58
  },
49
59
  {
50
- "note": "ticket for the test-kit fixture order, attempt 0",
60
+ "note": "ticket for the test-kit fixture order, attempt 0: EVM source, repayTo another address than the delivery key",
61
+ "fillerIdString": "acme-markets",
51
62
  "message": {
52
63
  "orderHash": "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
53
- "filler": "0x742d35cc6634c0532925a3b844bc454e4438f44e",
64
+ "fillerId": "0x112e2693409c427698100f54d0439fc3593fedb25221fe3a54c4823c0a0ee2d5",
65
+ "deliveryKey": "0x742d35cc6634c0532925a3b844bc454e4438f44e",
66
+ "repayTo": "0x0000000000000000000000003c44cdddb6a900fa2b585dd299e03d12fa4293bc",
54
67
  "attempt": 0,
55
68
  "validFrom": "1790000040",
56
69
  "validUntil": "1790000400"
57
70
  },
58
- "digest": "0x466bc75e5efad07ad975aeea9ec731902bc804461686a6c8f76ef4fd50297819"
71
+ "digest": "0x8eaef6b8d59e72288487b0def58e0eb9200fa7600170351af985111eaec5a0a9"
72
+ },
73
+ {
74
+ "note": "Canton source (canton-order.json): repayTo = keccak256(utf8(partyId)) of the filler party",
75
+ "fillerIdString": "acme-markets",
76
+ "repayToParty": "acme-markets::1220acdeacdeacdeacdeacdeacdeacdeacdeacdeacdeacdeacdeacdeacdeacdeacde",
77
+ "message": {
78
+ "orderHash": "0x770f1ebba8ab5b96e3efbed39c0f630d56f934f9f232771abaccdb0cf17ca204",
79
+ "fillerId": "0x112e2693409c427698100f54d0439fc3593fedb25221fe3a54c4823c0a0ee2d5",
80
+ "deliveryKey": "0x742d35cc6634c0532925a3b844bc454e4438f44e",
81
+ "repayTo": "0xe61d35ec4ca48f587165d3138bd11c79b42e52f6de0cec4b9e2d4350017f1e87",
82
+ "attempt": 1,
83
+ "validFrom": "1789999500",
84
+ "validUntil": "1789999800"
85
+ },
86
+ "digest": "0xbbec903b320790bbe11b93446e183872ad43b3e2fa83d0a3daeb2cd79672b9c1"
59
87
  },
60
88
  {
61
89
  "note": "every integer at its maximum",
62
90
  "message": {
63
91
  "orderHash": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
64
- "filler": "0xffffffffffffffffffffffffffffffffffffffff",
92
+ "fillerId": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
93
+ "deliveryKey": "0xffffffffffffffffffffffffffffffffffffffff",
94
+ "repayTo": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
65
95
  "attempt": 4294967295,
66
96
  "validFrom": "18446744073709551615",
67
97
  "validUntil": "18446744073709551615"
68
98
  },
69
- "digest": "0xc42ba85a1f897e17c385efd7de3b6e7948c18c129a7c2580b71a18205edb628e"
99
+ "digest": "0x041820b7007543c4750057958545f330ece16fc5ae81d4d30571b2f09269ccb3"
70
100
  },
71
101
  {
72
102
  "note": "zero",
73
103
  "message": {
74
104
  "orderHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
75
- "filler": "0x0000000000000000000000000000000000000000",
105
+ "fillerId": "0x0000000000000000000000000000000000000000000000000000000000000000",
106
+ "deliveryKey": "0x0000000000000000000000000000000000000000",
107
+ "repayTo": "0x0000000000000000000000000000000000000000000000000000000000000000",
76
108
  "attempt": 0,
77
109
  "validFrom": "0",
78
110
  "validUntil": "0"
79
111
  },
80
- "digest": "0xfeddbe10514c1cd10524b20487f96b3335e92fcb74b9aa9368a21caad1eef948"
112
+ "digest": "0x205fd8f9d58d390da2bf1158f6a4025274dfc0d1db56422610b271d0a5ddd098"
81
113
  }
82
114
  ]
83
115
  }
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/networks.ts"],"names":[],"mappings":";AA6BO,IAAM,QAAA,GAA8C;AAAA,EACzD,MAAA,EAAQ,EAAE,EAAA,EAAI,QAAA,EAAU,MAAM,QAAA,EAAU,IAAA,EAAM,QAAA,EAAU,OAAA,EAAS,KAAA,EAAM;AAAA,EACvE,QAAA,EAAU;AAAA,IACR,EAAA,EAAI,UAAA;AAAA,IAAY,IAAA,EAAM,KAAA;AAAA,IAAO,IAAA,EAAM,UAAA;AAAA,IAAY,OAAA,EAAS,CAAA;AAAA,IAAG,WA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AAA,EAAM,MAAA,EAAQ,IAAA,EAAM,aAAA,EAAe,WAAA,EAAa,6BAAA,EAA+B,OAAA,EAAS,IAAA;AAC5H;AAGO,IAAM,eAAA,GAAoD,EAAE,GAAA,EAAK,UAAA;AAEjE,SAAS,UAAU,EAAA,EAAiC;AACzD,EAAA,OAAO,QAAA,CAAS,eAAA,CAAgB,EAAE,CAAA,IAAK,EAAE,CAAA;AAC3C;AAEO,SAAS,cAAc,EAAA,EAAqC;AACjE,EAAA,OAAO,SAAA,CAAU,EAAE,CAAA,EAAG,IAAA;AACxB;AAGO,SAAS,iBAAiB,OAAA,EAAsC;AACrE,EAAA,OAAO,MAAA,CAAO,OAAO,QAAQ,CAAA,CAAE,KAAK,CAAC,CAAA,KAAM,CAAA,CAAE,OAAA,KAAY,OAAO,CAAA;AAClE","file":"chunk-VODZRADO.js","sourcesContent":["/**\n * `@cancore/contracts/networks` — the chains Cancore settles on, by the ids the\n * API uses (`sourceNetwork`, `targetNetwork` in an order are these keys).\n *\n * Three kinds, because three address formats and three signing models:\n * `evm` (0x…, EIP-155 chain id), `tron` (base58, same Solidity, no chain id in\n * the EVM sense), `canton` (party ids, no addresses at all). A caller that\n * branches on `kind` instead of on the id keeps working when a chain is added.\n *\n * Contract addresses live next door in `DEPLOYMENTS`, keyed by environment —\n * dev, testnet and mainnet each have their own HTLC. `BYTECODE_HASHES` (from `.`)\n * pins the build of a release, not what an address runs (see `DEPLOYMENTS`).\n */\n\nexport type NetworkKind = 'evm' | 'tron' | 'canton';\n\nexport interface Network {\n /** The id the Cancore API uses for this chain. */\n id: string;\n kind: NetworkKind;\n name: string;\n /** EIP-155 chain id; absent for Tron and Canton. */\n chainId?: number;\n /** Where a transaction or address of this chain can be looked at. */\n explorerUrl?: string;\n nativeCurrency?: { name: string; symbol: string; decimals: number };\n testnet: boolean;\n}\n\nexport const NETWORKS: Readonly<Record<string, Network>> = {\n canton: { id: 'canton', kind: 'canton', name: 'Canton', testnet: false },\n ethereum: {\n id: 'ethereum', kind: 'evm', name: 'Ethereum', chainId: 1, explorerUrl: 'https://etherscan.io',\n nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, testnet: false,\n },\n sepolia: {\n id: 'sepolia', kind: 'evm', name: 'Sepolia', chainId: 11155111, explorerUrl: 'https://sepolia.etherscan.io',\n nativeCurrency: { name: 'Sepolia ETH', symbol: 'ETH', decimals: 18 }, testnet: true,\n },\n bnb: {\n id: 'bnb', kind: 'evm', name: 'BNB Chain', chainId: 56, explorerUrl: 'https://bscscan.com',\n nativeCurrency: { name: 'BNB', symbol: 'BNB', decimals: 18 }, testnet: false,\n },\n bnb_testnet: {\n id: 'bnb_testnet', kind: 'evm', name: 'BNB Testnet', chainId: 97, explorerUrl: 'https://testnet.bscscan.com',\n nativeCurrency: { name: 'Test BNB', symbol: 'tBNB', decimals: 18 }, testnet: true,\n },\n arbitrum: {\n id: 'arbitrum', kind: 'evm', name: 'Arbitrum One', chainId: 42161, explorerUrl: 'https://arbiscan.io',\n nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, testnet: false,\n },\n arbitrum_sepolia: {\n id: 'arbitrum_sepolia', kind: 'evm', name: 'Arbitrum Sepolia', chainId: 421614, explorerUrl: 'https://sepolia.arbiscan.io',\n nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, testnet: true,\n },\n robinhood: {\n id: 'robinhood', kind: 'evm', name: 'Robinhood Chain', chainId: 4663, explorerUrl: 'https://robinhoodchain.blockscout.com',\n nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, testnet: false,\n },\n robinhood_testnet: {\n id: 'robinhood_testnet', kind: 'evm', name: 'Robinhood Testnet', chainId: 46630, explorerUrl: 'https://explorer.testnet.chain.robinhood.com',\n nativeCurrency: { name: 'Ether', symbol: 'ETH', decimals: 18 }, testnet: true,\n },\n tron_nile: { id: 'tron_nile', kind: 'tron', name: 'Tron Nile', explorerUrl: 'https://nile.tronscan.org', testnet: true },\n tron_shasta: { id: 'tron_shasta', kind: 'tron', name: 'Tron Shasta', explorerUrl: 'https://shasta.tronscan.org', testnet: true },\n};\n\n/** `eth` is an older alias of `ethereum` still seen in order payloads. */\nexport const NETWORK_ALIASES: Readonly<Record<string, string>> = { eth: 'ethereum' };\n\nexport function networkOf(id: string): Network | undefined {\n return NETWORKS[NETWORK_ALIASES[id] ?? id];\n}\n\nexport function networkKindOf(id: string): NetworkKind | undefined {\n return networkOf(id)?.kind;\n}\n\n/** The network for an EIP-155 chain id, e.g. from a wallet's `eth_chainId`. */\nexport function networkByChainId(chainId: number): Network | undefined {\n return Object.values(NETWORKS).find((n) => n.chainId === chainId);\n}\n"]}