@chainrails/common 0.2.5 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chainrails-common.es.js +375 -331
- package/dist/chainrails-common.es.mjs +375 -331
- package/dist/chainrails-common.umd.js +2 -2
- package/dist/src/chains/all.d.ts +2 -2
- package/dist/src/chains/all.d.ts.map +1 -1
- package/dist/src/chains/constants.d.ts +21 -1
- package/dist/src/chains/constants.d.ts.map +1 -1
- package/dist/src/chains/index.d.ts +1 -0
- package/dist/src/chains/index.d.ts.map +1 -1
- package/dist/src/chains/types.d.ts +3 -2
- package/dist/src/chains/types.d.ts.map +1 -1
- package/dist/src/chains/utils.d.ts +58 -0
- package/dist/src/chains/utils.d.ts.map +1 -0
- package/dist/src/tokens/types.d.ts +3 -5
- package/dist/src/tokens/types.d.ts.map +1 -1
- package/dist/src/tokens/utils.d.ts +11 -10
- package/dist/src/tokens/utils.d.ts.map +1 -1
- package/dist/src/tokens/validation.d.ts +7 -7
- package/dist/src/tokens/validation.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const
|
|
1
|
+
const E = {
|
|
2
2
|
EVM: "EVM",
|
|
3
3
|
STARKNET: "STARKNET"
|
|
4
4
|
}, c = {
|
|
@@ -20,186 +20,205 @@ const u = {
|
|
|
20
20
|
POLYGON: "POLYGON_MAINNET",
|
|
21
21
|
STARKNET: "STARKNET_MAINNET",
|
|
22
22
|
STARKNET_TESTNET: "STARKNET_TESTNET"
|
|
23
|
+
}, te = {
|
|
24
|
+
ARBITRUM: "ARBITRUM",
|
|
25
|
+
ARBITRUM_TESTNET: "ARBITRUM_TESTNET",
|
|
26
|
+
AVALANCHE: "AVALANCHE",
|
|
27
|
+
AVALANCHE_TESTNET: "AVALANCHE_TESTNET",
|
|
28
|
+
BASE: "BASE",
|
|
29
|
+
BASE_TESTNET: "BASE_TESTNET",
|
|
30
|
+
BSC: "BSC",
|
|
31
|
+
ETHEREUM: "ETHEREUM",
|
|
32
|
+
ETHEREUM_TESTNET: "ETHEREUM_TESTNET",
|
|
33
|
+
HYPEREVM: "HYPEREVM",
|
|
34
|
+
LISK: "LISK",
|
|
35
|
+
MONAD: "MONAD",
|
|
36
|
+
MONAD_TESTNET: "MONAD_TESTNET",
|
|
37
|
+
OPTIMISM: "OPTIMISM",
|
|
38
|
+
OPTIMISM_TESTNET: "OPTIMISM_TESTNET",
|
|
39
|
+
POLYGON: "POLYGON",
|
|
40
|
+
STARKNET: "STARKNET",
|
|
41
|
+
STARKNET_TESTNET: "STARKNET_TESTNET"
|
|
23
42
|
}, se = {
|
|
24
|
-
type:
|
|
43
|
+
type: E.EVM,
|
|
25
44
|
chainId: 42161,
|
|
26
45
|
name: "Arbitrum",
|
|
27
46
|
cctpDomain: 3,
|
|
28
47
|
logoURI: "/images/chains/arbitrum.svg",
|
|
29
48
|
explorer: "https://arbiscan.io"
|
|
30
|
-
},
|
|
31
|
-
type:
|
|
49
|
+
}, ne = {
|
|
50
|
+
type: E.EVM,
|
|
32
51
|
chainId: 421614,
|
|
33
52
|
name: "Arbitrum Sepolia",
|
|
34
53
|
cctpDomain: 3,
|
|
35
54
|
logoURI: "/images/chains/arbitrum.svg",
|
|
36
55
|
explorer: "https://sepolia.arbiscan.io"
|
|
37
|
-
},
|
|
38
|
-
type:
|
|
56
|
+
}, oe = {
|
|
57
|
+
type: E.EVM,
|
|
39
58
|
chainId: 43114,
|
|
40
59
|
name: "Avalanche",
|
|
41
60
|
cctpDomain: 1,
|
|
42
61
|
logoURI: "/images/chains/avalanche.svg",
|
|
43
62
|
explorer: "https://snowtrace.io"
|
|
44
|
-
},
|
|
45
|
-
type:
|
|
63
|
+
}, ie = {
|
|
64
|
+
type: E.EVM,
|
|
46
65
|
chainId: 43113,
|
|
47
66
|
name: "Avalanche Fuji",
|
|
48
67
|
cctpDomain: 1,
|
|
49
68
|
logoURI: "/images/chains/avalanche.svg",
|
|
50
69
|
explorer: "https://testnet.snowtrace.io"
|
|
51
|
-
},
|
|
52
|
-
type:
|
|
70
|
+
}, ae = {
|
|
71
|
+
type: E.EVM,
|
|
53
72
|
chainId: 8453,
|
|
54
73
|
name: "Base",
|
|
55
74
|
cctpDomain: 6,
|
|
56
75
|
logoURI: "/images/chains/base.webp",
|
|
57
76
|
explorer: "https://basescan.org"
|
|
58
|
-
},
|
|
59
|
-
type:
|
|
77
|
+
}, re = {
|
|
78
|
+
type: E.EVM,
|
|
60
79
|
chainId: 84532,
|
|
61
80
|
name: "Base Sepolia",
|
|
62
81
|
cctpDomain: 6,
|
|
63
82
|
logoURI: "/images/chains/base.webp",
|
|
64
83
|
explorer: "https://sepolia.basescan.org"
|
|
65
|
-
},
|
|
66
|
-
type:
|
|
84
|
+
}, ce = {
|
|
85
|
+
type: E.EVM,
|
|
67
86
|
chainId: 56,
|
|
68
87
|
name: "BNB Chain",
|
|
69
88
|
cctpDomain: null,
|
|
70
89
|
logoURI: "/images/chains/bsc.webp",
|
|
71
90
|
explorer: "https://bscscan.com"
|
|
72
|
-
},
|
|
73
|
-
type:
|
|
91
|
+
}, rt = {
|
|
92
|
+
type: E.EVM,
|
|
74
93
|
chainId: 42220,
|
|
75
94
|
name: "Celo",
|
|
76
95
|
cctpDomain: null,
|
|
77
96
|
logoURI: "/images/chains/celo.svg",
|
|
78
97
|
explorer: "https://celoscan.io"
|
|
79
|
-
},
|
|
80
|
-
type:
|
|
98
|
+
}, de = {
|
|
99
|
+
type: E.EVM,
|
|
81
100
|
chainId: 1,
|
|
82
101
|
name: "Ethereum",
|
|
83
102
|
cctpDomain: 0,
|
|
84
103
|
logoURI: "/images/chains/ethereum.svg",
|
|
85
104
|
explorer: "https://etherscan.io"
|
|
86
|
-
},
|
|
87
|
-
type:
|
|
105
|
+
}, le = {
|
|
106
|
+
type: E.EVM,
|
|
88
107
|
chainId: 11155111,
|
|
89
108
|
name: "Ethereum Sepolia",
|
|
90
109
|
cctpDomain: 0,
|
|
91
110
|
logoURI: "/images/chains/ethereum.svg",
|
|
92
111
|
explorer: "https://sepolia.etherscan.io"
|
|
93
|
-
},
|
|
94
|
-
type:
|
|
112
|
+
}, me = {
|
|
113
|
+
type: E.EVM,
|
|
95
114
|
chainId: 999,
|
|
96
115
|
name: "HyperEVM",
|
|
97
116
|
cctpDomain: 19,
|
|
98
117
|
logoURI: "/images/chains/hyperevm.webp",
|
|
99
118
|
explorer: "https://liquidscan.io"
|
|
100
|
-
},
|
|
101
|
-
type:
|
|
119
|
+
}, ct = {
|
|
120
|
+
type: E.EVM,
|
|
102
121
|
chainId: 59144,
|
|
103
122
|
name: "Linea",
|
|
104
123
|
cctpDomain: 11,
|
|
105
124
|
logoURI: "/images/chains/linea.svg",
|
|
106
125
|
explorer: "https://lineascan.build"
|
|
107
|
-
},
|
|
108
|
-
type:
|
|
126
|
+
}, Ee = {
|
|
127
|
+
type: E.EVM,
|
|
109
128
|
chainId: 1135,
|
|
110
129
|
name: "Lisk",
|
|
111
130
|
cctpDomain: null,
|
|
112
131
|
logoURI: "/images/chains/lisk.png",
|
|
113
132
|
explorer: "https://blockscout.lisk.com"
|
|
114
133
|
}, ue = {
|
|
115
|
-
type:
|
|
134
|
+
type: E.EVM,
|
|
116
135
|
chainId: 15,
|
|
117
136
|
name: "Monad",
|
|
118
137
|
cctpDomain: 7,
|
|
119
138
|
logoURI: "/images/chains/monad.png",
|
|
120
139
|
explorer: "https://monadvision.com"
|
|
121
|
-
},
|
|
122
|
-
type:
|
|
140
|
+
}, Te = {
|
|
141
|
+
type: E.EVM,
|
|
123
142
|
chainId: 10143,
|
|
124
143
|
name: "Monad Testnet",
|
|
125
144
|
cctpDomain: null,
|
|
126
145
|
logoURI: "/images/chains/monad.png",
|
|
127
146
|
explorer: "https://testnet.monadvision.com"
|
|
128
|
-
},
|
|
129
|
-
type:
|
|
147
|
+
}, he = {
|
|
148
|
+
type: E.EVM,
|
|
130
149
|
chainId: 10,
|
|
131
150
|
name: "Optimism",
|
|
132
151
|
cctpDomain: 2,
|
|
133
152
|
logoURI: "/images/chains/optimism.svg",
|
|
134
153
|
explorer: "https://optimistic.etherscan.io"
|
|
135
|
-
},
|
|
136
|
-
type:
|
|
154
|
+
}, ge = {
|
|
155
|
+
type: E.EVM,
|
|
137
156
|
chainId: 11155420,
|
|
138
157
|
name: "Optimism Testnet",
|
|
139
158
|
cctpDomain: 2,
|
|
140
159
|
logoURI: "/images/chains/optimism.svg",
|
|
141
160
|
explorer: "https://testnet-explorer.optimism.io"
|
|
142
161
|
}, fe = {
|
|
143
|
-
type:
|
|
162
|
+
type: E.EVM,
|
|
144
163
|
chainId: 137,
|
|
145
164
|
name: "Polygon",
|
|
146
165
|
cctpDomain: 7,
|
|
147
166
|
logoURI: "/images/chains/polygon.svg",
|
|
148
167
|
explorer: "https://polygonscan.com"
|
|
149
|
-
},
|
|
150
|
-
type:
|
|
168
|
+
}, pe = {
|
|
169
|
+
type: E.STARKNET,
|
|
151
170
|
chainId: "0x534e5f4d41494e",
|
|
152
171
|
// SN_MAIN
|
|
153
172
|
name: "Starknet",
|
|
154
173
|
cctpDomain: 25,
|
|
155
174
|
logoURI: "/images/chains/starknet.svg",
|
|
156
175
|
explorer: ""
|
|
157
|
-
},
|
|
158
|
-
type:
|
|
176
|
+
}, Se = {
|
|
177
|
+
type: E.STARKNET,
|
|
159
178
|
chainId: "0x534e5f5345504f4c4941",
|
|
160
179
|
// SN_SEPOLIA
|
|
161
180
|
name: "Starknet Testnet",
|
|
162
181
|
cctpDomain: null,
|
|
163
182
|
logoURI: "/images/chains/starknet.svg",
|
|
164
183
|
explorer: ""
|
|
165
|
-
},
|
|
166
|
-
type:
|
|
184
|
+
}, dt = {
|
|
185
|
+
type: E.EVM,
|
|
167
186
|
chainId: 130,
|
|
168
187
|
name: "Unichain",
|
|
169
188
|
cctpDomain: 10,
|
|
170
189
|
logoURI: "/images/chains/unichain.webp",
|
|
171
190
|
explorer: ""
|
|
172
|
-
},
|
|
173
|
-
type:
|
|
191
|
+
}, lt = {
|
|
192
|
+
type: E.EVM,
|
|
174
193
|
chainId: 480,
|
|
175
194
|
name: "Worldchain",
|
|
176
195
|
cctpDomain: 14,
|
|
177
196
|
logoURI: "/images/chains/worldchain.svg",
|
|
178
197
|
explorer: ""
|
|
179
198
|
};
|
|
180
|
-
function
|
|
181
|
-
return !e || typeof e != "string" ? !1 :
|
|
199
|
+
function y(e, { strict: t = !0 } = {}) {
|
|
200
|
+
return !e || typeof e != "string" ? !1 : t ? /^0x[0-9a-fA-F]*$/.test(e) : e.startsWith("0x");
|
|
182
201
|
}
|
|
183
|
-
function
|
|
184
|
-
return
|
|
202
|
+
function x(e) {
|
|
203
|
+
return y(e, { strict: !1 }) ? Math.ceil((e.length - 2) / 2) : e.length;
|
|
185
204
|
}
|
|
186
|
-
const
|
|
187
|
-
let
|
|
188
|
-
getDocsUrl: ({ docsBaseUrl: e, docsPath:
|
|
189
|
-
version: `viem@${
|
|
205
|
+
const L = "2.43.4";
|
|
206
|
+
let D = {
|
|
207
|
+
getDocsUrl: ({ docsBaseUrl: e, docsPath: t = "", docsSlug: s }) => t ? `${e ?? "https://viem.sh"}${t}${s ? `#${s}` : ""}` : void 0,
|
|
208
|
+
version: `viem@${L}`
|
|
190
209
|
};
|
|
191
|
-
class
|
|
192
|
-
constructor(
|
|
193
|
-
const o =
|
|
194
|
-
|
|
210
|
+
class g extends Error {
|
|
211
|
+
constructor(t, s = {}) {
|
|
212
|
+
const o = s.cause instanceof g ? s.cause.details : s.cause?.message ? s.cause.message : s.details, i = s.cause instanceof g && s.cause.docsPath || s.docsPath, r = D.getDocsUrl?.({ ...s, docsPath: i }), a = [
|
|
213
|
+
t || "An error occurred.",
|
|
195
214
|
"",
|
|
196
|
-
...
|
|
215
|
+
...s.metaMessages ? [...s.metaMessages, ""] : [],
|
|
197
216
|
...r ? [`Docs: ${r}`] : [],
|
|
198
217
|
...o ? [`Details: ${o}`] : [],
|
|
199
|
-
...
|
|
218
|
+
...D.version ? [`Version: ${D.version}`] : []
|
|
200
219
|
].join(`
|
|
201
220
|
`);
|
|
202
|
-
super(a,
|
|
221
|
+
super(a, s.cause ? { cause: s.cause } : void 0), Object.defineProperty(this, "details", {
|
|
203
222
|
enumerable: !0,
|
|
204
223
|
configurable: !0,
|
|
205
224
|
writable: !0,
|
|
@@ -229,93 +248,93 @@ class f extends Error {
|
|
|
229
248
|
configurable: !0,
|
|
230
249
|
writable: !0,
|
|
231
250
|
value: "BaseError"
|
|
232
|
-
}), this.details = o, this.docsPath = i, this.metaMessages =
|
|
251
|
+
}), this.details = o, this.docsPath = i, this.metaMessages = s.metaMessages, this.name = s.name ?? this.name, this.shortMessage = t, this.version = L;
|
|
233
252
|
}
|
|
234
|
-
walk(
|
|
235
|
-
return
|
|
253
|
+
walk(t) {
|
|
254
|
+
return F(this, t);
|
|
236
255
|
}
|
|
237
256
|
}
|
|
238
|
-
function
|
|
239
|
-
return
|
|
257
|
+
function F(e, t) {
|
|
258
|
+
return t?.(e) ? e : e && typeof e == "object" && "cause" in e && e.cause !== void 0 ? F(e.cause, t) : t ? null : e;
|
|
240
259
|
}
|
|
241
|
-
class $ extends
|
|
242
|
-
constructor({ size:
|
|
243
|
-
super(`${o.charAt(0).toUpperCase()}${o.slice(1).toLowerCase()} size (${
|
|
260
|
+
class $ extends g {
|
|
261
|
+
constructor({ size: t, targetSize: s, type: o }) {
|
|
262
|
+
super(`${o.charAt(0).toUpperCase()}${o.slice(1).toLowerCase()} size (${t}) exceeds padding size (${s}).`, { name: "SizeExceedsPaddingSizeError" });
|
|
244
263
|
}
|
|
245
264
|
}
|
|
246
|
-
function
|
|
247
|
-
return typeof e == "string" ?
|
|
265
|
+
function U(e, { dir: t, size: s = 32 } = {}) {
|
|
266
|
+
return typeof e == "string" ? Ae(e, { dir: t, size: s }) : be(e, { dir: t, size: s });
|
|
248
267
|
}
|
|
249
|
-
function
|
|
250
|
-
if (
|
|
268
|
+
function Ae(e, { dir: t, size: s = 32 } = {}) {
|
|
269
|
+
if (s === null)
|
|
251
270
|
return e;
|
|
252
271
|
const o = e.replace("0x", "");
|
|
253
|
-
if (o.length >
|
|
272
|
+
if (o.length > s * 2)
|
|
254
273
|
throw new $({
|
|
255
274
|
size: Math.ceil(o.length / 2),
|
|
256
|
-
targetSize:
|
|
275
|
+
targetSize: s,
|
|
257
276
|
type: "hex"
|
|
258
277
|
});
|
|
259
|
-
return `0x${o[
|
|
278
|
+
return `0x${o[t === "right" ? "padEnd" : "padStart"](s * 2, "0")}`;
|
|
260
279
|
}
|
|
261
|
-
function be(e, { dir:
|
|
262
|
-
if (
|
|
280
|
+
function be(e, { dir: t, size: s = 32 } = {}) {
|
|
281
|
+
if (s === null)
|
|
263
282
|
return e;
|
|
264
|
-
if (e.length >
|
|
283
|
+
if (e.length > s)
|
|
265
284
|
throw new $({
|
|
266
285
|
size: e.length,
|
|
267
|
-
targetSize:
|
|
286
|
+
targetSize: s,
|
|
268
287
|
type: "bytes"
|
|
269
288
|
});
|
|
270
|
-
const o = new Uint8Array(
|
|
271
|
-
for (let i = 0; i <
|
|
272
|
-
const r =
|
|
273
|
-
o[r ? i :
|
|
289
|
+
const o = new Uint8Array(s);
|
|
290
|
+
for (let i = 0; i < s; i++) {
|
|
291
|
+
const r = t === "right";
|
|
292
|
+
o[r ? i : s - i - 1] = e[r ? i : e.length - i - 1];
|
|
274
293
|
}
|
|
275
294
|
return o;
|
|
276
295
|
}
|
|
277
|
-
class
|
|
278
|
-
constructor({ max:
|
|
279
|
-
super(`Number "${r}" is not in safe ${i ? `${i * 8}-bit ${o ? "signed" : "unsigned"} ` : ""}integer range ${
|
|
296
|
+
class Ie extends g {
|
|
297
|
+
constructor({ max: t, min: s, signed: o, size: i, value: r }) {
|
|
298
|
+
super(`Number "${r}" is not in safe ${i ? `${i * 8}-bit ${o ? "signed" : "unsigned"} ` : ""}integer range ${t ? `(${s} to ${t})` : `(above ${s})`}`, { name: "IntegerOutOfRangeError" });
|
|
280
299
|
}
|
|
281
300
|
}
|
|
282
|
-
class Ue extends
|
|
283
|
-
constructor({ givenSize:
|
|
284
|
-
super(`Size cannot exceed ${
|
|
301
|
+
class Ue extends g {
|
|
302
|
+
constructor({ givenSize: t, maxSize: s }) {
|
|
303
|
+
super(`Size cannot exceed ${s} bytes. Given size: ${t} bytes.`, { name: "SizeOverflowError" });
|
|
285
304
|
}
|
|
286
305
|
}
|
|
287
|
-
function
|
|
288
|
-
if (
|
|
306
|
+
function C(e, { size: t }) {
|
|
307
|
+
if (x(e) > t)
|
|
289
308
|
throw new Ue({
|
|
290
|
-
givenSize:
|
|
291
|
-
maxSize:
|
|
309
|
+
givenSize: x(e),
|
|
310
|
+
maxSize: t
|
|
292
311
|
});
|
|
293
312
|
}
|
|
294
|
-
function De(e,
|
|
295
|
-
const { signed:
|
|
313
|
+
function De(e, t = {}) {
|
|
314
|
+
const { signed: s, size: o } = t, i = BigInt(e);
|
|
296
315
|
let r;
|
|
297
|
-
o ?
|
|
298
|
-
const a = typeof r == "bigint" &&
|
|
316
|
+
o ? s ? r = (1n << BigInt(o) * 8n - 1n) - 1n : r = 2n ** (BigInt(o) * 8n) - 1n : typeof e == "number" && (r = BigInt(Number.MAX_SAFE_INTEGER));
|
|
317
|
+
const a = typeof r == "bigint" && s ? -r - 1n : 0;
|
|
299
318
|
if (r && i > r || i < a) {
|
|
300
|
-
const
|
|
301
|
-
throw new
|
|
302
|
-
max: r ? `${r}${
|
|
303
|
-
min: `${a}${
|
|
304
|
-
signed:
|
|
319
|
+
const T = typeof e == "bigint" ? "n" : "";
|
|
320
|
+
throw new Ie({
|
|
321
|
+
max: r ? `${r}${T}` : void 0,
|
|
322
|
+
min: `${a}${T}`,
|
|
323
|
+
signed: s,
|
|
305
324
|
size: o,
|
|
306
|
-
value: `${e}${
|
|
325
|
+
value: `${e}${T}`
|
|
307
326
|
});
|
|
308
327
|
}
|
|
309
|
-
const l = `0x${(
|
|
310
|
-
return o ?
|
|
328
|
+
const l = `0x${(s && i < 0 ? (1n << BigInt(o * 8)) + BigInt(i) : i).toString(16)}`;
|
|
329
|
+
return o ? U(l, { size: o }) : l;
|
|
311
330
|
}
|
|
312
|
-
const
|
|
313
|
-
function
|
|
314
|
-
return typeof e == "number" || typeof e == "bigint" ? Ce(e,
|
|
331
|
+
const Re = /* @__PURE__ */ new TextEncoder();
|
|
332
|
+
function Ne(e, t = {}) {
|
|
333
|
+
return typeof e == "number" || typeof e == "bigint" ? Ce(e, t) : typeof e == "boolean" ? ye(e, t) : y(e) ? P(e, t) : V(e, t);
|
|
315
334
|
}
|
|
316
|
-
function
|
|
317
|
-
const
|
|
318
|
-
return
|
|
335
|
+
function ye(e, t = {}) {
|
|
336
|
+
const s = new Uint8Array(1);
|
|
337
|
+
return s[0] = Number(e), typeof t.size == "number" ? (C(s, { size: t.size }), U(s, { size: t.size })) : s;
|
|
319
338
|
}
|
|
320
339
|
const h = {
|
|
321
340
|
zero: 48,
|
|
@@ -333,154 +352,154 @@ function B(e) {
|
|
|
333
352
|
if (e >= h.a && e <= h.f)
|
|
334
353
|
return e - (h.a - 10);
|
|
335
354
|
}
|
|
336
|
-
function P(e,
|
|
337
|
-
let
|
|
338
|
-
|
|
339
|
-
let o =
|
|
355
|
+
function P(e, t = {}) {
|
|
356
|
+
let s = e;
|
|
357
|
+
t.size && (C(s, { size: t.size }), s = U(s, { dir: "right", size: t.size }));
|
|
358
|
+
let o = s.slice(2);
|
|
340
359
|
o.length % 2 && (o = `0${o}`);
|
|
341
360
|
const i = o.length / 2, r = new Uint8Array(i);
|
|
342
361
|
for (let a = 0, l = 0; a < i; a++) {
|
|
343
|
-
const
|
|
344
|
-
if (
|
|
345
|
-
throw new
|
|
346
|
-
r[a] =
|
|
362
|
+
const T = B(o.charCodeAt(l++)), f = B(o.charCodeAt(l++));
|
|
363
|
+
if (T === void 0 || f === void 0)
|
|
364
|
+
throw new g(`Invalid byte sequence ("${o[l - 2]}${o[l - 1]}" in "${o}").`);
|
|
365
|
+
r[a] = T * 16 + f;
|
|
347
366
|
}
|
|
348
367
|
return r;
|
|
349
368
|
}
|
|
350
|
-
function Ce(e,
|
|
351
|
-
const
|
|
352
|
-
return P(
|
|
369
|
+
function Ce(e, t) {
|
|
370
|
+
const s = De(e, t);
|
|
371
|
+
return P(s);
|
|
353
372
|
}
|
|
354
|
-
function V(e,
|
|
355
|
-
const
|
|
356
|
-
return typeof
|
|
373
|
+
function V(e, t = {}) {
|
|
374
|
+
const s = Re.encode(e);
|
|
375
|
+
return typeof t.size == "number" ? (C(s, { size: t.size }), U(s, { dir: "right", size: t.size })) : s;
|
|
357
376
|
}
|
|
358
|
-
const
|
|
359
|
-
function
|
|
360
|
-
return
|
|
377
|
+
const b = /* @__PURE__ */ BigInt(2 ** 32 - 1), k = /* @__PURE__ */ BigInt(32);
|
|
378
|
+
function Me(e, t = !1) {
|
|
379
|
+
return t ? { h: Number(e & b), l: Number(e >> k & b) } : { h: Number(e >> k & b) | 0, l: Number(e & b) | 0 };
|
|
361
380
|
}
|
|
362
|
-
function xe(e,
|
|
363
|
-
const
|
|
364
|
-
let o = new Uint32Array(
|
|
365
|
-
for (let r = 0; r <
|
|
366
|
-
const { h: a, l } =
|
|
381
|
+
function xe(e, t = !1) {
|
|
382
|
+
const s = e.length;
|
|
383
|
+
let o = new Uint32Array(s), i = new Uint32Array(s);
|
|
384
|
+
for (let r = 0; r < s; r++) {
|
|
385
|
+
const { h: a, l } = Me(e[r], t);
|
|
367
386
|
[o[r], i[r]] = [a, l];
|
|
368
387
|
}
|
|
369
388
|
return [o, i];
|
|
370
389
|
}
|
|
371
|
-
const
|
|
390
|
+
const Be = (e, t, s) => e << s | t >>> 32 - s, ke = (e, t, s) => t << s | e >>> 32 - s, we = (e, t, s) => t << s - 32 | e >>> 64 - s, ve = (e, t, s) => e << s - 32 | t >>> 64 - s;
|
|
372
391
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
373
|
-
function
|
|
392
|
+
function Oe(e) {
|
|
374
393
|
return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
|
|
375
394
|
}
|
|
376
395
|
function w(e) {
|
|
377
396
|
if (!Number.isSafeInteger(e) || e < 0)
|
|
378
397
|
throw new Error("positive integer expected, got " + e);
|
|
379
398
|
}
|
|
380
|
-
function
|
|
381
|
-
if (!
|
|
399
|
+
function I(e, ...t) {
|
|
400
|
+
if (!Oe(e))
|
|
382
401
|
throw new Error("Uint8Array expected");
|
|
383
|
-
if (
|
|
384
|
-
throw new Error("Uint8Array expected of length " +
|
|
402
|
+
if (t.length > 0 && !t.includes(e.length))
|
|
403
|
+
throw new Error("Uint8Array expected of length " + t + ", got length=" + e.length);
|
|
385
404
|
}
|
|
386
|
-
function v(e,
|
|
405
|
+
function v(e, t = !0) {
|
|
387
406
|
if (e.destroyed)
|
|
388
407
|
throw new Error("Hash instance has been destroyed");
|
|
389
|
-
if (
|
|
408
|
+
if (t && e.finished)
|
|
390
409
|
throw new Error("Hash#digest() has already been called");
|
|
391
410
|
}
|
|
392
|
-
function
|
|
393
|
-
|
|
394
|
-
const
|
|
395
|
-
if (e.length <
|
|
396
|
-
throw new Error("digestInto() expects output buffer of length at least " +
|
|
411
|
+
function He(e, t) {
|
|
412
|
+
I(e);
|
|
413
|
+
const s = t.outputLen;
|
|
414
|
+
if (e.length < s)
|
|
415
|
+
throw new Error("digestInto() expects output buffer of length at least " + s);
|
|
397
416
|
}
|
|
398
|
-
function
|
|
417
|
+
function _e(e) {
|
|
399
418
|
return new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4));
|
|
400
419
|
}
|
|
401
420
|
function K(...e) {
|
|
402
|
-
for (let
|
|
403
|
-
e[
|
|
421
|
+
for (let t = 0; t < e.length; t++)
|
|
422
|
+
e[t].fill(0);
|
|
404
423
|
}
|
|
405
|
-
const
|
|
406
|
-
function
|
|
424
|
+
const Le = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
425
|
+
function Fe(e) {
|
|
407
426
|
return e << 24 & 4278190080 | e << 8 & 16711680 | e >>> 8 & 65280 | e >>> 24 & 255;
|
|
408
427
|
}
|
|
409
|
-
function
|
|
410
|
-
for (let
|
|
411
|
-
e[
|
|
428
|
+
function $e(e) {
|
|
429
|
+
for (let t = 0; t < e.length; t++)
|
|
430
|
+
e[t] = Fe(e[t]);
|
|
412
431
|
return e;
|
|
413
432
|
}
|
|
414
|
-
const O =
|
|
415
|
-
function
|
|
433
|
+
const O = Le ? (e) => e : $e;
|
|
434
|
+
function Pe(e) {
|
|
416
435
|
if (typeof e != "string")
|
|
417
436
|
throw new Error("string expected");
|
|
418
437
|
return new Uint8Array(new TextEncoder().encode(e));
|
|
419
438
|
}
|
|
420
439
|
function z(e) {
|
|
421
|
-
return typeof e == "string" && (e =
|
|
440
|
+
return typeof e == "string" && (e = Pe(e)), I(e), e;
|
|
422
441
|
}
|
|
423
|
-
class
|
|
442
|
+
class Ve {
|
|
424
443
|
}
|
|
425
|
-
function
|
|
426
|
-
const
|
|
427
|
-
return
|
|
444
|
+
function Ke(e) {
|
|
445
|
+
const t = (o) => e().update(z(o)).digest(), s = e();
|
|
446
|
+
return t.outputLen = s.outputLen, t.blockLen = s.blockLen, t.create = () => e(), t;
|
|
428
447
|
}
|
|
429
|
-
const
|
|
430
|
-
for (let e = 0,
|
|
431
|
-
[
|
|
432
|
-
let i =
|
|
448
|
+
const ze = BigInt(0), S = BigInt(1), We = BigInt(2), Ye = BigInt(7), je = BigInt(256), Ge = BigInt(113), W = [], Y = [], j = [];
|
|
449
|
+
for (let e = 0, t = S, s = 1, o = 0; e < 24; e++) {
|
|
450
|
+
[s, o] = [o, (2 * s + 3 * o) % 5], W.push(2 * (5 * o + s)), Y.push((e + 1) * (e + 2) / 2 % 64);
|
|
451
|
+
let i = ze;
|
|
433
452
|
for (let r = 0; r < 7; r++)
|
|
434
|
-
|
|
435
|
-
|
|
453
|
+
t = (t << S ^ (t >> Ye) * Ge) % je, t & We && (i ^= S << (S << /* @__PURE__ */ BigInt(r)) - S);
|
|
454
|
+
j.push(i);
|
|
436
455
|
}
|
|
437
|
-
const G = xe(
|
|
438
|
-
function
|
|
439
|
-
const
|
|
440
|
-
for (let o = 24 -
|
|
456
|
+
const G = xe(j, !0), Xe = G[0], qe = G[1], H = (e, t, s) => s > 32 ? we(e, t, s) : Be(e, t, s), _ = (e, t, s) => s > 32 ? ve(e, t, s) : ke(e, t, s);
|
|
457
|
+
function Je(e, t = 24) {
|
|
458
|
+
const s = new Uint32Array(10);
|
|
459
|
+
for (let o = 24 - t; o < 24; o++) {
|
|
441
460
|
for (let a = 0; a < 10; a++)
|
|
442
|
-
|
|
461
|
+
s[a] = e[a] ^ e[a + 10] ^ e[a + 20] ^ e[a + 30] ^ e[a + 40];
|
|
443
462
|
for (let a = 0; a < 10; a += 2) {
|
|
444
|
-
const l = (a + 8) % 10,
|
|
445
|
-
for (let
|
|
446
|
-
e[a +
|
|
463
|
+
const l = (a + 8) % 10, T = (a + 2) % 10, f = s[T], p = s[T + 1], Z = H(f, p, 1) ^ s[l], ee = _(f, p, 1) ^ s[l + 1];
|
|
464
|
+
for (let A = 0; A < 50; A += 10)
|
|
465
|
+
e[a + A] ^= Z, e[a + A + 1] ^= ee;
|
|
447
466
|
}
|
|
448
467
|
let i = e[2], r = e[3];
|
|
449
468
|
for (let a = 0; a < 24; a++) {
|
|
450
|
-
const l =
|
|
451
|
-
i = e[p], r = e[p + 1], e[p] =
|
|
469
|
+
const l = Y[a], T = H(i, r, l), f = _(i, r, l), p = W[a];
|
|
470
|
+
i = e[p], r = e[p + 1], e[p] = T, e[p + 1] = f;
|
|
452
471
|
}
|
|
453
472
|
for (let a = 0; a < 50; a += 10) {
|
|
454
473
|
for (let l = 0; l < 10; l++)
|
|
455
|
-
|
|
474
|
+
s[l] = e[a + l];
|
|
456
475
|
for (let l = 0; l < 10; l++)
|
|
457
|
-
e[a + l] ^= ~
|
|
476
|
+
e[a + l] ^= ~s[(l + 2) % 10] & s[(l + 4) % 10];
|
|
458
477
|
}
|
|
459
|
-
e[0] ^=
|
|
478
|
+
e[0] ^= Xe[o], e[1] ^= qe[o];
|
|
460
479
|
}
|
|
461
|
-
K(
|
|
480
|
+
K(s);
|
|
462
481
|
}
|
|
463
|
-
class
|
|
482
|
+
class M extends Ve {
|
|
464
483
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
465
|
-
constructor(
|
|
466
|
-
if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen =
|
|
484
|
+
constructor(t, s, o, i = !1, r = 24) {
|
|
485
|
+
if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = t, this.suffix = s, this.outputLen = o, this.enableXOF = i, this.rounds = r, w(o), !(0 < t && t < 200))
|
|
467
486
|
throw new Error("only keccak-f1600 function is supported");
|
|
468
|
-
this.state = new Uint8Array(200), this.state32 =
|
|
487
|
+
this.state = new Uint8Array(200), this.state32 = _e(this.state);
|
|
469
488
|
}
|
|
470
489
|
clone() {
|
|
471
490
|
return this._cloneInto();
|
|
472
491
|
}
|
|
473
492
|
keccak() {
|
|
474
|
-
O(this.state32),
|
|
493
|
+
O(this.state32), Je(this.state32, this.rounds), O(this.state32), this.posOut = 0, this.pos = 0;
|
|
475
494
|
}
|
|
476
|
-
update(
|
|
477
|
-
v(this),
|
|
478
|
-
const { blockLen:
|
|
495
|
+
update(t) {
|
|
496
|
+
v(this), t = z(t), I(t);
|
|
497
|
+
const { blockLen: s, state: o } = this, i = t.length;
|
|
479
498
|
for (let r = 0; r < i; ) {
|
|
480
|
-
const a = Math.min(
|
|
499
|
+
const a = Math.min(s - this.pos, i - r);
|
|
481
500
|
for (let l = 0; l < a; l++)
|
|
482
|
-
o[this.pos++] ^=
|
|
483
|
-
this.pos ===
|
|
501
|
+
o[this.pos++] ^= t[r++];
|
|
502
|
+
this.pos === s && this.keccak();
|
|
484
503
|
}
|
|
485
504
|
return this;
|
|
486
505
|
}
|
|
@@ -488,31 +507,31 @@ class x extends Pe {
|
|
|
488
507
|
if (this.finished)
|
|
489
508
|
return;
|
|
490
509
|
this.finished = !0;
|
|
491
|
-
const { state:
|
|
492
|
-
|
|
510
|
+
const { state: t, suffix: s, pos: o, blockLen: i } = this;
|
|
511
|
+
t[o] ^= s, (s & 128) !== 0 && o === i - 1 && this.keccak(), t[i - 1] ^= 128, this.keccak();
|
|
493
512
|
}
|
|
494
|
-
writeInto(
|
|
495
|
-
v(this, !1),
|
|
496
|
-
const
|
|
497
|
-
for (let i = 0, r =
|
|
513
|
+
writeInto(t) {
|
|
514
|
+
v(this, !1), I(t), this.finish();
|
|
515
|
+
const s = this.state, { blockLen: o } = this;
|
|
516
|
+
for (let i = 0, r = t.length; i < r; ) {
|
|
498
517
|
this.posOut >= o && this.keccak();
|
|
499
518
|
const a = Math.min(o - this.posOut, r - i);
|
|
500
|
-
|
|
519
|
+
t.set(s.subarray(this.posOut, this.posOut + a), i), this.posOut += a, i += a;
|
|
501
520
|
}
|
|
502
|
-
return
|
|
521
|
+
return t;
|
|
503
522
|
}
|
|
504
|
-
xofInto(
|
|
523
|
+
xofInto(t) {
|
|
505
524
|
if (!this.enableXOF)
|
|
506
525
|
throw new Error("XOF is not possible for this instance");
|
|
507
|
-
return this.writeInto(
|
|
526
|
+
return this.writeInto(t);
|
|
508
527
|
}
|
|
509
|
-
xof(
|
|
510
|
-
return w(
|
|
528
|
+
xof(t) {
|
|
529
|
+
return w(t), this.xofInto(new Uint8Array(t));
|
|
511
530
|
}
|
|
512
|
-
digestInto(
|
|
513
|
-
if (
|
|
531
|
+
digestInto(t) {
|
|
532
|
+
if (He(t, this), this.finished)
|
|
514
533
|
throw new Error("digest() was already called");
|
|
515
|
-
return this.writeInto(
|
|
534
|
+
return this.writeInto(t), this.destroy(), t;
|
|
516
535
|
}
|
|
517
536
|
digest() {
|
|
518
537
|
return this.digestInto(new Uint8Array(this.outputLen));
|
|
@@ -520,18 +539,18 @@ class x extends Pe {
|
|
|
520
539
|
destroy() {
|
|
521
540
|
this.destroyed = !0, K(this.state);
|
|
522
541
|
}
|
|
523
|
-
_cloneInto(
|
|
524
|
-
const { blockLen:
|
|
525
|
-
return
|
|
542
|
+
_cloneInto(t) {
|
|
543
|
+
const { blockLen: s, suffix: o, outputLen: i, rounds: r, enableXOF: a } = this;
|
|
544
|
+
return t || (t = new M(s, o, i, a, r)), t.state32.set(this.state32), t.pos = this.pos, t.posOut = this.posOut, t.finished = this.finished, t.rounds = r, t.suffix = o, t.outputLen = i, t.enableXOF = a, t.destroyed = this.destroyed, t;
|
|
526
545
|
}
|
|
527
546
|
}
|
|
528
|
-
const
|
|
529
|
-
function
|
|
530
|
-
return
|
|
547
|
+
const Qe = (e, t, s) => Ke(() => new M(t, e, s)), Ze = Qe(1, 136, 256 / 8);
|
|
548
|
+
function et(e, t) {
|
|
549
|
+
return Ze(y(e, { strict: !1 }) ? Ne(e) : e);
|
|
531
550
|
}
|
|
532
|
-
class
|
|
533
|
-
constructor({ address:
|
|
534
|
-
super(`Address "${
|
|
551
|
+
class tt extends g {
|
|
552
|
+
constructor({ address: t }) {
|
|
553
|
+
super(`Address "${t}" is invalid.`, {
|
|
535
554
|
metaMessages: [
|
|
536
555
|
"- Address must be a hex value of 20 bytes (40 hex characters).",
|
|
537
556
|
"- Address must match its checksum counterpart."
|
|
@@ -541,48 +560,48 @@ class es extends f {
|
|
|
541
560
|
}
|
|
542
561
|
}
|
|
543
562
|
class X extends Map {
|
|
544
|
-
constructor(
|
|
563
|
+
constructor(t) {
|
|
545
564
|
super(), Object.defineProperty(this, "maxSize", {
|
|
546
565
|
enumerable: !0,
|
|
547
566
|
configurable: !0,
|
|
548
567
|
writable: !0,
|
|
549
568
|
value: void 0
|
|
550
|
-
}), this.maxSize =
|
|
569
|
+
}), this.maxSize = t;
|
|
551
570
|
}
|
|
552
|
-
get(
|
|
553
|
-
const
|
|
554
|
-
return super.has(
|
|
571
|
+
get(t) {
|
|
572
|
+
const s = super.get(t);
|
|
573
|
+
return super.has(t) && s !== void 0 && (this.delete(t), super.set(t, s)), s;
|
|
555
574
|
}
|
|
556
|
-
set(
|
|
557
|
-
if (super.set(
|
|
575
|
+
set(t, s) {
|
|
576
|
+
if (super.set(t, s), this.maxSize && this.size > this.maxSize) {
|
|
558
577
|
const o = this.keys().next().value;
|
|
559
578
|
o && this.delete(o);
|
|
560
579
|
}
|
|
561
580
|
return this;
|
|
562
581
|
}
|
|
563
582
|
}
|
|
564
|
-
const
|
|
565
|
-
function q(e,
|
|
566
|
-
if (
|
|
567
|
-
return
|
|
568
|
-
const
|
|
583
|
+
const R = /* @__PURE__ */ new X(8192);
|
|
584
|
+
function q(e, t) {
|
|
585
|
+
if (R.has(`${e}.${t}`))
|
|
586
|
+
return R.get(`${e}.${t}`);
|
|
587
|
+
const s = e.substring(2).toLowerCase(), o = et(V(s)), i = s.split("");
|
|
569
588
|
for (let a = 0; a < 40; a += 2)
|
|
570
589
|
o[a >> 1] >> 4 >= 8 && i[a] && (i[a] = i[a].toUpperCase()), (o[a >> 1] & 15) >= 8 && i[a + 1] && (i[a + 1] = i[a + 1].toUpperCase());
|
|
571
590
|
const r = `0x${i.join("")}`;
|
|
572
|
-
return
|
|
591
|
+
return R.set(`${e}.${t}`, r), r;
|
|
573
592
|
}
|
|
574
|
-
function
|
|
575
|
-
if (!
|
|
576
|
-
throw new
|
|
577
|
-
return q(e,
|
|
593
|
+
function u(e, t) {
|
|
594
|
+
if (!nt(e, { strict: !1 }))
|
|
595
|
+
throw new tt({ address: e });
|
|
596
|
+
return q(e, t);
|
|
578
597
|
}
|
|
579
|
-
const
|
|
580
|
-
function
|
|
581
|
-
const { strict:
|
|
582
|
-
if (
|
|
583
|
-
return
|
|
584
|
-
const i =
|
|
585
|
-
return
|
|
598
|
+
const st = /^0x[a-fA-F0-9]{40}$/, N = /* @__PURE__ */ new X(8192);
|
|
599
|
+
function nt(e, t) {
|
|
600
|
+
const { strict: s = !0 } = t ?? {}, o = `${e}.${s}`;
|
|
601
|
+
if (N.has(o))
|
|
602
|
+
return N.get(o);
|
|
603
|
+
const i = st.test(e) ? e.toLowerCase() === e ? !0 : s ? q(e) === e : !0 : !1;
|
|
604
|
+
return N.set(o, i), i;
|
|
586
605
|
}
|
|
587
606
|
const n = {
|
|
588
607
|
USDC: "USDC",
|
|
@@ -595,10 +614,10 @@ const n = {
|
|
|
595
614
|
STRK: "STRK",
|
|
596
615
|
BNB: "BNB",
|
|
597
616
|
LORDS: "LORDS"
|
|
598
|
-
},
|
|
617
|
+
}, mt = n.USDC, d = {
|
|
599
618
|
[c.ARBITRUM]: {
|
|
600
619
|
[n.DAI]: {
|
|
601
|
-
address:
|
|
620
|
+
address: u("0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"),
|
|
602
621
|
symbol: n.DAI,
|
|
603
622
|
name: "Dai Stablecoin",
|
|
604
623
|
decimals: 18,
|
|
@@ -614,7 +633,7 @@ const n = {
|
|
|
614
633
|
/* ETH */
|
|
615
634
|
},
|
|
616
635
|
[n.USDC]: {
|
|
617
|
-
address:
|
|
636
|
+
address: u("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
|
|
618
637
|
symbol: n.USDC,
|
|
619
638
|
name: "USD Coin",
|
|
620
639
|
decimals: 6,
|
|
@@ -622,7 +641,7 @@ const n = {
|
|
|
622
641
|
/* USDC */
|
|
623
642
|
},
|
|
624
643
|
[n.USDT]: {
|
|
625
|
-
address:
|
|
644
|
+
address: u("0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"),
|
|
626
645
|
symbol: n.USDT,
|
|
627
646
|
name: "Tether USD",
|
|
628
647
|
decimals: 6,
|
|
@@ -630,7 +649,7 @@ const n = {
|
|
|
630
649
|
/* USDT */
|
|
631
650
|
},
|
|
632
651
|
[n.WETH]: {
|
|
633
|
-
address:
|
|
652
|
+
address: u("0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"),
|
|
634
653
|
symbol: n.WETH,
|
|
635
654
|
name: "Wrapped Ether",
|
|
636
655
|
decimals: 18,
|
|
@@ -640,7 +659,7 @@ const n = {
|
|
|
640
659
|
},
|
|
641
660
|
[c.ARBITRUM_TESTNET]: {
|
|
642
661
|
[n.USDC]: {
|
|
643
|
-
address:
|
|
662
|
+
address: u("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),
|
|
644
663
|
symbol: n.USDC,
|
|
645
664
|
name: "USD Coin",
|
|
646
665
|
fiatISO: "USD",
|
|
@@ -659,7 +678,7 @@ const n = {
|
|
|
659
678
|
/* DAI */
|
|
660
679
|
},
|
|
661
680
|
[n.USDC]: {
|
|
662
|
-
address:
|
|
681
|
+
address: u("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),
|
|
663
682
|
symbol: n.USDC,
|
|
664
683
|
name: "USD Coin",
|
|
665
684
|
fiatISO: "USD",
|
|
@@ -686,7 +705,7 @@ const n = {
|
|
|
686
705
|
},
|
|
687
706
|
[c.AVALANCHE_TESTNET]: {
|
|
688
707
|
[n.USDC]: {
|
|
689
|
-
address:
|
|
708
|
+
address: u("0x5425890298aed601595a70AB815c96711a31Bc65"),
|
|
690
709
|
symbol: n.USDC,
|
|
691
710
|
name: "USD Coin",
|
|
692
711
|
fiatISO: "USD",
|
|
@@ -721,7 +740,7 @@ const n = {
|
|
|
721
740
|
/* EURC */
|
|
722
741
|
},
|
|
723
742
|
[n.USDC]: {
|
|
724
|
-
address:
|
|
743
|
+
address: u("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),
|
|
725
744
|
symbol: n.USDC,
|
|
726
745
|
name: "USD Coin",
|
|
727
746
|
fiatISO: "USD",
|
|
@@ -730,7 +749,7 @@ const n = {
|
|
|
730
749
|
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
731
750
|
},
|
|
732
751
|
[n.WETH]: {
|
|
733
|
-
address:
|
|
752
|
+
address: u("0x4200000000000000000000000000000000000006"),
|
|
734
753
|
symbol: n.WETH,
|
|
735
754
|
name: "Wrapped Ether",
|
|
736
755
|
decimals: 18,
|
|
@@ -740,7 +759,7 @@ const n = {
|
|
|
740
759
|
},
|
|
741
760
|
[c.BASE_TESTNET]: {
|
|
742
761
|
[n.USDC]: {
|
|
743
|
-
address:
|
|
762
|
+
address: u("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),
|
|
744
763
|
symbol: n.USDC,
|
|
745
764
|
name: "USD Coin",
|
|
746
765
|
fiatISO: "USD",
|
|
@@ -783,7 +802,7 @@ const n = {
|
|
|
783
802
|
/* ETH */
|
|
784
803
|
},
|
|
785
804
|
[n.USDC]: {
|
|
786
|
-
address:
|
|
805
|
+
address: u("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),
|
|
787
806
|
symbol: n.USDC,
|
|
788
807
|
decimals: 18,
|
|
789
808
|
name: "USD Coin",
|
|
@@ -809,7 +828,7 @@ const n = {
|
|
|
809
828
|
/* BUSD */
|
|
810
829
|
},
|
|
811
830
|
[n.DAI]: {
|
|
812
|
-
address:
|
|
831
|
+
address: u("0x6B175474E89094C44Da98b954EedeAC495271d0F"),
|
|
813
832
|
symbol: n.DAI,
|
|
814
833
|
name: "Dai Stablecoin",
|
|
815
834
|
decimals: 18,
|
|
@@ -841,7 +860,7 @@ const n = {
|
|
|
841
860
|
/* STRK */
|
|
842
861
|
},
|
|
843
862
|
[n.USDC]: {
|
|
844
|
-
address:
|
|
863
|
+
address: u("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
|
|
845
864
|
symbol: n.USDC,
|
|
846
865
|
name: "USD Coin",
|
|
847
866
|
decimals: 6,
|
|
@@ -849,7 +868,7 @@ const n = {
|
|
|
849
868
|
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
850
869
|
},
|
|
851
870
|
[n.USDT]: {
|
|
852
|
-
address:
|
|
871
|
+
address: u("0xdAC17F958D2ee523a2206206994597C13D831ec7"),
|
|
853
872
|
symbol: n.USDT,
|
|
854
873
|
name: "Tether USD",
|
|
855
874
|
decimals: 6,
|
|
@@ -857,7 +876,7 @@ const n = {
|
|
|
857
876
|
/* USDT */
|
|
858
877
|
},
|
|
859
878
|
[n.WETH]: {
|
|
860
|
-
address:
|
|
879
|
+
address: u("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),
|
|
861
880
|
symbol: n.WETH,
|
|
862
881
|
name: "Wrapped Ether",
|
|
863
882
|
decimals: 18,
|
|
@@ -867,7 +886,7 @@ const n = {
|
|
|
867
886
|
},
|
|
868
887
|
[c.ETHEREUM_TESTNET]: {
|
|
869
888
|
[n.USDC]: {
|
|
870
|
-
address:
|
|
889
|
+
address: u("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),
|
|
871
890
|
symbol: n.USDC,
|
|
872
891
|
decimals: 6,
|
|
873
892
|
name: "USD Coin",
|
|
@@ -1061,7 +1080,7 @@ const n = {
|
|
|
1061
1080
|
/* USDC */
|
|
1062
1081
|
}
|
|
1063
1082
|
}
|
|
1064
|
-
},
|
|
1083
|
+
}, Et = {
|
|
1065
1084
|
ARBITRUM: d[c.ARBITRUM],
|
|
1066
1085
|
ARBITRUM_TESTNET: d[c.ARBITRUM_TESTNET],
|
|
1067
1086
|
AVALANCHE: d[c.AVALANCHE],
|
|
@@ -1072,49 +1091,49 @@ const n = {
|
|
|
1072
1091
|
ETHEREUM: d[c.ETHEREUM],
|
|
1073
1092
|
ETHEREUM_TESTNET: d[c.ETHEREUM_TESTNET],
|
|
1074
1093
|
STARKNET: d[c.STARKNET]
|
|
1075
|
-
},
|
|
1094
|
+
}, ut = {
|
|
1076
1095
|
ARBITRUM_MAINNET: {
|
|
1077
1096
|
...se,
|
|
1078
1097
|
tokens: d[c.ARBITRUM]
|
|
1079
1098
|
},
|
|
1080
1099
|
ARBITRUM_TESTNET: {
|
|
1081
|
-
...
|
|
1100
|
+
...ne,
|
|
1082
1101
|
tokens: d[c.ARBITRUM_TESTNET]
|
|
1083
1102
|
},
|
|
1084
1103
|
AVALANCHE_MAINNET: {
|
|
1085
|
-
...
|
|
1104
|
+
...oe,
|
|
1086
1105
|
tokens: d[c.AVALANCHE]
|
|
1087
1106
|
},
|
|
1088
1107
|
AVALANCHE_TESTNET: {
|
|
1089
|
-
...
|
|
1108
|
+
...ie,
|
|
1090
1109
|
tokens: d[c.AVALANCHE_TESTNET]
|
|
1091
1110
|
},
|
|
1092
1111
|
BASE_MAINNET: {
|
|
1093
|
-
...
|
|
1112
|
+
...ae,
|
|
1094
1113
|
tokens: d[c.BASE]
|
|
1095
1114
|
},
|
|
1096
1115
|
BASE_TESTNET: {
|
|
1097
|
-
...
|
|
1116
|
+
...re,
|
|
1098
1117
|
tokens: d[c.BASE_TESTNET]
|
|
1099
1118
|
},
|
|
1100
1119
|
BSC_MAINNET: {
|
|
1101
|
-
...
|
|
1120
|
+
...ce,
|
|
1102
1121
|
tokens: d[c.BSC]
|
|
1103
1122
|
},
|
|
1104
1123
|
ETHEREUM_MAINNET: {
|
|
1105
|
-
...
|
|
1124
|
+
...de,
|
|
1106
1125
|
tokens: d[c.ETHEREUM]
|
|
1107
1126
|
},
|
|
1108
1127
|
ETHEREUM_TESTNET: {
|
|
1109
|
-
...
|
|
1128
|
+
...le,
|
|
1110
1129
|
tokens: d[c.ETHEREUM_TESTNET]
|
|
1111
1130
|
},
|
|
1112
1131
|
HYPEREVM_MAINNET: {
|
|
1113
|
-
...
|
|
1132
|
+
...me,
|
|
1114
1133
|
tokens: d[c.HYPEREVM]
|
|
1115
1134
|
},
|
|
1116
1135
|
LISK_MAINNET: {
|
|
1117
|
-
...
|
|
1136
|
+
...Ee,
|
|
1118
1137
|
tokens: d[c.LISK]
|
|
1119
1138
|
},
|
|
1120
1139
|
MONAD_MAINNET: {
|
|
@@ -1122,15 +1141,15 @@ const n = {
|
|
|
1122
1141
|
tokens: d[c.MONAD]
|
|
1123
1142
|
},
|
|
1124
1143
|
MONAD_TESTNET: {
|
|
1125
|
-
...
|
|
1144
|
+
...Te,
|
|
1126
1145
|
tokens: d[c.MONAD_TESTNET]
|
|
1127
1146
|
},
|
|
1128
1147
|
OPTIMISM_MAINNET: {
|
|
1129
|
-
...
|
|
1148
|
+
...he,
|
|
1130
1149
|
tokens: d[c.OPTIMISM]
|
|
1131
1150
|
},
|
|
1132
1151
|
OPTIMISM_TESTNET: {
|
|
1133
|
-
...
|
|
1152
|
+
...ge,
|
|
1134
1153
|
tokens: d[c.OPTIMISM_TESTNET]
|
|
1135
1154
|
},
|
|
1136
1155
|
POLYGON_MAINNET: {
|
|
@@ -1138,22 +1157,42 @@ const n = {
|
|
|
1138
1157
|
tokens: d[c.POLYGON]
|
|
1139
1158
|
},
|
|
1140
1159
|
STARKNET_MAINNET: {
|
|
1141
|
-
...
|
|
1160
|
+
...pe,
|
|
1142
1161
|
tokens: d[c.STARKNET]
|
|
1143
1162
|
},
|
|
1144
1163
|
STARKNET_TESTNET: {
|
|
1145
|
-
...
|
|
1164
|
+
...Se,
|
|
1146
1165
|
tokens: d[c.STARKNET_TESTNET]
|
|
1147
1166
|
}
|
|
1148
|
-
};
|
|
1149
|
-
function
|
|
1150
|
-
if (e
|
|
1167
|
+
}, ot = new Set(Object.values(c));
|
|
1168
|
+
function Tt(e) {
|
|
1169
|
+
if (it(e))
|
|
1170
|
+
return e;
|
|
1171
|
+
const t = c[e];
|
|
1172
|
+
if (!t)
|
|
1173
|
+
throw new Error(`Invalid chain: ${e}. Chain must be a valid chain alias or internal chain value from Chains.`);
|
|
1174
|
+
return t;
|
|
1175
|
+
}
|
|
1176
|
+
function ht(e) {
|
|
1177
|
+
for (const [t, s] of Object.entries(c))
|
|
1178
|
+
if (s === e)
|
|
1179
|
+
return t;
|
|
1180
|
+
throw new Error(`Invalid internal chain value: ${e}. Internal chain value must be a valid value from InternalChains.`);
|
|
1181
|
+
}
|
|
1182
|
+
function gt(e) {
|
|
1183
|
+
return e in te;
|
|
1184
|
+
}
|
|
1185
|
+
function it(e) {
|
|
1186
|
+
return ot.has(e);
|
|
1187
|
+
}
|
|
1188
|
+
function ft(e, t) {
|
|
1189
|
+
if (e.symbol !== t)
|
|
1151
1190
|
throw new Error(
|
|
1152
|
-
`Token symbol mismatch: token is ${e.symbol}, tokenSymbol is ${
|
|
1191
|
+
`Token symbol mismatch: token is ${e.symbol}, tokenSymbol is ${t}. The token symbol must match the tokenSymbol parameter.`
|
|
1153
1192
|
);
|
|
1154
1193
|
}
|
|
1155
|
-
function
|
|
1156
|
-
const
|
|
1194
|
+
function at(e, t) {
|
|
1195
|
+
const s = t.toLowerCase().trim(), o = d[e];
|
|
1157
1196
|
if (!o)
|
|
1158
1197
|
throw new Error(
|
|
1159
1198
|
`Chain not found: ${e}. The chain key must be a valid chain identifier.`
|
|
@@ -1161,52 +1200,52 @@ function ns(e, s) {
|
|
|
1161
1200
|
let i;
|
|
1162
1201
|
for (const r in o) {
|
|
1163
1202
|
const a = o[r];
|
|
1164
|
-
if (a && a.address.toLowerCase() ===
|
|
1203
|
+
if (a && a.address.toLowerCase() === s.toLowerCase()) {
|
|
1165
1204
|
i = a;
|
|
1166
1205
|
break;
|
|
1167
1206
|
}
|
|
1168
1207
|
}
|
|
1169
1208
|
if (!i)
|
|
1170
1209
|
throw new Error(
|
|
1171
|
-
`Token address mismatch: address ${
|
|
1210
|
+
`Token address mismatch: address ${t} does not exist on chain ${e}. The token address must be a valid token address on the specified chain.`
|
|
1172
1211
|
);
|
|
1173
1212
|
return i;
|
|
1174
1213
|
}
|
|
1175
|
-
function
|
|
1176
|
-
if (e.symbol !==
|
|
1214
|
+
function pt(e, t) {
|
|
1215
|
+
if (e.symbol !== t)
|
|
1177
1216
|
throw new Error(
|
|
1178
|
-
`Token symbol mismatch: token symbol is "${e.symbol}", expected "${
|
|
1217
|
+
`Token symbol mismatch: token symbol is "${e.symbol}", expected "${t}". The token symbol must match the expected token symbol.`
|
|
1179
1218
|
);
|
|
1180
1219
|
}
|
|
1181
|
-
function
|
|
1182
|
-
const o =
|
|
1183
|
-
if (o.symbol !==
|
|
1220
|
+
function St(e, t, s) {
|
|
1221
|
+
const o = at(e, t);
|
|
1222
|
+
if (o.symbol !== s)
|
|
1184
1223
|
throw new Error(
|
|
1185
|
-
`Token address and symbol mismatch: address ${
|
|
1224
|
+
`Token address and symbol mismatch: address ${t} on chain ${e} corresponds to token "${o.symbol}", but expected "${s}". The token address must correspond to a token with the expected symbol on the specified chain.`
|
|
1186
1225
|
);
|
|
1187
1226
|
return o;
|
|
1188
1227
|
}
|
|
1189
|
-
function J(e,
|
|
1190
|
-
return d[e]?.[
|
|
1228
|
+
function J(e, t) {
|
|
1229
|
+
return d[e]?.[t];
|
|
1191
1230
|
}
|
|
1192
|
-
function
|
|
1193
|
-
return J(e,
|
|
1231
|
+
function At(e, t) {
|
|
1232
|
+
return J(e, t)?.address;
|
|
1194
1233
|
}
|
|
1195
|
-
function
|
|
1196
|
-
return J(e,
|
|
1234
|
+
function bt(e, t) {
|
|
1235
|
+
return J(e, t)?.decimals;
|
|
1197
1236
|
}
|
|
1198
1237
|
var Q = /* @__PURE__ */ ((e) => (e.PRODUCTION = "production", e.STAGING = "staging", e))(Q || {});
|
|
1199
1238
|
class m {
|
|
1200
|
-
constructor({ api_key:
|
|
1201
|
-
this.api_key =
|
|
1239
|
+
constructor({ api_key: t, env: s, seesion_token: o, props: i }) {
|
|
1240
|
+
this.api_key = t || "", this.sessionToken = o || "", this.env = s ?? Q.PRODUCTION, this.props = i;
|
|
1202
1241
|
}
|
|
1203
|
-
static async config(
|
|
1242
|
+
static async config(t) {
|
|
1204
1243
|
if (!m.app) {
|
|
1205
|
-
if (!
|
|
1244
|
+
if (!t)
|
|
1206
1245
|
throw new Error("Please provide an api_key");
|
|
1207
|
-
m.app = new m(
|
|
1246
|
+
m.app = new m(t);
|
|
1208
1247
|
}
|
|
1209
|
-
return
|
|
1248
|
+
return t && (t.api_key !== void 0 && (m.app.api_key = t.api_key), t.seesion_token !== void 0 && (m.app.sessionToken = t.seesion_token), t.env !== void 0 && (m.app.env = t.env), t.props !== void 0 && (m.app.props = t.props)), m.app;
|
|
1210
1249
|
}
|
|
1211
1250
|
static getApiKey() {
|
|
1212
1251
|
if (!m.app)
|
|
@@ -1242,50 +1281,55 @@ class m {
|
|
|
1242
1281
|
return "https://api.chainrails.io/api/v1";
|
|
1243
1282
|
}
|
|
1244
1283
|
}
|
|
1245
|
-
static getPayModalUrl(
|
|
1284
|
+
static getPayModalUrl(t) {
|
|
1246
1285
|
if (!m.app)
|
|
1247
1286
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
1248
|
-
const
|
|
1249
|
-
return
|
|
1287
|
+
const s = m.app.env === "internal" ? "https://chainrails-frontend-git-staging-horus-labs.vercel.app" : "https://app.chainrails.io", o = Number(t), i = t && !isNaN(Number(t)) && o > 0 ? "/pay/" : "/deposit/", r = `${t && !isNaN(Number(t)) && o > 0 ? o * 100 : ""}`;
|
|
1288
|
+
return s + i + r;
|
|
1250
1289
|
}
|
|
1251
1290
|
}
|
|
1252
1291
|
export {
|
|
1253
1292
|
n as AmountSymbols,
|
|
1254
|
-
|
|
1293
|
+
E as ChainTypes,
|
|
1255
1294
|
m as Chainrails,
|
|
1256
|
-
|
|
1257
|
-
|
|
1295
|
+
te as Chains,
|
|
1296
|
+
mt as DEFAULT_AMOUNT_SYMBOL,
|
|
1297
|
+
c as InternalChains,
|
|
1258
1298
|
d as TOKEN_REGISTRY,
|
|
1259
|
-
|
|
1260
|
-
|
|
1299
|
+
Et as Tokens,
|
|
1300
|
+
ut as allChains,
|
|
1261
1301
|
se as arbitrum,
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1302
|
+
ne as arbitrumTestnet,
|
|
1303
|
+
at as assertTokenAddressMatchesChain,
|
|
1304
|
+
St as assertTokenAddressMatchesChainAndSymbol,
|
|
1305
|
+
ft as assertTokenMatchesAmountSymbol,
|
|
1306
|
+
pt as assertTokenSymbolMatches,
|
|
1307
|
+
oe as avalanche,
|
|
1308
|
+
ie as avalancheTestnet,
|
|
1309
|
+
ae as base,
|
|
1310
|
+
re as baseTestnet,
|
|
1311
|
+
ce as bsc,
|
|
1312
|
+
rt as celo,
|
|
1273
1313
|
Q as environment,
|
|
1274
|
-
|
|
1275
|
-
|
|
1314
|
+
de as ethereum,
|
|
1315
|
+
le as ethereumTestnet,
|
|
1276
1316
|
J as getToken,
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1317
|
+
At as getTokenAddress,
|
|
1318
|
+
bt as getTokenDecimals,
|
|
1319
|
+
me as hyperevm,
|
|
1320
|
+
gt as isChainAlias,
|
|
1321
|
+
it as isInternalChain,
|
|
1322
|
+
ct as linea,
|
|
1323
|
+
Ee as lisk,
|
|
1282
1324
|
ue as monad,
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1325
|
+
Te as monadTestnet,
|
|
1326
|
+
he as optimism,
|
|
1327
|
+
ge as optimismTestnet,
|
|
1286
1328
|
fe as polygon,
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1329
|
+
pe as starknet,
|
|
1330
|
+
Se as starknetTestnet,
|
|
1331
|
+
ht as toChainAlias,
|
|
1332
|
+
Tt as toInternalChain,
|
|
1333
|
+
dt as unichain,
|
|
1334
|
+
lt as worldchain
|
|
1291
1335
|
};
|