@cancore/contracts 0.1.0 → 0.2.0-rc.13

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 (62) hide show
  1. package/README.md +522 -10
  2. package/dist/abi.d.ts +6598 -1675
  3. package/dist/abi.js +1 -1
  4. package/dist/chunk-2ELHDMZ7.js +9911 -0
  5. package/dist/chunk-2ELHDMZ7.js.map +1 -0
  6. package/dist/{chunk-CIBYXHSX.js → chunk-IAPV7XWJ.js} +2 -2
  7. package/dist/chunk-IAPV7XWJ.js.map +1 -0
  8. package/dist/index.d.ts +1774 -29
  9. package/dist/index.js +3692 -21
  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 +2666 -0
  18. package/spec/abi/FeeVault.json +604 -0
  19. package/spec/abi/HTLC.json +717 -0
  20. package/spec/abi/IAttribute.json +110 -0
  21. package/spec/abi/IBurnMintERC20.json +252 -0
  22. package/spec/abi/ICancoreRouter.json +1361 -0
  23. package/spec/abi/IFormula.json +28 -0
  24. package/spec/abi/IHTLC.json +382 -0
  25. package/spec/abi/IPayment.json +40 -0
  26. package/spec/abi/IPermit2.json +150 -0
  27. package/spec/abi/IResolver.json +55 -0
  28. package/spec/abi/IStep.json +30 -0
  29. package/spec/abi/IVariableRole.json +141 -0
  30. package/spec/abi/MultiBalanceChecker.json +34 -0
  31. package/spec/abi/PointsClaim.json +791 -0
  32. package/spec/constants.json +66 -0
  33. package/spec/protocol/asyncapi.json +1587 -0
  34. package/spec/protocol/messages.schema.json +906 -0
  35. package/spec/protocol/records.schema.json +94 -0
  36. package/spec/protocol/rest.schema.json +193 -0
  37. package/spec/protocol/typed-data/CantonTicketReceipt.json +77 -0
  38. package/spec/protocol/typed-data/FillerAuth.json +58 -0
  39. package/spec/protocol/typed-data/FillerKeyRegistration.json +69 -0
  40. package/spec/protocol/typed-data/FillerMessage.json +115 -0
  41. package/spec/protocol/typed-data/FillerQuote.json +75 -0
  42. package/spec/protocol/typed-data/GatewayMessage.json +95 -0
  43. package/spec/protocol/typed-data/StakeBinding.json +75 -0
  44. package/spec/protocol/typed-data/TicketIntent.json +113 -0
  45. package/spec/protocol/typed-data/TicketReceipt.json +51 -0
  46. package/spec/protocol/vectors/draw.json +61 -0
  47. package/spec/protocol/vectors/jcs.json +59 -0
  48. package/spec/protocol/vectors/messages.json +743 -0
  49. package/spec/protocol/vectors/records.json +81 -0
  50. package/spec/protocol/vectors/settle-attestations.json +544 -0
  51. package/spec/typed-data/FillProof.json +227 -0
  52. package/spec/typed-data/FillTicket.json +116 -0
  53. package/spec/typed-data/Order.json +169 -0
  54. package/spec/typed-data/Quote.json +79 -0
  55. package/spec/vectors/canton-destination.json +60 -0
  56. package/spec/vectors/canton-order.json +70 -0
  57. package/spec/vectors/evm-order.json +50 -0
  58. package/spec/vectors/fee-split.json +179 -0
  59. package/spec/vectors/permit-witness.json +150 -0
  60. package/dist/chunk-CIBYXHSX.js.map +0 -1
  61. package/dist/chunk-ZSX67S72.js +0 -3423
  62. package/dist/chunk-ZSX67S72.js.map +0 -1
