@chainrails/common 0.0.22 → 0.0.24
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 +658 -41
- package/dist/chainrails-common.es.mjs +658 -41
- package/dist/chainrails-common.umd.js +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/src/app/index.d.ts +4 -4
- package/dist/src/app/index.d.ts.map +1 -1
- package/dist/src/chains/all.d.ts +5 -0
- package/dist/src/chains/all.d.ts.map +1 -0
- package/dist/src/chains/constants.d.ts +25 -0
- package/dist/src/chains/constants.d.ts.map +1 -0
- 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 +14 -0
- package/dist/src/chains/types.d.ts.map +1 -0
- package/dist/src/tokenAddresses/index.d.ts +8 -0
- package/dist/src/tokenAddresses/index.d.ts.map +1 -0
- package/dist/src/tokens/all.d.ts +35 -0
- package/dist/src/tokens/all.d.ts.map +1 -0
- package/dist/src/tokens/index.d.ts +10 -0
- package/dist/src/tokens/index.d.ts.map +1 -1
- package/package.json +2 -1
|
@@ -1,48 +1,662 @@
|
|
|
1
|
-
var
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
1
|
+
var l = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(l || {});
|
|
2
|
+
const O = {
|
|
3
|
+
type: "evm",
|
|
4
|
+
chainId: 42161,
|
|
5
|
+
name: "Arbitrum",
|
|
6
|
+
cctpDomain: 3,
|
|
7
|
+
logoURI: "/images/chains/arbitrum.svg"
|
|
8
|
+
}, _ = {
|
|
9
|
+
type: "evm",
|
|
10
|
+
chainId: 421614,
|
|
11
|
+
name: "Arbitrum Sepolia",
|
|
12
|
+
cctpDomain: 3,
|
|
13
|
+
logoURI: "/images/chains/arbitrum.svg"
|
|
14
|
+
}, z = {
|
|
15
|
+
type: "evm",
|
|
16
|
+
chainId: 8453,
|
|
17
|
+
name: "Base",
|
|
18
|
+
cctpDomain: 6,
|
|
19
|
+
logoURI: "/images/chains/base.webp"
|
|
20
|
+
}, L = {
|
|
21
|
+
type: "evm",
|
|
22
|
+
chainId: 84532,
|
|
23
|
+
name: "Base Sepolia",
|
|
24
|
+
cctpDomain: 6,
|
|
25
|
+
logoURI: "/images/chains/base.webp"
|
|
26
|
+
}, H = {
|
|
27
|
+
type: "evm",
|
|
28
|
+
chainId: 56,
|
|
29
|
+
name: "BNB Chain",
|
|
30
|
+
cctpDomain: null,
|
|
31
|
+
logoURI: "/images/chains/bsc.webp"
|
|
32
|
+
}, P = {
|
|
33
|
+
type: "evm",
|
|
34
|
+
chainId: 1,
|
|
35
|
+
name: "Ethereum",
|
|
36
|
+
cctpDomain: 0,
|
|
37
|
+
logoURI: "/images/chains/ethereum.svg"
|
|
38
|
+
}, F = {
|
|
39
|
+
type: "evm",
|
|
40
|
+
chainId: 11155111,
|
|
41
|
+
name: "Ethereum Sepolia",
|
|
42
|
+
cctpDomain: 0,
|
|
43
|
+
logoURI: "/images/chains/ethereum.svg"
|
|
44
|
+
}, j = {
|
|
45
|
+
type: "evm",
|
|
46
|
+
chainId: 43114,
|
|
47
|
+
name: "Avalanche",
|
|
48
|
+
cctpDomain: 1,
|
|
49
|
+
logoURI: "/images/chains/avalanche.svg"
|
|
50
|
+
}, K = {
|
|
51
|
+
type: "evm",
|
|
52
|
+
chainId: 43113,
|
|
53
|
+
name: "Avalanche Fuji",
|
|
54
|
+
cctpDomain: 1,
|
|
55
|
+
logoURI: "/images/chains/avalanche.svg"
|
|
56
|
+
}, V = {
|
|
57
|
+
type: "starknet",
|
|
58
|
+
chainId: "0x534e5f4d41494e",
|
|
59
|
+
// SN_MAIN
|
|
60
|
+
name: "Starknet",
|
|
61
|
+
cctpDomain: null,
|
|
62
|
+
logoURI: "/images/chains/starknet.svg"
|
|
63
|
+
};
|
|
64
|
+
function T(e, { strict: t = !0 } = {}) {
|
|
65
|
+
return !e || typeof e != "string" ? !1 : t ? /^0x[0-9a-fA-F]*$/.test(e) : e.startsWith("0x");
|
|
66
|
+
}
|
|
67
|
+
function D(e) {
|
|
68
|
+
return T(e, { strict: !1 }) ? Math.ceil((e.length - 2) / 2) : e.length;
|
|
69
|
+
}
|
|
70
|
+
const X = "2.43.4";
|
|
71
|
+
let S = {
|
|
72
|
+
getDocsUrl: ({ docsBaseUrl: e, docsPath: t = "", docsSlug: n }) => t ? `${e ?? "https://viem.sh"}${t}${n ? `#${n}` : ""}` : void 0,
|
|
73
|
+
version: `viem@${X}`
|
|
74
|
+
};
|
|
75
|
+
class d extends Error {
|
|
76
|
+
constructor(t, n = {}) {
|
|
77
|
+
const s = n.cause instanceof d ? n.cause.details : n.cause?.message ? n.cause.message : n.details, o = n.cause instanceof d && n.cause.docsPath || n.docsPath, r = S.getDocsUrl?.({ ...n, docsPath: o }), i = [
|
|
78
|
+
t || "An error occurred.",
|
|
79
|
+
"",
|
|
80
|
+
...n.metaMessages ? [...n.metaMessages, ""] : [],
|
|
81
|
+
...r ? [`Docs: ${r}`] : [],
|
|
82
|
+
...s ? [`Details: ${s}`] : [],
|
|
83
|
+
...S.version ? [`Version: ${S.version}`] : []
|
|
84
|
+
].join(`
|
|
85
|
+
`);
|
|
86
|
+
super(i, n.cause ? { cause: n.cause } : void 0), Object.defineProperty(this, "details", {
|
|
87
|
+
enumerable: !0,
|
|
88
|
+
configurable: !0,
|
|
89
|
+
writable: !0,
|
|
90
|
+
value: void 0
|
|
91
|
+
}), Object.defineProperty(this, "docsPath", {
|
|
92
|
+
enumerable: !0,
|
|
93
|
+
configurable: !0,
|
|
94
|
+
writable: !0,
|
|
95
|
+
value: void 0
|
|
96
|
+
}), Object.defineProperty(this, "metaMessages", {
|
|
97
|
+
enumerable: !0,
|
|
98
|
+
configurable: !0,
|
|
99
|
+
writable: !0,
|
|
100
|
+
value: void 0
|
|
101
|
+
}), Object.defineProperty(this, "shortMessage", {
|
|
102
|
+
enumerable: !0,
|
|
103
|
+
configurable: !0,
|
|
104
|
+
writable: !0,
|
|
105
|
+
value: void 0
|
|
106
|
+
}), Object.defineProperty(this, "version", {
|
|
107
|
+
enumerable: !0,
|
|
108
|
+
configurable: !0,
|
|
109
|
+
writable: !0,
|
|
110
|
+
value: void 0
|
|
111
|
+
}), Object.defineProperty(this, "name", {
|
|
112
|
+
enumerable: !0,
|
|
113
|
+
configurable: !0,
|
|
114
|
+
writable: !0,
|
|
115
|
+
value: "BaseError"
|
|
116
|
+
}), this.details = s, this.docsPath = o, this.metaMessages = n.metaMessages, this.name = n.name ?? this.name, this.shortMessage = t, this.version = X;
|
|
117
|
+
}
|
|
118
|
+
walk(t) {
|
|
119
|
+
return G(this, t);
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function G(e, t) {
|
|
123
|
+
return t?.(e) ? e : e && typeof e == "object" && "cause" in e && e.cause !== void 0 ? G(e.cause, t) : t ? null : e;
|
|
124
|
+
}
|
|
125
|
+
class q extends d {
|
|
126
|
+
constructor({ size: t, targetSize: n, type: s }) {
|
|
127
|
+
super(`${s.charAt(0).toUpperCase()}${s.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`, { name: "SizeExceedsPaddingSizeError" });
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function y(e, { dir: t, size: n = 32 } = {}) {
|
|
131
|
+
return typeof e == "string" ? ae(e, { dir: t, size: n }) : ue(e, { dir: t, size: n });
|
|
132
|
+
}
|
|
133
|
+
function ae(e, { dir: t, size: n = 32 } = {}) {
|
|
134
|
+
if (n === null)
|
|
135
|
+
return e;
|
|
136
|
+
const s = e.replace("0x", "");
|
|
137
|
+
if (s.length > n * 2)
|
|
138
|
+
throw new q({
|
|
139
|
+
size: Math.ceil(s.length / 2),
|
|
140
|
+
targetSize: n,
|
|
141
|
+
type: "hex"
|
|
142
|
+
});
|
|
143
|
+
return `0x${s[t === "right" ? "padEnd" : "padStart"](n * 2, "0")}`;
|
|
144
|
+
}
|
|
145
|
+
function ue(e, { dir: t, size: n = 32 } = {}) {
|
|
146
|
+
if (n === null)
|
|
147
|
+
return e;
|
|
148
|
+
if (e.length > n)
|
|
149
|
+
throw new q({
|
|
150
|
+
size: e.length,
|
|
151
|
+
targetSize: n,
|
|
152
|
+
type: "bytes"
|
|
153
|
+
});
|
|
154
|
+
const s = new Uint8Array(n);
|
|
155
|
+
for (let o = 0; o < n; o++) {
|
|
156
|
+
const r = t === "right";
|
|
157
|
+
s[r ? o : n - o - 1] = e[r ? o : e.length - o - 1];
|
|
158
|
+
}
|
|
159
|
+
return s;
|
|
160
|
+
}
|
|
161
|
+
class le extends d {
|
|
162
|
+
constructor({ max: t, min: n, signed: s, size: o, value: r }) {
|
|
163
|
+
super(`Number "${r}" is not in safe ${o ? `${o * 8}-bit ${s ? "signed" : "unsigned"} ` : ""}integer range ${t ? `(${n} to ${t})` : `(above ${n})`}`, { name: "IntegerOutOfRangeError" });
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
class fe extends d {
|
|
167
|
+
constructor({ givenSize: t, maxSize: n }) {
|
|
168
|
+
super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`, { name: "SizeOverflowError" });
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
function x(e, { size: t }) {
|
|
172
|
+
if (D(e) > t)
|
|
173
|
+
throw new fe({
|
|
174
|
+
givenSize: D(e),
|
|
175
|
+
maxSize: t
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
function he(e, t = {}) {
|
|
179
|
+
const { signed: n, size: s } = t, o = BigInt(e);
|
|
180
|
+
let r;
|
|
181
|
+
s ? n ? r = (1n << BigInt(s) * 8n - 1n) - 1n : r = 2n ** (BigInt(s) * 8n) - 1n : typeof e == "number" && (r = BigInt(Number.MAX_SAFE_INTEGER));
|
|
182
|
+
const i = typeof r == "bigint" && n ? -r - 1n : 0;
|
|
183
|
+
if (r && o > r || o < i) {
|
|
184
|
+
const u = typeof e == "bigint" ? "n" : "";
|
|
185
|
+
throw new le({
|
|
186
|
+
max: r ? `${r}${u}` : void 0,
|
|
187
|
+
min: `${i}${u}`,
|
|
188
|
+
signed: n,
|
|
189
|
+
size: s,
|
|
190
|
+
value: `${e}${u}`
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
const c = `0x${(n && o < 0 ? (1n << BigInt(s * 8)) + BigInt(o) : o).toString(16)}`;
|
|
194
|
+
return s ? y(c, { size: s }) : c;
|
|
195
|
+
}
|
|
196
|
+
const de = /* @__PURE__ */ new TextEncoder();
|
|
197
|
+
function pe(e, t = {}) {
|
|
198
|
+
return typeof e == "number" || typeof e == "bigint" ? me(e, t) : typeof e == "boolean" ? ge(e, t) : T(e) ? W(e, t) : J(e, t);
|
|
199
|
+
}
|
|
200
|
+
function ge(e, t = {}) {
|
|
201
|
+
const n = new Uint8Array(1);
|
|
202
|
+
return n[0] = Number(e), typeof t.size == "number" ? (x(n, { size: t.size }), y(n, { size: t.size })) : n;
|
|
203
|
+
}
|
|
204
|
+
const f = {
|
|
205
|
+
zero: 48,
|
|
206
|
+
nine: 57,
|
|
207
|
+
A: 65,
|
|
208
|
+
F: 70,
|
|
209
|
+
a: 97,
|
|
210
|
+
f: 102
|
|
211
|
+
};
|
|
212
|
+
function C(e) {
|
|
213
|
+
if (e >= f.zero && e <= f.nine)
|
|
214
|
+
return e - f.zero;
|
|
215
|
+
if (e >= f.A && e <= f.F)
|
|
216
|
+
return e - (f.A - 10);
|
|
217
|
+
if (e >= f.a && e <= f.f)
|
|
218
|
+
return e - (f.a - 10);
|
|
219
|
+
}
|
|
220
|
+
function W(e, t = {}) {
|
|
221
|
+
let n = e;
|
|
222
|
+
t.size && (x(n, { size: t.size }), n = y(n, { dir: "right", size: t.size }));
|
|
223
|
+
let s = n.slice(2);
|
|
224
|
+
s.length % 2 && (s = `0${s}`);
|
|
225
|
+
const o = s.length / 2, r = new Uint8Array(o);
|
|
226
|
+
for (let i = 0, c = 0; i < o; i++) {
|
|
227
|
+
const u = C(s.charCodeAt(c++)), p = C(s.charCodeAt(c++));
|
|
228
|
+
if (u === void 0 || p === void 0)
|
|
229
|
+
throw new d(`Invalid byte sequence ("${s[c - 2]}${s[c - 1]}" in "${s}").`);
|
|
230
|
+
r[i] = u * 16 + p;
|
|
231
|
+
}
|
|
232
|
+
return r;
|
|
233
|
+
}
|
|
234
|
+
function me(e, t) {
|
|
235
|
+
const n = he(e, t);
|
|
236
|
+
return W(n);
|
|
237
|
+
}
|
|
238
|
+
function J(e, t = {}) {
|
|
239
|
+
const n = de.encode(e);
|
|
240
|
+
return typeof t.size == "number" ? (x(n, { size: t.size }), y(n, { dir: "right", size: t.size })) : n;
|
|
241
|
+
}
|
|
242
|
+
const E = /* @__PURE__ */ BigInt(2 ** 32 - 1), v = /* @__PURE__ */ BigInt(32);
|
|
243
|
+
function be(e, t = !1) {
|
|
244
|
+
return t ? { h: Number(e & E), l: Number(e >> v & E) } : { h: Number(e >> v & E) | 0, l: Number(e & E) | 0 };
|
|
245
|
+
}
|
|
246
|
+
function Ee(e, t = !1) {
|
|
247
|
+
const n = e.length;
|
|
248
|
+
let s = new Uint32Array(n), o = new Uint32Array(n);
|
|
249
|
+
for (let r = 0; r < n; r++) {
|
|
250
|
+
const { h: i, l: c } = be(e[r], t);
|
|
251
|
+
[s[r], o[r]] = [i, c];
|
|
252
|
+
}
|
|
253
|
+
return [s, o];
|
|
254
|
+
}
|
|
255
|
+
const Ie = (e, t, n) => e << n | t >>> 32 - n, ye = (e, t, n) => t << n | e >>> 32 - n, Se = (e, t, n) => t << n - 32 | e >>> 64 - n, Ae = (e, t, n) => e << n - 32 | t >>> 64 - n;
|
|
256
|
+
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
257
|
+
function Ue(e) {
|
|
258
|
+
return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
|
|
259
|
+
}
|
|
260
|
+
function B(e) {
|
|
261
|
+
if (!Number.isSafeInteger(e) || e < 0)
|
|
262
|
+
throw new Error("positive integer expected, got " + e);
|
|
263
|
+
}
|
|
264
|
+
function I(e, ...t) {
|
|
265
|
+
if (!Ue(e))
|
|
266
|
+
throw new Error("Uint8Array expected");
|
|
267
|
+
if (t.length > 0 && !t.includes(e.length))
|
|
268
|
+
throw new Error("Uint8Array expected of length " + t + ", got length=" + e.length);
|
|
269
|
+
}
|
|
270
|
+
function k(e, t = !0) {
|
|
271
|
+
if (e.destroyed)
|
|
272
|
+
throw new Error("Hash instance has been destroyed");
|
|
273
|
+
if (t && e.finished)
|
|
274
|
+
throw new Error("Hash#digest() has already been called");
|
|
275
|
+
}
|
|
276
|
+
function Te(e, t) {
|
|
277
|
+
I(e);
|
|
278
|
+
const n = t.outputLen;
|
|
279
|
+
if (e.length < n)
|
|
280
|
+
throw new Error("digestInto() expects output buffer of length at least " + n);
|
|
281
|
+
}
|
|
282
|
+
function xe(e) {
|
|
283
|
+
return new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4));
|
|
284
|
+
}
|
|
285
|
+
function Q(...e) {
|
|
286
|
+
for (let t = 0; t < e.length; t++)
|
|
287
|
+
e[t].fill(0);
|
|
288
|
+
}
|
|
289
|
+
const we = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
290
|
+
function De(e) {
|
|
291
|
+
return e << 24 & 4278190080 | e << 8 & 16711680 | e >>> 8 & 65280 | e >>> 24 & 255;
|
|
292
|
+
}
|
|
293
|
+
function Ce(e) {
|
|
294
|
+
for (let t = 0; t < e.length; t++)
|
|
295
|
+
e[t] = De(e[t]);
|
|
296
|
+
return e;
|
|
297
|
+
}
|
|
298
|
+
const R = we ? (e) => e : Ce;
|
|
299
|
+
function ve(e) {
|
|
300
|
+
if (typeof e != "string")
|
|
301
|
+
throw new Error("string expected");
|
|
302
|
+
return new Uint8Array(new TextEncoder().encode(e));
|
|
303
|
+
}
|
|
304
|
+
function Y(e) {
|
|
305
|
+
return typeof e == "string" && (e = ve(e)), I(e), e;
|
|
306
|
+
}
|
|
307
|
+
class Be {
|
|
308
|
+
}
|
|
309
|
+
function ke(e) {
|
|
310
|
+
const t = (s) => e().update(Y(s)).digest(), n = e();
|
|
311
|
+
return t.outputLen = n.outputLen, t.blockLen = n.blockLen, t.create = () => e(), t;
|
|
312
|
+
}
|
|
313
|
+
const Re = BigInt(0), m = BigInt(1), Ne = BigInt(2), $e = BigInt(7), Me = BigInt(256), Oe = BigInt(113), Z = [], ee = [], te = [];
|
|
314
|
+
for (let e = 0, t = m, n = 1, s = 0; e < 24; e++) {
|
|
315
|
+
[n, s] = [s, (2 * n + 3 * s) % 5], Z.push(2 * (5 * s + n)), ee.push((e + 1) * (e + 2) / 2 % 64);
|
|
316
|
+
let o = Re;
|
|
317
|
+
for (let r = 0; r < 7; r++)
|
|
318
|
+
t = (t << m ^ (t >> $e) * Oe) % Me, t & Ne && (o ^= m << (m << /* @__PURE__ */ BigInt(r)) - m);
|
|
319
|
+
te.push(o);
|
|
320
|
+
}
|
|
321
|
+
const ne = Ee(te, !0), _e = ne[0], ze = ne[1], N = (e, t, n) => n > 32 ? Se(e, t, n) : Ie(e, t, n), $ = (e, t, n) => n > 32 ? Ae(e, t, n) : ye(e, t, n);
|
|
322
|
+
function Le(e, t = 24) {
|
|
323
|
+
const n = new Uint32Array(10);
|
|
324
|
+
for (let s = 24 - t; s < 24; s++) {
|
|
325
|
+
for (let i = 0; i < 10; i++)
|
|
326
|
+
n[i] = e[i] ^ e[i + 10] ^ e[i + 20] ^ e[i + 30] ^ e[i + 40];
|
|
327
|
+
for (let i = 0; i < 10; i += 2) {
|
|
328
|
+
const c = (i + 8) % 10, u = (i + 2) % 10, p = n[u], g = n[u + 1], re = N(p, g, 1) ^ n[c], ce = $(p, g, 1) ^ n[c + 1];
|
|
329
|
+
for (let b = 0; b < 50; b += 10)
|
|
330
|
+
e[i + b] ^= re, e[i + b + 1] ^= ce;
|
|
331
|
+
}
|
|
332
|
+
let o = e[2], r = e[3];
|
|
333
|
+
for (let i = 0; i < 24; i++) {
|
|
334
|
+
const c = ee[i], u = N(o, r, c), p = $(o, r, c), g = Z[i];
|
|
335
|
+
o = e[g], r = e[g + 1], e[g] = u, e[g + 1] = p;
|
|
336
|
+
}
|
|
337
|
+
for (let i = 0; i < 50; i += 10) {
|
|
338
|
+
for (let c = 0; c < 10; c++)
|
|
339
|
+
n[c] = e[i + c];
|
|
340
|
+
for (let c = 0; c < 10; c++)
|
|
341
|
+
e[i + c] ^= ~n[(c + 2) % 10] & n[(c + 4) % 10];
|
|
342
|
+
}
|
|
343
|
+
e[0] ^= _e[s], e[1] ^= ze[s];
|
|
344
|
+
}
|
|
345
|
+
Q(n);
|
|
346
|
+
}
|
|
347
|
+
class w extends Be {
|
|
348
|
+
// NOTE: we accept arguments in bytes instead of bits here.
|
|
349
|
+
constructor(t, n, s, o = !1, r = 24) {
|
|
350
|
+
if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = t, this.suffix = n, this.outputLen = s, this.enableXOF = o, this.rounds = r, B(s), !(0 < t && t < 200))
|
|
351
|
+
throw new Error("only keccak-f1600 function is supported");
|
|
352
|
+
this.state = new Uint8Array(200), this.state32 = xe(this.state);
|
|
353
|
+
}
|
|
354
|
+
clone() {
|
|
355
|
+
return this._cloneInto();
|
|
356
|
+
}
|
|
357
|
+
keccak() {
|
|
358
|
+
R(this.state32), Le(this.state32, this.rounds), R(this.state32), this.posOut = 0, this.pos = 0;
|
|
359
|
+
}
|
|
360
|
+
update(t) {
|
|
361
|
+
k(this), t = Y(t), I(t);
|
|
362
|
+
const { blockLen: n, state: s } = this, o = t.length;
|
|
363
|
+
for (let r = 0; r < o; ) {
|
|
364
|
+
const i = Math.min(n - this.pos, o - r);
|
|
365
|
+
for (let c = 0; c < i; c++)
|
|
366
|
+
s[this.pos++] ^= t[r++];
|
|
367
|
+
this.pos === n && this.keccak();
|
|
368
|
+
}
|
|
369
|
+
return this;
|
|
370
|
+
}
|
|
371
|
+
finish() {
|
|
372
|
+
if (this.finished)
|
|
373
|
+
return;
|
|
374
|
+
this.finished = !0;
|
|
375
|
+
const { state: t, suffix: n, pos: s, blockLen: o } = this;
|
|
376
|
+
t[s] ^= n, (n & 128) !== 0 && s === o - 1 && this.keccak(), t[o - 1] ^= 128, this.keccak();
|
|
377
|
+
}
|
|
378
|
+
writeInto(t) {
|
|
379
|
+
k(this, !1), I(t), this.finish();
|
|
380
|
+
const n = this.state, { blockLen: s } = this;
|
|
381
|
+
for (let o = 0, r = t.length; o < r; ) {
|
|
382
|
+
this.posOut >= s && this.keccak();
|
|
383
|
+
const i = Math.min(s - this.posOut, r - o);
|
|
384
|
+
t.set(n.subarray(this.posOut, this.posOut + i), o), this.posOut += i, o += i;
|
|
385
|
+
}
|
|
386
|
+
return t;
|
|
387
|
+
}
|
|
388
|
+
xofInto(t) {
|
|
389
|
+
if (!this.enableXOF)
|
|
390
|
+
throw new Error("XOF is not possible for this instance");
|
|
391
|
+
return this.writeInto(t);
|
|
392
|
+
}
|
|
393
|
+
xof(t) {
|
|
394
|
+
return B(t), this.xofInto(new Uint8Array(t));
|
|
395
|
+
}
|
|
396
|
+
digestInto(t) {
|
|
397
|
+
if (Te(t, this), this.finished)
|
|
398
|
+
throw new Error("digest() was already called");
|
|
399
|
+
return this.writeInto(t), this.destroy(), t;
|
|
400
|
+
}
|
|
401
|
+
digest() {
|
|
402
|
+
return this.digestInto(new Uint8Array(this.outputLen));
|
|
403
|
+
}
|
|
404
|
+
destroy() {
|
|
405
|
+
this.destroyed = !0, Q(this.state);
|
|
406
|
+
}
|
|
407
|
+
_cloneInto(t) {
|
|
408
|
+
const { blockLen: n, suffix: s, outputLen: o, rounds: r, enableXOF: i } = this;
|
|
409
|
+
return t || (t = new w(n, s, o, i, r)), t.state32.set(this.state32), t.pos = this.pos, t.posOut = this.posOut, t.finished = this.finished, t.rounds = r, t.suffix = s, t.outputLen = o, t.enableXOF = i, t.destroyed = this.destroyed, t;
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
const He = (e, t, n) => ke(() => new w(t, e, n)), Pe = He(1, 136, 256 / 8);
|
|
413
|
+
function Fe(e, t) {
|
|
414
|
+
return Pe(T(e, { strict: !1 }) ? pe(e) : e);
|
|
415
|
+
}
|
|
416
|
+
class je extends d {
|
|
417
|
+
constructor({ address: t }) {
|
|
418
|
+
super(`Address "${t}" is invalid.`, {
|
|
419
|
+
metaMessages: [
|
|
420
|
+
"- Address must be a hex value of 20 bytes (40 hex characters).",
|
|
421
|
+
"- Address must match its checksum counterpart."
|
|
422
|
+
],
|
|
423
|
+
name: "InvalidAddressError"
|
|
424
|
+
});
|
|
425
|
+
}
|
|
426
|
+
}
|
|
427
|
+
class se extends Map {
|
|
428
|
+
constructor(t) {
|
|
429
|
+
super(), Object.defineProperty(this, "maxSize", {
|
|
430
|
+
enumerable: !0,
|
|
431
|
+
configurable: !0,
|
|
432
|
+
writable: !0,
|
|
433
|
+
value: void 0
|
|
434
|
+
}), this.maxSize = t;
|
|
435
|
+
}
|
|
436
|
+
get(t) {
|
|
437
|
+
const n = super.get(t);
|
|
438
|
+
return super.has(t) && n !== void 0 && (this.delete(t), super.set(t, n)), n;
|
|
439
|
+
}
|
|
440
|
+
set(t, n) {
|
|
441
|
+
if (super.set(t, n), this.maxSize && this.size > this.maxSize) {
|
|
442
|
+
const s = this.keys().next().value;
|
|
443
|
+
s && this.delete(s);
|
|
11
444
|
}
|
|
12
|
-
return
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
445
|
+
return this;
|
|
446
|
+
}
|
|
447
|
+
}
|
|
448
|
+
const A = /* @__PURE__ */ new se(8192);
|
|
449
|
+
function oe(e, t) {
|
|
450
|
+
if (A.has(`${e}.${t}`))
|
|
451
|
+
return A.get(`${e}.${t}`);
|
|
452
|
+
const n = e.substring(2).toLowerCase(), s = Fe(J(n)), o = n.split("");
|
|
453
|
+
for (let i = 0; i < 40; i += 2)
|
|
454
|
+
s[i >> 1] >> 4 >= 8 && o[i] && (o[i] = o[i].toUpperCase()), (s[i >> 1] & 15) >= 8 && o[i + 1] && (o[i + 1] = o[i + 1].toUpperCase());
|
|
455
|
+
const r = `0x${o.join("")}`;
|
|
456
|
+
return A.set(`${e}.${t}`, r), r;
|
|
457
|
+
}
|
|
458
|
+
function h(e, t) {
|
|
459
|
+
if (!Ve(e, { strict: !1 }))
|
|
460
|
+
throw new je({ address: e });
|
|
461
|
+
return oe(e, t);
|
|
462
|
+
}
|
|
463
|
+
const Ke = /^0x[a-fA-F0-9]{40}$/, U = /* @__PURE__ */ new se(8192);
|
|
464
|
+
function Ve(e, t) {
|
|
465
|
+
const { strict: n = !0 } = t ?? {}, s = `${e}.${n}`;
|
|
466
|
+
if (U.has(s))
|
|
467
|
+
return U.get(s);
|
|
468
|
+
const o = Ke.test(e) ? e.toLowerCase() === e ? !0 : n ? oe(e) === e : !0 : !1;
|
|
469
|
+
return U.set(s, o), o;
|
|
470
|
+
}
|
|
471
|
+
const Xe = {
|
|
472
|
+
chainId: _.chainId,
|
|
473
|
+
address: h("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),
|
|
474
|
+
symbol: "USDC",
|
|
475
|
+
fiatISO: "USD",
|
|
476
|
+
decimals: 6,
|
|
477
|
+
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
478
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
479
|
+
}, Ge = {
|
|
480
|
+
chainId: O.chainId,
|
|
481
|
+
address: h("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
|
|
482
|
+
symbol: "USDC",
|
|
483
|
+
name: "USD Coin",
|
|
484
|
+
decimals: 6,
|
|
485
|
+
logoURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
486
|
+
/* USDC */
|
|
487
|
+
}, qe = {
|
|
488
|
+
chainId: K.chainId,
|
|
489
|
+
address: h("0x5425890298aed601595a70ab815c96711a31bc65"),
|
|
490
|
+
symbol: "USDC",
|
|
491
|
+
fiatISO: "USD",
|
|
492
|
+
decimals: 6,
|
|
493
|
+
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
494
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
495
|
+
}, We = {
|
|
496
|
+
chainId: j.chainId,
|
|
497
|
+
address: h("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),
|
|
498
|
+
symbol: "USDC",
|
|
499
|
+
fiatISO: "USD",
|
|
500
|
+
decimals: 6,
|
|
501
|
+
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
502
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
503
|
+
}, Je = {
|
|
504
|
+
chainId: L.chainId,
|
|
505
|
+
address: h("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),
|
|
506
|
+
symbol: "USDC",
|
|
507
|
+
fiatISO: "USD",
|
|
508
|
+
decimals: 6,
|
|
509
|
+
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
510
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
511
|
+
}, Qe = {
|
|
512
|
+
chainId: z.chainId,
|
|
513
|
+
address: h("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),
|
|
514
|
+
symbol: "USDC",
|
|
515
|
+
fiatISO: "USD",
|
|
516
|
+
decimals: 6,
|
|
517
|
+
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
518
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
519
|
+
}, Ye = {
|
|
520
|
+
chainId: H.chainId,
|
|
521
|
+
address: h("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),
|
|
522
|
+
symbol: "USDC",
|
|
523
|
+
decimals: 18,
|
|
524
|
+
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
525
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
526
|
+
}, Ze = {
|
|
527
|
+
chainId: F.chainId,
|
|
528
|
+
address: h("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),
|
|
529
|
+
symbol: "USDC",
|
|
530
|
+
decimals: 6,
|
|
531
|
+
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
532
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
533
|
+
}, et = {
|
|
534
|
+
chainId: P.chainId,
|
|
535
|
+
address: h("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
|
|
536
|
+
symbol: "USDC",
|
|
537
|
+
decimals: 6,
|
|
538
|
+
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
539
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
540
|
+
}, tt = {
|
|
541
|
+
chainId: V.chainId,
|
|
542
|
+
address: "0x053C91253BC9682c04929cA02ED00b3E423f6710D2ee7e0D5EBB06F3eCF368A8",
|
|
543
|
+
symbol: "USDC",
|
|
544
|
+
decimals: 6,
|
|
545
|
+
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
546
|
+
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
547
|
+
}, M = {
|
|
548
|
+
ARBITRUM_MAINNET: {
|
|
549
|
+
...O,
|
|
550
|
+
tokens: {
|
|
551
|
+
[l.USDC]: Ge
|
|
552
|
+
},
|
|
553
|
+
explorer: "https://arbiscan.io"
|
|
554
|
+
},
|
|
555
|
+
ARBITRUM_TESTNET: {
|
|
556
|
+
..._,
|
|
557
|
+
explorer: "https://sepolia.arbiscan.io",
|
|
558
|
+
tokens: {
|
|
559
|
+
[l.USDC]: Xe
|
|
560
|
+
}
|
|
561
|
+
},
|
|
562
|
+
AVALANCHE_MAINNET: {
|
|
563
|
+
...j,
|
|
564
|
+
tokens: {
|
|
565
|
+
[l.USDC]: We
|
|
566
|
+
},
|
|
567
|
+
explorer: "https://snowtrace.io"
|
|
568
|
+
},
|
|
569
|
+
AVALANCHE_TESTNET: {
|
|
570
|
+
...K,
|
|
571
|
+
tokens: {
|
|
572
|
+
[l.USDC]: qe
|
|
573
|
+
},
|
|
574
|
+
explorer: "https://testnet.snowtrace.io"
|
|
575
|
+
},
|
|
576
|
+
BASE_MAINNET: {
|
|
577
|
+
...z,
|
|
578
|
+
tokens: {
|
|
579
|
+
[l.USDC]: Qe
|
|
580
|
+
},
|
|
581
|
+
explorer: "https://basescan.org"
|
|
582
|
+
},
|
|
583
|
+
BASE_TESTNET: {
|
|
584
|
+
...L,
|
|
585
|
+
tokens: {
|
|
586
|
+
[l.USDC]: Je
|
|
587
|
+
},
|
|
588
|
+
explorer: "https://sepolia.basescan.org"
|
|
589
|
+
},
|
|
590
|
+
BSC_MAINNET: {
|
|
591
|
+
...H,
|
|
592
|
+
tokens: {
|
|
593
|
+
[l.USDC]: Ye
|
|
594
|
+
},
|
|
595
|
+
explorer: "https://bscscan.com"
|
|
596
|
+
},
|
|
597
|
+
ETHEREUM_MAINNET: {
|
|
598
|
+
...P,
|
|
599
|
+
tokens: {
|
|
600
|
+
[l.USDC]: et
|
|
601
|
+
},
|
|
602
|
+
explorer: "https://etherscan.io"
|
|
603
|
+
},
|
|
604
|
+
ETHEREUM_TESTNET: {
|
|
605
|
+
...F,
|
|
606
|
+
tokens: {
|
|
607
|
+
[l.USDC]: Ze
|
|
608
|
+
},
|
|
609
|
+
explorer: "https://sepolia.etherscan.io"
|
|
610
|
+
},
|
|
611
|
+
STARKNET_MAINNET: {
|
|
612
|
+
...V,
|
|
613
|
+
tokens: {
|
|
614
|
+
[l.USDC]: tt
|
|
615
|
+
},
|
|
616
|
+
explorer: ""
|
|
617
|
+
}
|
|
618
|
+
};
|
|
619
|
+
var nt = /* @__PURE__ */ ((e) => (e.ARBITRUM = "ARBITRUM_MAINNET", e.ARBITRUM_TESTNET = "ARBITRUM_TESTNET", e.AVALANCHE = "AVALANCHE_MAINNET", e.AVALANCHE_TESTNET = "AVALANCHE_TESTNET", e.BASE = "BASE_MAINNET", e.BASE_TESTNET = "BASE_TESTNET", e.BSC = "BSC_MAINNET", e.ETHEREUM = "ETHEREUM_MAINNET", e.ETHEREUM_TESTNET = "ETHEREUM_TESTNET", e.STARKNET = "STARKNET_MAINNET", e))(nt || {}), st = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(st || {});
|
|
620
|
+
const ot = (e) => {
|
|
621
|
+
const t = e.trim().toUpperCase();
|
|
622
|
+
if (M[t])
|
|
623
|
+
return M[t];
|
|
624
|
+
};
|
|
625
|
+
function it(e, t) {
|
|
626
|
+
return ot(e)?.tokens[t]?.address;
|
|
627
|
+
}
|
|
628
|
+
var ie = /* @__PURE__ */ ((e) => (e.PRODUCTION = "production", e.STAGING = "staging", e))(ie || {});
|
|
629
|
+
class a {
|
|
630
|
+
constructor({ api_key: t, env: n, seesion_token: s }) {
|
|
631
|
+
this.api_key = t || "", this.sessionToken = s || "", this.env = n ?? ie.PRODUCTION;
|
|
632
|
+
}
|
|
633
|
+
static async config(t) {
|
|
634
|
+
if (!a.app) {
|
|
635
|
+
if (!t)
|
|
636
|
+
throw new Error("Please provide an api_key");
|
|
637
|
+
a.app = new a(t);
|
|
27
638
|
}
|
|
639
|
+
return t && (t.api_key !== void 0 && (a.app.api_key = t.api_key), t.seesion_token !== void 0 && (a.app.sessionToken = t.seesion_token), t.env !== void 0 && (a.app.env = t.env)), a.app;
|
|
28
640
|
}
|
|
29
641
|
static getApiKey() {
|
|
30
|
-
if (!
|
|
642
|
+
if (!a.app)
|
|
31
643
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
32
|
-
return
|
|
644
|
+
return a.app.api_key;
|
|
33
645
|
}
|
|
34
|
-
static
|
|
35
|
-
|
|
646
|
+
static getSessionToken() {
|
|
647
|
+
if (!a.app)
|
|
648
|
+
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
649
|
+
return a.app.sessionToken;
|
|
36
650
|
}
|
|
37
651
|
static getEnv() {
|
|
38
|
-
if (!
|
|
652
|
+
if (!a.app)
|
|
39
653
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
40
|
-
return
|
|
654
|
+
return a.app.env === "internal" ? "staging" : a.app.env;
|
|
41
655
|
}
|
|
42
656
|
static getBaseUrl() {
|
|
43
|
-
if (!
|
|
657
|
+
if (!a.app)
|
|
44
658
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
45
|
-
switch (
|
|
659
|
+
switch (a.app.env) {
|
|
46
660
|
case "production":
|
|
47
661
|
return "https://api.chainrails.io/api/v1";
|
|
48
662
|
case "staging":
|
|
@@ -53,16 +667,19 @@ class e {
|
|
|
53
667
|
return "https://api.chainrails.io/api/v1";
|
|
54
668
|
}
|
|
55
669
|
}
|
|
56
|
-
static getPayModalUrl(
|
|
57
|
-
if (!
|
|
670
|
+
static getPayModalUrl(t, n, s, o) {
|
|
671
|
+
if (!a.app)
|
|
58
672
|
throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
|
|
59
|
-
const
|
|
60
|
-
return
|
|
673
|
+
const r = a.app.env === "internal" ? "https://chainrails-frontend-git-staging-horus-labs.vercel.app" : "https://app.chainrails.io", i = o && o > 0 ? "/pay/" : "/deposit/", c = `_chain_/${t}/_token_/${n}/_to_/${s}${o ? "/_amount_/" + o * 100 : ""}`;
|
|
674
|
+
return r + i + c;
|
|
61
675
|
}
|
|
62
676
|
}
|
|
63
677
|
export {
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
678
|
+
a as Chainrails,
|
|
679
|
+
M as allChains,
|
|
680
|
+
nt as chains,
|
|
681
|
+
ie as environment,
|
|
682
|
+
ot as getChainByChainEnum,
|
|
683
|
+
it as getTokenAddress,
|
|
684
|
+
st as tokens
|
|
68
685
|
};
|