@cancore/contracts 0.1.0 → 0.2.0-rc.3

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.
Files changed (47) hide show
  1. package/README.md +168 -9
  2. package/dist/abi.d.ts +6086 -1675
  3. package/dist/abi.js +1 -1
  4. package/dist/chunk-NV5IUURP.js +9252 -0
  5. package/dist/chunk-NV5IUURP.js.map +1 -0
  6. package/dist/{chunk-CIBYXHSX.js → chunk-VODZRADO.js} +2 -2
  7. package/dist/chunk-VODZRADO.js.map +1 -0
  8. package/dist/index.d.ts +849 -28
  9. package/dist/index.js +2065 -16
  10. package/dist/index.js.map +1 -1
  11. package/dist/networks.d.ts +2 -2
  12. package/dist/networks.js +1 -1
  13. package/package.json +10 -8
  14. package/spec/abi/AttestorSet.json +476 -0
  15. package/spec/abi/CNRX.json +1294 -0
  16. package/spec/abi/CNRXStaking.json +510 -0
  17. package/spec/abi/CancoreRouter.json +2564 -0
  18. package/spec/abi/FeeVault.json +604 -0
  19. package/spec/abi/HTLC.json +717 -0
  20. package/spec/abi/IBurnMintERC20.json +252 -0
  21. package/spec/abi/ICancoreRouter.json +1226 -0
  22. package/spec/abi/IHTLC.json +382 -0
  23. package/spec/abi/IPermit2.json +150 -0
  24. package/spec/abi/MultiBalanceChecker.json +34 -0
  25. package/spec/abi/PointsClaim.json +791 -0
  26. package/spec/protocol/asyncapi.json +1050 -0
  27. package/spec/protocol/messages.schema.json +414 -0
  28. package/spec/protocol/records.schema.json +93 -0
  29. package/spec/protocol/rest.schema.json +115 -0
  30. package/spec/protocol/typed-data/FillerAuth.json +58 -0
  31. package/spec/protocol/typed-data/FillerQuote.json +75 -0
  32. package/spec/protocol/typed-data/GatewayMessage.json +90 -0
  33. package/spec/protocol/typed-data/StakeBinding.json +75 -0
  34. package/spec/protocol/typed-data/TicketIntent.json +65 -0
  35. package/spec/protocol/typed-data/TicketReceipt.json +51 -0
  36. package/spec/protocol/vectors/draw.json +61 -0
  37. package/spec/protocol/vectors/jcs.json +59 -0
  38. package/spec/protocol/vectors/messages.json +343 -0
  39. package/spec/protocol/vectors/records.json +81 -0
  40. package/spec/typed-data/FillProof.json +199 -0
  41. package/spec/typed-data/FillTicket.json +83 -0
  42. package/spec/typed-data/Order.json +141 -0
  43. package/spec/typed-data/Quote.json +69 -0
  44. package/spec/vectors/canton-order.json +67 -0
  45. package/dist/chunk-CIBYXHSX.js.map +0 -1
  46. package/dist/chunk-ZSX67S72.js +0 -3423
  47. package/dist/chunk-ZSX67S72.js.map +0 -1
