@gibs/bridge-sdk 1.10.1 → 1.12.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/package.json +12 -5
- package/src/abis.ts +3 -70
- package/src/chain-info.test.ts +968 -0
- package/src/chain-info.ts +161 -127
- package/src/chains.test.ts +123 -0
- package/src/chains.ts +5 -5
- package/src/config.test.ts +679 -0
- package/src/config.ts +138 -118
- package/src/fee-type.test.ts +45 -0
- package/src/fee-type.ts +2 -2
- package/src/image-links.test.ts +160 -0
- package/src/image-links.ts +20 -16
- package/src/index.ts +8 -8
- package/src/settings.test.ts +2754 -0
- package/src/settings.ts +325 -348
- package/src/types.ts +25 -25
- package/tsconfig.json +2 -1
- package/vitest.config.ts +13 -0
- package/dist/src/abis.d.ts +0 -384
- package/dist/src/abis.js +0 -68
- package/dist/src/chain-info.d.ts +0 -130
- package/dist/src/chain-info.js +0 -350
- package/dist/src/chains.d.ts +0 -6
- package/dist/src/chains.js +0 -86
- package/dist/src/config.d.ts +0 -136
- package/dist/src/config.js +0 -386
- package/dist/src/fee-type.d.ts +0 -10
- package/dist/src/fee-type.js +0 -9
- package/dist/src/image-links.d.ts +0 -41
- package/dist/src/image-links.js +0 -45
- package/dist/src/index.d.ts +0 -8
- package/dist/src/index.js +0 -8
- package/dist/src/settings.d.ts +0 -357
- package/dist/src/settings.js +0 -642
- package/dist/src/types.d.ts +0 -44
- package/dist/src/types.js +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
package/src/types.ts
CHANGED
|
@@ -1,48 +1,48 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { Chains, Provider } from './config.js'
|
|
1
|
+
import type { Chain, Hex } from 'viem';
|
|
2
|
+
import type { Chains, Provider } from './config.js';
|
|
3
3
|
|
|
4
4
|
/** The per network bridge link */
|
|
5
5
|
export type PerNetworkBridgeLink = {
|
|
6
|
-
tokenAddress: Hex
|
|
7
|
-
}
|
|
6
|
+
tokenAddress: Hex;
|
|
7
|
+
};
|
|
8
8
|
/** The extensions for a token */
|
|
9
9
|
export type Extensions = {
|
|
10
|
-
wrapped?: { address: Hex }
|
|
11
|
-
bridgeInfo?: Record<number, PerNetworkBridgeLink
|
|
12
|
-
}
|
|
10
|
+
wrapped?: { address: Hex };
|
|
11
|
+
bridgeInfo?: Record<number, PerNetworkBridgeLink>;
|
|
12
|
+
};
|
|
13
13
|
|
|
14
14
|
/** The metadata for a token */
|
|
15
15
|
export type TokenMetadata = {
|
|
16
|
-
name: string
|
|
17
|
-
symbol: string
|
|
18
|
-
decimals: number
|
|
19
|
-
}
|
|
16
|
+
name: string;
|
|
17
|
+
symbol: string;
|
|
18
|
+
decimals: number;
|
|
19
|
+
};
|
|
20
20
|
|
|
21
21
|
/** The token for a given asset */
|
|
22
22
|
export type Token = TokenMetadata & {
|
|
23
|
-
address: string
|
|
24
|
-
chainId: number
|
|
25
|
-
logoURI: string | null
|
|
26
|
-
extensions?: Extensions
|
|
27
|
-
}
|
|
23
|
+
address: string;
|
|
24
|
+
chainId: number;
|
|
25
|
+
logoURI: string | null;
|
|
26
|
+
extensions?: Extensions;
|
|
27
|
+
};
|
|
28
28
|
|
|
29
29
|
/** The token out for a given asset */
|
|
30
|
-
export type TokenOut = Omit<Token, 'address'> & { address: string | null }
|
|
30
|
+
export type TokenOut = Omit<Token, 'address'> & { address: string | null };
|
|
31
31
|
|
|
32
32
|
/** The token list for a given asset */
|
|
33
33
|
export type TokenList = {
|
|
34
|
-
tokens: Token[]
|
|
35
|
-
}
|
|
34
|
+
tokens: Token[];
|
|
35
|
+
};
|
|
36
36
|
|
|
37
37
|
/** The bridge key for a given provider, from chain, and to chain */
|
|
38
|
-
export type BridgeKey = [Provider, Chains, Chains]
|
|
38
|
+
export type BridgeKey = [Provider, Chains, Chains];
|
|
39
39
|
|
|
40
40
|
/** The visual chain for a given chain */
|
|
41
41
|
export type VisualChain = Chain & {
|
|
42
|
-
chainId: Chains
|
|
43
|
-
logoURI: string
|
|
44
|
-
alt: string
|
|
45
|
-
}
|
|
42
|
+
chainId: Chains;
|
|
43
|
+
logoURI: string;
|
|
44
|
+
alt: string;
|
|
45
|
+
};
|
|
46
46
|
|
|
47
47
|
/** The metadata for a chain */
|
|
48
|
-
export type ChainsMetadata = Record<Chains, VisualChain
|
|
48
|
+
export type ChainsMetadata = Record<Chains, VisualChain>;
|
package/tsconfig.json
CHANGED
package/vitest.config.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { defineConfig } from 'vitest/config';
|
|
2
|
+
|
|
3
|
+
export default defineConfig({
|
|
4
|
+
test: {
|
|
5
|
+
globals: true,
|
|
6
|
+
environment: 'node',
|
|
7
|
+
coverage: {
|
|
8
|
+
provider: 'v8',
|
|
9
|
+
reporter: ['text', 'json', 'html'],
|
|
10
|
+
exclude: ['node_modules/**', 'dist/**', '**/*.config.ts', '**/*.d.ts'],
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
});
|
package/dist/src/abis.d.ts
DELETED
|
@@ -1,384 +0,0 @@
|
|
|
1
|
-
/** the abi for the input bridge */
|
|
2
|
-
export declare const inputBridge: readonly [{
|
|
3
|
-
readonly name: "minPerTx";
|
|
4
|
-
readonly type: "function";
|
|
5
|
-
readonly stateMutability: "view";
|
|
6
|
-
readonly inputs: readonly [{
|
|
7
|
-
readonly type: "address";
|
|
8
|
-
readonly name: "token";
|
|
9
|
-
}];
|
|
10
|
-
readonly outputs: readonly [{
|
|
11
|
-
readonly type: "uint256";
|
|
12
|
-
}];
|
|
13
|
-
}, {
|
|
14
|
-
readonly name: "foreignTokenAddress";
|
|
15
|
-
readonly type: "function";
|
|
16
|
-
readonly stateMutability: "view";
|
|
17
|
-
readonly inputs: readonly [{
|
|
18
|
-
readonly type: "address";
|
|
19
|
-
readonly name: "token";
|
|
20
|
-
}];
|
|
21
|
-
readonly outputs: readonly [{
|
|
22
|
-
readonly type: "address";
|
|
23
|
-
}];
|
|
24
|
-
}, {
|
|
25
|
-
readonly name: "homeTokenAddress";
|
|
26
|
-
readonly type: "function";
|
|
27
|
-
readonly stateMutability: "view";
|
|
28
|
-
readonly inputs: readonly [{
|
|
29
|
-
readonly type: "address";
|
|
30
|
-
readonly name: "token";
|
|
31
|
-
}];
|
|
32
|
-
readonly outputs: readonly [{
|
|
33
|
-
readonly type: "address";
|
|
34
|
-
}];
|
|
35
|
-
}, {
|
|
36
|
-
readonly name: "bridgedTokenAddress";
|
|
37
|
-
readonly type: "function";
|
|
38
|
-
readonly stateMutability: "view";
|
|
39
|
-
readonly inputs: readonly [{
|
|
40
|
-
readonly type: "address";
|
|
41
|
-
readonly name: "token";
|
|
42
|
-
}];
|
|
43
|
-
readonly outputs: readonly [{
|
|
44
|
-
readonly type: "address";
|
|
45
|
-
}];
|
|
46
|
-
}, {
|
|
47
|
-
readonly name: "nativeTokenAddress";
|
|
48
|
-
readonly type: "function";
|
|
49
|
-
readonly stateMutability: "view";
|
|
50
|
-
readonly inputs: readonly [{
|
|
51
|
-
readonly type: "address";
|
|
52
|
-
readonly name: "token";
|
|
53
|
-
}];
|
|
54
|
-
readonly outputs: readonly [{
|
|
55
|
-
readonly type: "address";
|
|
56
|
-
}];
|
|
57
|
-
}, {
|
|
58
|
-
readonly name: "feeManager";
|
|
59
|
-
readonly type: "function";
|
|
60
|
-
readonly stateMutability: "view";
|
|
61
|
-
readonly inputs: readonly [];
|
|
62
|
-
readonly outputs: readonly [{
|
|
63
|
-
readonly type: "address";
|
|
64
|
-
}];
|
|
65
|
-
}, {
|
|
66
|
-
readonly name: "relayTokensAndCall";
|
|
67
|
-
readonly type: "function";
|
|
68
|
-
readonly stateMutability: "nonpayable";
|
|
69
|
-
readonly inputs: readonly [{
|
|
70
|
-
readonly type: "address";
|
|
71
|
-
readonly name: "token";
|
|
72
|
-
}, {
|
|
73
|
-
readonly type: "address";
|
|
74
|
-
readonly name: "_receiver";
|
|
75
|
-
}, {
|
|
76
|
-
readonly type: "uint256";
|
|
77
|
-
readonly name: "_value";
|
|
78
|
-
}, {
|
|
79
|
-
readonly type: "bytes";
|
|
80
|
-
readonly name: "_data";
|
|
81
|
-
}];
|
|
82
|
-
readonly outputs: readonly [];
|
|
83
|
-
}, {
|
|
84
|
-
readonly name: "relayTokens";
|
|
85
|
-
readonly type: "function";
|
|
86
|
-
readonly stateMutability: "nonpayable";
|
|
87
|
-
readonly inputs: readonly [{
|
|
88
|
-
readonly type: "address";
|
|
89
|
-
readonly name: "token";
|
|
90
|
-
}, {
|
|
91
|
-
readonly type: "address";
|
|
92
|
-
readonly name: "_receiver";
|
|
93
|
-
}, {
|
|
94
|
-
readonly type: "uint256";
|
|
95
|
-
readonly name: "_value";
|
|
96
|
-
}];
|
|
97
|
-
readonly outputs: readonly [];
|
|
98
|
-
}];
|
|
99
|
-
/** the abi for the input bridge with extra input for the sender origin (tokensex) */
|
|
100
|
-
export declare const inputBridgeExtraInput: readonly [{
|
|
101
|
-
readonly name: "relayTokensAndCall";
|
|
102
|
-
readonly type: "function";
|
|
103
|
-
readonly stateMutability: "nonpayable";
|
|
104
|
-
readonly inputs: readonly [{
|
|
105
|
-
readonly type: "address";
|
|
106
|
-
readonly name: "token";
|
|
107
|
-
}, {
|
|
108
|
-
readonly type: "address";
|
|
109
|
-
readonly name: "_receiver";
|
|
110
|
-
}, {
|
|
111
|
-
readonly type: "uint256";
|
|
112
|
-
readonly name: "_value";
|
|
113
|
-
}, {
|
|
114
|
-
readonly type: "bytes";
|
|
115
|
-
readonly name: "_data";
|
|
116
|
-
}, {
|
|
117
|
-
readonly type: "address";
|
|
118
|
-
readonly name: "_senderOrigin";
|
|
119
|
-
}];
|
|
120
|
-
readonly outputs: readonly [];
|
|
121
|
-
}, {
|
|
122
|
-
readonly name: "relayTokens";
|
|
123
|
-
readonly type: "function";
|
|
124
|
-
readonly stateMutability: "nonpayable";
|
|
125
|
-
readonly inputs: readonly [{
|
|
126
|
-
readonly type: "address";
|
|
127
|
-
readonly name: "token";
|
|
128
|
-
}, {
|
|
129
|
-
readonly type: "address";
|
|
130
|
-
readonly name: "_receiver";
|
|
131
|
-
}, {
|
|
132
|
-
readonly type: "uint256";
|
|
133
|
-
readonly name: "_value";
|
|
134
|
-
}, {
|
|
135
|
-
readonly type: "address";
|
|
136
|
-
readonly name: "_senderOrigin";
|
|
137
|
-
}];
|
|
138
|
-
readonly outputs: readonly [];
|
|
139
|
-
}];
|
|
140
|
-
/** the abi for erc677 tokens */
|
|
141
|
-
export declare const erc677: readonly [{
|
|
142
|
-
readonly name: "transferAndCall";
|
|
143
|
-
readonly type: "function";
|
|
144
|
-
readonly stateMutability: "nonpayable";
|
|
145
|
-
readonly inputs: readonly [{
|
|
146
|
-
readonly type: "address";
|
|
147
|
-
}, {
|
|
148
|
-
readonly type: "uint256";
|
|
149
|
-
}, {
|
|
150
|
-
readonly type: "bytes";
|
|
151
|
-
}];
|
|
152
|
-
readonly outputs: readonly [];
|
|
153
|
-
}];
|
|
154
|
-
/** the abi for erc677 tokens bridge with extra input for the sender origin (tokensex) */
|
|
155
|
-
export declare const erc677ExtraInput: readonly [{
|
|
156
|
-
readonly name: "transferAndCall";
|
|
157
|
-
readonly type: "function";
|
|
158
|
-
readonly stateMutability: "nonpayable";
|
|
159
|
-
readonly inputs: readonly [{
|
|
160
|
-
readonly type: "address";
|
|
161
|
-
}, {
|
|
162
|
-
readonly type: "uint256";
|
|
163
|
-
}, {
|
|
164
|
-
readonly type: "bytes";
|
|
165
|
-
}, {
|
|
166
|
-
readonly type: "address";
|
|
167
|
-
readonly name: "sender";
|
|
168
|
-
}];
|
|
169
|
-
readonly outputs: readonly [];
|
|
170
|
-
}];
|
|
171
|
-
/** the abi to read data from the output router */
|
|
172
|
-
export declare const outputRouter: readonly [{
|
|
173
|
-
readonly name: "onTokenBridged";
|
|
174
|
-
readonly type: "function";
|
|
175
|
-
readonly stateMutability: "payable";
|
|
176
|
-
readonly inputs: readonly [{
|
|
177
|
-
readonly type: "address";
|
|
178
|
-
readonly name: "_token";
|
|
179
|
-
}, {
|
|
180
|
-
readonly type: "uint256";
|
|
181
|
-
readonly name: "_value";
|
|
182
|
-
}, {
|
|
183
|
-
readonly type: "bytes";
|
|
184
|
-
readonly name: "_data";
|
|
185
|
-
}];
|
|
186
|
-
readonly outputs: readonly [];
|
|
187
|
-
}, {
|
|
188
|
-
readonly name: "WETH";
|
|
189
|
-
readonly type: "function";
|
|
190
|
-
readonly stateMutability: "view";
|
|
191
|
-
readonly inputs: readonly [];
|
|
192
|
-
readonly outputs: readonly [{
|
|
193
|
-
readonly type: "address";
|
|
194
|
-
}];
|
|
195
|
-
}, {
|
|
196
|
-
readonly name: "bridge";
|
|
197
|
-
readonly type: "function";
|
|
198
|
-
readonly stateMutability: "view";
|
|
199
|
-
readonly inputs: readonly [];
|
|
200
|
-
readonly outputs: readonly [{
|
|
201
|
-
readonly type: "address";
|
|
202
|
-
}];
|
|
203
|
-
}, {
|
|
204
|
-
readonly name: "safeExecuteSignaturesWithAutoGasLimit";
|
|
205
|
-
readonly type: "function";
|
|
206
|
-
readonly stateMutability: "payable";
|
|
207
|
-
readonly inputs: readonly [{
|
|
208
|
-
readonly type: "address";
|
|
209
|
-
readonly name: "runner";
|
|
210
|
-
}, {
|
|
211
|
-
readonly type: "bytes";
|
|
212
|
-
readonly name: "_data";
|
|
213
|
-
}, {
|
|
214
|
-
readonly type: "bytes";
|
|
215
|
-
readonly name: "_signatures";
|
|
216
|
-
}];
|
|
217
|
-
readonly outputs: readonly [];
|
|
218
|
-
}];
|
|
219
|
-
/** the abi for the output bridge */
|
|
220
|
-
export declare const outputBridge: readonly [{
|
|
221
|
-
readonly name: "bridgeContract";
|
|
222
|
-
readonly type: "function";
|
|
223
|
-
readonly stateMutability: "view";
|
|
224
|
-
readonly inputs: readonly [];
|
|
225
|
-
readonly outputs: readonly [{
|
|
226
|
-
readonly type: "address";
|
|
227
|
-
}];
|
|
228
|
-
}];
|
|
229
|
-
/** the abi for the fee manager */
|
|
230
|
-
export declare const feeManager: readonly [{
|
|
231
|
-
readonly name: "HOME_TO_FOREIGN_FEE";
|
|
232
|
-
readonly type: "function";
|
|
233
|
-
readonly stateMutability: "view";
|
|
234
|
-
readonly inputs: readonly [];
|
|
235
|
-
readonly outputs: readonly [{
|
|
236
|
-
readonly type: "bytes32";
|
|
237
|
-
}];
|
|
238
|
-
}, {
|
|
239
|
-
readonly name: "FOREIGN_TO_HOME_FEE";
|
|
240
|
-
readonly type: "function";
|
|
241
|
-
readonly stateMutability: "view";
|
|
242
|
-
readonly inputs: readonly [];
|
|
243
|
-
readonly outputs: readonly [{
|
|
244
|
-
readonly type: "bytes32";
|
|
245
|
-
}];
|
|
246
|
-
}, {
|
|
247
|
-
readonly name: "getFee";
|
|
248
|
-
readonly type: "function";
|
|
249
|
-
readonly stateMutability: "view";
|
|
250
|
-
readonly inputs: readonly [{
|
|
251
|
-
readonly type: "bytes32";
|
|
252
|
-
}, {
|
|
253
|
-
readonly type: "address";
|
|
254
|
-
}];
|
|
255
|
-
readonly outputs: readonly [{
|
|
256
|
-
readonly type: "uint256";
|
|
257
|
-
}];
|
|
258
|
-
}];
|
|
259
|
-
/** the abi for the native router */
|
|
260
|
-
export declare const nativeRouter: readonly [{
|
|
261
|
-
readonly name: "wrapAndRelayTokens";
|
|
262
|
-
readonly type: "function";
|
|
263
|
-
readonly stateMutability: "payable";
|
|
264
|
-
readonly inputs: readonly [{
|
|
265
|
-
readonly type: "address";
|
|
266
|
-
readonly name: "receiver";
|
|
267
|
-
}];
|
|
268
|
-
readonly outputs: readonly [];
|
|
269
|
-
}, {
|
|
270
|
-
readonly name: "relayTokensAndCall";
|
|
271
|
-
readonly type: "function";
|
|
272
|
-
readonly stateMutability: "payable";
|
|
273
|
-
readonly inputs: readonly [{
|
|
274
|
-
readonly type: "address";
|
|
275
|
-
readonly name: "receiver";
|
|
276
|
-
}, {
|
|
277
|
-
readonly type: "bytes";
|
|
278
|
-
readonly name: "data";
|
|
279
|
-
}];
|
|
280
|
-
readonly outputs: readonly [];
|
|
281
|
-
}];
|
|
282
|
-
/** the abi for the native router with extra input for the sender origin (tokensex) */
|
|
283
|
-
export declare const nativeRouterExtraInput: readonly [{
|
|
284
|
-
readonly name: "wrapAndRelayTokens";
|
|
285
|
-
readonly type: "function";
|
|
286
|
-
readonly stateMutability: "payable";
|
|
287
|
-
readonly inputs: readonly [{
|
|
288
|
-
readonly type: "address";
|
|
289
|
-
readonly name: "receiver";
|
|
290
|
-
}, {
|
|
291
|
-
readonly type: "address";
|
|
292
|
-
readonly name: "sender";
|
|
293
|
-
}];
|
|
294
|
-
readonly outputs: readonly [];
|
|
295
|
-
}, {
|
|
296
|
-
readonly name: "relayTokensAndCall";
|
|
297
|
-
readonly type: "function";
|
|
298
|
-
readonly stateMutability: "payable";
|
|
299
|
-
readonly inputs: readonly [{
|
|
300
|
-
readonly type: "address";
|
|
301
|
-
readonly name: "receiver";
|
|
302
|
-
}, {
|
|
303
|
-
readonly type: "bytes";
|
|
304
|
-
readonly name: "data";
|
|
305
|
-
}, {
|
|
306
|
-
readonly type: "address";
|
|
307
|
-
readonly name: "sender";
|
|
308
|
-
}];
|
|
309
|
-
readonly outputs: readonly [];
|
|
310
|
-
}];
|
|
311
|
-
/** the abi for the univ2 router */
|
|
312
|
-
export declare const univ2Router: readonly [{
|
|
313
|
-
readonly name: "getAmountsOut";
|
|
314
|
-
readonly type: "function";
|
|
315
|
-
readonly stateMutability: "view";
|
|
316
|
-
readonly inputs: readonly [{
|
|
317
|
-
readonly type: "uint256";
|
|
318
|
-
readonly name: "amountIn";
|
|
319
|
-
}, {
|
|
320
|
-
readonly type: "address[]";
|
|
321
|
-
readonly name: "path";
|
|
322
|
-
}];
|
|
323
|
-
readonly outputs: readonly [{
|
|
324
|
-
readonly type: "uint256[]";
|
|
325
|
-
}];
|
|
326
|
-
}];
|
|
327
|
-
/** the abi for the fee delivery struct */
|
|
328
|
-
export declare const feeDeliveryStruct: readonly [{
|
|
329
|
-
readonly type: "tuple";
|
|
330
|
-
readonly components: readonly [{
|
|
331
|
-
readonly type: "address";
|
|
332
|
-
}, {
|
|
333
|
-
readonly type: "uint256";
|
|
334
|
-
}, {
|
|
335
|
-
readonly type: "uint256";
|
|
336
|
-
}, {
|
|
337
|
-
readonly type: "uint256";
|
|
338
|
-
}];
|
|
339
|
-
}];
|
|
340
|
-
/** the abi for the relay tokens direct */
|
|
341
|
-
export declare const relayTokensDirect: readonly [{
|
|
342
|
-
readonly name: "safeExecuteSignaturesWithAutoGasLimit";
|
|
343
|
-
readonly type: "function";
|
|
344
|
-
readonly stateMutability: "nonpayable";
|
|
345
|
-
readonly inputs: readonly [{
|
|
346
|
-
readonly type: "bytes";
|
|
347
|
-
readonly name: "data";
|
|
348
|
-
}, {
|
|
349
|
-
readonly type: "bytes";
|
|
350
|
-
readonly name: "signatures";
|
|
351
|
-
}];
|
|
352
|
-
readonly outputs: readonly [];
|
|
353
|
-
}];
|
|
354
|
-
/** the abi for the home amb */
|
|
355
|
-
export declare const homeAmb: readonly [{
|
|
356
|
-
readonly name: "submitSignature";
|
|
357
|
-
readonly type: "function";
|
|
358
|
-
readonly stateMutability: "nonpayable";
|
|
359
|
-
readonly inputs: readonly [{
|
|
360
|
-
readonly type: "bytes";
|
|
361
|
-
readonly name: "message";
|
|
362
|
-
}, {
|
|
363
|
-
readonly type: "bytes";
|
|
364
|
-
readonly name: "signature";
|
|
365
|
-
}];
|
|
366
|
-
readonly outputs: readonly [];
|
|
367
|
-
}];
|
|
368
|
-
/** the abi for the univ2 pair */
|
|
369
|
-
export declare const pair: readonly [{
|
|
370
|
-
readonly name: "getReserves";
|
|
371
|
-
readonly type: "function";
|
|
372
|
-
readonly stateMutability: "view";
|
|
373
|
-
readonly inputs: readonly [];
|
|
374
|
-
readonly outputs: readonly [{
|
|
375
|
-
readonly type: "uint112";
|
|
376
|
-
readonly name: "reserve0";
|
|
377
|
-
}, {
|
|
378
|
-
readonly type: "uint112";
|
|
379
|
-
readonly name: "reserve1";
|
|
380
|
-
}, {
|
|
381
|
-
readonly type: "uint32";
|
|
382
|
-
readonly name: "blockTimestampLast";
|
|
383
|
-
}];
|
|
384
|
-
}];
|
package/dist/src/abis.js
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
import { parseAbi, parseAbiParameters } from 'viem';
|
|
2
|
-
/** the abi for the input bridge */
|
|
3
|
-
export const inputBridge = parseAbi([
|
|
4
|
-
'function minPerTx(address token) external view returns(uint256)',
|
|
5
|
-
'function foreignTokenAddress(address token) external view returns(address)',
|
|
6
|
-
'function homeTokenAddress(address token) external view returns(address)',
|
|
7
|
-
'function bridgedTokenAddress(address token) external view returns(address)',
|
|
8
|
-
'function nativeTokenAddress(address token) external view returns(address)',
|
|
9
|
-
'function feeManager() external view returns(address)',
|
|
10
|
-
'function relayTokensAndCall(address token, address _receiver, uint256 _value, bytes memory _data) external',
|
|
11
|
-
'function relayTokens(address token, address _receiver, uint256 _value) external',
|
|
12
|
-
]);
|
|
13
|
-
/** the abi for the input bridge with extra input for the sender origin (tokensex) */
|
|
14
|
-
export const inputBridgeExtraInput = parseAbi([
|
|
15
|
-
'function relayTokensAndCall(address token, address _receiver, uint256 _value, bytes memory _data, address _senderOrigin) external',
|
|
16
|
-
'function relayTokens(address token, address _receiver, uint256 _value, address _senderOrigin) external',
|
|
17
|
-
]);
|
|
18
|
-
/** the abi for erc677 tokens */
|
|
19
|
-
export const erc677 = parseAbi([
|
|
20
|
-
'function transferAndCall(address, uint256, bytes calldata) external',
|
|
21
|
-
]);
|
|
22
|
-
/** the abi for erc677 tokens bridge with extra input for the sender origin (tokensex) */
|
|
23
|
-
export const erc677ExtraInput = parseAbi([
|
|
24
|
-
'function transferAndCall(address, uint256, bytes calldata, address sender) external',
|
|
25
|
-
]);
|
|
26
|
-
/** the abi to read data from the output router */
|
|
27
|
-
export const outputRouter = parseAbi([
|
|
28
|
-
'function onTokenBridged(address _token, uint256 _value, bytes memory _data) external payable',
|
|
29
|
-
'function WETH() external view returns(address)',
|
|
30
|
-
'function bridge() external view returns(address)',
|
|
31
|
-
'function safeExecuteSignaturesWithAutoGasLimit(address runner,bytes calldata _data,bytes calldata _signatures) external payable',
|
|
32
|
-
]);
|
|
33
|
-
/** the abi for the output bridge */
|
|
34
|
-
export const outputBridge = parseAbi(['function bridgeContract() external view returns(address)']);
|
|
35
|
-
/** the abi for the fee manager */
|
|
36
|
-
export const feeManager = parseAbi([
|
|
37
|
-
'function HOME_TO_FOREIGN_FEE() public view returns(bytes32)',
|
|
38
|
-
'function FOREIGN_TO_HOME_FEE() public view returns(bytes32)',
|
|
39
|
-
'function getFee(bytes32, address) public view returns(uint256)',
|
|
40
|
-
]);
|
|
41
|
-
/** the abi for the native router */
|
|
42
|
-
export const nativeRouter = parseAbi([
|
|
43
|
-
'function wrapAndRelayTokens(address receiver) external payable',
|
|
44
|
-
'function relayTokensAndCall(address receiver, bytes calldata data) external payable',
|
|
45
|
-
]);
|
|
46
|
-
/** the abi for the native router with extra input for the sender origin (tokensex) */
|
|
47
|
-
export const nativeRouterExtraInput = parseAbi([
|
|
48
|
-
'function wrapAndRelayTokens(address receiver, address sender) external payable',
|
|
49
|
-
'function relayTokensAndCall(address receiver, bytes calldata data, address sender) external payable',
|
|
50
|
-
]);
|
|
51
|
-
/** the abi for the univ2 router */
|
|
52
|
-
export const univ2Router = parseAbi([
|
|
53
|
-
'function getAmountsOut(uint256 amountIn, address[] calldata path) external view returns(uint256[] memory)',
|
|
54
|
-
]);
|
|
55
|
-
/** the abi for the fee delivery struct */
|
|
56
|
-
export const feeDeliveryStruct = parseAbiParameters('(address, uint256, uint256, uint256)');
|
|
57
|
-
/** the abi for the relay tokens direct */
|
|
58
|
-
export const relayTokensDirect = parseAbi([
|
|
59
|
-
'function safeExecuteSignaturesWithAutoGasLimit(bytes calldata data, bytes calldata signatures) external',
|
|
60
|
-
]);
|
|
61
|
-
/** the abi for the home amb */
|
|
62
|
-
export const homeAmb = parseAbi([
|
|
63
|
-
'function submitSignature(bytes message, bytes signature) external',
|
|
64
|
-
]);
|
|
65
|
-
/** the abi for the univ2 pair */
|
|
66
|
-
export const pair = parseAbi([
|
|
67
|
-
'function getReserves() view returns (uint112 reserve0, uint112 reserve1, uint32 blockTimestampLast)',
|
|
68
|
-
]);
|
package/dist/src/chain-info.d.ts
DELETED
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
import { type Hex, type PublicClient } from "viem";
|
|
2
|
-
import { Chains, type Pathway } from "./config.js";
|
|
3
|
-
import type { BridgeKey, Token } from "./types.js";
|
|
4
|
-
import _ from "lodash";
|
|
5
|
-
export type TokenBridgeInfo = {
|
|
6
|
-
originationChainId: Chains;
|
|
7
|
-
assetInAddress: Hex;
|
|
8
|
-
assetOutAddress: Hex | null;
|
|
9
|
-
toForeign?: {
|
|
10
|
-
home: Hex;
|
|
11
|
-
foreign: Hex | null;
|
|
12
|
-
};
|
|
13
|
-
toHome?: {
|
|
14
|
-
home: Hex | null;
|
|
15
|
-
foreign: Hex;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* Returns the bridged token address and native token address
|
|
20
|
-
* @param chainId - the chain id being targeted
|
|
21
|
-
* @param target - the target
|
|
22
|
-
* @param address - the address
|
|
23
|
-
* @param client - the client
|
|
24
|
-
* @returns the bridged token address and native token address
|
|
25
|
-
*/
|
|
26
|
-
export declare const links: (({ chainId, target, address, client }: {
|
|
27
|
-
chainId: number;
|
|
28
|
-
target: Hex;
|
|
29
|
-
address: Hex;
|
|
30
|
-
client: PublicClient;
|
|
31
|
-
}) => Promise<[`0x${string}`, `0x${string}`]>) & _.MemoizedFunction;
|
|
32
|
-
/**
|
|
33
|
-
* Returns the token bridge info for the given bridge key, asset in, is prod, from chain client, and to chain client
|
|
34
|
-
* @param bridgeKey - the bridge key
|
|
35
|
-
* @param assetIn - the asset in
|
|
36
|
-
* @param isProd - whether to use the production pathway
|
|
37
|
-
* @param fromChainClient - the from chain client
|
|
38
|
-
* @param toChainClient - the to chain client
|
|
39
|
-
* @returns the token bridge info
|
|
40
|
-
*/
|
|
41
|
-
export declare const tokenBridgeInfo: ({ bridgeKey, assetIn, isProd, fromChainClient, toChainClient, }: {
|
|
42
|
-
bridgeKey: BridgeKey;
|
|
43
|
-
assetIn: Token | null;
|
|
44
|
-
isProd: boolean;
|
|
45
|
-
fromChainClient: PublicClient;
|
|
46
|
-
toChainClient: PublicClient;
|
|
47
|
-
}) => Promise<null | TokenBridgeInfo>;
|
|
48
|
-
/** The result of reading the amount out from a router */
|
|
49
|
-
export type FetchResult = bigint[] | Hex;
|
|
50
|
-
/**
|
|
51
|
-
* Fetch the price corrective for the given bridge key, asset out, measurement token, from chain client, to chain client, asset link, amount in, and is prod
|
|
52
|
-
* @param bridgeKeyPartner - the bridge key partner
|
|
53
|
-
* @param assetOut - the asset out
|
|
54
|
-
* @param measurementToken - the measurement token
|
|
55
|
-
* @param fromChainClient - the from chain client
|
|
56
|
-
* @param toChainClient - the to chain client
|
|
57
|
-
* @param assetLink - the asset link
|
|
58
|
-
* @param amountIn - the amount in
|
|
59
|
-
* @param isProd - whether to use the production pathway
|
|
60
|
-
* @returns the price corrective
|
|
61
|
-
*/
|
|
62
|
-
export declare const fetchPriceCorrective: ({ bridgeKeyPartner, assetOut, measurementToken, fromChainClient, toChainClient, assetLink, amountIn, isProd, }: {
|
|
63
|
-
bridgeKey: BridgeKey;
|
|
64
|
-
bridgeKeyPartner: BridgeKey;
|
|
65
|
-
measurementToken: Hex;
|
|
66
|
-
assetOut: Token;
|
|
67
|
-
fromChainClient: PublicClient;
|
|
68
|
-
toChainClient: PublicClient;
|
|
69
|
-
assetLink: TokenBridgeInfo;
|
|
70
|
-
amountIn: bigint;
|
|
71
|
-
isProd: boolean;
|
|
72
|
-
}) => {
|
|
73
|
-
getPaymentToken: () => Promise<TokenBridgeInfo | null>;
|
|
74
|
-
getSwapResults: ({ paymentTokenResult, chain, uniV2Router, client, }: {
|
|
75
|
-
paymentTokenResult: TokenBridgeInfo;
|
|
76
|
-
chain: Chains;
|
|
77
|
-
client: PublicClient;
|
|
78
|
-
uniV2Router?: Hex;
|
|
79
|
-
}) => Promise<[FetchResult[], FetchResult[]]>;
|
|
80
|
-
reduceResults: ({ results, oneToken, }: {
|
|
81
|
-
results: [FetchResult[], ...[FetchResult[]]];
|
|
82
|
-
oneToken: bigint;
|
|
83
|
-
}) => bigint;
|
|
84
|
-
};
|
|
85
|
-
/**
|
|
86
|
-
* Fetch the minimum bridge amount in for the given asset in, pathway, from public client, and to public client
|
|
87
|
-
* @param assetIn - the asset in
|
|
88
|
-
* @param pathway - the pathway
|
|
89
|
-
* @param fromPublicClient - the from public client
|
|
90
|
-
* @param toPublicClient - the to public client
|
|
91
|
-
* @returns the minimum bridge amount in
|
|
92
|
-
*/
|
|
93
|
-
export declare const minBridgeAmountIn: ({ assetIn, pathway, fromPublicClient, toPublicClient, }: {
|
|
94
|
-
assetIn: Token;
|
|
95
|
-
pathway: Pathway;
|
|
96
|
-
fromPublicClient: PublicClient;
|
|
97
|
-
toPublicClient: PublicClient;
|
|
98
|
-
}) => Promise<bigint>;
|
|
99
|
-
/** get the symbol of the native asset, unwrap it if it needs to be */
|
|
100
|
-
export declare const nativeSymbol: (asset: {
|
|
101
|
-
address: string;
|
|
102
|
-
symbol: string;
|
|
103
|
-
chainId: number;
|
|
104
|
-
} | null, unwrap?: boolean) => string;
|
|
105
|
-
/** The input for loading the bridge fees */
|
|
106
|
-
export type InputLoadFeeFor = {
|
|
107
|
-
pathway: Pathway;
|
|
108
|
-
fromChainClient: PublicClient;
|
|
109
|
-
toChainClient: PublicClient;
|
|
110
|
-
};
|
|
111
|
-
/** The fee configuration for a given pathway */
|
|
112
|
-
export type PathwayExtendableConfig = {
|
|
113
|
-
feeManager: Hex;
|
|
114
|
-
feeH2F: bigint;
|
|
115
|
-
feeF2H: bigint;
|
|
116
|
-
};
|
|
117
|
-
/**
|
|
118
|
-
* Returns the chain multicall for the given client
|
|
119
|
-
* @param client - the client
|
|
120
|
-
* @returns the chain multicall
|
|
121
|
-
*/
|
|
122
|
-
export declare const chainMulticall: (client: PublicClient) => any;
|
|
123
|
-
/**
|
|
124
|
-
* Load the bridge fees for the given pathway, from chain client, and to chain client
|
|
125
|
-
* @param pathway - the pathway
|
|
126
|
-
* @param fromChainClient - the from chain client
|
|
127
|
-
* @param toChainClient - the to chain client
|
|
128
|
-
* @returns the bridge fees
|
|
129
|
-
*/
|
|
130
|
-
export declare const loadBridgeFees: ({ pathway, fromChainClient, toChainClient }: InputLoadFeeFor) => Promise<PathwayExtendableConfig>;
|