@chainrails/sdk 0.0.36 → 0.0.39
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-sdk.es.js +137 -137
- package/dist/chainrails-sdk.es.mjs +137 -137
- package/dist/chainrails-sdk.umd.js +2 -2
- package/dist/src/Auth/index.d.ts.map +1 -1
- package/package.json +2 -2
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import
|
|
1
|
+
import de from "ky";
|
|
2
2
|
var h = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(h || {});
|
|
3
|
-
const
|
|
3
|
+
const j = {
|
|
4
4
|
type: "evm",
|
|
5
5
|
chainId: 42161,
|
|
6
6
|
name: "Arbitrum",
|
|
7
7
|
cctpDomain: 3,
|
|
8
8
|
logoURI: "/images/chains/arbitrum.svg"
|
|
9
|
-
},
|
|
9
|
+
}, _ = {
|
|
10
10
|
type: "evm",
|
|
11
11
|
chainId: 421614,
|
|
12
12
|
name: "Arbitrum Sepolia",
|
|
13
13
|
cctpDomain: 3,
|
|
14
14
|
logoURI: "/images/chains/arbitrum.svg"
|
|
15
|
-
},
|
|
15
|
+
}, F = {
|
|
16
16
|
type: "evm",
|
|
17
17
|
chainId: 8453,
|
|
18
18
|
name: "Base",
|
|
19
19
|
cctpDomain: 6,
|
|
20
20
|
logoURI: "/images/chains/base.webp"
|
|
21
|
-
},
|
|
21
|
+
}, L = {
|
|
22
22
|
type: "evm",
|
|
23
23
|
chainId: 84532,
|
|
24
24
|
name: "Base Sepolia",
|
|
25
25
|
cctpDomain: 6,
|
|
26
26
|
logoURI: "/images/chains/base.webp"
|
|
27
|
-
},
|
|
27
|
+
}, H = {
|
|
28
28
|
type: "evm",
|
|
29
29
|
chainId: 56,
|
|
30
30
|
name: "BNB Chain",
|
|
31
31
|
cctpDomain: null,
|
|
32
32
|
logoURI: "/images/chains/bsc.webp"
|
|
33
|
-
},
|
|
33
|
+
}, K = {
|
|
34
34
|
type: "evm",
|
|
35
35
|
chainId: 1,
|
|
36
36
|
name: "Ethereum",
|
|
37
37
|
cctpDomain: 0,
|
|
38
38
|
logoURI: "/images/chains/ethereum.svg"
|
|
39
|
-
},
|
|
39
|
+
}, q = {
|
|
40
40
|
type: "evm",
|
|
41
41
|
chainId: 11155111,
|
|
42
42
|
name: "Ethereum Sepolia",
|
|
43
43
|
cctpDomain: 0,
|
|
44
44
|
logoURI: "/images/chains/ethereum.svg"
|
|
45
|
-
},
|
|
45
|
+
}, V = {
|
|
46
46
|
type: "evm",
|
|
47
47
|
chainId: 43114,
|
|
48
48
|
name: "Avalanche",
|
|
49
49
|
cctpDomain: 1,
|
|
50
50
|
logoURI: "/images/chains/avalanche.svg"
|
|
51
|
-
},
|
|
51
|
+
}, X = {
|
|
52
52
|
type: "evm",
|
|
53
53
|
chainId: 43113,
|
|
54
54
|
name: "Avalanche Fuji",
|
|
55
55
|
cctpDomain: 1,
|
|
56
56
|
logoURI: "/images/chains/avalanche.svg"
|
|
57
|
-
},
|
|
57
|
+
}, G = {
|
|
58
58
|
type: "starknet",
|
|
59
59
|
chainId: "0x534e5f4d41494e",
|
|
60
60
|
// SN_MAIN
|
|
@@ -62,26 +62,26 @@ const P = {
|
|
|
62
62
|
cctpDomain: null,
|
|
63
63
|
logoURI: "/images/chains/starknet.svg"
|
|
64
64
|
};
|
|
65
|
-
function
|
|
65
|
+
function T(e, { strict: t = !0 } = {}) {
|
|
66
66
|
return !e || typeof e != "string" ? !1 : t ? /^0x[0-9a-fA-F]*$/.test(e) : e.startsWith("0x");
|
|
67
67
|
}
|
|
68
|
-
function
|
|
69
|
-
return
|
|
68
|
+
function R(e) {
|
|
69
|
+
return T(e, { strict: !1 }) ? Math.ceil((e.length - 2) / 2) : e.length;
|
|
70
70
|
}
|
|
71
|
-
const
|
|
72
|
-
let
|
|
71
|
+
const Q = "2.43.4";
|
|
72
|
+
let A = {
|
|
73
73
|
getDocsUrl: ({ docsBaseUrl: e, docsPath: t = "", docsSlug: s }) => t ? `${e ?? "https://viem.sh"}${t}${s ? `#${s}` : ""}` : void 0,
|
|
74
|
-
version: `viem@${
|
|
74
|
+
version: `viem@${Q}`
|
|
75
75
|
};
|
|
76
76
|
class g extends Error {
|
|
77
77
|
constructor(t, s = {}) {
|
|
78
|
-
const n = 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 =
|
|
78
|
+
const n = 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 = A.getDocsUrl?.({ ...s, docsPath: i }), o = [
|
|
79
79
|
t || "An error occurred.",
|
|
80
80
|
"",
|
|
81
81
|
...s.metaMessages ? [...s.metaMessages, ""] : [],
|
|
82
82
|
...r ? [`Docs: ${r}`] : [],
|
|
83
83
|
...n ? [`Details: ${n}`] : [],
|
|
84
|
-
...
|
|
84
|
+
...A.version ? [`Version: ${A.version}`] : []
|
|
85
85
|
].join(`
|
|
86
86
|
`);
|
|
87
87
|
super(o, s.cause ? { cause: s.cause } : void 0), Object.defineProperty(this, "details", {
|
|
@@ -114,29 +114,29 @@ class g extends Error {
|
|
|
114
114
|
configurable: !0,
|
|
115
115
|
writable: !0,
|
|
116
116
|
value: "BaseError"
|
|
117
|
-
}), this.details = n, this.docsPath = i, this.metaMessages = s.metaMessages, this.name = s.name ?? this.name, this.shortMessage = t, this.version =
|
|
117
|
+
}), this.details = n, this.docsPath = i, this.metaMessages = s.metaMessages, this.name = s.name ?? this.name, this.shortMessage = t, this.version = Q;
|
|
118
118
|
}
|
|
119
119
|
walk(t) {
|
|
120
|
-
return
|
|
120
|
+
return W(this, t);
|
|
121
121
|
}
|
|
122
122
|
}
|
|
123
|
-
function
|
|
124
|
-
return t?.(e) ? e : e && typeof e == "object" && "cause" in e && e.cause !== void 0 ?
|
|
123
|
+
function W(e, t) {
|
|
124
|
+
return t?.(e) ? e : e && typeof e == "object" && "cause" in e && e.cause !== void 0 ? W(e.cause, t) : t ? null : e;
|
|
125
125
|
}
|
|
126
|
-
class
|
|
126
|
+
class J extends g {
|
|
127
127
|
constructor({ size: t, targetSize: s, type: n }) {
|
|
128
128
|
super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${t}) exceeds padding size (${s}).`, { name: "SizeExceedsPaddingSizeError" });
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
function
|
|
132
|
-
return typeof e == "string" ?
|
|
131
|
+
function S(e, { dir: t, size: s = 32 } = {}) {
|
|
132
|
+
return typeof e == "string" ? pe(e, { dir: t, size: s }) : ge(e, { dir: t, size: s });
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function pe(e, { dir: t, size: s = 32 } = {}) {
|
|
135
135
|
if (s === null)
|
|
136
136
|
return e;
|
|
137
137
|
const n = e.replace("0x", "");
|
|
138
138
|
if (n.length > s * 2)
|
|
139
|
-
throw new
|
|
139
|
+
throw new J({
|
|
140
140
|
size: Math.ceil(n.length / 2),
|
|
141
141
|
targetSize: s,
|
|
142
142
|
type: "hex"
|
|
@@ -147,7 +147,7 @@ function ge(e, { dir: t, size: s = 32 } = {}) {
|
|
|
147
147
|
if (s === null)
|
|
148
148
|
return e;
|
|
149
149
|
if (e.length > s)
|
|
150
|
-
throw new
|
|
150
|
+
throw new J({
|
|
151
151
|
size: e.length,
|
|
152
152
|
targetSize: s,
|
|
153
153
|
type: "bytes"
|
|
@@ -169,10 +169,10 @@ class me extends g {
|
|
|
169
169
|
super(`Size cannot exceed ${s} bytes. Given size: ${t} bytes.`, { name: "SizeOverflowError" });
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
|
-
function
|
|
173
|
-
if (
|
|
172
|
+
function x(e, { size: t }) {
|
|
173
|
+
if (R(e) > t)
|
|
174
174
|
throw new me({
|
|
175
|
-
givenSize:
|
|
175
|
+
givenSize: R(e),
|
|
176
176
|
maxSize: t
|
|
177
177
|
});
|
|
178
178
|
}
|
|
@@ -192,17 +192,17 @@ function ye(e, t = {}) {
|
|
|
192
192
|
});
|
|
193
193
|
}
|
|
194
194
|
const a = `0x${(s && i < 0 ? (1n << BigInt(n * 8)) + BigInt(i) : i).toString(16)}`;
|
|
195
|
-
return n ?
|
|
195
|
+
return n ? S(a, { size: n }) : a;
|
|
196
196
|
}
|
|
197
197
|
const be = /* @__PURE__ */ new TextEncoder();
|
|
198
198
|
function Ie(e, t = {}) {
|
|
199
|
-
return typeof e == "number" || typeof e == "bigint" ? we(e, t) : typeof e == "boolean" ? Ee(e, t) :
|
|
199
|
+
return typeof e == "number" || typeof e == "bigint" ? we(e, t) : typeof e == "boolean" ? Ee(e, t) : T(e) ? Y(e, t) : Z(e, t);
|
|
200
200
|
}
|
|
201
201
|
function Ee(e, t = {}) {
|
|
202
202
|
const s = new Uint8Array(1);
|
|
203
|
-
return s[0] = Number(e), typeof t.size == "number" ? (
|
|
203
|
+
return s[0] = Number(e), typeof t.size == "number" ? (x(s, { size: t.size }), S(s, { size: t.size })) : s;
|
|
204
204
|
}
|
|
205
|
-
const
|
|
205
|
+
const d = {
|
|
206
206
|
zero: 48,
|
|
207
207
|
nine: 57,
|
|
208
208
|
A: 65,
|
|
@@ -210,22 +210,22 @@ const p = {
|
|
|
210
210
|
a: 97,
|
|
211
211
|
f: 102
|
|
212
212
|
};
|
|
213
|
-
function
|
|
214
|
-
if (e >=
|
|
215
|
-
return e -
|
|
216
|
-
if (e >=
|
|
217
|
-
return e - (
|
|
218
|
-
if (e >=
|
|
219
|
-
return e - (
|
|
220
|
-
}
|
|
221
|
-
function
|
|
213
|
+
function k(e) {
|
|
214
|
+
if (e >= d.zero && e <= d.nine)
|
|
215
|
+
return e - d.zero;
|
|
216
|
+
if (e >= d.A && e <= d.F)
|
|
217
|
+
return e - (d.A - 10);
|
|
218
|
+
if (e >= d.a && e <= d.f)
|
|
219
|
+
return e - (d.a - 10);
|
|
220
|
+
}
|
|
221
|
+
function Y(e, t = {}) {
|
|
222
222
|
let s = e;
|
|
223
|
-
t.size && (
|
|
223
|
+
t.size && (x(s, { size: t.size }), s = S(s, { dir: "right", size: t.size }));
|
|
224
224
|
let n = s.slice(2);
|
|
225
225
|
n.length % 2 && (n = `0${n}`);
|
|
226
226
|
const i = n.length / 2, r = new Uint8Array(i);
|
|
227
227
|
for (let o = 0, a = 0; o < i; o++) {
|
|
228
|
-
const l =
|
|
228
|
+
const l = k(n.charCodeAt(a++)), f = k(n.charCodeAt(a++));
|
|
229
229
|
if (l === void 0 || f === void 0)
|
|
230
230
|
throw new g(`Invalid byte sequence ("${n[a - 2]}${n[a - 1]}" in "${n}").`);
|
|
231
231
|
r[o] = l * 16 + f;
|
|
@@ -234,15 +234,15 @@ function J(e, t = {}) {
|
|
|
234
234
|
}
|
|
235
235
|
function we(e, t) {
|
|
236
236
|
const s = ye(e, t);
|
|
237
|
-
return
|
|
237
|
+
return Y(s);
|
|
238
238
|
}
|
|
239
|
-
function
|
|
239
|
+
function Z(e, t = {}) {
|
|
240
240
|
const s = be.encode(e);
|
|
241
|
-
return typeof t.size == "number" ? (
|
|
241
|
+
return typeof t.size == "number" ? (x(s, { size: t.size }), S(s, { dir: "right", size: t.size })) : s;
|
|
242
242
|
}
|
|
243
|
-
const I = /* @__PURE__ */ BigInt(2 ** 32 - 1),
|
|
243
|
+
const I = /* @__PURE__ */ BigInt(2 ** 32 - 1), N = /* @__PURE__ */ BigInt(32);
|
|
244
244
|
function Se(e, t = !1) {
|
|
245
|
-
return t ? { h: Number(e & I), l: Number(e >>
|
|
245
|
+
return t ? { h: Number(e & I), l: Number(e >> N & I) } : { h: Number(e >> N & I) | 0, l: Number(e & I) | 0 };
|
|
246
246
|
}
|
|
247
247
|
function Ae(e, t = !1) {
|
|
248
248
|
const s = e.length;
|
|
@@ -258,24 +258,24 @@ const Ue = (e, t, s) => e << s | t >>> 32 - s, ve = (e, t, s) => t << s | e >>>
|
|
|
258
258
|
function xe(e) {
|
|
259
259
|
return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
|
|
260
260
|
}
|
|
261
|
-
function
|
|
261
|
+
function B(e) {
|
|
262
262
|
if (!Number.isSafeInteger(e) || e < 0)
|
|
263
263
|
throw new Error("positive integer expected, got " + e);
|
|
264
264
|
}
|
|
265
|
-
function
|
|
265
|
+
function w(e, ...t) {
|
|
266
266
|
if (!xe(e))
|
|
267
267
|
throw new Error("Uint8Array expected");
|
|
268
268
|
if (t.length > 0 && !t.includes(e.length))
|
|
269
269
|
throw new Error("Uint8Array expected of length " + t + ", got length=" + e.length);
|
|
270
270
|
}
|
|
271
|
-
function
|
|
271
|
+
function $(e, t = !0) {
|
|
272
272
|
if (e.destroyed)
|
|
273
273
|
throw new Error("Hash instance has been destroyed");
|
|
274
274
|
if (t && e.finished)
|
|
275
275
|
throw new Error("Hash#digest() has already been called");
|
|
276
276
|
}
|
|
277
277
|
function De(e, t) {
|
|
278
|
-
|
|
278
|
+
w(e);
|
|
279
279
|
const s = t.outputLen;
|
|
280
280
|
if (e.length < s)
|
|
281
281
|
throw new Error("digestInto() expects output buffer of length at least " + s);
|
|
@@ -283,7 +283,7 @@ function De(e, t) {
|
|
|
283
283
|
function Re(e) {
|
|
284
284
|
return new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4));
|
|
285
285
|
}
|
|
286
|
-
function
|
|
286
|
+
function ee(...e) {
|
|
287
287
|
for (let t = 0; t < e.length; t++)
|
|
288
288
|
e[t].fill(0);
|
|
289
289
|
}
|
|
@@ -296,43 +296,43 @@ function Be(e) {
|
|
|
296
296
|
e[t] = Ne(e[t]);
|
|
297
297
|
return e;
|
|
298
298
|
}
|
|
299
|
-
const
|
|
299
|
+
const z = ke ? (e) => e : Be;
|
|
300
300
|
function $e(e) {
|
|
301
301
|
if (typeof e != "string")
|
|
302
302
|
throw new Error("string expected");
|
|
303
303
|
return new Uint8Array(new TextEncoder().encode(e));
|
|
304
304
|
}
|
|
305
|
-
function
|
|
306
|
-
return typeof e == "string" && (e = $e(e)),
|
|
305
|
+
function te(e) {
|
|
306
|
+
return typeof e == "string" && (e = $e(e)), w(e), e;
|
|
307
307
|
}
|
|
308
308
|
class ze {
|
|
309
309
|
}
|
|
310
310
|
function Me(e) {
|
|
311
|
-
const t = (n) => e().update(
|
|
311
|
+
const t = (n) => e().update(te(n)).digest(), s = e();
|
|
312
312
|
return t.outputLen = s.outputLen, t.blockLen = s.blockLen, t.create = () => e(), t;
|
|
313
313
|
}
|
|
314
|
-
const Oe = BigInt(0), y = BigInt(1), Pe = BigInt(2), je = BigInt(7), _e = BigInt(256), Fe = BigInt(113),
|
|
314
|
+
const Oe = BigInt(0), y = BigInt(1), Pe = BigInt(2), je = BigInt(7), _e = BigInt(256), Fe = BigInt(113), se = [], ne = [], ie = [];
|
|
315
315
|
for (let e = 0, t = y, s = 1, n = 0; e < 24; e++) {
|
|
316
|
-
[s, n] = [n, (2 * s + 3 * n) % 5],
|
|
316
|
+
[s, n] = [n, (2 * s + 3 * n) % 5], se.push(2 * (5 * n + s)), ne.push((e + 1) * (e + 2) / 2 % 64);
|
|
317
317
|
let i = Oe;
|
|
318
318
|
for (let r = 0; r < 7; r++)
|
|
319
319
|
t = (t << y ^ (t >> je) * Fe) % _e, t & Pe && (i ^= y << (y << /* @__PURE__ */ BigInt(r)) - y);
|
|
320
|
-
|
|
320
|
+
ie.push(i);
|
|
321
321
|
}
|
|
322
|
-
const
|
|
322
|
+
const oe = Ae(ie, !0), Le = oe[0], He = oe[1], M = (e, t, s) => s > 32 ? Ce(e, t, s) : Ue(e, t, s), O = (e, t, s) => s > 32 ? Te(e, t, s) : ve(e, t, s);
|
|
323
323
|
function Ke(e, t = 24) {
|
|
324
324
|
const s = new Uint32Array(10);
|
|
325
325
|
for (let n = 24 - t; n < 24; n++) {
|
|
326
326
|
for (let o = 0; o < 10; o++)
|
|
327
327
|
s[o] = e[o] ^ e[o + 10] ^ e[o + 20] ^ e[o + 30] ^ e[o + 40];
|
|
328
328
|
for (let o = 0; o < 10; o += 2) {
|
|
329
|
-
const a = (o + 8) % 10, l = (o + 2) % 10, f = s[l], m = s[l + 1], le =
|
|
329
|
+
const a = (o + 8) % 10, l = (o + 2) % 10, f = s[l], m = s[l + 1], le = M(f, m, 1) ^ s[a], he = O(f, m, 1) ^ s[a + 1];
|
|
330
330
|
for (let b = 0; b < 50; b += 10)
|
|
331
331
|
e[o + b] ^= le, e[o + b + 1] ^= he;
|
|
332
332
|
}
|
|
333
333
|
let i = e[2], r = e[3];
|
|
334
334
|
for (let o = 0; o < 24; o++) {
|
|
335
|
-
const a =
|
|
335
|
+
const a = ne[o], l = M(i, r, a), f = O(i, r, a), m = se[o];
|
|
336
336
|
i = e[m], r = e[m + 1], e[m] = l, e[m + 1] = f;
|
|
337
337
|
}
|
|
338
338
|
for (let o = 0; o < 50; o += 10) {
|
|
@@ -343,12 +343,12 @@ function Ke(e, t = 24) {
|
|
|
343
343
|
}
|
|
344
344
|
e[0] ^= Le[n], e[1] ^= He[n];
|
|
345
345
|
}
|
|
346
|
-
|
|
346
|
+
ee(s);
|
|
347
347
|
}
|
|
348
|
-
class
|
|
348
|
+
class D extends ze {
|
|
349
349
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
350
350
|
constructor(t, s, n, i = !1, r = 24) {
|
|
351
|
-
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 = n, this.enableXOF = i, this.rounds = r,
|
|
351
|
+
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 = n, this.enableXOF = i, this.rounds = r, B(n), !(0 < t && t < 200))
|
|
352
352
|
throw new Error("only keccak-f1600 function is supported");
|
|
353
353
|
this.state = new Uint8Array(200), this.state32 = Re(this.state);
|
|
354
354
|
}
|
|
@@ -356,10 +356,10 @@ class x extends ze {
|
|
|
356
356
|
return this._cloneInto();
|
|
357
357
|
}
|
|
358
358
|
keccak() {
|
|
359
|
-
|
|
359
|
+
z(this.state32), Ke(this.state32, this.rounds), z(this.state32), this.posOut = 0, this.pos = 0;
|
|
360
360
|
}
|
|
361
361
|
update(t) {
|
|
362
|
-
|
|
362
|
+
$(this), t = te(t), w(t);
|
|
363
363
|
const { blockLen: s, state: n } = this, i = t.length;
|
|
364
364
|
for (let r = 0; r < i; ) {
|
|
365
365
|
const o = Math.min(s - this.pos, i - r);
|
|
@@ -377,7 +377,7 @@ class x extends ze {
|
|
|
377
377
|
t[n] ^= s, (s & 128) !== 0 && n === i - 1 && this.keccak(), t[i - 1] ^= 128, this.keccak();
|
|
378
378
|
}
|
|
379
379
|
writeInto(t) {
|
|
380
|
-
|
|
380
|
+
$(this, !1), w(t), this.finish();
|
|
381
381
|
const s = this.state, { blockLen: n } = this;
|
|
382
382
|
for (let i = 0, r = t.length; i < r; ) {
|
|
383
383
|
this.posOut >= n && this.keccak();
|
|
@@ -392,7 +392,7 @@ class x extends ze {
|
|
|
392
392
|
return this.writeInto(t);
|
|
393
393
|
}
|
|
394
394
|
xof(t) {
|
|
395
|
-
return
|
|
395
|
+
return B(t), this.xofInto(new Uint8Array(t));
|
|
396
396
|
}
|
|
397
397
|
digestInto(t) {
|
|
398
398
|
if (De(t, this), this.finished)
|
|
@@ -403,16 +403,16 @@ class x extends ze {
|
|
|
403
403
|
return this.digestInto(new Uint8Array(this.outputLen));
|
|
404
404
|
}
|
|
405
405
|
destroy() {
|
|
406
|
-
this.destroyed = !0,
|
|
406
|
+
this.destroyed = !0, ee(this.state);
|
|
407
407
|
}
|
|
408
408
|
_cloneInto(t) {
|
|
409
409
|
const { blockLen: s, suffix: n, outputLen: i, rounds: r, enableXOF: o } = this;
|
|
410
|
-
return t || (t = new
|
|
410
|
+
return t || (t = new D(s, n, i, o, r)), t.state32.set(this.state32), t.pos = this.pos, t.posOut = this.posOut, t.finished = this.finished, t.rounds = r, t.suffix = n, t.outputLen = i, t.enableXOF = o, t.destroyed = this.destroyed, t;
|
|
411
411
|
}
|
|
412
412
|
}
|
|
413
|
-
const qe = (e, t, s) => Me(() => new
|
|
413
|
+
const qe = (e, t, s) => Me(() => new D(t, e, s)), Ve = qe(1, 136, 256 / 8);
|
|
414
414
|
function Xe(e, t) {
|
|
415
|
-
return Ve(
|
|
415
|
+
return Ve(T(e, { strict: !1 }) ? Ie(e) : e);
|
|
416
416
|
}
|
|
417
417
|
class Ge extends g {
|
|
418
418
|
constructor({ address: t }) {
|
|
@@ -425,7 +425,7 @@ class Ge extends g {
|
|
|
425
425
|
});
|
|
426
426
|
}
|
|
427
427
|
}
|
|
428
|
-
class
|
|
428
|
+
class re extends Map {
|
|
429
429
|
constructor(t) {
|
|
430
430
|
super(), Object.defineProperty(this, "maxSize", {
|
|
431
431
|
enumerable: !0,
|
|
@@ -446,182 +446,182 @@ class oe extends Map {
|
|
|
446
446
|
return this;
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
|
-
const
|
|
450
|
-
function
|
|
451
|
-
if (
|
|
452
|
-
return
|
|
453
|
-
const s = e.substring(2).toLowerCase(), n = Xe(
|
|
449
|
+
const U = /* @__PURE__ */ new re(8192);
|
|
450
|
+
function ae(e, t) {
|
|
451
|
+
if (U.has(`${e}.${t}`))
|
|
452
|
+
return U.get(`${e}.${t}`);
|
|
453
|
+
const s = e.substring(2).toLowerCase(), n = Xe(Z(s)), i = s.split("");
|
|
454
454
|
for (let o = 0; o < 40; o += 2)
|
|
455
455
|
n[o >> 1] >> 4 >= 8 && i[o] && (i[o] = i[o].toUpperCase()), (n[o >> 1] & 15) >= 8 && i[o + 1] && (i[o + 1] = i[o + 1].toUpperCase());
|
|
456
456
|
const r = `0x${i.join("")}`;
|
|
457
|
-
return
|
|
457
|
+
return U.set(`${e}.${t}`, r), r;
|
|
458
458
|
}
|
|
459
|
-
function
|
|
459
|
+
function p(e, t) {
|
|
460
460
|
if (!We(e, { strict: !1 }))
|
|
461
461
|
throw new Ge({ address: e });
|
|
462
|
-
return
|
|
462
|
+
return ae(e, t);
|
|
463
463
|
}
|
|
464
|
-
const Qe = /^0x[a-fA-F0-9]{40}$/,
|
|
464
|
+
const Qe = /^0x[a-fA-F0-9]{40}$/, v = /* @__PURE__ */ new re(8192);
|
|
465
465
|
function We(e, t) {
|
|
466
466
|
const { strict: s = !0 } = t ?? {}, n = `${e}.${s}`;
|
|
467
|
-
if (
|
|
468
|
-
return
|
|
469
|
-
const i = Qe.test(e) ? e.toLowerCase() === e ? !0 : s ?
|
|
470
|
-
return
|
|
467
|
+
if (v.has(n))
|
|
468
|
+
return v.get(n);
|
|
469
|
+
const i = Qe.test(e) ? e.toLowerCase() === e ? !0 : s ? ae(e) === e : !0 : !1;
|
|
470
|
+
return v.set(n, i), i;
|
|
471
471
|
}
|
|
472
472
|
const Je = {
|
|
473
|
-
chainId:
|
|
474
|
-
address:
|
|
473
|
+
chainId: _.chainId,
|
|
474
|
+
address: p("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),
|
|
475
475
|
symbol: "USDC",
|
|
476
476
|
fiatISO: "USD",
|
|
477
477
|
decimals: 6,
|
|
478
478
|
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
479
479
|
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
480
480
|
}, Ye = {
|
|
481
|
-
chainId:
|
|
482
|
-
address:
|
|
481
|
+
chainId: j.chainId,
|
|
482
|
+
address: p("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
|
|
483
483
|
symbol: "USDC",
|
|
484
484
|
name: "USD Coin",
|
|
485
485
|
decimals: 6,
|
|
486
486
|
logoURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
487
487
|
/* USDC */
|
|
488
488
|
}, Ze = {
|
|
489
|
-
chainId:
|
|
490
|
-
address:
|
|
489
|
+
chainId: X.chainId,
|
|
490
|
+
address: p("0x5425890298aed601595a70ab815c96711a31bc65"),
|
|
491
491
|
symbol: "USDC",
|
|
492
492
|
fiatISO: "USD",
|
|
493
493
|
decimals: 6,
|
|
494
494
|
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
495
495
|
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
496
496
|
}, et = {
|
|
497
|
-
chainId:
|
|
498
|
-
address:
|
|
497
|
+
chainId: V.chainId,
|
|
498
|
+
address: p("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),
|
|
499
499
|
symbol: "USDC",
|
|
500
500
|
fiatISO: "USD",
|
|
501
501
|
decimals: 6,
|
|
502
502
|
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
503
503
|
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
504
504
|
}, tt = {
|
|
505
|
-
chainId:
|
|
506
|
-
address:
|
|
505
|
+
chainId: L.chainId,
|
|
506
|
+
address: p("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),
|
|
507
507
|
symbol: "USDC",
|
|
508
508
|
fiatISO: "USD",
|
|
509
509
|
decimals: 6,
|
|
510
510
|
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
511
511
|
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
512
512
|
}, st = {
|
|
513
|
-
chainId:
|
|
514
|
-
address:
|
|
513
|
+
chainId: F.chainId,
|
|
514
|
+
address: p("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),
|
|
515
515
|
symbol: "USDC",
|
|
516
516
|
fiatISO: "USD",
|
|
517
517
|
decimals: 6,
|
|
518
518
|
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
519
519
|
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
520
520
|
}, nt = {
|
|
521
|
-
chainId:
|
|
522
|
-
address:
|
|
521
|
+
chainId: H.chainId,
|
|
522
|
+
address: p("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),
|
|
523
523
|
symbol: "USDC",
|
|
524
524
|
decimals: 18,
|
|
525
525
|
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
526
526
|
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
527
527
|
}, it = {
|
|
528
|
-
chainId:
|
|
529
|
-
address:
|
|
528
|
+
chainId: q.chainId,
|
|
529
|
+
address: p("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),
|
|
530
530
|
symbol: "USDC",
|
|
531
531
|
decimals: 6,
|
|
532
532
|
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
533
533
|
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
534
534
|
}, ot = {
|
|
535
|
-
chainId:
|
|
536
|
-
address:
|
|
535
|
+
chainId: K.chainId,
|
|
536
|
+
address: p("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
|
|
537
537
|
symbol: "USDC",
|
|
538
538
|
decimals: 6,
|
|
539
539
|
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
540
540
|
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
541
541
|
}, rt = {
|
|
542
|
-
chainId:
|
|
542
|
+
chainId: G.chainId,
|
|
543
543
|
address: "0x053C91253BC9682c04929cA02ED00b3E423f6710D2ee7e0D5EBB06F3eCF368A8",
|
|
544
544
|
symbol: "USDC",
|
|
545
545
|
decimals: 6,
|
|
546
546
|
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
547
547
|
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
548
|
-
},
|
|
548
|
+
}, P = {
|
|
549
549
|
ARBITRUM_MAINNET: {
|
|
550
|
-
...
|
|
550
|
+
...j,
|
|
551
551
|
tokens: {
|
|
552
552
|
[h.USDC]: Ye
|
|
553
553
|
},
|
|
554
554
|
explorer: "https://arbiscan.io"
|
|
555
555
|
},
|
|
556
556
|
ARBITRUM_TESTNET: {
|
|
557
|
-
...
|
|
557
|
+
..._,
|
|
558
558
|
explorer: "https://sepolia.arbiscan.io",
|
|
559
559
|
tokens: {
|
|
560
560
|
[h.USDC]: Je
|
|
561
561
|
}
|
|
562
562
|
},
|
|
563
563
|
AVALANCHE_MAINNET: {
|
|
564
|
-
...
|
|
564
|
+
...V,
|
|
565
565
|
tokens: {
|
|
566
566
|
[h.USDC]: et
|
|
567
567
|
},
|
|
568
568
|
explorer: "https://snowtrace.io"
|
|
569
569
|
},
|
|
570
570
|
AVALANCHE_TESTNET: {
|
|
571
|
-
...
|
|
571
|
+
...X,
|
|
572
572
|
tokens: {
|
|
573
573
|
[h.USDC]: Ze
|
|
574
574
|
},
|
|
575
575
|
explorer: "https://testnet.snowtrace.io"
|
|
576
576
|
},
|
|
577
577
|
BASE_MAINNET: {
|
|
578
|
-
...
|
|
578
|
+
...F,
|
|
579
579
|
tokens: {
|
|
580
580
|
[h.USDC]: st
|
|
581
581
|
},
|
|
582
582
|
explorer: "https://basescan.org"
|
|
583
583
|
},
|
|
584
584
|
BASE_TESTNET: {
|
|
585
|
-
...
|
|
585
|
+
...L,
|
|
586
586
|
tokens: {
|
|
587
587
|
[h.USDC]: tt
|
|
588
588
|
},
|
|
589
589
|
explorer: "https://sepolia.basescan.org"
|
|
590
590
|
},
|
|
591
591
|
BSC_MAINNET: {
|
|
592
|
-
...
|
|
592
|
+
...H,
|
|
593
593
|
tokens: {
|
|
594
594
|
[h.USDC]: nt
|
|
595
595
|
},
|
|
596
596
|
explorer: "https://bscscan.com"
|
|
597
597
|
},
|
|
598
598
|
ETHEREUM_MAINNET: {
|
|
599
|
-
...
|
|
599
|
+
...K,
|
|
600
600
|
tokens: {
|
|
601
601
|
[h.USDC]: ot
|
|
602
602
|
},
|
|
603
603
|
explorer: "https://etherscan.io"
|
|
604
604
|
},
|
|
605
605
|
ETHEREUM_TESTNET: {
|
|
606
|
-
...
|
|
606
|
+
...q,
|
|
607
607
|
tokens: {
|
|
608
608
|
[h.USDC]: it
|
|
609
609
|
},
|
|
610
610
|
explorer: "https://sepolia.etherscan.io"
|
|
611
611
|
},
|
|
612
612
|
STARKNET_MAINNET: {
|
|
613
|
-
...
|
|
613
|
+
...G,
|
|
614
614
|
tokens: {
|
|
615
615
|
[h.USDC]: rt
|
|
616
616
|
},
|
|
617
617
|
explorer: ""
|
|
618
618
|
}
|
|
619
619
|
};
|
|
620
|
-
var
|
|
620
|
+
var E = /* @__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))(E || {}), ce = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(ce || {});
|
|
621
621
|
const at = (e) => {
|
|
622
|
-
const t = e
|
|
623
|
-
if (
|
|
624
|
-
return
|
|
622
|
+
const t = e?.trim().toUpperCase();
|
|
623
|
+
if (P[t])
|
|
624
|
+
return P[t];
|
|
625
625
|
};
|
|
626
626
|
function ct(e, t) {
|
|
627
627
|
return at(e)?.tokens[t]?.address;
|
|
@@ -675,9 +675,9 @@ class c {
|
|
|
675
675
|
return r + o + a;
|
|
676
676
|
}
|
|
677
677
|
}
|
|
678
|
-
let
|
|
678
|
+
let C = null;
|
|
679
679
|
function ut() {
|
|
680
|
-
|
|
680
|
+
C = de.create({
|
|
681
681
|
prefixUrl: c.getBaseUrl(),
|
|
682
682
|
headers: {
|
|
683
683
|
"Content-Type": "application/json"
|
|
@@ -697,7 +697,7 @@ function ut() {
|
|
|
697
697
|
});
|
|
698
698
|
}
|
|
699
699
|
function u() {
|
|
700
|
-
return
|
|
700
|
+
return C || ut(), C;
|
|
701
701
|
}
|
|
702
702
|
class lt {
|
|
703
703
|
async getById(t) {
|
|
@@ -736,7 +736,7 @@ class ht {
|
|
|
736
736
|
return await u().get("quotes/multi-source", { searchParams: t }).json();
|
|
737
737
|
}
|
|
738
738
|
}
|
|
739
|
-
class
|
|
739
|
+
class dt {
|
|
740
740
|
async getOptimalRoutes(t) {
|
|
741
741
|
return await u().get("router/optimal-route", { searchParams: t }).json();
|
|
742
742
|
}
|
|
@@ -750,7 +750,7 @@ class pt {
|
|
|
750
750
|
return await u().get("router/supported-bridges/bridge/" + t, { searchParams: s }).json();
|
|
751
751
|
}
|
|
752
752
|
}
|
|
753
|
-
class
|
|
753
|
+
class pt {
|
|
754
754
|
async getSupported(t) {
|
|
755
755
|
return await u().get("chains", { searchParams: t }).json();
|
|
756
756
|
}
|
|
@@ -765,26 +765,26 @@ class ft {
|
|
|
765
765
|
const s = {
|
|
766
766
|
recipient: t.recipient,
|
|
767
767
|
tokenOut: ct(
|
|
768
|
-
|
|
768
|
+
E[t.destinationChain],
|
|
769
769
|
ce[t.token]
|
|
770
770
|
),
|
|
771
|
-
destinationChain: t.destinationChain,
|
|
771
|
+
destinationChain: E[t.destinationChain],
|
|
772
772
|
amount: t.amount
|
|
773
773
|
};
|
|
774
|
-
return u().post("modal/sessions", { json: s }).json();
|
|
774
|
+
return console.log(t.destinationChain, E[t.destinationChain], s), u().post("modal/sessions", { json: s }).json();
|
|
775
775
|
}
|
|
776
776
|
}
|
|
777
777
|
const yt = {
|
|
778
|
-
router: new
|
|
778
|
+
router: new dt(),
|
|
779
779
|
quotes: new ht(),
|
|
780
780
|
intents: new lt(),
|
|
781
|
-
chains: new
|
|
781
|
+
chains: new pt(),
|
|
782
782
|
client: new gt(),
|
|
783
783
|
auth: new ft()
|
|
784
784
|
};
|
|
785
785
|
export {
|
|
786
786
|
c as Chainrails,
|
|
787
|
-
|
|
787
|
+
E as chains,
|
|
788
788
|
yt as crapi,
|
|
789
789
|
ue as environment,
|
|
790
790
|
ce as tokens
|