@@ -0,0 +1,83 @@
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.",
3
+ "primaryType": "FillTicket",
4
+ "domain": {
5
+ "name": "CancoreFillTicket",
6
+ "version": "1",
7
+ "fields": [
8
+ "name",
9
+ "version"
10
+ ]
11
+ },
12
+ "typeString": "FillTicket(bytes32 orderHash,address filler,uint32 attempt,uint64 validFrom,uint64 validUntil)",
13
+ "types": {
14
+ "FillTicket": [
15
+ {
16
+ "name": "orderHash",
17
+ "type": "bytes32"
18
+ },
19
+ {
20
+ "name": "filler",
21
+ "type": "address"
22
+ },
23
+ {
24
+ "name": "attempt",
25
+ "type": "uint32"
26
+ },
27
+ {
28
+ "name": "validFrom",
29
+ "type": "uint64"
30
+ },
31
+ {
32
+ "name": "validUntil",
33
+ "type": "uint64"
34
+ }
35
+ ]
36
+ },
37
+ "vectors": [
38
+ {
39
+ "note": "protocol.md §3.3 hashTicket example: a fixed bytes32 orderHash input (the pre-CAN-1683 golden value)",
40
+ "message": {
41
+ "orderHash": "0xe61e980d40d1a666a509d2296c0d2658a40ff681e290c7646a75a550629ce1ad",
42
+ "filler": "0x742d35cc6634c0532925a3b844bc454e4438f44e",
43
+ "attempt": 0,
44
+ "validFrom": "1789999000",
45
+ "validUntil": "1789999180"
46
+ },
47
+ "digest": "0x80a86c8877ddb8c8ff1924b52311c1f2a7000b8d3ee3e69ed4314b2d38cab2c1"
48
+ },
49
+ {
50
+ "note": "ticket for the test-kit fixture order, attempt 0",
51
+ "message": {
52
+ "orderHash": "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
53
+ "filler": "0x742d35cc6634c0532925a3b844bc454e4438f44e",
54
+ "attempt": 0,
55
+ "validFrom": "1790000040",
56
+ "validUntil": "1790000400"
57
+ },
58
+ "digest": "0x466bc75e5efad07ad975aeea9ec731902bc804461686a6c8f76ef4fd50297819"
59
+ },
60
+ {
61
+ "note": "every integer at its maximum",
62
+ "message": {
63
+ "orderHash": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
64
+ "filler": "0xffffffffffffffffffffffffffffffffffffffff",
65
+ "attempt": 4294967295,
66
+ "validFrom": "18446744073709551615",
67
+ "validUntil": "18446744073709551615"
68
+ },
69
+ "digest": "0xc42ba85a1f897e17c385efd7de3b6e7948c18c129a7c2580b71a18205edb628e"
70
+ },
71
+ {
72
+ "note": "zero",
73
+ "message": {
74
+ "orderHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
75
+ "filler": "0x0000000000000000000000000000000000000000",
76
+ "attempt": 0,
77
+ "validFrom": "0",
78
+ "validUntil": "0"
79
+ },
80
+ "digest": "0xfeddbe10514c1cd10524b20487f96b3335e92fcb74b9aa9368a21caad1eef948"
81
+ }
82
+ ]
83
+ }
@@ -0,0 +1,141 @@
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. The canton vector equals spec/vectors/canton-order.json (Solidity-pinned); the sepolia vector is the test-kit fixture order.",
3
+ "primaryType": "Order",
4
+ "domain": {
5
+ "name": "CancoreRouter",
6
+ "version": "1",
7
+ "fields": [
8
+ "name",
9
+ "version",
10
+ "chainId",
11
+ "verifyingContract"
12
+ ]
13
+ },
14
+ "typeString": "Order(address user,uint64 originChainId,address inputToken,uint256 inputAmount,bytes32 destination,bytes32 outputAsset,uint256 minReceived,bytes32 recipient,uint64 createdAt,uint64 fillDeadline,uint16 feeBps)",
15
+ "types": {
16
+ "Order": [
17
+ {
18
+ "name": "user",
19
+ "type": "address"
20
+ },
21
+ {
22
+ "name": "originChainId",
23
+ "type": "uint64"
24
+ },
25
+ {
26
+ "name": "inputToken",
27
+ "type": "address"
28
+ },
29
+ {
30
+ "name": "inputAmount",
31
+ "type": "uint256"
32
+ },
33
+ {
34
+ "name": "destination",
35
+ "type": "bytes32"
36
+ },
37
+ {
38
+ "name": "outputAsset",
39
+ "type": "bytes32"
40
+ },
41
+ {
42
+ "name": "minReceived",
43
+ "type": "uint256"
44
+ },
45
+ {
46
+ "name": "recipient",
47
+ "type": "bytes32"
48
+ },
49
+ {
50
+ "name": "createdAt",
51
+ "type": "uint64"
52
+ },
53
+ {
54
+ "name": "fillDeadline",
55
+ "type": "uint64"
56
+ },
57
+ {
58
+ "name": "feeBps",
59
+ "type": "uint16"
60
+ }
61
+ ]
62
+ },
63
+ "vectors": [
64
+ {
65
+ "note": "canton-source golden order (spec/vectors/canton-order.json)",
66
+ "chainId": "9223372036854775809",
67
+ "verifyingContract": "0x2f37b46ea93001829498b145985fb53028033701",
68
+ "message": {
69
+ "user": "0x47f0d84377b46651f7936ae656dcecefdc1a2a86",
70
+ "originChainId": "9223372036854775809",
71
+ "inputToken": "0x795ae88257786ea0e2cfe2c43b88b420993dc98f",
72
+ "inputAmount": "12505000000000",
73
+ "destination": "0x0000000000000000000000000000000000000000000000000000000000000001",
74
+ "outputAsset": "0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
75
+ "minReceived": "1200250000",
76
+ "recipient": "0x000000000000000000000000742d35cc6634c0532925a3b844bc454e4438f44e",
77
+ "createdAt": "1789999400",
78
+ "fillDeadline": "1790000000",
79
+ "feeBps": "30"
80
+ },
81
+ "digest": "0x770f1ebba8ab5b96e3efbed39c0f630d56f934f9f232771abaccdb0cf17ca204"
82
+ },
83
+ {
84
+ "note": "EVM-source fixture order of @cancore/test-kit (sepolia to arbitrum sepolia)",
85
+ "chainId": "11155111",
86
+ "verifyingContract": "0x00000000000000000000000000000000cafe0001",
87
+ "message": {
88
+ "user": "0xa11ce00000000000000000000000000000000001",
89
+ "originChainId": "11155111",
90
+ "inputToken": "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238",
91
+ "inputAmount": "1003000000",
92
+ "destination": "0x0000000000000000000000000000000000000000000000000000000000066eee",
93
+ "outputAsset": "0x00000000000000000000000075faf114eafb1bdbe2f0316df893fd58ce46aa4d",
94
+ "minReceived": "999000000",
95
+ "recipient": "0x000000000000000000000000742d35cc6634c0532925a3b844bc454e4438f44e",
96
+ "createdAt": "1790000000",
97
+ "fillDeadline": "1790000600",
98
+ "feeBps": "30"
99
+ },
100
+ "digest": "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6"
101
+ },
102
+ {
103
+ "note": "every integer at its maximum",
104
+ "chainId": "11155111",
105
+ "verifyingContract": "0x00000000000000000000000000000000cafe0001",
106
+ "message": {
107
+ "user": "0xffffffffffffffffffffffffffffffffffffffff",
108
+ "originChainId": "18446744073709551615",
109
+ "inputToken": "0xffffffffffffffffffffffffffffffffffffffff",
110
+ "inputAmount": "115792089237316195423570985008687907853269984665640564039457584007913129639935",
111
+ "destination": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
112
+ "outputAsset": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
113
+ "minReceived": "115792089237316195423570985008687907853269984665640564039457584007913129639935",
114
+ "recipient": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
115
+ "createdAt": "18446744073709551615",
116
+ "fillDeadline": "18446744073709551615",
117
+ "feeBps": "65535"
118
+ },
119
+ "digest": "0x86cc928e50ec1003b13c9474aca3fd27a02eba667560e281f47f1962388300f8"
120
+ },
121
+ {
122
+ "note": "zero words and the zero address",
123
+ "chainId": "11155111",
124
+ "verifyingContract": "0x00000000000000000000000000000000cafe0001",
125
+ "message": {
126
+ "user": "0x0000000000000000000000000000000000000000",
127
+ "originChainId": "0",
128
+ "inputToken": "0x0000000000000000000000000000000000000000",
129
+ "inputAmount": "0",
130
+ "destination": "0x0000000000000000000000000000000000000000000000000000000000000000",
131
+ "outputAsset": "0x0000000000000000000000000000000000000000000000000000000000000000",
132
+ "minReceived": "0",
133
+ "recipient": "0x0000000000000000000000000000000000000000000000000000000000000000",
134
+ "createdAt": "0",
135
+ "fillDeadline": "0",
136
+ "feeBps": "0"
137
+ },
138
+ "digest": "0x3da628e3bc0683cdb45726c73345d9d2c479dc7607d9fa31275cb5e59a0cbd44"
139
+ }
140
+ ]
141
+ }
@@ -0,0 +1,69 @@
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.",
3
+ "primaryType": "Quote",
4
+ "domain": {
5
+ "name": "CancoreRouter",
6
+ "version": "1",
7
+ "fields": [
8
+ "name",
9
+ "version",
10
+ "chainId",
11
+ "verifyingContract"
12
+ ]
13
+ },
14
+ "typeString": "Quote(bytes32 orderHash,uint64 quoteDeadline)",
15
+ "types": {
16
+ "Quote": [
17
+ {
18
+ "name": "orderHash",
19
+ "type": "bytes32"
20
+ },
21
+ {
22
+ "name": "quoteDeadline",
23
+ "type": "uint64"
24
+ }
25
+ ]
26
+ },
27
+ "vectors": [
28
+ {
29
+ "note": "quote signer approves the fixture order",
30
+ "chainId": "11155111",
31
+ "verifyingContract": "0x00000000000000000000000000000000cafe0001",
32
+ "message": {
33
+ "orderHash": "0x585ec61a0813109803da9d47aea37a165f7df1371553f1e4ea8c139cf74058a6",
34
+ "quoteDeadline": "1790000030"
35
+ },
36
+ "digest": "0xacf52bd67ac646e4e85269571c6a0b8d4596b02b591afe28ef1d25d857878b7c"
37
+ },
38
+ {
39
+ "note": "every integer at its maximum",
40
+ "chainId": "11155111",
41
+ "verifyingContract": "0x00000000000000000000000000000000cafe0001",
42
+ "message": {
43
+ "orderHash": "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",
44
+ "quoteDeadline": "18446744073709551615"
45
+ },
46
+ "digest": "0x072fa3c045504f6548a932dee33c632e410e03c1707c960e17b071d4200d3db0"
47
+ },
48
+ {
49
+ "note": "zero",
50
+ "chainId": "11155111",
51
+ "verifyingContract": "0x00000000000000000000000000000000cafe0001",
52
+ "message": {
53
+ "orderHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
54
+ "quoteDeadline": "0"
55
+ },
56
+ "digest": "0x073bf52876f4f94c77600e57aa4a20376c538f1f5d0f2ad2fe52209a8c777b3e"
57
+ },
58
+ {
59
+ "note": "canton source domain",
60
+ "chainId": "9223372036854775809",
61
+ "verifyingContract": "0x2f37b46ea93001829498b145985fb53028033701",
62
+ "message": {
63
+ "orderHash": "0x770f1ebba8ab5b96e3efbed39c0f630d56f934f9f232771abaccdb0cf17ca204",
64
+ "quoteDeadline": "1789999430"
65
+ },
66
+ "digest": "0x4a8ff126558a8cbbfcffce73bef171a6242a4e7bd074070bd0be77220f1f6dec"
67
+ }
68
+ ]
69
+ }
@@ -0,0 +1,67 @@
1
+ {
2
+ "$description": "Golden vector for the EVM-form Order of a Canton-source intent (tech plan §3.2a). A Canton intent has no EVM user and no EVM input token, so both are deterministic labels derived from the Canton identifiers, and the source EIP-712 domain points at a fixed anchor address instead of a deployed router. Nothing on chain checks this construction: it is the only rule that makes a Canton delivery matchable on an EVM destination, and every implementation (Solidity tests, @cancore/contracts, the backend, the attestors, the fillers) must reproduce the orderHash below byte for byte.",
3
+ "$producedBy": "test/helpers/cantonOrder.ts — buildCantonSourceOrder(); verified against CancoreRouter.sourceOrderHash in test/CancoreRouter.ts",
4
+ "constants": {
5
+ "eip2294MaxChainId": "9223372036854775771",
6
+ "$eip2294MaxChainId": "floor((2^64 - 1) / 2) - 36. Every Canton origin id is above it, so no EVM chain can ever collide with one.",
7
+ "cantonOriginId": {
8
+ "mainnet": "9223372036854775809",
9
+ "testnet": "9223372036854775810",
10
+ "devnet": "9223372036854775811"
11
+ },
12
+ "$cantonOriginId": "2^63 + n. Above the EIP-2294 bound, inside uint64 (Order.originChainId), recognisable by eye. 2^63 itself is deliberately unassigned: a bare 9223372036854775808 in a config is more likely a truncation artefact than a deliberate choice.",
13
+ "cantonSourceAnchor": "0x2f37b46Ea93001829498b145985fb53028033701",
14
+ "$cantonSourceAnchor": "address(uint160(uint256(keccak256(\"cancore:canton-source-anchor:v1\")))) — the verifyingContract of the Canton source domain. One value for every Canton network: the domain already separates them through chainId. Register it once per origin id with setSourceRouter(originChainId, anchor) on every destination router — that call is WRITE-ONCE.",
15
+ "ownerLabelTag": "cancore:owner:v1",
16
+ "instrumentLabelTag": "cancore:instrument:v1",
17
+ "damlNumericScale": 10
18
+ },
19
+ "rules": {
20
+ "user": "address(uint160(uint256(keccak256(abi.encode(\"cancore:owner:v1\", ownerPartyId, requestId)))))",
21
+ "inputToken": "address(uint160(uint256(keccak256(abi.encode(\"cancore:instrument:v1\", instrumentAdmin, instrumentId)))))",
22
+ "inputAmount": "amount × 10^10 (Daml Numeric 10); the request is refused unless it is exact",
23
+ "minReceived": "minReceived × 10^decimals(wantToken); the request is refused unless it is exact",
24
+ "feeBps": "feeRate × 10000; refused unless it is a whole number and ≤ MAX_FEE_BPS (1000). The fee is INCLUSIVE on both rails: inputAmount is the total, payout = inputAmount × 10000 / (10000 + feeBps) floored, fee = inputAmount − payout",
25
+ "createdAt": "unix seconds, the signing time of the Canton request; refused unless it is a whole second. Part of the hash only: the destination does not check it",
26
+ "fillDeadline": "unix seconds; refused unless it is a whole second",
27
+ "$requestId": "requestId is part of the owner label on purpose: without it two identical requests in the same second share one orderHash, and one delivery would match two SwapIntents (AUD-E-13, AUD-C-3)."
28
+ },
29
+ "vector": {
30
+ "input": {
31
+ "ownerPartyId": "alice::1220a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f9",
32
+ "requestId": "req-7f3a9c21-4d88-4e5b-9a1e-0c2f6b8d4e31",
33
+ "instrumentAdmin": "cancore-registry::1220f0e1d2c3b4a5968778695a4b3c2d1e0f0e1d2c3b4a5968778695a4b3c2d1e0f",
34
+ "instrumentId": "CNRX",
35
+ "amount": "1250.5",
36
+ "destinationChainId": "1",
37
+ "wantToken": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
38
+ "wantDecimals": 6,
39
+ "minReceived": "1200.25",
40
+ "recipient": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
41
+ "createdAt": 1789999400,
42
+ "fillDeadline": 1790000000,
43
+ "feeRate": "0.003",
44
+ "cantonOriginId": "9223372036854775809"
45
+ },
46
+ "order": {
47
+ "user": "0x47f0d84377B46651f7936AE656DCEceFDc1A2A86",
48
+ "originChainId": "9223372036854775809",
49
+ "inputToken": "0x795ae88257786ea0e2CFe2c43B88B420993dC98f",
50
+ "inputAmount": "12505000000000",
51
+ "destination": "0x0000000000000000000000000000000000000000000000000000000000000001",
52
+ "outputAsset": "0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
53
+ "minReceived": "1200250000",
54
+ "recipient": "0x000000000000000000000000742d35cc6634c0532925a3b844bc454e4438f44e",
55
+ "createdAt": "1789999400",
56
+ "fillDeadline": "1790000000",
57
+ "feeBps": "30"
58
+ },
59
+ "domain": {
60
+ "name": "CancoreRouter",
61
+ "version": "1",
62
+ "chainId": "9223372036854775809",
63
+ "verifyingContract": "0x2f37b46Ea93001829498b145985fb53028033701"
64
+ },
65
+ "orderHash": "0x770f1ebba8ab5b96e3efbed39c0f630d56f934f9f232771abaccdb0cf17ca204"
66
+ }
67
+ }
@@ -1 +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O,WAAA,EAAa,8CAAA;AAAA,IAC9F,gBAAgB,EAAE,IAAA,EAAM,SAAS,MAAA,EAAQ,KAAA,EAAO,UAAU,EAAA,EAAG;AAAA,IAAG,OAAA,EAAS;AAAA,GAC3E;AAAA,EACA,SAAA,EAAW,EAAE,EAAA,EAAI,WAAA,EAAa,IAAA,EAAM,MAAA,EAAQ,IAAA,EAAM,WAAA,EAAa,WAAA,EAAa,2BAAA,EAA6B,OAAA,EAAS,IAAA,EAAK;AAAA,EACvH,WAAA,EAAa,EAAE,EAAA,EAAI,aAAA,EAAe,IAAA,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-CIBYXHSX.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 — and `BYTECODE_HASHES`\n * (from `.`) is how a deployment at any of those addresses is verified.\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"]}