@chainrails/sdk 0.0.35 → 0.0.38
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 +189 -186
- package/dist/chainrails-sdk.es.mjs +189 -186
- 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,16 +62,16 @@ 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
|
|
71
|
+
const Q = "2.43.4";
|
|
72
72
|
let S = {
|
|
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 = {}) {
|
|
@@ -114,40 +114,40 @@ 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
131
|
function w(e, { dir: t, size: s = 32 } = {}) {
|
|
132
|
-
return typeof e == "string" ?
|
|
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"
|
|
143
143
|
});
|
|
144
144
|
return `0x${n[t === "right" ? "padEnd" : "padStart"](s * 2, "0")}`;
|
|
145
145
|
}
|
|
146
|
-
function
|
|
146
|
+
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"
|
|
@@ -159,31 +159,31 @@ function pe(e, { dir: t, size: s = 32 } = {}) {
|
|
|
159
159
|
}
|
|
160
160
|
return n;
|
|
161
161
|
}
|
|
162
|
-
class
|
|
162
|
+
class fe extends g {
|
|
163
163
|
constructor({ max: t, min: s, signed: n, size: i, value: r }) {
|
|
164
164
|
super(`Number "${r}" is not in safe ${i ? `${i * 8}-bit ${n ? "signed" : "unsigned"} ` : ""}integer range ${t ? `(${s} to ${t})` : `(above ${s})`}`, { name: "IntegerOutOfRangeError" });
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
|
-
class
|
|
167
|
+
class me extends g {
|
|
168
168
|
constructor({ givenSize: t, maxSize: s }) {
|
|
169
169
|
super(`Size cannot exceed ${s} bytes. Given size: ${t} bytes.`, { name: "SizeOverflowError" });
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
|
-
function
|
|
173
|
-
if (
|
|
174
|
-
throw new
|
|
175
|
-
givenSize:
|
|
172
|
+
function x(e, { size: t }) {
|
|
173
|
+
if (R(e) > t)
|
|
174
|
+
throw new me({
|
|
175
|
+
givenSize: R(e),
|
|
176
176
|
maxSize: t
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
|
-
function
|
|
179
|
+
function ye(e, t = {}) {
|
|
180
180
|
const { signed: s, size: n } = t, i = BigInt(e);
|
|
181
181
|
let r;
|
|
182
182
|
n ? s ? r = (1n << BigInt(n) * 8n - 1n) - 1n : r = 2n ** (BigInt(n) * 8n) - 1n : typeof e == "number" && (r = BigInt(Number.MAX_SAFE_INTEGER));
|
|
183
183
|
const o = typeof r == "bigint" && s ? -r - 1n : 0;
|
|
184
184
|
if (r && i > r || i < o) {
|
|
185
185
|
const l = typeof e == "bigint" ? "n" : "";
|
|
186
|
-
throw new
|
|
186
|
+
throw new fe({
|
|
187
187
|
max: r ? `${r}${l}` : void 0,
|
|
188
188
|
min: `${o}${l}`,
|
|
189
189
|
signed: s,
|
|
@@ -194,15 +194,15 @@ function fe(e, t = {}) {
|
|
|
194
194
|
const a = `0x${(s && i < 0 ? (1n << BigInt(n * 8)) + BigInt(i) : i).toString(16)}`;
|
|
195
195
|
return n ? w(a, { size: n }) : a;
|
|
196
196
|
}
|
|
197
|
-
const
|
|
198
|
-
function
|
|
199
|
-
return typeof e == "number" || typeof e == "bigint" ?
|
|
197
|
+
const be = /* @__PURE__ */ new TextEncoder();
|
|
198
|
+
function Ie(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
|
-
function
|
|
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 }), w(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,129 +210,129 @@ 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 = w(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;
|
|
232
232
|
}
|
|
233
233
|
return r;
|
|
234
234
|
}
|
|
235
|
-
function
|
|
236
|
-
const s =
|
|
237
|
-
return
|
|
235
|
+
function we(e, t) {
|
|
236
|
+
const s = ye(e, t);
|
|
237
|
+
return Y(s);
|
|
238
238
|
}
|
|
239
|
-
function
|
|
240
|
-
const s =
|
|
241
|
-
return typeof t.size == "number" ? (
|
|
239
|
+
function Z(e, t = {}) {
|
|
240
|
+
const s = be.encode(e);
|
|
241
|
+
return typeof t.size == "number" ? (x(s, { size: t.size }), w(s, { dir: "right", size: t.size })) : s;
|
|
242
242
|
}
|
|
243
|
-
const I = /* @__PURE__ */ BigInt(2 ** 32 - 1),
|
|
244
|
-
function
|
|
245
|
-
return t ? { h: Number(e & I), l: Number(e >>
|
|
243
|
+
const I = /* @__PURE__ */ BigInt(2 ** 32 - 1), N = /* @__PURE__ */ BigInt(32);
|
|
244
|
+
function Se(e, t = !1) {
|
|
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
|
-
function
|
|
247
|
+
function Ae(e, t = !1) {
|
|
248
248
|
const s = e.length;
|
|
249
249
|
let n = new Uint32Array(s), i = new Uint32Array(s);
|
|
250
250
|
for (let r = 0; r < s; r++) {
|
|
251
|
-
const { h: o, l: a } =
|
|
251
|
+
const { h: o, l: a } = Se(e[r], t);
|
|
252
252
|
[n[r], i[r]] = [o, a];
|
|
253
253
|
}
|
|
254
254
|
return [n, i];
|
|
255
255
|
}
|
|
256
|
-
const
|
|
256
|
+
const Ue = (e, t, s) => e << s | t >>> 32 - s, ve = (e, t, s) => t << s | e >>> 32 - s, Ce = (e, t, s) => t << s - 32 | e >>> 64 - s, Te = (e, t, s) => e << s - 32 | t >>> 64 - s;
|
|
257
257
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
258
|
-
function
|
|
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
265
|
function E(e, ...t) {
|
|
266
|
-
if (!
|
|
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
|
-
function
|
|
277
|
+
function De(e, t) {
|
|
278
278
|
E(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);
|
|
282
282
|
}
|
|
283
|
-
function
|
|
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
|
}
|
|
290
|
-
const
|
|
291
|
-
function
|
|
290
|
+
const ke = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
291
|
+
function Ne(e) {
|
|
292
292
|
return e << 24 & 4278190080 | e << 8 & 16711680 | e >>> 8 & 65280 | e >>> 24 & 255;
|
|
293
293
|
}
|
|
294
|
-
function
|
|
294
|
+
function Be(e) {
|
|
295
295
|
for (let t = 0; t < e.length; t++)
|
|
296
|
-
e[t] =
|
|
296
|
+
e[t] = Ne(e[t]);
|
|
297
297
|
return e;
|
|
298
298
|
}
|
|
299
|
-
const
|
|
300
|
-
function
|
|
299
|
+
const z = ke ? (e) => e : Be;
|
|
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 =
|
|
305
|
+
function te(e) {
|
|
306
|
+
return typeof e == "string" && (e = $e(e)), E(e), e;
|
|
307
307
|
}
|
|
308
|
-
class
|
|
308
|
+
class ze {
|
|
309
309
|
}
|
|
310
|
-
function
|
|
311
|
-
const t = (n) => e().update(
|
|
310
|
+
function Me(e) {
|
|
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
|
|
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],
|
|
317
|
-
let i =
|
|
316
|
+
[s, n] = [n, (2 * s + 3 * n) % 5], se.push(2 * (5 * n + s)), ne.push((e + 1) * (e + 2) / 2 % 64);
|
|
317
|
+
let i = Oe;
|
|
318
318
|
for (let r = 0; r < 7; r++)
|
|
319
|
-
t = (t << y ^ (t >>
|
|
320
|
-
|
|
319
|
+
t = (t << y ^ (t >> je) * Fe) % _e, t & Pe && (i ^= y << (y << /* @__PURE__ */ BigInt(r)) - y);
|
|
320
|
+
ie.push(i);
|
|
321
321
|
}
|
|
322
|
-
const
|
|
323
|
-
function
|
|
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
|
+
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],
|
|
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
|
-
e[o + b] ^=
|
|
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) {
|
|
@@ -341,25 +341,25 @@ function Le(e, t = 24) {
|
|
|
341
341
|
for (let a = 0; a < 10; a++)
|
|
342
342
|
e[o + a] ^= ~s[(a + 2) % 10] & s[(a + 4) % 10];
|
|
343
343
|
}
|
|
344
|
-
e[0] ^=
|
|
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
|
-
this.state = new Uint8Array(200), this.state32 =
|
|
353
|
+
this.state = new Uint8Array(200), this.state32 = Re(this.state);
|
|
354
354
|
}
|
|
355
355
|
clone() {
|
|
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), E(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 Be {
|
|
|
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), E(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,10 +392,10 @@ class x extends Be {
|
|
|
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
|
-
if (
|
|
398
|
+
if (De(t, this), this.finished)
|
|
399
399
|
throw new Error("digest() was already called");
|
|
400
400
|
return this.writeInto(t), this.destroy(), t;
|
|
401
401
|
}
|
|
@@ -403,18 +403,18 @@ class x extends Be {
|
|
|
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
|
|
414
|
-
function
|
|
415
|
-
return
|
|
413
|
+
const qe = (e, t, s) => Me(() => new D(t, e, s)), Ve = qe(1, 136, 256 / 8);
|
|
414
|
+
function Xe(e, t) {
|
|
415
|
+
return Ve(T(e, { strict: !1 }) ? Ie(e) : e);
|
|
416
416
|
}
|
|
417
|
-
class
|
|
417
|
+
class Ge extends g {
|
|
418
418
|
constructor({ address: t }) {
|
|
419
419
|
super(`Address "${t}" is invalid.`, {
|
|
420
420
|
metaMessages: [
|
|
@@ -425,7 +425,7 @@ class Ve 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,190 +446,190 @@ class oe extends Map {
|
|
|
446
446
|
return this;
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
|
-
const A = /* @__PURE__ */ new
|
|
450
|
-
function
|
|
449
|
+
const A = /* @__PURE__ */ new re(8192);
|
|
450
|
+
function ae(e, t) {
|
|
451
451
|
if (A.has(`${e}.${t}`))
|
|
452
452
|
return A.get(`${e}.${t}`);
|
|
453
|
-
const s = e.substring(2).toLowerCase(), n =
|
|
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
457
|
return A.set(`${e}.${t}`, r), r;
|
|
458
458
|
}
|
|
459
|
-
function
|
|
460
|
-
if (!
|
|
461
|
-
throw new
|
|
462
|
-
return
|
|
459
|
+
function p(e, t) {
|
|
460
|
+
if (!We(e, { strict: !1 }))
|
|
461
|
+
throw new Ge({ address: e });
|
|
462
|
+
return ae(e, t);
|
|
463
463
|
}
|
|
464
|
-
const
|
|
465
|
-
function
|
|
464
|
+
const Qe = /^0x[a-fA-F0-9]{40}$/, U = /* @__PURE__ */ new re(8192);
|
|
465
|
+
function We(e, t) {
|
|
466
466
|
const { strict: s = !0 } = t ?? {}, n = `${e}.${s}`;
|
|
467
467
|
if (U.has(n))
|
|
468
468
|
return U.get(n);
|
|
469
|
-
const i =
|
|
469
|
+
const i = Qe.test(e) ? e.toLowerCase() === e ? !0 : s ? ae(e) === e : !0 : !1;
|
|
470
470
|
return U.set(n, i), i;
|
|
471
471
|
}
|
|
472
|
-
const
|
|
473
|
-
chainId:
|
|
474
|
-
address:
|
|
472
|
+
const Je = {
|
|
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
|
-
},
|
|
481
|
-
chainId:
|
|
482
|
-
address:
|
|
480
|
+
}, Ye = {
|
|
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
|
-
},
|
|
489
|
-
chainId:
|
|
490
|
-
address:
|
|
488
|
+
}, Ze = {
|
|
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
|
-
},
|
|
497
|
-
chainId:
|
|
498
|
-
address:
|
|
496
|
+
}, et = {
|
|
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
|
-
},
|
|
505
|
-
chainId:
|
|
506
|
-
address:
|
|
504
|
+
}, tt = {
|
|
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
|
-
},
|
|
513
|
-
chainId:
|
|
514
|
-
address:
|
|
512
|
+
}, st = {
|
|
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
|
-
},
|
|
521
|
-
chainId:
|
|
522
|
-
address:
|
|
520
|
+
}, nt = {
|
|
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
|
-
},
|
|
528
|
-
chainId:
|
|
529
|
-
address:
|
|
527
|
+
}, it = {
|
|
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
|
-
},
|
|
535
|
-
chainId:
|
|
536
|
-
address:
|
|
534
|
+
}, ot = {
|
|
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
|
-
},
|
|
542
|
-
chainId:
|
|
541
|
+
}, rt = {
|
|
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
|
-
[h.USDC]:
|
|
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
|
-
[h.USDC]:
|
|
560
|
+
[h.USDC]: Je
|
|
561
561
|
}
|
|
562
562
|
},
|
|
563
563
|
AVALANCHE_MAINNET: {
|
|
564
|
-
...
|
|
564
|
+
...V,
|
|
565
565
|
tokens: {
|
|
566
|
-
[h.USDC]:
|
|
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
|
-
[h.USDC]:
|
|
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
|
-
[h.USDC]:
|
|
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
|
-
[h.USDC]:
|
|
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
|
-
[h.USDC]:
|
|
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
|
-
[h.USDC]:
|
|
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
|
-
[h.USDC]:
|
|
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
|
-
[h.USDC]:
|
|
615
|
+
[h.USDC]: rt
|
|
616
616
|
},
|
|
617
617
|
explorer: ""
|
|
618
618
|
}
|
|
619
619
|
};
|
|
620
|
-
var
|
|
620
|
+
var v = /* @__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))(v || {}), 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;
|
|
628
628
|
}
|
|
629
|
-
var
|
|
629
|
+
var ue = /* @__PURE__ */ ((e) => (e.PRODUCTION = "production", e.STAGING = "staging", e))(ue || {});
|
|
630
630
|
class c {
|
|
631
631
|
constructor({ api_key: t, env: s, seesion_token: n }) {
|
|
632
|
-
this.api_key = t || "", this.sessionToken = n || "", this.env = s ??
|
|
632
|
+
this.api_key = t || "", this.sessionToken = n || "", this.env = s ?? ue.PRODUCTION;
|
|
633
633
|
}
|
|
634
634
|
static async config(t) {
|
|
635
635
|
if (!c.app) {
|
|
@@ -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
|
}
|
|
@@ -764,25 +764,28 @@ class ft {
|
|
|
764
764
|
getSessionToken(t) {
|
|
765
765
|
const s = {
|
|
766
766
|
recipient: t.recipient,
|
|
767
|
-
tokenOut: ct(
|
|
767
|
+
tokenOut: ct(
|
|
768
|
+
v[t.destinationChain],
|
|
769
|
+
ce[t.token]
|
|
770
|
+
),
|
|
768
771
|
destinationChain: t.destinationChain,
|
|
769
772
|
amount: t.amount
|
|
770
773
|
};
|
|
771
|
-
return u().post("modal/sessions", { json: s }).json();
|
|
774
|
+
return console.log(t.destinationChain, v[t.destinationChain], s), u().post("modal/sessions", { json: s }).json();
|
|
772
775
|
}
|
|
773
776
|
}
|
|
774
777
|
const yt = {
|
|
775
|
-
router: new
|
|
778
|
+
router: new dt(),
|
|
776
779
|
quotes: new ht(),
|
|
777
780
|
intents: new lt(),
|
|
778
|
-
chains: new
|
|
781
|
+
chains: new pt(),
|
|
779
782
|
client: new gt(),
|
|
780
783
|
auth: new ft()
|
|
781
784
|
};
|
|
782
785
|
export {
|
|
783
786
|
c as Chainrails,
|
|
784
|
-
|
|
787
|
+
v as chains,
|
|
785
788
|
yt as crapi,
|
|
786
|
-
|
|
787
|
-
|
|
789
|
+
ue as environment,
|
|
790
|
+
ce as tokens
|
|
788
791
|
};
|