@@ -0,0 +1,70 @@
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
+ "fillerId": "keccak256(utf8(fillerId)) of the filler the owner picked, the twelfth and last Order field; the request is refused when fillerId is empty. The destination router's fill accepts only a ticket naming it, and settle only a proof naming it (WrongFiller)",
28
+ "$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)."
29
+ },
30
+ "vector": {
31
+ "input": {
32
+ "ownerPartyId": "alice::1220a1b2c3d4e5f60718293a4b5c6d7e8f90a1b2c3d4e5f60718293a4b5c6d7e8f9",
33
+ "requestId": "req-7f3a9c21-4d88-4e5b-9a1e-0c2f6b8d4e31",
34
+ "instrumentAdmin": "cancore-registry::1220f0e1d2c3b4a5968778695a4b3c2d1e0f0e1d2c3b4a5968778695a4b3c2d1e0f",
35
+ "instrumentId": "CNRX",
36
+ "amount": "1250.5",
37
+ "destinationChainId": "1",
38
+ "wantToken": "0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",
39
+ "wantDecimals": 6,
40
+ "minReceived": "1200.25",
41
+ "recipient": "0x742d35Cc6634C0532925a3b844Bc454e4438f44e",
42
+ "createdAt": 1789999400,
43
+ "fillDeadline": 1790000000,
44
+ "feeRate": "0.003",
45
+ "cantonOriginId": "9223372036854775809",
46
+ "fillerId": "acme"
47
+ },
48
+ "order": {
49
+ "user": "0x47f0d84377B46651f7936AE656DCEceFDc1A2A86",
50
+ "originChainId": "9223372036854775809",
51
+ "inputToken": "0x795ae88257786ea0e2CFe2c43B88B420993dC98f",
52
+ "inputAmount": "12505000000000",
53
+ "destination": "0x0000000000000000000000000000000000000000000000000000000000000001",
54
+ "outputAsset": "0x000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
55
+ "minReceived": "1200250000",
56
+ "recipient": "0x000000000000000000000000742d35cc6634c0532925a3b844bc454e4438f44e",
57
+ "createdAt": "1789999400",
58
+ "fillDeadline": "1790000000",
59
+ "feeBps": "30",
60
+ "fillerId": "0xe29dae06ef4c3e336b7538b6d4f52ca1ecec009b1df6fb501320e11b223aeeaf"
61
+ },
62
+ "domain": {
63
+ "name": "CancoreRouter",
64
+ "version": "1",
65
+ "chainId": "9223372036854775809",
66
+ "verifyingContract": "0x2f37b46Ea93001829498b145985fb53028033701"
67
+ },
68
+ "orderHash": "0x22e3a53ab72c6990b1971fd50b9ec6c527a003d987cd58d26058b380dd7ae79a"
69
+ }
70
+ }
@@ -0,0 +1,50 @@
1
+ {
2
+ "$comment": "EVM-source Order (protocol.md §3.3) and its orderHash = CancoreRouter.hashOrder in the source router domain {CancoreRouter, 1, chainId, verifyingContract}. Digests by ethers TypedDataEncoder; @cancore/contracts hashOrder must reproduce them. Generated by scripts/gen-router-vectors.mjs.",
3
+ "typeString": "Order(address user,uint64 originChainId,address inputToken,uint256 inputAmount,bytes32 destination,bytes32 outputAsset,uint256 minReceived,bytes32 recipient,uint64 createdAt,uint64 fillDeadline,uint16 feeBps,bytes32 fillerId)",
4
+ "vectors": [
5
+ {
6
+ "note": "EVM-source fixture order (sepolia to arbitrum sepolia, 30 bps) — the same order and digest as spec/typed-data/Order.json",
7
+ "domain": {
8
+ "chainId": "11155111",
9
+ "verifyingContract": "0x00000000000000000000000000000000cafe0001"
10
+ },
11
+ "order": {
12
+ "user": "0xa11ce00000000000000000000000000000000001",
13
+ "originChainId": "11155111",
14
+ "inputToken": "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238",
15
+ "inputAmount": "1003000000",
16
+ "destination": "0x0000000000000000000000000000000000000000000000000000000000066eee",
17
+ "outputAsset": "0x00000000000000000000000075faf114eafb1bdbe2f0316df893fd58ce46aa4d",
18
+ "minReceived": "999000000",
19
+ "recipient": "0x000000000000000000000000742d35cc6634c0532925a3b844bc454e4438f44e",
20
+ "createdAt": "1790000000",
21
+ "fillDeadline": "1790000600",
22
+ "feeBps": "30",
23
+ "fillerId": "0x112e2693409c427698100f54d0439fc3593fedb25221fe3a54c4823c0a0ee2d5"
24
+ },
25
+ "orderHash": "0x65f9010d612499d381eefba1a2385b76982c9bdaf9ed15bedbafd7b09fb3b73b"
26
+ },
27
+ {
28
+ "note": "the reverse route at MAX_FEE_BPS: 110 total, 100 net",
29
+ "domain": {
30
+ "chainId": "421614",
31
+ "verifyingContract": "0x00000000000000000000000000000000cafe0002"
32
+ },
33
+ "order": {
34
+ "user": "0xa11ce00000000000000000000000000000000001",
35
+ "originChainId": "421614",
36
+ "inputToken": "0x75faf114eafb1bdbe2f0316df893fd58ce46aa4d",
37
+ "inputAmount": "110000000",
38
+ "destination": "0x0000000000000000000000000000000000000000000000000000000000aa36a7",
39
+ "outputAsset": "0x0000000000000000000000001c7d4b196cb0c7b01d743fbc6116a902379c7238",
40
+ "minReceived": "100000000",
41
+ "recipient": "0x000000000000000000000000742d35cc6634c0532925a3b844bc454e4438f44e",
42
+ "createdAt": "1790000000",
43
+ "fillDeadline": "1790000600",
44
+ "feeBps": "1000",
45
+ "fillerId": "0x112e2693409c427698100f54d0439fc3593fedb25221fe3a54c4823c0a0ee2d5"
46
+ },
47
+ "orderHash": "0xfe95eb242c908edc755498b2fb32ae91cc3be9467bdf5a2669c7f588ee90fe7c"
48
+ }
49
+ ]
50
+ }
@@ -0,0 +1,179 @@
1
+ {
2
+ "$comment": "The inclusive fee of protocol.md §3.11: the maker hands over the total T, the filler is paid `payout`, Cancore keeps `fee` = T − payout. evm: CancoreRouter.settle, payout = floor(T × 10000 / (10000 + feeBps)) — each case names the router test that pins it (pinnedBy). canton: Daml inclusiveFee in EVM-form units (T = amount × 10^10, feeBps = feeRate × 10000), payout = the same quotient rounded half to even; ledgerPayout/ledgerFee are the Daml Decimal values (protocol.md §3.11), evmPayout the EVM formula for comparison. Generated by scripts/gen-router-vectors.mjs.",
3
+ "evm": [
4
+ {
5
+ "note": "protocol.md §3.11 hand vector: 105 total at 5 % — 100 to the filler, 5 of fee (6 decimals)",
6
+ "total": "105000000",
7
+ "feeBps": 500,
8
+ "payout": "100000000",
9
+ "fee": "5000000",
10
+ "pinnedBy": "evm-contracts test/CancoreRouter.ts @ c214f56:1042"
11
+ },
12
+ {
13
+ "note": "the same at 18 decimals",
14
+ "total": "105000000000000000000",
15
+ "feeBps": 500,
16
+ "payout": "100000000000000000000",
17
+ "fee": "5000000000000000000",
18
+ "pinnedBy": "evm-contracts test/CancoreRouter.ts @ c214f56:1042"
19
+ },
20
+ {
21
+ "note": "feeBps = 0: the whole input is paid out",
22
+ "total": "100000000000000000000",
23
+ "feeBps": 0,
24
+ "payout": "100000000000000000000",
25
+ "fee": "0",
26
+ "pinnedBy": "evm-contracts test/CancoreRouter.ts @ c214f56:1058"
27
+ },
28
+ {
29
+ "note": "feeBps = MAX_FEE_BPS: 11 000 total, 10 000 net, 1 000 fee (1/11 of the total)",
30
+ "total": "11000",
31
+ "feeBps": 1000,
32
+ "payout": "10000",
33
+ "fee": "1000",
34
+ "pinnedBy": "evm-contracts test/CancoreRouter.ts @ c214f56:1066"
35
+ },
36
+ {
37
+ "note": "rounding dust on the fee: 12 345 at 33 bps pays 12 304, fee 41 (the ideal 40.6 rounded up)",
38
+ "total": "12345",
39
+ "feeBps": 33,
40
+ "payout": "12304",
41
+ "fee": "41",
42
+ "pinnedBy": "evm-contracts test/CancoreRouter.ts @ c214f56:1079"
43
+ },
44
+ {
45
+ "note": "inexact division",
46
+ "total": "1000001",
47
+ "feeBps": 7,
48
+ "payout": "999301",
49
+ "fee": "700",
50
+ "pinnedBy": "evm-contracts test/CancoreRouter.ts @ c214f56:1092"
51
+ },
52
+ {
53
+ "note": "inexact division",
54
+ "total": "999",
55
+ "feeBps": 999,
56
+ "payout": "908",
57
+ "fee": "91",
58
+ "pinnedBy": "evm-contracts test/CancoreRouter.ts @ c214f56:1092"
59
+ },
60
+ {
61
+ "note": "inexact division",
62
+ "total": "7",
63
+ "feeBps": 1,
64
+ "payout": "6",
65
+ "fee": "1",
66
+ "pinnedBy": "evm-contracts test/CancoreRouter.ts @ c214f56:1092"
67
+ },
68
+ {
69
+ "note": "dust below one net unit is all fee: 1 at MAX_FEE_BPS pays 0",
70
+ "total": "1",
71
+ "feeBps": 1000,
72
+ "payout": "0",
73
+ "fee": "1",
74
+ "pinnedBy": "evm-contracts test/CancoreRouter.ts @ c214f56:1100"
75
+ },
76
+ {
77
+ "note": "dust at a low rate: 1 at 30 bps pays 0",
78
+ "total": "1",
79
+ "feeBps": 30,
80
+ "payout": "0",
81
+ "fee": "1",
82
+ "pinnedBy": "CAN-1934 acceptance"
83
+ },
84
+ {
85
+ "note": "11 at MAX_FEE_BPS: 10 and 1",
86
+ "total": "11",
87
+ "feeBps": 1000,
88
+ "payout": "10",
89
+ "fee": "1",
90
+ "pinnedBy": "CAN-1934 acceptance"
91
+ },
92
+ {
93
+ "note": "10 000 at 0 bps",
94
+ "total": "10000",
95
+ "feeBps": 0,
96
+ "payout": "10000",
97
+ "fee": "0",
98
+ "pinnedBy": "CAN-1934 acceptance"
99
+ },
100
+ {
101
+ "note": "2^250 at MAX_FEE_BPS: no overflow (mulDiv)",
102
+ "total": "1809251394333065553493296640760748560207343510400633813116524750123642650624",
103
+ "feeBps": 1000,
104
+ "payout": "1644773994848241412266633309782498691097585009455121648287749772839675136930",
105
+ "fee": "164477399484824141226663330978249869109758500945512164828774977283967513694",
106
+ "pinnedBy": "evm-contracts test/CancoreRouter.ts @ c214f56:1112"
107
+ },
108
+ {
109
+ "note": "the fixture order: 1003 USDC at 30 bps is 1000 to the filler, 3 of fee (order.settled example)",
110
+ "total": "1003000000",
111
+ "feeBps": 30,
112
+ "payout": "1000000000",
113
+ "fee": "3000000",
114
+ "pinnedBy": "spec/protocol/vectors/messages.json"
115
+ }
116
+ ],
117
+ "canton": [
118
+ {
119
+ "note": "worked: 1000.0 at 0.003",
120
+ "amount": "1000.0",
121
+ "feeRate": "0.003",
122
+ "total": "10000000000000",
123
+ "feeBps": 30,
124
+ "payout": "9970089730808",
125
+ "fee": "29910269192",
126
+ "ledgerPayout": "997.0089730808",
127
+ "ledgerFee": "2.9910269192",
128
+ "evmPayout": "9970089730807"
129
+ },
130
+ {
131
+ "note": "same as EVM: 105.0 at 0.05",
132
+ "amount": "105.0",
133
+ "feeRate": "0.05",
134
+ "total": "1050000000000",
135
+ "feeBps": 500,
136
+ "payout": "1000000000000",
137
+ "fee": "50000000000",
138
+ "ledgerPayout": "100.0",
139
+ "ledgerFee": "5.0",
140
+ "evmPayout": "1000000000000"
141
+ },
142
+ {
143
+ "note": "tie, q even, kept",
144
+ "amount": "100.8000000063",
145
+ "feeRate": "0.008",
146
+ "total": "1008000000063",
147
+ "feeBps": 80,
148
+ "payout": "1000000000062",
149
+ "fee": "8000000001",
150
+ "ledgerPayout": "100.0000000062",
151
+ "ledgerFee": "0.8000000001",
152
+ "evmPayout": "1000000000062"
153
+ },
154
+ {
155
+ "note": "tie, q odd, rounded up",
156
+ "amount": "100.8000000189",
157
+ "feeRate": "0.008",
158
+ "total": "1008000000189",
159
+ "feeBps": 80,
160
+ "payout": "1000000000188",
161
+ "fee": "8000000001",
162
+ "ledgerPayout": "100.0000000188",
163
+ "ledgerFee": "0.8000000001",
164
+ "evmPayout": "1000000000187"
165
+ },
166
+ {
167
+ "note": "dust: 0.0000000002 at 0.1 is all payout",
168
+ "amount": "0.0000000002",
169
+ "feeRate": "0.1",
170
+ "total": "2",
171
+ "feeBps": 1000,
172
+ "payout": "2",
173
+ "fee": "0",
174
+ "ledgerPayout": "0.0000000002",
175
+ "ledgerFee": "0.0",
176
+ "evmPayout": "1"
177
+ }
178
+ ]
179
+ }
@@ -0,0 +1,150 @@
1
+ {
2
+ "$comment": "The Permit2 PermitWitnessTransferFrom typed data a maker signs to open an EVM-source intent, the Order nested as witness; the type is the stub Permit2 prepends followed by CancoreRouter.WITNESS_TYPE_STRING (spec/constants.json). Domain {Permit2, chainId, verifyingContract = PERMIT2_ADDRESS}, no version. witnessHash = hashStruct(Order) = what openFor passes to Permit2. Digests by ethers TypedDataEncoder. Generated by scripts/gen-router-vectors.mjs.",
3
+ "typeString": "PermitWitnessTransferFrom(TokenPermissions permitted,address spender,uint256 nonce,uint256 deadline,Order witness)Order(address user,uint64 originChainId,address inputToken,uint256 inputAmount,bytes32 destination,bytes32 outputAsset,uint256 minReceived,bytes32 recipient,uint64 createdAt,uint64 fillDeadline,uint16 feeBps,bytes32 fillerId)TokenPermissions(address token,uint256 amount)",
4
+ "types": {
5
+ "PermitWitnessTransferFrom": [
6
+ {
7
+ "name": "permitted",
8
+ "type": "TokenPermissions"
9
+ },
10
+ {
11
+ "name": "spender",
12
+ "type": "address"
13
+ },
14
+ {
15
+ "name": "nonce",
16
+ "type": "uint256"
17
+ },
18
+ {
19
+ "name": "deadline",
20
+ "type": "uint256"
21
+ },
22
+ {
23
+ "name": "witness",
24
+ "type": "Order"
25
+ }
26
+ ],
27
+ "TokenPermissions": [
28
+ {
29
+ "name": "token",
30
+ "type": "address"
31
+ },
32
+ {
33
+ "name": "amount",
34
+ "type": "uint256"
35
+ }
36
+ ],
37
+ "Order": [
38
+ {
39
+ "name": "user",
40
+ "type": "address"
41
+ },
42
+ {
43
+ "name": "originChainId",
44
+ "type": "uint64"
45
+ },
46
+ {
47
+ "name": "inputToken",
48
+ "type": "address"
49
+ },
50
+ {
51
+ "name": "inputAmount",
52
+ "type": "uint256"
53
+ },
54
+ {
55
+ "name": "destination",
56
+ "type": "bytes32"
57
+ },
58
+ {
59
+ "name": "outputAsset",
60
+ "type": "bytes32"
61
+ },
62
+ {
63
+ "name": "minReceived",
64
+ "type": "uint256"
65
+ },
66
+ {
67
+ "name": "recipient",
68
+ "type": "bytes32"
69
+ },
70
+ {
71
+ "name": "createdAt",
72
+ "type": "uint64"
73
+ },
74
+ {
75
+ "name": "fillDeadline",
76
+ "type": "uint64"
77
+ },
78
+ {
79
+ "name": "feeBps",
80
+ "type": "uint16"
81
+ },
82
+ {
83
+ "name": "fillerId",
84
+ "type": "bytes32"
85
+ }
86
+ ]
87
+ },
88
+ "vectors": [
89
+ {
90
+ "note": "the fixture order: permitted = its input token and total, spender = its source router, deadline = its fillDeadline (the router refuses a permit that outlives the order)",
91
+ "chainId": "11155111",
92
+ "verifyingContract": "0x000000000022D473030F116dDEE9F6B43aC78BA3",
93
+ "message": {
94
+ "permitted": {
95
+ "token": "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238",
96
+ "amount": "1003000000"
97
+ },
98
+ "spender": "0x00000000000000000000000000000000cafe0001",
99
+ "nonce": "1",
100
+ "deadline": "1790000600",
101
+ "witness": {
102
+ "user": "0xa11ce00000000000000000000000000000000001",
103
+ "originChainId": "11155111",
104
+ "inputToken": "0x1c7d4b196cb0c7b01d743fbc6116a902379c7238",
105
+ "inputAmount": "1003000000",
106
+ "destination": "0x0000000000000000000000000000000000000000000000000000000000066eee",
107
+ "outputAsset": "0x00000000000000000000000075faf114eafb1bdbe2f0316df893fd58ce46aa4d",
108
+ "minReceived": "999000000",
109
+ "recipient": "0x000000000000000000000000742d35cc6634c0532925a3b844bc454e4438f44e",
110
+ "createdAt": "1790000000",
111
+ "fillDeadline": "1790000600",
112
+ "feeBps": "30",
113
+ "fillerId": "0x112e2693409c427698100f54d0439fc3593fedb25221fe3a54c4823c0a0ee2d5"
114
+ }
115
+ },
116
+ "witnessHash": "0x65dafb2380df045e9f2214e5f58852eb75bb570311d47c75be9c939a4e09d468",
117
+ "digest": "0x9412d1faddaed6ce23393e9935277b0550aa16d69dc110acaab0e8b0d8486cc7"
118
+ },
119
+ {
120
+ "note": "the reverse route on arbitrum sepolia, a large unordered nonce",
121
+ "chainId": "421614",
122
+ "verifyingContract": "0x000000000022D473030F116dDEE9F6B43aC78BA3",
123
+ "message": {
124
+ "permitted": {
125
+ "token": "0x75faf114eafb1bdbe2f0316df893fd58ce46aa4d",
126
+ "amount": "110000000"
127
+ },
128
+ "spender": "0x00000000000000000000000000000000cafe0002",
129
+ "nonce": "1790000000123456789",
130
+ "deadline": "1790000600",
131
+ "witness": {
132
+ "user": "0xa11ce00000000000000000000000000000000001",
133
+ "originChainId": "421614",
134
+ "inputToken": "0x75faf114eafb1bdbe2f0316df893fd58ce46aa4d",
135
+ "inputAmount": "110000000",
136
+ "destination": "0x0000000000000000000000000000000000000000000000000000000000aa36a7",
137
+ "outputAsset": "0x0000000000000000000000001c7d4b196cb0c7b01d743fbc6116a902379c7238",
138
+ "minReceived": "100000000",
139
+ "recipient": "0x000000000000000000000000742d35cc6634c0532925a3b844bc454e4438f44e",
140
+ "createdAt": "1790000000",
141
+ "fillDeadline": "1790000600",
142
+ "feeBps": "1000",
143
+ "fillerId": "0x112e2693409c427698100f54d0439fc3593fedb25221fe3a54c4823c0a0ee2d5"
144
+ }
145
+ },
146
+ "witnessHash": "0x61347f16f30013e657e2f5aa4aa9d26344b766b573cec6316cc1c2ed1b225feb",
147
+ "digest": "0xef852c301d87b66e04938fce3b86ba268371fef0e2ec486602a1eed778175717"
148
+ }
149
+ ]
150
+ }
@@ -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,WAAA,EAAa,sBAAA;AAAA,IACxE,gBAAgB,EAAE,IAAA,EAAM,SAAS,MAAA,EAAQ,KAAA,EAAO,UAAU,EAAA,EAAG;AAAA,IAAG,OAAA,EAAS;AAAA,GAC3E;AAAA,EACA,OAAA,EAAS;AAAA,IACP,EAAA,EAAI,SAAA;AAAA,IAAW,IAAA,EAAM,KAAA;AAAA,IAAO,IAAA,EAAM,SAAA;AAAA,IAAW,OAAA,EAAS,QAAA;AAAA,IAAU,WAAA,EAAa,8BAAA;AAAA,IAC7E,gBAAgB,EAAE,IAAA,EAAM,eAAe,MAAA,EAAQ,KAAA,EAAO,UAAU,EAAA,EAAG;AAAA,IAAG,OAAA,EAAS;AAAA,GACjF;AAAA,EACA,GAAA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AAA,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"]}