@arbilink/sdk 0.1.0
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.
- package/LICENSE +21 -0
- package/README.md +255 -0
- package/dist/ArbiLink.d.ts +112 -0
- package/dist/ArbiLink.d.ts.map +1 -0
- package/dist/ArbiLink.js +257 -0
- package/dist/ArbiLink.js.map +1 -0
- package/dist/abi/MessageHub.json +156 -0
- package/dist/abi/Receiver.json +211 -0
- package/dist/constants.d.ts +13 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +53 -0
- package/dist/constants.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +53 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +22 -0
- package/dist/types.js.map +1 -0
- package/dist/utils.d.ts +50 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +99 -0
- package/dist/utils.js.map +1 -0
- package/package.json +46 -0
- package/src/ArbiLink.ts +301 -0
- package/src/abi/MessageHub.json +156 -0
- package/src/abi/Receiver.json +211 -0
- package/src/constants.ts +60 -0
- package/src/index.ts +41 -0
- package/src/types.ts +82 -0
- package/src/utils.ts +111 -0
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"type": "function",
|
|
4
|
+
"name": "initialize",
|
|
5
|
+
"inputs": [
|
|
6
|
+
{ "name": "min_stake", "type": "uint256" },
|
|
7
|
+
{ "name": "challenge_period", "type": "uint256" }
|
|
8
|
+
],
|
|
9
|
+
"outputs": [],
|
|
10
|
+
"stateMutability": "nonpayable"
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
"type": "function",
|
|
14
|
+
"name": "sendMessage",
|
|
15
|
+
"inputs": [
|
|
16
|
+
{ "name": "destination_chain", "type": "uint32" },
|
|
17
|
+
{ "name": "target", "type": "address" },
|
|
18
|
+
{ "name": "data", "type": "bytes" }
|
|
19
|
+
],
|
|
20
|
+
"outputs": [{ "name": "", "type": "uint256" }],
|
|
21
|
+
"stateMutability": "payable"
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
"type": "function",
|
|
25
|
+
"name": "confirmDelivery",
|
|
26
|
+
"inputs": [
|
|
27
|
+
{ "name": "message_id", "type": "uint256" },
|
|
28
|
+
{ "name": "_proof", "type": "bytes" }
|
|
29
|
+
],
|
|
30
|
+
"outputs": [],
|
|
31
|
+
"stateMutability": "nonpayable"
|
|
32
|
+
},
|
|
33
|
+
{
|
|
34
|
+
"type": "function",
|
|
35
|
+
"name": "registerRelayer",
|
|
36
|
+
"inputs": [],
|
|
37
|
+
"outputs": [],
|
|
38
|
+
"stateMutability": "payable"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"type": "function",
|
|
42
|
+
"name": "exitRelayer",
|
|
43
|
+
"inputs": [],
|
|
44
|
+
"outputs": [],
|
|
45
|
+
"stateMutability": "nonpayable"
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"type": "function",
|
|
49
|
+
"name": "addChain",
|
|
50
|
+
"inputs": [
|
|
51
|
+
{ "name": "chain_id", "type": "uint32" },
|
|
52
|
+
{ "name": "receiver_address", "type": "address" },
|
|
53
|
+
{ "name": "base_fee", "type": "uint256" }
|
|
54
|
+
],
|
|
55
|
+
"outputs": [],
|
|
56
|
+
"stateMutability": "nonpayable"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"type": "function",
|
|
60
|
+
"name": "getMessageStatus",
|
|
61
|
+
"inputs": [{ "name": "message_id", "type": "uint256" }],
|
|
62
|
+
"outputs": [{ "name": "", "type": "uint8" }],
|
|
63
|
+
"stateMutability": "view"
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
"type": "function",
|
|
67
|
+
"name": "calculateFee",
|
|
68
|
+
"inputs": [{ "name": "destination_chain", "type": "uint32" }],
|
|
69
|
+
"outputs": [{ "name": "", "type": "uint256" }],
|
|
70
|
+
"stateMutability": "view"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
"type": "function",
|
|
74
|
+
"name": "isActiveRelayer",
|
|
75
|
+
"inputs": [{ "name": "relayer", "type": "address" }],
|
|
76
|
+
"outputs": [{ "name": "", "type": "bool" }],
|
|
77
|
+
"stateMutability": "view"
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
"type": "function",
|
|
81
|
+
"name": "messageCount",
|
|
82
|
+
"inputs": [],
|
|
83
|
+
"outputs": [{ "name": "", "type": "uint256" }],
|
|
84
|
+
"stateMutability": "view"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"type": "function",
|
|
88
|
+
"name": "owner",
|
|
89
|
+
"inputs": [],
|
|
90
|
+
"outputs": [{ "name": "", "type": "address" }],
|
|
91
|
+
"stateMutability": "view"
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
"type": "function",
|
|
95
|
+
"name": "minStake",
|
|
96
|
+
"inputs": [],
|
|
97
|
+
"outputs": [{ "name": "", "type": "uint256" }],
|
|
98
|
+
"stateMutability": "view"
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"type": "event",
|
|
102
|
+
"name": "MessageSent",
|
|
103
|
+
"inputs": [
|
|
104
|
+
{ "name": "messageId", "type": "uint256", "indexed": true },
|
|
105
|
+
{ "name": "sender", "type": "address", "indexed": true },
|
|
106
|
+
{ "name": "destinationChain", "type": "uint32", "indexed": false },
|
|
107
|
+
{ "name": "target", "type": "address", "indexed": false },
|
|
108
|
+
{ "name": "data", "type": "bytes", "indexed": false },
|
|
109
|
+
{ "name": "fee", "type": "uint256", "indexed": false }
|
|
110
|
+
]
|
|
111
|
+
},
|
|
112
|
+
{
|
|
113
|
+
"type": "event",
|
|
114
|
+
"name": "MessageConfirmed",
|
|
115
|
+
"inputs": [
|
|
116
|
+
{ "name": "messageId", "type": "uint256", "indexed": true },
|
|
117
|
+
{ "name": "relayer", "type": "address", "indexed": true },
|
|
118
|
+
{ "name": "timestamp", "type": "uint256", "indexed": false }
|
|
119
|
+
]
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
"type": "event",
|
|
123
|
+
"name": "RelayerRegistered",
|
|
124
|
+
"inputs": [
|
|
125
|
+
{ "name": "relayer", "type": "address", "indexed": true },
|
|
126
|
+
{ "name": "stake", "type": "uint256", "indexed": false }
|
|
127
|
+
]
|
|
128
|
+
},
|
|
129
|
+
{
|
|
130
|
+
"type": "event",
|
|
131
|
+
"name": "RelayerExited",
|
|
132
|
+
"inputs": [
|
|
133
|
+
{ "name": "relayer", "type": "address", "indexed": true },
|
|
134
|
+
{ "name": "returned", "type": "uint256", "indexed": false }
|
|
135
|
+
]
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"type": "event",
|
|
139
|
+
"name": "ChainAdded",
|
|
140
|
+
"inputs": [
|
|
141
|
+
{ "name": "chainId", "type": "uint32", "indexed": true },
|
|
142
|
+
{ "name": "receiver", "type": "address", "indexed": false },
|
|
143
|
+
{ "name": "baseFee", "type": "uint256", "indexed": false }
|
|
144
|
+
]
|
|
145
|
+
},
|
|
146
|
+
{ "type": "error", "name": "ChainNotSupported", "inputs": [{ "name": "chainId", "type": "uint32" }] },
|
|
147
|
+
{ "type": "error", "name": "InsufficientFee", "inputs": [{ "name": "required", "type": "uint256" }, { "name": "provided", "type": "uint256" }] },
|
|
148
|
+
{ "type": "error", "name": "MessageNotFound", "inputs": [{ "name": "messageId", "type": "uint256" }] },
|
|
149
|
+
{ "type": "error", "name": "InsufficientStake", "inputs": [{ "name": "required", "type": "uint256" }, { "name": "provided", "type": "uint256" }] },
|
|
150
|
+
{ "type": "error", "name": "Unauthorized", "inputs": [{ "name": "caller", "type": "address" }] },
|
|
151
|
+
{ "type": "error", "name": "RelayerNotActive", "inputs": [{ "name": "relayer", "type": "address" }] },
|
|
152
|
+
{ "type": "error", "name": "AlreadyRelayed", "inputs": [{ "name": "messageId", "type": "uint256" }] },
|
|
153
|
+
{ "type": "error", "name": "TransferFailed", "inputs": [] },
|
|
154
|
+
{ "type": "error", "name": "ZeroAddress", "inputs": [] },
|
|
155
|
+
{ "type": "error", "name": "AlreadyInitialized", "inputs": [] }
|
|
156
|
+
]
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"type": "constructor",
|
|
4
|
+
"inputs": [
|
|
5
|
+
{ "name": "_messageHub", "type": "address" },
|
|
6
|
+
{ "name": "_hubSigningKey", "type": "address" }
|
|
7
|
+
]
|
|
8
|
+
},
|
|
9
|
+
{
|
|
10
|
+
"type": "function",
|
|
11
|
+
"name": "receiveMessage",
|
|
12
|
+
"inputs": [
|
|
13
|
+
{
|
|
14
|
+
"name": "message",
|
|
15
|
+
"type": "tuple",
|
|
16
|
+
"components": [
|
|
17
|
+
{ "name": "id", "type": "uint256" },
|
|
18
|
+
{ "name": "sender", "type": "address" },
|
|
19
|
+
{ "name": "target", "type": "address" },
|
|
20
|
+
{ "name": "data", "type": "bytes" },
|
|
21
|
+
{ "name": "sourceChain", "type": "uint32" }
|
|
22
|
+
]
|
|
23
|
+
},
|
|
24
|
+
{ "name": "proof", "type": "bytes" }
|
|
25
|
+
],
|
|
26
|
+
"outputs": [{ "name": "success", "type": "bool" }],
|
|
27
|
+
"stateMutability": "nonpayable"
|
|
28
|
+
},
|
|
29
|
+
{
|
|
30
|
+
"type": "function",
|
|
31
|
+
"name": "proofPayload",
|
|
32
|
+
"inputs": [
|
|
33
|
+
{
|
|
34
|
+
"name": "message",
|
|
35
|
+
"type": "tuple",
|
|
36
|
+
"components": [
|
|
37
|
+
{ "name": "id", "type": "uint256" },
|
|
38
|
+
{ "name": "sender", "type": "address" },
|
|
39
|
+
{ "name": "target", "type": "address" },
|
|
40
|
+
{ "name": "data", "type": "bytes" },
|
|
41
|
+
{ "name": "sourceChain", "type": "uint32" }
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
],
|
|
45
|
+
"outputs": [{ "name": "", "type": "bytes32" }],
|
|
46
|
+
"stateMutability": "pure"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
"type": "function",
|
|
50
|
+
"name": "nonExecutionProofPayload",
|
|
51
|
+
"inputs": [
|
|
52
|
+
{ "name": "messageId", "type": "uint256" },
|
|
53
|
+
{ "name": "destinationChain", "type": "uint32" }
|
|
54
|
+
],
|
|
55
|
+
"outputs": [{ "name": "", "type": "bytes32" }],
|
|
56
|
+
"stateMutability": "pure"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
"type": "function",
|
|
60
|
+
"name": "setRelayer",
|
|
61
|
+
"inputs": [
|
|
62
|
+
{ "name": "relayer", "type": "address" },
|
|
63
|
+
{ "name": "authorized", "type": "bool" }
|
|
64
|
+
],
|
|
65
|
+
"outputs": [],
|
|
66
|
+
"stateMutability": "nonpayable"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
"type": "function",
|
|
70
|
+
"name": "setHubSigningKey",
|
|
71
|
+
"inputs": [{ "name": "newKey", "type": "address" }],
|
|
72
|
+
"outputs": [],
|
|
73
|
+
"stateMutability": "nonpayable"
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
"type": "function",
|
|
77
|
+
"name": "transferOwnership",
|
|
78
|
+
"inputs": [{ "name": "newOwner", "type": "address" }],
|
|
79
|
+
"outputs": [],
|
|
80
|
+
"stateMutability": "nonpayable"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
"type": "function",
|
|
84
|
+
"name": "isProcessed",
|
|
85
|
+
"inputs": [
|
|
86
|
+
{
|
|
87
|
+
"name": "message",
|
|
88
|
+
"type": "tuple",
|
|
89
|
+
"components": [
|
|
90
|
+
{ "name": "id", "type": "uint256" },
|
|
91
|
+
{ "name": "sender", "type": "address" },
|
|
92
|
+
{ "name": "target", "type": "address" },
|
|
93
|
+
{ "name": "data", "type": "bytes" },
|
|
94
|
+
{ "name": "sourceChain", "type": "uint32" }
|
|
95
|
+
]
|
|
96
|
+
}
|
|
97
|
+
],
|
|
98
|
+
"outputs": [{ "name": "", "type": "bool" }],
|
|
99
|
+
"stateMutability": "view"
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
"type": "function",
|
|
103
|
+
"name": "getReceipt",
|
|
104
|
+
"inputs": [
|
|
105
|
+
{
|
|
106
|
+
"name": "message",
|
|
107
|
+
"type": "tuple",
|
|
108
|
+
"components": [
|
|
109
|
+
{ "name": "id", "type": "uint256" },
|
|
110
|
+
{ "name": "sender", "type": "address" },
|
|
111
|
+
{ "name": "target", "type": "address" },
|
|
112
|
+
{ "name": "data", "type": "bytes" },
|
|
113
|
+
{ "name": "sourceChain", "type": "uint32" }
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
],
|
|
117
|
+
"outputs": [
|
|
118
|
+
{ "name": "executed", "type": "bool" },
|
|
119
|
+
{ "name": "success", "type": "bool" },
|
|
120
|
+
{ "name": "timestamp", "type": "uint256" }
|
|
121
|
+
],
|
|
122
|
+
"stateMutability": "view"
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
"type": "function",
|
|
126
|
+
"name": "messageHub",
|
|
127
|
+
"inputs": [],
|
|
128
|
+
"outputs": [{ "name": "", "type": "address" }],
|
|
129
|
+
"stateMutability": "view"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
"type": "function",
|
|
133
|
+
"name": "owner",
|
|
134
|
+
"inputs": [],
|
|
135
|
+
"outputs": [{ "name": "", "type": "address" }],
|
|
136
|
+
"stateMutability": "view"
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
"type": "function",
|
|
140
|
+
"name": "hubSigningKey",
|
|
141
|
+
"inputs": [],
|
|
142
|
+
"outputs": [{ "name": "", "type": "address" }],
|
|
143
|
+
"stateMutability": "view"
|
|
144
|
+
},
|
|
145
|
+
{
|
|
146
|
+
"type": "function",
|
|
147
|
+
"name": "authorizedRelayers",
|
|
148
|
+
"inputs": [{ "name": "", "type": "address" }],
|
|
149
|
+
"outputs": [{ "name": "", "type": "bool" }],
|
|
150
|
+
"stateMutability": "view"
|
|
151
|
+
},
|
|
152
|
+
{
|
|
153
|
+
"type": "function",
|
|
154
|
+
"name": "processedMessages",
|
|
155
|
+
"inputs": [{ "name": "", "type": "bytes32" }],
|
|
156
|
+
"outputs": [{ "name": "", "type": "bool" }],
|
|
157
|
+
"stateMutability": "view"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
"type": "function",
|
|
161
|
+
"name": "totalExecuted",
|
|
162
|
+
"inputs": [],
|
|
163
|
+
"outputs": [{ "name": "", "type": "uint256" }],
|
|
164
|
+
"stateMutability": "view"
|
|
165
|
+
},
|
|
166
|
+
{
|
|
167
|
+
"type": "function",
|
|
168
|
+
"name": "totalFailed",
|
|
169
|
+
"inputs": [],
|
|
170
|
+
"outputs": [{ "name": "", "type": "uint256" }],
|
|
171
|
+
"stateMutability": "view"
|
|
172
|
+
},
|
|
173
|
+
{
|
|
174
|
+
"type": "event",
|
|
175
|
+
"name": "MessageReceived",
|
|
176
|
+
"inputs": [
|
|
177
|
+
{ "name": "messageId", "type": "uint256", "indexed": true },
|
|
178
|
+
{ "name": "sender", "type": "address", "indexed": true },
|
|
179
|
+
{ "name": "target", "type": "address", "indexed": true },
|
|
180
|
+
{ "name": "success", "type": "bool", "indexed": false }
|
|
181
|
+
]
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
"type": "event",
|
|
185
|
+
"name": "RelayerAuthorized",
|
|
186
|
+
"inputs": [
|
|
187
|
+
{ "name": "relayer", "type": "address", "indexed": true },
|
|
188
|
+
{ "name": "authorized", "type": "bool", "indexed": false }
|
|
189
|
+
]
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
"type": "event",
|
|
193
|
+
"name": "HubSigningKeyUpdated",
|
|
194
|
+
"inputs": [
|
|
195
|
+
{ "name": "newKey", "type": "address", "indexed": true }
|
|
196
|
+
]
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
"type": "event",
|
|
200
|
+
"name": "OwnershipTransferred",
|
|
201
|
+
"inputs": [
|
|
202
|
+
{ "name": "previousOwner", "type": "address", "indexed": true },
|
|
203
|
+
{ "name": "newOwner", "type": "address", "indexed": true }
|
|
204
|
+
]
|
|
205
|
+
},
|
|
206
|
+
{ "type": "error", "name": "NotRelayer", "inputs": [] },
|
|
207
|
+
{ "type": "error", "name": "AlreadyProcessed", "inputs": [{ "name": "msgHash", "type": "bytes32" }] },
|
|
208
|
+
{ "type": "error", "name": "InvalidSignature", "inputs": [] },
|
|
209
|
+
{ "type": "error", "name": "InvalidTarget", "inputs": [] },
|
|
210
|
+
{ "type": "error", "name": "Unauthorized", "inputs": [] }
|
|
211
|
+
]
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ChainConfig, ChainName } from './types';
|
|
2
|
+
/** MessageHub deployed on Arbitrum Sepolia (421614) */
|
|
3
|
+
export declare const MESSAGE_HUB_ADDRESS = "0x9a9e7Ec4EA29bb63fE7c38E124B253b44fF897Cc";
|
|
4
|
+
/** ArbiLinkReceiver addresses on each destination chain */
|
|
5
|
+
export declare const RECEIVER_ADDRESSES: Record<number, string>;
|
|
6
|
+
export declare const SUPPORTED_CHAINS: ChainConfig[];
|
|
7
|
+
/** Map chain short-names to numeric IDs */
|
|
8
|
+
export declare const CHAIN_IDS: Record<ChainName, number>;
|
|
9
|
+
/** Default challenge period in seconds (matches hub deployment param) */
|
|
10
|
+
export declare const DEFAULT_CHALLENGE_PERIOD_SECS = 300;
|
|
11
|
+
export declare const ARBITRUM_SEPOLIA_CHAIN_ID = 421614;
|
|
12
|
+
export declare const ARBITRUM_SEPOLIA_RPC = "https://sepolia-rollup.arbitrum.io/rpc";
|
|
13
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAItD,uDAAuD;AACvD,eAAO,MAAM,mBAAmB,+CAA+C,CAAC;AAEhF,2DAA2D;AAC3D,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAIrD,CAAC;AAIF,eAAO,MAAM,gBAAgB,EAAE,WAAW,EAyBzC,CAAC;AAEF,2CAA2C;AAC3C,eAAO,MAAM,SAAS,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAK/C,CAAC;AAIF,yEAAyE;AACzE,eAAO,MAAM,6BAA6B,MAAM,CAAC;AAIjD,eAAO,MAAM,yBAAyB,SAAS,CAAC;AAChD,eAAO,MAAM,oBAAoB,2CAA2C,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ARBITRUM_SEPOLIA_RPC = exports.ARBITRUM_SEPOLIA_CHAIN_ID = exports.DEFAULT_CHALLENGE_PERIOD_SECS = exports.CHAIN_IDS = exports.SUPPORTED_CHAINS = exports.RECEIVER_ADDRESSES = exports.MESSAGE_HUB_ADDRESS = void 0;
|
|
4
|
+
// ── Contract addresses ────────────────────────────────────────────────────────
|
|
5
|
+
/** MessageHub deployed on Arbitrum Sepolia (421614) */
|
|
6
|
+
exports.MESSAGE_HUB_ADDRESS = '0x9a9e7Ec4EA29bb63fE7c38E124B253b44fF897Cc';
|
|
7
|
+
/** ArbiLinkReceiver addresses on each destination chain */
|
|
8
|
+
exports.RECEIVER_ADDRESSES = {
|
|
9
|
+
11155111: '0x895058E57bBE8c84C2AABA5d61c4C739C5869F71', // Ethereum Sepolia
|
|
10
|
+
84532: '0xD45efE42904C9a27630A548A1FB6d9F133Cf5D35', // Base Sepolia
|
|
11
|
+
80002: '0x221B7Cca1C385C6c81e17b086C753328AF41AAAa', // Polygon Amoy
|
|
12
|
+
};
|
|
13
|
+
// ── Supported chains ──────────────────────────────────────────────────────────
|
|
14
|
+
exports.SUPPORTED_CHAINS = [
|
|
15
|
+
{
|
|
16
|
+
id: 11155111,
|
|
17
|
+
name: 'Ethereum Sepolia',
|
|
18
|
+
shortName: 'ethereum',
|
|
19
|
+
rpc: 'https://sepolia.infura.io/v3/',
|
|
20
|
+
explorer: 'https://sepolia.etherscan.io',
|
|
21
|
+
receiverAddress: exports.RECEIVER_ADDRESSES[11155111],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
id: 84532,
|
|
25
|
+
name: 'Base Sepolia',
|
|
26
|
+
shortName: 'base',
|
|
27
|
+
rpc: 'https://sepolia.base.org',
|
|
28
|
+
explorer: 'https://sepolia.basescan.org',
|
|
29
|
+
receiverAddress: exports.RECEIVER_ADDRESSES[84532],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
id: 80002,
|
|
33
|
+
name: 'Polygon Amoy',
|
|
34
|
+
shortName: 'polygon',
|
|
35
|
+
rpc: 'https://rpc-amoy.polygon.technology',
|
|
36
|
+
explorer: 'https://amoy.polygonscan.com',
|
|
37
|
+
receiverAddress: exports.RECEIVER_ADDRESSES[80002],
|
|
38
|
+
},
|
|
39
|
+
];
|
|
40
|
+
/** Map chain short-names to numeric IDs */
|
|
41
|
+
exports.CHAIN_IDS = {
|
|
42
|
+
ethereum: 11155111, // Sepolia
|
|
43
|
+
base: 84532, // Base Sepolia
|
|
44
|
+
polygon: 80002, // Amoy testnet
|
|
45
|
+
optimism: 11155420, // Optimism Sepolia
|
|
46
|
+
};
|
|
47
|
+
// ── Challenge window ──────────────────────────────────────────────────────────
|
|
48
|
+
/** Default challenge period in seconds (matches hub deployment param) */
|
|
49
|
+
exports.DEFAULT_CHALLENGE_PERIOD_SECS = 300; // 5 minutes
|
|
50
|
+
// ── Arbitrum Sepolia hub chain ────────────────────────────────────────────────
|
|
51
|
+
exports.ARBITRUM_SEPOLIA_CHAIN_ID = 421614;
|
|
52
|
+
exports.ARBITRUM_SEPOLIA_RPC = 'https://sepolia-rollup.arbitrum.io/rpc';
|
|
53
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../src/constants.ts"],"names":[],"mappings":";;;AAEA,iFAAiF;AAEjF,uDAAuD;AAC1C,QAAA,mBAAmB,GAAG,4CAA4C,CAAC;AAEhF,2DAA2D;AAC9C,QAAA,kBAAkB,GAA2B;IACxD,QAAQ,EAAE,4CAA4C,EAAE,mBAAmB;IAC3E,KAAK,EAAK,4CAA4C,EAAE,eAAe;IACvE,KAAK,EAAK,4CAA4C,EAAE,eAAe;CACxE,CAAC;AAEF,iFAAiF;AAEpE,QAAA,gBAAgB,GAAkB;IAC7C;QACE,EAAE,EAAe,QAAQ;QACzB,IAAI,EAAa,kBAAkB;QACnC,SAAS,EAAQ,UAAU;QAC3B,GAAG,EAAc,+BAA+B;QAChD,QAAQ,EAAS,8BAA8B;QAC/C,eAAe,EAAE,0BAAkB,CAAC,QAAQ,CAAC;KAC9C;IACD;QACE,EAAE,EAAe,KAAK;QACtB,IAAI,EAAa,cAAc;QAC/B,SAAS,EAAQ,MAAM;QACvB,GAAG,EAAc,0BAA0B;QAC3C,QAAQ,EAAS,8BAA8B;QAC/C,eAAe,EAAE,0BAAkB,CAAC,KAAK,CAAC;KAC3C;IACD;QACE,EAAE,EAAe,KAAK;QACtB,IAAI,EAAa,cAAc;QAC/B,SAAS,EAAQ,SAAS;QAC1B,GAAG,EAAc,qCAAqC;QACtD,QAAQ,EAAS,8BAA8B;QAC/C,eAAe,EAAE,0BAAkB,CAAC,KAAK,CAAC;KAC3C;CACF,CAAC;AAEF,2CAA2C;AAC9B,QAAA,SAAS,GAA8B;IAClD,QAAQ,EAAE,QAAQ,EAAE,UAAU;IAC9B,IAAI,EAAM,KAAK,EAAK,eAAe;IACnC,OAAO,EAAG,KAAK,EAAK,eAAe;IACnC,QAAQ,EAAE,QAAQ,EAAE,mBAAmB;CACxC,CAAC;AAEF,iFAAiF;AAEjF,yEAAyE;AAC5D,QAAA,6BAA6B,GAAG,GAAG,CAAC,CAAC,YAAY;AAE9D,iFAAiF;AAEpE,QAAA,yBAAyB,GAAG,MAAM,CAAC;AACnC,QAAA,oBAAoB,GAAG,wCAAwC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { ArbiLink } from './ArbiLink';
|
|
2
|
+
export type { ChainId, ChainName, ChainConfig, Message, MessageStatus, RelayerInfo, SendMessageParams, WatchOptions, } from './types';
|
|
3
|
+
export { ArbiLinkError } from './types';
|
|
4
|
+
export { encodeCall, formatMessageId, formatEth, statusLabel, resolveChainId, estimateDeliveryTime, parseStatusCode, } from './utils';
|
|
5
|
+
export { MESSAGE_HUB_ADDRESS, RECEIVER_ADDRESSES, SUPPORTED_CHAINS, CHAIN_IDS, ARBITRUM_SEPOLIA_CHAIN_ID, ARBITRUM_SEPOLIA_RPC, DEFAULT_CHALLENGE_PERIOD_SECS, } from './constants';
|
|
6
|
+
export { default as MessageHubABI } from './abi/MessageHub.json';
|
|
7
|
+
export { default as ReceiverABI } from './abi/Receiver.json';
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAGtC,YAAY,EACV,OAAO,EACP,SAAS,EACT,WAAW,EACX,OAAO,EACP,aAAa,EACb,WAAW,EACX,iBAAiB,EACjB,YAAY,GACb,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAGxC,OAAO,EACL,UAAU,EACV,eAAe,EACf,SAAS,EACT,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,eAAe,GAChB,MAAM,SAAS,CAAC;AAGjB,OAAO,EACL,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,SAAS,EACT,yBAAyB,EACzB,oBAAoB,EACpB,6BAA6B,GAC9B,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAQ,qBAAqB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ReceiverABI = exports.MessageHubABI = exports.DEFAULT_CHALLENGE_PERIOD_SECS = exports.ARBITRUM_SEPOLIA_RPC = exports.ARBITRUM_SEPOLIA_CHAIN_ID = exports.CHAIN_IDS = exports.SUPPORTED_CHAINS = exports.RECEIVER_ADDRESSES = exports.MESSAGE_HUB_ADDRESS = exports.parseStatusCode = exports.estimateDeliveryTime = exports.resolveChainId = exports.statusLabel = exports.formatEth = exports.formatMessageId = exports.encodeCall = exports.ArbiLinkError = exports.ArbiLink = void 0;
|
|
7
|
+
// Main SDK class
|
|
8
|
+
var ArbiLink_1 = require("./ArbiLink");
|
|
9
|
+
Object.defineProperty(exports, "ArbiLink", { enumerable: true, get: function () { return ArbiLink_1.ArbiLink; } });
|
|
10
|
+
var types_1 = require("./types");
|
|
11
|
+
Object.defineProperty(exports, "ArbiLinkError", { enumerable: true, get: function () { return types_1.ArbiLinkError; } });
|
|
12
|
+
// Utilities
|
|
13
|
+
var utils_1 = require("./utils");
|
|
14
|
+
Object.defineProperty(exports, "encodeCall", { enumerable: true, get: function () { return utils_1.encodeCall; } });
|
|
15
|
+
Object.defineProperty(exports, "formatMessageId", { enumerable: true, get: function () { return utils_1.formatMessageId; } });
|
|
16
|
+
Object.defineProperty(exports, "formatEth", { enumerable: true, get: function () { return utils_1.formatEth; } });
|
|
17
|
+
Object.defineProperty(exports, "statusLabel", { enumerable: true, get: function () { return utils_1.statusLabel; } });
|
|
18
|
+
Object.defineProperty(exports, "resolveChainId", { enumerable: true, get: function () { return utils_1.resolveChainId; } });
|
|
19
|
+
Object.defineProperty(exports, "estimateDeliveryTime", { enumerable: true, get: function () { return utils_1.estimateDeliveryTime; } });
|
|
20
|
+
Object.defineProperty(exports, "parseStatusCode", { enumerable: true, get: function () { return utils_1.parseStatusCode; } });
|
|
21
|
+
// Constants
|
|
22
|
+
var constants_1 = require("./constants");
|
|
23
|
+
Object.defineProperty(exports, "MESSAGE_HUB_ADDRESS", { enumerable: true, get: function () { return constants_1.MESSAGE_HUB_ADDRESS; } });
|
|
24
|
+
Object.defineProperty(exports, "RECEIVER_ADDRESSES", { enumerable: true, get: function () { return constants_1.RECEIVER_ADDRESSES; } });
|
|
25
|
+
Object.defineProperty(exports, "SUPPORTED_CHAINS", { enumerable: true, get: function () { return constants_1.SUPPORTED_CHAINS; } });
|
|
26
|
+
Object.defineProperty(exports, "CHAIN_IDS", { enumerable: true, get: function () { return constants_1.CHAIN_IDS; } });
|
|
27
|
+
Object.defineProperty(exports, "ARBITRUM_SEPOLIA_CHAIN_ID", { enumerable: true, get: function () { return constants_1.ARBITRUM_SEPOLIA_CHAIN_ID; } });
|
|
28
|
+
Object.defineProperty(exports, "ARBITRUM_SEPOLIA_RPC", { enumerable: true, get: function () { return constants_1.ARBITRUM_SEPOLIA_RPC; } });
|
|
29
|
+
Object.defineProperty(exports, "DEFAULT_CHALLENGE_PERIOD_SECS", { enumerable: true, get: function () { return constants_1.DEFAULT_CHALLENGE_PERIOD_SECS; } });
|
|
30
|
+
// ABIs (useful for integrators building their own wrappers)
|
|
31
|
+
var MessageHub_json_1 = require("./abi/MessageHub.json");
|
|
32
|
+
Object.defineProperty(exports, "MessageHubABI", { enumerable: true, get: function () { return __importDefault(MessageHub_json_1).default; } });
|
|
33
|
+
var Receiver_json_1 = require("./abi/Receiver.json");
|
|
34
|
+
Object.defineProperty(exports, "ReceiverABI", { enumerable: true, get: function () { return __importDefault(Receiver_json_1).default; } });
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;AAAA,iBAAiB;AACjB,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AAajB,iCAAwC;AAA/B,sGAAA,aAAa,OAAA;AAEtB,YAAY;AACZ,iCAQiB;AAPf,mGAAA,UAAU,OAAA;AACV,wGAAA,eAAe,OAAA;AACf,kGAAA,SAAS,OAAA;AACT,oGAAA,WAAW,OAAA;AACX,uGAAA,cAAc,OAAA;AACd,6GAAA,oBAAoB,OAAA;AACpB,wGAAA,eAAe,OAAA;AAGjB,YAAY;AACZ,yCAQqB;AAPnB,gHAAA,mBAAmB,OAAA;AACnB,+GAAA,kBAAkB,OAAA;AAClB,6GAAA,gBAAgB,OAAA;AAChB,sGAAA,SAAS,OAAA;AACT,sHAAA,yBAAyB,OAAA;AACzB,iHAAA,oBAAoB,OAAA;AACpB,0HAAA,6BAA6B,OAAA;AAG/B,4DAA4D;AAC5D,yDAAiE;AAAxD,iIAAA,OAAO,OAAiB;AACjC,qDAA+D;AAAtD,6HAAA,OAAO,OAAe"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export type ChainId = 11155111 | 84532 | 80002 | 11155420;
|
|
2
|
+
export type ChainName = 'ethereum' | 'base' | 'polygon' | 'optimism';
|
|
3
|
+
export interface ChainConfig {
|
|
4
|
+
id: number;
|
|
5
|
+
name: string;
|
|
6
|
+
shortName: ChainName;
|
|
7
|
+
rpc: string;
|
|
8
|
+
explorer: string;
|
|
9
|
+
receiverAddress: string;
|
|
10
|
+
}
|
|
11
|
+
/** On-chain status codes (matches STATUS_* constants in MessageHub) */
|
|
12
|
+
export type MessageStatus = 'pending' | 'relayed' | 'confirmed' | 'failed';
|
|
13
|
+
/** Full message record as returned by the SDK */
|
|
14
|
+
export interface Message {
|
|
15
|
+
id: bigint;
|
|
16
|
+
status: MessageStatus;
|
|
17
|
+
/** Sender address — populated from MessageSent event logs */
|
|
18
|
+
sender?: string;
|
|
19
|
+
/** Destination chain ID — populated from MessageSent event logs */
|
|
20
|
+
destinationChain?: number;
|
|
21
|
+
/** Target contract on the destination chain */
|
|
22
|
+
target?: string;
|
|
23
|
+
/** Encoded calldata for the target */
|
|
24
|
+
data?: string;
|
|
25
|
+
/** Protocol fee paid (in wei) — populated from MessageSent event logs */
|
|
26
|
+
feePaid?: bigint;
|
|
27
|
+
/** Relayer address, present once a relayer confirms delivery */
|
|
28
|
+
relayer?: string;
|
|
29
|
+
}
|
|
30
|
+
export interface SendMessageParams {
|
|
31
|
+
/** Destination chain – either a numeric chain ID or a supported chain name */
|
|
32
|
+
to: number | ChainName;
|
|
33
|
+
/** Target contract address on the destination chain */
|
|
34
|
+
target: string;
|
|
35
|
+
/** ABI-encoded function call (use encodeCall() from utils) */
|
|
36
|
+
data: string;
|
|
37
|
+
/** Override the auto-calculated fee (wei). Fetched from hub if omitted. */
|
|
38
|
+
fee?: bigint;
|
|
39
|
+
}
|
|
40
|
+
export interface WatchOptions {
|
|
41
|
+
/** Poll interval in ms when WebSocket is unavailable (default: 3000) */
|
|
42
|
+
pollIntervalMs?: number;
|
|
43
|
+
}
|
|
44
|
+
export interface RelayerInfo {
|
|
45
|
+
active: boolean;
|
|
46
|
+
stake: bigint;
|
|
47
|
+
}
|
|
48
|
+
export declare class ArbiLinkError extends Error {
|
|
49
|
+
readonly cause?: unknown | undefined;
|
|
50
|
+
constructor(message: string, cause?: unknown | undefined);
|
|
51
|
+
static from(err: unknown, context: string): ArbiLinkError;
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,OAAO,GAAG,QAAQ,GAAG,KAAK,GAAG,KAAK,GAAG,QAAQ,CAAC;AAE1D,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,MAAM,GAAG,SAAS,GAAG,UAAU,CAAC;AAErE,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,SAAS,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,EAAE,MAAM,CAAC;IACjB,eAAe,EAAE,MAAM,CAAC;CACzB;AAID,uEAAuE;AACvE,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,SAAS,GAAG,WAAW,GAAG,QAAQ,CAAC;AAE3E,iDAAiD;AACjD,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,aAAa,CAAC;IACtB,6DAA6D;IAC7D,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,mEAAmE;IACnE,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,sCAAsC;IACtC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yEAAyE;IACzE,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,gEAAgE;IAChE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAID,MAAM,WAAW,iBAAiB;IAChC,8EAA8E;IAC9E,EAAE,EAAE,MAAM,GAAG,SAAS,CAAC;IACvB,uDAAuD;IACvD,MAAM,EAAE,MAAM,CAAC;IACf,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,2EAA2E;IAC3E,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,MAAM,WAAW,YAAY;IAC3B,wEAAwE;IACxE,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAID,MAAM,WAAW,WAAW;IAC1B,MAAM,EAAE,OAAO,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;CACf;AAID,qBAAa,aAAc,SAAQ,KAAK;aAGpB,KAAK,CAAC,EAAE,OAAO;gBAD/B,OAAO,EAAE,MAAM,EACC,KAAK,CAAC,EAAE,OAAO,YAAA;IAQjC,MAAM,CAAC,IAAI,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,GAAG,aAAa;CAK1D"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// ── Chain types ───────────────────────────────────────────────────────────────
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ArbiLinkError = void 0;
|
|
5
|
+
// ── Error ─────────────────────────────────────────────────────────────────────
|
|
6
|
+
class ArbiLinkError extends Error {
|
|
7
|
+
constructor(message, cause) {
|
|
8
|
+
super(message);
|
|
9
|
+
this.cause = cause;
|
|
10
|
+
this.name = 'ArbiLinkError';
|
|
11
|
+
// Preserve prototype chain in compiled JS
|
|
12
|
+
Object.setPrototypeOf(this, ArbiLinkError.prototype);
|
|
13
|
+
}
|
|
14
|
+
static from(err, context) {
|
|
15
|
+
if (err instanceof ArbiLinkError)
|
|
16
|
+
return err;
|
|
17
|
+
const detail = err instanceof Error ? err.message : String(err);
|
|
18
|
+
return new ArbiLinkError(`${context}: ${detail}`, err);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.ArbiLinkError = ArbiLinkError;
|
|
22
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,iFAAiF;;;AA+DjF,iFAAiF;AAEjF,MAAa,aAAc,SAAQ,KAAK;IACtC,YACE,OAAe,EACC,KAAe;QAE/B,KAAK,CAAC,OAAO,CAAC,CAAC;QAFC,UAAK,GAAL,KAAK,CAAU;QAG/B,IAAI,CAAC,IAAI,GAAG,eAAe,CAAC;QAC5B,0CAA0C;QAC1C,MAAM,CAAC,cAAc,CAAC,IAAI,EAAE,aAAa,CAAC,SAAS,CAAC,CAAC;IACvD,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,GAAY,EAAE,OAAe;QACvC,IAAI,GAAG,YAAY,aAAa;YAAE,OAAO,GAAG,CAAC;QAC7C,MAAM,MAAM,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAChE,OAAO,IAAI,aAAa,CAAC,GAAG,OAAO,KAAK,MAAM,EAAE,EAAE,GAAG,CAAC,CAAC;IACzD,CAAC;CACF;AAhBD,sCAgBC"}
|
package/dist/utils.d.ts
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { type Abi } from 'viem';
|
|
2
|
+
import type { MessageStatus } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Encode a contract function call into hex calldata ready for cross-chain delivery.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* const data = encodeCall({
|
|
9
|
+
* abi: parseAbi(['function mint(address to, uint256 amount)']),
|
|
10
|
+
* functionName: 'mint',
|
|
11
|
+
* args: ['0x742d35Cc...', 1000n],
|
|
12
|
+
* });
|
|
13
|
+
* ```
|
|
14
|
+
*/
|
|
15
|
+
export declare function encodeCall(params: {
|
|
16
|
+
abi: Abi;
|
|
17
|
+
functionName: string;
|
|
18
|
+
args?: readonly unknown[];
|
|
19
|
+
}): string;
|
|
20
|
+
/**
|
|
21
|
+
* Format a numeric message ID as a zero-padded string.
|
|
22
|
+
* @example formatMessageId(42n) → "#000042"
|
|
23
|
+
*/
|
|
24
|
+
export declare function formatMessageId(id: bigint): string;
|
|
25
|
+
/**
|
|
26
|
+
* Human-readable label for a message status.
|
|
27
|
+
*/
|
|
28
|
+
export declare function statusLabel(status: MessageStatus): string;
|
|
29
|
+
/**
|
|
30
|
+
* Resolve a chain name or numeric ID to a numeric chain ID.
|
|
31
|
+
* Throws `ArbiLinkError` for unknown chains.
|
|
32
|
+
*/
|
|
33
|
+
export declare function resolveChainId(chain: number | string): number;
|
|
34
|
+
/**
|
|
35
|
+
* Estimate message delivery time in seconds for a given destination chain.
|
|
36
|
+
*
|
|
37
|
+
* This is a rough heuristic based on block times – actual delivery depends on
|
|
38
|
+
* relayer availability and the 5-minute challenge window.
|
|
39
|
+
*/
|
|
40
|
+
export declare function estimateDeliveryTime(chainId: number): number;
|
|
41
|
+
/**
|
|
42
|
+
* Convert the on-chain numeric status code to the SDK string representation.
|
|
43
|
+
*/
|
|
44
|
+
export declare function parseStatusCode(code: number): MessageStatus;
|
|
45
|
+
/**
|
|
46
|
+
* Format a wei value as a human-readable ETH string.
|
|
47
|
+
* @example formatEth(1_000_000_000_000_000n) → "0.001 ETH"
|
|
48
|
+
*/
|
|
49
|
+
export declare function formatEth(wei: bigint): string;
|
|
50
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../src/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,GAAG,EAAE,MAAM,MAAM,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AAK7C;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE;IACjC,GAAG,EAAE,GAAG,CAAC;IACT,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;CAC3B,GAAG,MAAM,CAMT;AAID;;;GAGG;AACH,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAElD;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,aAAa,GAAG,MAAM,CAQzD;AAID;;;GAGG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAU7D;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAW5D;AAMD;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,CAE3D;AAID;;;GAGG;AACH,wBAAgB,SAAS,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG7C"}
|