@chainrails/sdk 0.0.34 → 0.0.36
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import pe from "ky";
|
|
2
2
|
var h = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(h || {});
|
|
3
3
|
const P = {
|
|
4
4
|
type: "evm",
|
|
@@ -129,9 +129,9 @@ class W extends g {
|
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
function w(e, { dir: t, size: s = 32 } = {}) {
|
|
132
|
-
return typeof e == "string" ?
|
|
132
|
+
return typeof e == "string" ? de(e, { dir: t, size: s }) : ge(e, { dir: t, size: s });
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function de(e, { dir: t, size: s = 32 } = {}) {
|
|
135
135
|
if (s === null)
|
|
136
136
|
return e;
|
|
137
137
|
const n = e.replace("0x", "");
|
|
@@ -143,7 +143,7 @@ function he(e, { dir: t, size: s = 32 } = {}) {
|
|
|
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)
|
|
@@ -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
172
|
function T(e, { size: t }) {
|
|
173
173
|
if (D(e) > t)
|
|
174
|
-
throw new
|
|
174
|
+
throw new me({
|
|
175
175
|
givenSize: D(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,11 +194,11 @@ 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) : C(e) ? J(e, t) : Y(e, t);
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function Ee(e, t = {}) {
|
|
202
202
|
const s = new Uint8Array(1);
|
|
203
203
|
return s[0] = Number(e), typeof t.size == "number" ? (T(s, { size: t.size }), w(s, { size: t.size })) : s;
|
|
204
204
|
}
|
|
@@ -232,30 +232,30 @@ function J(e, t = {}) {
|
|
|
232
232
|
}
|
|
233
233
|
return r;
|
|
234
234
|
}
|
|
235
|
-
function
|
|
236
|
-
const s =
|
|
235
|
+
function we(e, t) {
|
|
236
|
+
const s = ye(e, t);
|
|
237
237
|
return J(s);
|
|
238
238
|
}
|
|
239
239
|
function Y(e, t = {}) {
|
|
240
|
-
const s =
|
|
240
|
+
const s = be.encode(e);
|
|
241
241
|
return typeof t.size == "number" ? (T(s, { size: t.size }), w(s, { dir: "right", size: t.size })) : s;
|
|
242
242
|
}
|
|
243
243
|
const I = /* @__PURE__ */ BigInt(2 ** 32 - 1), k = /* @__PURE__ */ BigInt(32);
|
|
244
|
-
function
|
|
244
|
+
function Se(e, t = !1) {
|
|
245
245
|
return t ? { h: Number(e & I), l: Number(e >> k & I) } : { h: Number(e >> k & 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
261
|
function N(e) {
|
|
@@ -263,7 +263,7 @@ function N(e) {
|
|
|
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);
|
|
@@ -274,61 +274,61 @@ function B(e, t = !0) {
|
|
|
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
286
|
function Z(...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 $ = 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
305
|
function ee(e) {
|
|
306
|
-
return typeof e == "string" && (e =
|
|
306
|
+
return typeof e == "string" && (e = $e(e)), E(e), e;
|
|
307
307
|
}
|
|
308
|
-
class
|
|
308
|
+
class ze {
|
|
309
309
|
}
|
|
310
|
-
function
|
|
310
|
+
function Me(e) {
|
|
311
311
|
const t = (n) => e().update(ee(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), te = [], se = [], ne = [];
|
|
315
315
|
for (let e = 0, t = y, s = 1, n = 0; e < 24; e++) {
|
|
316
316
|
[s, n] = [n, (2 * s + 3 * n) % 5], te.push(2 * (5 * n + s)), se.push((e + 1) * (e + 2) / 2 % 64);
|
|
317
|
-
let i =
|
|
317
|
+
let i = Oe;
|
|
318
318
|
for (let r = 0; r < 7; r++)
|
|
319
|
-
t = (t << y ^ (t >>
|
|
319
|
+
t = (t << y ^ (t >> je) * Fe) % _e, t & Pe && (i ^= y << (y << /* @__PURE__ */ BigInt(r)) - y);
|
|
320
320
|
ne.push(i);
|
|
321
321
|
}
|
|
322
|
-
const ie =
|
|
323
|
-
function
|
|
322
|
+
const ie = Ae(ne, !0), Le = ie[0], He = ie[1], z = (e, t, s) => s > 32 ? Ce(e, t, s) : Ue(e, t, s), M = (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 = z(f, m, 1) ^ s[a], he = M(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++) {
|
|
@@ -341,22 +341,22 @@ 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
|
Z(s);
|
|
347
347
|
}
|
|
348
|
-
class x extends
|
|
348
|
+
class x 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
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, N(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
|
-
$(this.state32),
|
|
359
|
+
$(this.state32), Ke(this.state32, this.rounds), $(this.state32), this.posOut = 0, this.pos = 0;
|
|
360
360
|
}
|
|
361
361
|
update(t) {
|
|
362
362
|
B(this), t = ee(t), E(t);
|
|
@@ -395,7 +395,7 @@ class x extends Be {
|
|
|
395
395
|
return N(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
|
}
|
|
@@ -410,11 +410,11 @@ class x extends Be {
|
|
|
410
410
|
return t || (t = new x(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 x(t, e, s)), Ve = qe(1, 136, 256 / 8);
|
|
414
|
+
function Xe(e, t) {
|
|
415
|
+
return Ve(C(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: [
|
|
@@ -450,26 +450,26 @@ const A = /* @__PURE__ */ new oe(8192);
|
|
|
450
450
|
function re(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(Y(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
459
|
function d(e, t) {
|
|
460
|
-
if (!
|
|
461
|
-
throw new
|
|
460
|
+
if (!We(e, { strict: !1 }))
|
|
461
|
+
throw new Ge({ address: e });
|
|
462
462
|
return re(e, t);
|
|
463
463
|
}
|
|
464
|
-
const
|
|
465
|
-
function
|
|
464
|
+
const Qe = /^0x[a-fA-F0-9]{40}$/, U = /* @__PURE__ */ new oe(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 ? re(e) === e : !0 : !1;
|
|
470
470
|
return U.set(n, i), i;
|
|
471
471
|
}
|
|
472
|
-
const
|
|
472
|
+
const Je = {
|
|
473
473
|
chainId: j.chainId,
|
|
474
474
|
address: d("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),
|
|
475
475
|
symbol: "USDC",
|
|
@@ -477,7 +477,7 @@ const Qe = {
|
|
|
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
481
|
chainId: P.chainId,
|
|
482
482
|
address: d("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
|
|
483
483
|
symbol: "USDC",
|
|
@@ -485,7 +485,7 @@ const Qe = {
|
|
|
485
485
|
decimals: 6,
|
|
486
486
|
logoURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
487
487
|
/* USDC */
|
|
488
|
-
},
|
|
488
|
+
}, Ze = {
|
|
489
489
|
chainId: V.chainId,
|
|
490
490
|
address: d("0x5425890298aed601595a70ab815c96711a31bc65"),
|
|
491
491
|
symbol: "USDC",
|
|
@@ -493,7 +493,7 @@ const Qe = {
|
|
|
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
497
|
chainId: q.chainId,
|
|
498
498
|
address: d("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),
|
|
499
499
|
symbol: "USDC",
|
|
@@ -501,7 +501,7 @@ const Qe = {
|
|
|
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
505
|
chainId: F.chainId,
|
|
506
506
|
address: d("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),
|
|
507
507
|
symbol: "USDC",
|
|
@@ -509,7 +509,7 @@ const Qe = {
|
|
|
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
513
|
chainId: _.chainId,
|
|
514
514
|
address: d("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),
|
|
515
515
|
symbol: "USDC",
|
|
@@ -517,28 +517,28 @@ const Qe = {
|
|
|
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
521
|
chainId: L.chainId,
|
|
522
522
|
address: d("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
528
|
chainId: K.chainId,
|
|
529
529
|
address: d("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
535
|
chainId: H.chainId,
|
|
536
536
|
address: d("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
542
|
chainId: X.chainId,
|
|
543
543
|
address: "0x053C91253BC9682c04929cA02ED00b3E423f6710D2ee7e0D5EBB06F3eCF368A8",
|
|
544
544
|
symbol: "USDC",
|
|
@@ -549,7 +549,7 @@ const Qe = {
|
|
|
549
549
|
ARBITRUM_MAINNET: {
|
|
550
550
|
...P,
|
|
551
551
|
tokens: {
|
|
552
|
-
[h.USDC]:
|
|
552
|
+
[h.USDC]: Ye
|
|
553
553
|
},
|
|
554
554
|
explorer: "https://arbiscan.io"
|
|
555
555
|
},
|
|
@@ -557,67 +557,67 @@ const Qe = {
|
|
|
557
557
|
...j,
|
|
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
|
...q,
|
|
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
|
...V,
|
|
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
|
..._,
|
|
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
|
...F,
|
|
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
|
...L,
|
|
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
|
...H,
|
|
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
|
...K,
|
|
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
|
...X,
|
|
614
614
|
tokens: {
|
|
615
|
-
[h.USDC]:
|
|
615
|
+
[h.USDC]: rt
|
|
616
616
|
},
|
|
617
617
|
explorer: ""
|
|
618
618
|
}
|
|
619
619
|
};
|
|
620
|
-
var
|
|
620
|
+
var ae = /* @__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))(ae || {}), ce = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(ce || {});
|
|
621
621
|
const at = (e) => {
|
|
622
622
|
const t = e.trim().toUpperCase();
|
|
623
623
|
if (O[t])
|
|
@@ -626,10 +626,10 @@ const at = (e) => {
|
|
|
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) {
|
|
@@ -677,7 +677,7 @@ class c {
|
|
|
677
677
|
}
|
|
678
678
|
let v = null;
|
|
679
679
|
function ut() {
|
|
680
|
-
v =
|
|
680
|
+
v = pe.create({
|
|
681
681
|
prefixUrl: c.getBaseUrl(),
|
|
682
682
|
headers: {
|
|
683
683
|
"Content-Type": "application/json"
|
|
@@ -761,14 +761,17 @@ class gt {
|
|
|
761
761
|
}
|
|
762
762
|
}
|
|
763
763
|
class ft {
|
|
764
|
-
|
|
764
|
+
getSessionToken(t) {
|
|
765
765
|
const s = {
|
|
766
766
|
recipient: t.recipient,
|
|
767
|
-
tokenOut: ct(
|
|
767
|
+
tokenOut: ct(
|
|
768
|
+
ae[t.destinationChain],
|
|
769
|
+
ce[t.token]
|
|
770
|
+
),
|
|
768
771
|
destinationChain: t.destinationChain,
|
|
769
772
|
amount: t.amount
|
|
770
773
|
};
|
|
771
|
-
return
|
|
774
|
+
return u().post("modal/sessions", { json: s }).json();
|
|
772
775
|
}
|
|
773
776
|
}
|
|
774
777
|
const yt = {
|
|
@@ -781,8 +784,8 @@ const yt = {
|
|
|
781
784
|
};
|
|
782
785
|
export {
|
|
783
786
|
c as Chainrails,
|
|
784
|
-
|
|
787
|
+
ae as chains,
|
|
785
788
|
yt as crapi,
|
|
786
|
-
|
|
787
|
-
|
|
789
|
+
ue as environment,
|
|
790
|
+
ce as tokens
|
|
788
791
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import pe from "ky";
|
|
2
2
|
var h = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(h || {});
|
|
3
3
|
const P = {
|
|
4
4
|
type: "evm",
|
|
@@ -129,9 +129,9 @@ class W extends g {
|
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
131
|
function w(e, { dir: t, size: s = 32 } = {}) {
|
|
132
|
-
return typeof e == "string" ?
|
|
132
|
+
return typeof e == "string" ? de(e, { dir: t, size: s }) : ge(e, { dir: t, size: s });
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function de(e, { dir: t, size: s = 32 } = {}) {
|
|
135
135
|
if (s === null)
|
|
136
136
|
return e;
|
|
137
137
|
const n = e.replace("0x", "");
|
|
@@ -143,7 +143,7 @@ function he(e, { dir: t, size: s = 32 } = {}) {
|
|
|
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)
|
|
@@ -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
172
|
function T(e, { size: t }) {
|
|
173
173
|
if (D(e) > t)
|
|
174
|
-
throw new
|
|
174
|
+
throw new me({
|
|
175
175
|
givenSize: D(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,11 +194,11 @@ 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) : C(e) ? J(e, t) : Y(e, t);
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function Ee(e, t = {}) {
|
|
202
202
|
const s = new Uint8Array(1);
|
|
203
203
|
return s[0] = Number(e), typeof t.size == "number" ? (T(s, { size: t.size }), w(s, { size: t.size })) : s;
|
|
204
204
|
}
|
|
@@ -232,30 +232,30 @@ function J(e, t = {}) {
|
|
|
232
232
|
}
|
|
233
233
|
return r;
|
|
234
234
|
}
|
|
235
|
-
function
|
|
236
|
-
const s =
|
|
235
|
+
function we(e, t) {
|
|
236
|
+
const s = ye(e, t);
|
|
237
237
|
return J(s);
|
|
238
238
|
}
|
|
239
239
|
function Y(e, t = {}) {
|
|
240
|
-
const s =
|
|
240
|
+
const s = be.encode(e);
|
|
241
241
|
return typeof t.size == "number" ? (T(s, { size: t.size }), w(s, { dir: "right", size: t.size })) : s;
|
|
242
242
|
}
|
|
243
243
|
const I = /* @__PURE__ */ BigInt(2 ** 32 - 1), k = /* @__PURE__ */ BigInt(32);
|
|
244
|
-
function
|
|
244
|
+
function Se(e, t = !1) {
|
|
245
245
|
return t ? { h: Number(e & I), l: Number(e >> k & I) } : { h: Number(e >> k & 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
261
|
function N(e) {
|
|
@@ -263,7 +263,7 @@ function N(e) {
|
|
|
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);
|
|
@@ -274,61 +274,61 @@ function B(e, t = !0) {
|
|
|
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
286
|
function Z(...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 $ = 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
305
|
function ee(e) {
|
|
306
|
-
return typeof e == "string" && (e =
|
|
306
|
+
return typeof e == "string" && (e = $e(e)), E(e), e;
|
|
307
307
|
}
|
|
308
|
-
class
|
|
308
|
+
class ze {
|
|
309
309
|
}
|
|
310
|
-
function
|
|
310
|
+
function Me(e) {
|
|
311
311
|
const t = (n) => e().update(ee(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), te = [], se = [], ne = [];
|
|
315
315
|
for (let e = 0, t = y, s = 1, n = 0; e < 24; e++) {
|
|
316
316
|
[s, n] = [n, (2 * s + 3 * n) % 5], te.push(2 * (5 * n + s)), se.push((e + 1) * (e + 2) / 2 % 64);
|
|
317
|
-
let i =
|
|
317
|
+
let i = Oe;
|
|
318
318
|
for (let r = 0; r < 7; r++)
|
|
319
|
-
t = (t << y ^ (t >>
|
|
319
|
+
t = (t << y ^ (t >> je) * Fe) % _e, t & Pe && (i ^= y << (y << /* @__PURE__ */ BigInt(r)) - y);
|
|
320
320
|
ne.push(i);
|
|
321
321
|
}
|
|
322
|
-
const ie =
|
|
323
|
-
function
|
|
322
|
+
const ie = Ae(ne, !0), Le = ie[0], He = ie[1], z = (e, t, s) => s > 32 ? Ce(e, t, s) : Ue(e, t, s), M = (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 = z(f, m, 1) ^ s[a], he = M(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++) {
|
|
@@ -341,22 +341,22 @@ 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
|
Z(s);
|
|
347
347
|
}
|
|
348
|
-
class x extends
|
|
348
|
+
class x 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
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, N(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
|
-
$(this.state32),
|
|
359
|
+
$(this.state32), Ke(this.state32, this.rounds), $(this.state32), this.posOut = 0, this.pos = 0;
|
|
360
360
|
}
|
|
361
361
|
update(t) {
|
|
362
362
|
B(this), t = ee(t), E(t);
|
|
@@ -395,7 +395,7 @@ class x extends Be {
|
|
|
395
395
|
return N(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
|
}
|
|
@@ -410,11 +410,11 @@ class x extends Be {
|
|
|
410
410
|
return t || (t = new x(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 x(t, e, s)), Ve = qe(1, 136, 256 / 8);
|
|
414
|
+
function Xe(e, t) {
|
|
415
|
+
return Ve(C(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: [
|
|
@@ -450,26 +450,26 @@ const A = /* @__PURE__ */ new oe(8192);
|
|
|
450
450
|
function re(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(Y(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
459
|
function d(e, t) {
|
|
460
|
-
if (!
|
|
461
|
-
throw new
|
|
460
|
+
if (!We(e, { strict: !1 }))
|
|
461
|
+
throw new Ge({ address: e });
|
|
462
462
|
return re(e, t);
|
|
463
463
|
}
|
|
464
|
-
const
|
|
465
|
-
function
|
|
464
|
+
const Qe = /^0x[a-fA-F0-9]{40}$/, U = /* @__PURE__ */ new oe(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 ? re(e) === e : !0 : !1;
|
|
470
470
|
return U.set(n, i), i;
|
|
471
471
|
}
|
|
472
|
-
const
|
|
472
|
+
const Je = {
|
|
473
473
|
chainId: j.chainId,
|
|
474
474
|
address: d("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),
|
|
475
475
|
symbol: "USDC",
|
|
@@ -477,7 +477,7 @@ const Qe = {
|
|
|
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
481
|
chainId: P.chainId,
|
|
482
482
|
address: d("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
|
|
483
483
|
symbol: "USDC",
|
|
@@ -485,7 +485,7 @@ const Qe = {
|
|
|
485
485
|
decimals: 6,
|
|
486
486
|
logoURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
487
487
|
/* USDC */
|
|
488
|
-
},
|
|
488
|
+
}, Ze = {
|
|
489
489
|
chainId: V.chainId,
|
|
490
490
|
address: d("0x5425890298aed601595a70ab815c96711a31bc65"),
|
|
491
491
|
symbol: "USDC",
|
|
@@ -493,7 +493,7 @@ const Qe = {
|
|
|
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
497
|
chainId: q.chainId,
|
|
498
498
|
address: d("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),
|
|
499
499
|
symbol: "USDC",
|
|
@@ -501,7 +501,7 @@ const Qe = {
|
|
|
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
505
|
chainId: F.chainId,
|
|
506
506
|
address: d("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),
|
|
507
507
|
symbol: "USDC",
|
|
@@ -509,7 +509,7 @@ const Qe = {
|
|
|
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
513
|
chainId: _.chainId,
|
|
514
514
|
address: d("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),
|
|
515
515
|
symbol: "USDC",
|
|
@@ -517,28 +517,28 @@ const Qe = {
|
|
|
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
521
|
chainId: L.chainId,
|
|
522
522
|
address: d("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
528
|
chainId: K.chainId,
|
|
529
529
|
address: d("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
535
|
chainId: H.chainId,
|
|
536
536
|
address: d("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
542
|
chainId: X.chainId,
|
|
543
543
|
address: "0x053C91253BC9682c04929cA02ED00b3E423f6710D2ee7e0D5EBB06F3eCF368A8",
|
|
544
544
|
symbol: "USDC",
|
|
@@ -549,7 +549,7 @@ const Qe = {
|
|
|
549
549
|
ARBITRUM_MAINNET: {
|
|
550
550
|
...P,
|
|
551
551
|
tokens: {
|
|
552
|
-
[h.USDC]:
|
|
552
|
+
[h.USDC]: Ye
|
|
553
553
|
},
|
|
554
554
|
explorer: "https://arbiscan.io"
|
|
555
555
|
},
|
|
@@ -557,67 +557,67 @@ const Qe = {
|
|
|
557
557
|
...j,
|
|
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
|
...q,
|
|
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
|
...V,
|
|
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
|
..._,
|
|
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
|
...F,
|
|
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
|
...L,
|
|
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
|
...H,
|
|
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
|
...K,
|
|
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
|
...X,
|
|
614
614
|
tokens: {
|
|
615
|
-
[h.USDC]:
|
|
615
|
+
[h.USDC]: rt
|
|
616
616
|
},
|
|
617
617
|
explorer: ""
|
|
618
618
|
}
|
|
619
619
|
};
|
|
620
|
-
var
|
|
620
|
+
var ae = /* @__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))(ae || {}), ce = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(ce || {});
|
|
621
621
|
const at = (e) => {
|
|
622
622
|
const t = e.trim().toUpperCase();
|
|
623
623
|
if (O[t])
|
|
@@ -626,10 +626,10 @@ const at = (e) => {
|
|
|
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) {
|
|
@@ -677,7 +677,7 @@ class c {
|
|
|
677
677
|
}
|
|
678
678
|
let v = null;
|
|
679
679
|
function ut() {
|
|
680
|
-
v =
|
|
680
|
+
v = pe.create({
|
|
681
681
|
prefixUrl: c.getBaseUrl(),
|
|
682
682
|
headers: {
|
|
683
683
|
"Content-Type": "application/json"
|
|
@@ -761,14 +761,17 @@ class gt {
|
|
|
761
761
|
}
|
|
762
762
|
}
|
|
763
763
|
class ft {
|
|
764
|
-
|
|
764
|
+
getSessionToken(t) {
|
|
765
765
|
const s = {
|
|
766
766
|
recipient: t.recipient,
|
|
767
|
-
tokenOut: ct(
|
|
767
|
+
tokenOut: ct(
|
|
768
|
+
ae[t.destinationChain],
|
|
769
|
+
ce[t.token]
|
|
770
|
+
),
|
|
768
771
|
destinationChain: t.destinationChain,
|
|
769
772
|
amount: t.amount
|
|
770
773
|
};
|
|
771
|
-
return
|
|
774
|
+
return u().post("modal/sessions", { json: s }).json();
|
|
772
775
|
}
|
|
773
776
|
}
|
|
774
777
|
const yt = {
|
|
@@ -781,8 +784,8 @@ const yt = {
|
|
|
781
784
|
};
|
|
782
785
|
export {
|
|
783
786
|
c as Chainrails,
|
|
784
|
-
|
|
787
|
+
ae as chains,
|
|
785
788
|
yt as crapi,
|
|
786
|
-
|
|
787
|
-
|
|
789
|
+
ue as environment,
|
|
790
|
+
ce as tokens
|
|
788
791
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
(function(l,b){typeof exports=="object"&&typeof module<"u"?b(exports,require("ky")):typeof define=="function"&&define.amd?define(["exports","ky"],b):(l=typeof globalThis<"u"?globalThis:l||self,b(l.Chainrails={},l.Ky))})(this,(function(l,b){"use strict";var h=(e=>(e.USDC="USDC",e))(h||{});const
|
|
2
|
-
`);super(o,s.cause?{cause:s.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=i,this.metaMessages=s.metaMessages,this.name=s.name??this.name,this.shortMessage=t,this.version=H}walk(t){return K(this,t)}}function K(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?K(e.cause,t):t?null:e}class q extends f{constructor({size:t,targetSize:s,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${t}) exceeds padding size (${s}).`,{name:"SizeExceedsPaddingSizeError"})}}function E(e,{dir:t,size:s=32}={}){return typeof e=="string"?de(e,{dir:t,size:s}):pe(e,{dir:t,size:s})}function de(e,{dir:t,size:s=32}={}){if(s===null)return e;const n=e.replace("0x","");if(n.length>s*2)throw new q({size:Math.ceil(n.length/2),targetSize:s,type:"hex"});return`0x${n[t==="right"?"padEnd":"padStart"](s*2,"0")}`}function pe(e,{dir:t,size:s=32}={}){if(s===null)return e;if(e.length>s)throw new q({size:e.length,targetSize:s,type:"bytes"});const n=new Uint8Array(s);for(let i=0;i<s;i++){const r=t==="right";n[r?i:s-i-1]=e[r?i:e.length-i-1]}return n}class ge extends f{constructor({max:t,min:s,signed:n,size:i,value:r}){super(`Number "${r}" is not in safe ${i?`${i*8}-bit ${n?"signed":"unsigned"} `:""}integer range ${t?`(${s} to ${t})`:`(above ${s})`}`,{name:"IntegerOutOfRangeError"})}}class fe extends f{constructor({givenSize:t,maxSize:s}){super(`Size cannot exceed ${s} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function C(e,{size:t}){if(L(e)>t)throw new fe({givenSize:L(e),maxSize:t})}function me(e,t={}){const{signed:s,size:n}=t,i=BigInt(e);let r;n?s?r=(1n<<BigInt(n)*8n-1n)-1n:r=2n**(BigInt(n)*8n)-1n:typeof e=="number"&&(r=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof r=="bigint"&&s?-r-1n:0;if(r&&i>r||i<o){const d=typeof e=="bigint"?"n":"";throw new ge({max:r?`${r}${d}`:void 0,min:`${o}${d}`,signed:s,size:n,value:`${e}${d}`})}const a=`0x${(s&&i<0?(1n<<BigInt(n*8))+BigInt(i):i).toString(16)}`;return n?E(a,{size:n}):a}const ye=new TextEncoder;function be(e,t={}){return typeof e=="number"||typeof e=="bigint"?Ee(e,t):typeof e=="boolean"?Ie(e,t):U(e)?X(e,t):G(e,t)}function Ie(e,t={}){const s=new Uint8Array(1);return s[0]=Number(e),typeof t.size=="number"?(C(s,{size:t.size}),E(s,{size:t.size})):s}const p={zero:48,nine:57,A:65,F:70,a:97,f:102};function V(e){if(e>=p.zero&&e<=p.nine)return e-p.zero;if(e>=p.A&&e<=p.F)return e-(p.A-10);if(e>=p.a&&e<=p.f)return e-(p.a-10)}function X(e,t={}){let s=e;t.size&&(C(s,{size:t.size}),s=E(s,{dir:"right",size:t.size}));let n=s.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,r=new Uint8Array(i);for(let o=0,a=0;o<i;o++){const d=V(n.charCodeAt(a++)),m=V(n.charCodeAt(a++));if(d===void 0||m===void 0)throw new f(`Invalid byte sequence ("${n[a-2]}${n[a-1]}" in "${n}").`);r[o]=d*16+m}return r}function Ee(e,t){const s=me(e,t);return X(s)}function G(e,t={}){const s=ye.encode(e);return typeof t.size=="number"?(C(s,{size:t.size}),E(s,{dir:"right",size:t.size})):s}const w=BigInt(2**32-1),Q=BigInt(32);function we(e,t=!1){return t?{h:Number(e&w),l:Number(e>>Q&w)}:{h:Number(e>>Q&w)|0,l:Number(e&w)|0}}function Se(e,t=!1){const s=e.length;let n=new Uint32Array(s),i=new Uint32Array(s);for(let r=0;r<s;r++){const{h:o,l:a}=we(e[r],t);[n[r],i[r]]=[o,a]}return[n,i]}const Ae=(e,t,s)=>e<<s|t>>>32-s,Ue=(e,t,s)=>t<<s|e>>>32-s,ve=(e,t,s)=>t<<s-32|e>>>64-s,Ce=(e,t,s)=>e<<s-32|t>>>64-s;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Te(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function W(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function S(e,...t){if(!Te(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function J(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function De(e,t){S(e);const s=t.outputLen;if(e.length<s)throw new Error("digestInto() expects output buffer of length at least "+s)}function xe(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function Y(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}const ke=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Re(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Ne(e){for(let t=0;t<e.length;t++)e[t]=Re(e[t]);return e}const Z=ke?e=>e:Ne;function Be(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function ee(e){return typeof e=="string"&&(e=Be(e)),S(e),e}class $e{}function ze(e){const t=n=>e().update(ee(n)).digest(),s=e();return t.outputLen=s.outputLen,t.blockLen=s.blockLen,t.create=()=>e(),t}const Me=BigInt(0),I=BigInt(1),Oe=BigInt(2),je=BigInt(7),Pe=BigInt(256),_e=BigInt(113),te=[],se=[],ne=[];for(let e=0,t=I,s=1,n=0;e<24;e++){[s,n]=[n,(2*s+3*n)%5],te.push(2*(5*n+s)),se.push((e+1)*(e+2)/2%64);let i=Me;for(let r=0;r<7;r++)t=(t<<I^(t>>je)*_e)%Pe,t&Oe&&(i^=I<<(I<<BigInt(r))-I);ne.push(i)}const ie=Se(ne,!0),Fe=ie[0],Le=ie[1],oe=(e,t,s)=>s>32?ve(e,t,s):Ae(e,t,s),re=(e,t,s)=>s>32?Ce(e,t,s):Ue(e,t,s);function He(e,t=24){const s=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let o=0;o<10;o++)s[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,d=(o+2)%10,m=s[d],y=s[d+1],mt=oe(m,y,1)^s[a],yt=re(m,y,1)^s[a+1];for(let A=0;A<50;A+=10)e[o+A]^=mt,e[o+A+1]^=yt}let i=e[2],r=e[3];for(let o=0;o<24;o++){const a=se[o],d=oe(i,r,a),m=re(i,r,a),y=te[o];i=e[y],r=e[y+1],e[y]=d,e[y+1]=m}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)s[a]=e[o+a];for(let a=0;a<10;a++)e[o+a]^=~s[(a+2)%10]&s[(a+4)%10]}e[0]^=Fe[n],e[1]^=Le[n]}Y(s)}class T extends $e{constructor(t,s,n,i=!1,r=24){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,W(n),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=xe(this.state)}clone(){return this._cloneInto()}keccak(){Z(this.state32),He(this.state32,this.rounds),Z(this.state32),this.posOut=0,this.pos=0}update(t){J(this),t=ee(t),S(t);const{blockLen:s,state:n}=this,i=t.length;for(let r=0;r<i;){const o=Math.min(s-this.pos,i-r);for(let a=0;a<o;a++)n[this.pos++]^=t[r++];this.pos===s&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:s,pos:n,blockLen:i}=this;t[n]^=s,(s&128)!==0&&n===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){J(this,!1),S(t),this.finish();const s=this.state,{blockLen:n}=this;for(let i=0,r=t.length;i<r;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,r-i);t.set(s.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return W(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(De(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,Y(this.state)}_cloneInto(t){const{blockLen:s,suffix:n,outputLen:i,rounds:r,enableXOF:o}=this;return t||(t=new T(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}}const Ke=(e,t,s)=>ze(()=>new T(t,e,s)),qe=Ke(1,136,256/8);function Ve(e,t){return qe(U(e,{strict:!1})?be(e):e)}class Xe extends f{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class ae extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const s=super.get(t);return super.has(t)&&s!==void 0&&(this.delete(t),super.set(t,s)),s}set(t,s){if(super.set(t,s),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const D=new ae(8192);function ce(e,t){if(D.has(`${e}.${t}`))return D.get(`${e}.${t}`);const s=e.substring(2).toLowerCase(),n=Ve(G(s)),i=s.split("");for(let o=0;o<40;o+=2)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());const r=`0x${i.join("")}`;return D.set(`${e}.${t}`,r),r}function g(e,t){if(!Qe(e,{strict:!1}))throw new Xe({address:e});return ce(e,t)}const Ge=/^0x[a-fA-F0-9]{40}$/,x=new ae(8192);function Qe(e,t){const{strict:s=!0}=t??{},n=`${e}.${s}`;if(x.has(n))return x.get(n);const i=Ge.test(e)?e.toLowerCase()===e?!0:s?ce(e)===e:!0:!1;return x.set(n,i),i}const We={chainId:B.chainId,address:g("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},Je={chainId:N.chainId,address:g("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),symbol:"USDC",name:"USD Coin",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png"},Ye={chainId:_.chainId,address:g("0x5425890298aed601595a70ab815c96711a31bc65"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},Ze={chainId:P.chainId,address:g("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},et={chainId:z.chainId,address:g("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},tt={chainId:$.chainId,address:g("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},st={chainId:M.chainId,address:g("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),symbol:"USDC",decimals:18,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},nt={chainId:j.chainId,address:g("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),symbol:"USDC",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},it={chainId:O.chainId,address:g("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),symbol:"USDC",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},ot={chainId:F.chainId,address:"0x053C91253BC9682c04929cA02ED00b3E423f6710D2ee7e0D5EBB06F3eCF368A8",symbol:"USDC",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},ue={ARBITRUM_MAINNET:{...N,tokens:{[h.USDC]:Je},explorer:"https://arbiscan.io"},ARBITRUM_TESTNET:{...B,explorer:"https://sepolia.arbiscan.io",tokens:{[h.USDC]:We}},AVALANCHE_MAINNET:{...P,tokens:{[h.USDC]:Ze},explorer:"https://snowtrace.io"},AVALANCHE_TESTNET:{..._,tokens:{[h.USDC]:Ye},explorer:"https://testnet.snowtrace.io"},BASE_MAINNET:{...$,tokens:{[h.USDC]:tt},explorer:"https://basescan.org"},BASE_TESTNET:{...z,tokens:{[h.USDC]:et},explorer:"https://sepolia.basescan.org"},BSC_MAINNET:{...M,tokens:{[h.USDC]:st},explorer:"https://bscscan.com"},ETHEREUM_MAINNET:{...O,tokens:{[h.USDC]:it},explorer:"https://etherscan.io"},ETHEREUM_TESTNET:{...j,tokens:{[h.USDC]:nt},explorer:"https://sepolia.etherscan.io"},STARKNET_MAINNET:{...F,tokens:{[h.USDC]:ot},explorer:""}};var le=(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))(le||{}),he=(e=>(e.USDC="USDC",e))(he||{});const rt=e=>{const t=e.trim().toUpperCase();if(ue[t])return ue[t]};function at(e,t){return rt(e)?.tokens[t]?.address}var k=(e=>(e.PRODUCTION="production",e.STAGING="staging",e))(k||{});class c{constructor({api_key:t,env:s,seesion_token:n}){this.api_key=t||"",this.sessionToken=n||"",this.env=s??k.PRODUCTION}static async config(t){if(!c.app){if(!t)throw new Error("Please provide an api_key");c.app=new c(t)}return t&&(t.api_key!==void 0&&(c.app.api_key=t.api_key),t.seesion_token!==void 0&&(c.app.sessionToken=t.seesion_token),t.env!==void 0&&(c.app.env=t.env)),c.app}static getApiKey(){if(!c.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return c.app.api_key}static getSessionToken(){if(!c.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return c.app.sessionToken}static getEnv(){if(!c.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return c.app.env==="internal"?"staging":c.app.env}static getBaseUrl(){if(!c.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");switch(c.app.env){case"production":return"https://api.chainrails.io/api/v1";case"staging":return"https://dev.chainrails.io/api/v1";case"internal":return"https://dev.chainrails.io/api/v1";default:return"https://api.chainrails.io/api/v1"}}static getPayModalUrl(t,s,n,i){if(!c.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");const r=c.app.env==="internal"?"https://chainrails-frontend-git-staging-horus-labs.vercel.app":"https://app.chainrails.io",o=i&&i>0?"/pay/":"/deposit/",a=`_chain_/${t}/_token_/${s}/_to_/${n}${i?"/_amount_/"+i*100:""}`;return r+o+a}}let R=null;function ct(){R=b.create({prefixUrl:c.getBaseUrl(),headers:{"Content-Type":"application/json"},hooks:{beforeRequest:[e=>{const t=c.getSessionToken()||c.getApiKey();e.headers.set("Authorization",`Bearer ${t}`)}],afterResponse:[(e,t,s)=>s]},retry:{limit:2}})}function u(){return R||ct(),R}class ut{async getById(t){return await u().get("intents/"+t).json()}async getForSender(t){return await u().get("intents/user/"+t).json()}async getForAddress(t){return await u().get("intents/address/"+t).json()}async getAll(t){return await u().get("intents",{searchParams:t}).json()}async create(t){return await u().post("intents",{json:t}).json()}async update(t,s){return await u().post("intents",{json:s}).json()}async triggerProcessing(t){return await u().post(`intents/${t}/trigger-processing`).json()}}class lt{async getFromSpecificBridge(t){return await u().get("quotes/single",{searchParams:t}).json()}async getFromAllBridges(t){return await u().get("quotes/multiple",{searchParams:t}).json()}async getBestAcrossBridges(t){return await u().get("quotes/best",{searchParams:t}).json()}async getAll(t){return await u().get("quotes/multi-source",{searchParams:t}).json()}}class ht{async getOptimalRoutes(t){return await u().get("router/optimal-route",{searchParams:t}).json()}async getAllSupportedBridges(){return await u().get("router/supported-bridges/all").json()}async getSupportedBridges(t){return await u().get("router/supported-bridges/route",{searchParams:t}).json()}async getSupportedRoutes(t,s){return await u().get("router/supported-bridges/bridge/"+t,{searchParams:s}).json()}}class dt{async getSupported(t){return await u().get("chains",{searchParams:t}).json()}}class pt{async getClientInfo(){return await u().get("client/auth/client-info").json()}}class gt{async getSessionToken(t){const s={recipient:t.recipient,tokenOut:at(t.destinationChain,t.token),destinationChain:t.destinationChain,amount:t.amount};return await u().post("modal/sessions",{json:s}).json()}}const ft={router:new ht,quotes:new lt,intents:new ut,chains:new dt,client:new pt,auth:new gt};l.Chainrails=c,l.chains=le,l.crapi=ft,l.environment=k,l.tokens=he,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})}));
|
|
1
|
+
(function(l,b){typeof exports=="object"&&typeof module<"u"?b(exports,require("ky")):typeof define=="function"&&define.amd?define(["exports","ky"],b):(l=typeof globalThis<"u"?globalThis:l||self,b(l.Chainrails={},l.Ky))})(this,(function(l,b){"use strict";var h=(e=>(e.USDC="USDC",e))(h||{});const $={type:"evm",chainId:42161,name:"Arbitrum",cctpDomain:3,logoURI:"/images/chains/arbitrum.svg"},z={type:"evm",chainId:421614,name:"Arbitrum Sepolia",cctpDomain:3,logoURI:"/images/chains/arbitrum.svg"},M={type:"evm",chainId:8453,name:"Base",cctpDomain:6,logoURI:"/images/chains/base.webp"},O={type:"evm",chainId:84532,name:"Base Sepolia",cctpDomain:6,logoURI:"/images/chains/base.webp"},j={type:"evm",chainId:56,name:"BNB Chain",cctpDomain:null,logoURI:"/images/chains/bsc.webp"},P={type:"evm",chainId:1,name:"Ethereum",cctpDomain:0,logoURI:"/images/chains/ethereum.svg"},_={type:"evm",chainId:11155111,name:"Ethereum Sepolia",cctpDomain:0,logoURI:"/images/chains/ethereum.svg"},F={type:"evm",chainId:43114,name:"Avalanche",cctpDomain:1,logoURI:"/images/chains/avalanche.svg"},L={type:"evm",chainId:43113,name:"Avalanche Fuji",cctpDomain:1,logoURI:"/images/chains/avalanche.svg"},H={type:"starknet",chainId:"0x534e5f4d41494e",name:"Starknet",cctpDomain:null,logoURI:"/images/chains/starknet.svg"};function U(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function K(e){return U(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const q="2.43.4";let v={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:s})=>t?`${e??"https://viem.sh"}${t}${s?`#${s}`:""}`:void 0,version:`viem@${q}`};class f extends Error{constructor(t,s={}){const n=s.cause instanceof f?s.cause.details:s.cause?.message?s.cause.message:s.details,i=s.cause instanceof f&&s.cause.docsPath||s.docsPath,r=v.getDocsUrl?.({...s,docsPath:i}),o=[t||"An error occurred.","",...s.metaMessages?[...s.metaMessages,""]:[],...r?[`Docs: ${r}`]:[],...n?[`Details: ${n}`]:[],...v.version?[`Version: ${v.version}`]:[]].join(`
|
|
2
|
+
`);super(o,s.cause?{cause:s.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=n,this.docsPath=i,this.metaMessages=s.metaMessages,this.name=s.name??this.name,this.shortMessage=t,this.version=q}walk(t){return V(this,t)}}function V(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?V(e.cause,t):t?null:e}class X extends f{constructor({size:t,targetSize:s,type:n}){super(`${n.charAt(0).toUpperCase()}${n.slice(1).toLowerCase()} size (${t}) exceeds padding size (${s}).`,{name:"SizeExceedsPaddingSizeError"})}}function E(e,{dir:t,size:s=32}={}){return typeof e=="string"?de(e,{dir:t,size:s}):pe(e,{dir:t,size:s})}function de(e,{dir:t,size:s=32}={}){if(s===null)return e;const n=e.replace("0x","");if(n.length>s*2)throw new X({size:Math.ceil(n.length/2),targetSize:s,type:"hex"});return`0x${n[t==="right"?"padEnd":"padStart"](s*2,"0")}`}function pe(e,{dir:t,size:s=32}={}){if(s===null)return e;if(e.length>s)throw new X({size:e.length,targetSize:s,type:"bytes"});const n=new Uint8Array(s);for(let i=0;i<s;i++){const r=t==="right";n[r?i:s-i-1]=e[r?i:e.length-i-1]}return n}class ge extends f{constructor({max:t,min:s,signed:n,size:i,value:r}){super(`Number "${r}" is not in safe ${i?`${i*8}-bit ${n?"signed":"unsigned"} `:""}integer range ${t?`(${s} to ${t})`:`(above ${s})`}`,{name:"IntegerOutOfRangeError"})}}class fe extends f{constructor({givenSize:t,maxSize:s}){super(`Size cannot exceed ${s} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function C(e,{size:t}){if(K(e)>t)throw new fe({givenSize:K(e),maxSize:t})}function me(e,t={}){const{signed:s,size:n}=t,i=BigInt(e);let r;n?s?r=(1n<<BigInt(n)*8n-1n)-1n:r=2n**(BigInt(n)*8n)-1n:typeof e=="number"&&(r=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof r=="bigint"&&s?-r-1n:0;if(r&&i>r||i<o){const d=typeof e=="bigint"?"n":"";throw new ge({max:r?`${r}${d}`:void 0,min:`${o}${d}`,signed:s,size:n,value:`${e}${d}`})}const a=`0x${(s&&i<0?(1n<<BigInt(n*8))+BigInt(i):i).toString(16)}`;return n?E(a,{size:n}):a}const ye=new TextEncoder;function be(e,t={}){return typeof e=="number"||typeof e=="bigint"?Ee(e,t):typeof e=="boolean"?Ie(e,t):U(e)?Q(e,t):W(e,t)}function Ie(e,t={}){const s=new Uint8Array(1);return s[0]=Number(e),typeof t.size=="number"?(C(s,{size:t.size}),E(s,{size:t.size})):s}const p={zero:48,nine:57,A:65,F:70,a:97,f:102};function G(e){if(e>=p.zero&&e<=p.nine)return e-p.zero;if(e>=p.A&&e<=p.F)return e-(p.A-10);if(e>=p.a&&e<=p.f)return e-(p.a-10)}function Q(e,t={}){let s=e;t.size&&(C(s,{size:t.size}),s=E(s,{dir:"right",size:t.size}));let n=s.slice(2);n.length%2&&(n=`0${n}`);const i=n.length/2,r=new Uint8Array(i);for(let o=0,a=0;o<i;o++){const d=G(n.charCodeAt(a++)),m=G(n.charCodeAt(a++));if(d===void 0||m===void 0)throw new f(`Invalid byte sequence ("${n[a-2]}${n[a-1]}" in "${n}").`);r[o]=d*16+m}return r}function Ee(e,t){const s=me(e,t);return Q(s)}function W(e,t={}){const s=ye.encode(e);return typeof t.size=="number"?(C(s,{size:t.size}),E(s,{dir:"right",size:t.size})):s}const w=BigInt(2**32-1),J=BigInt(32);function we(e,t=!1){return t?{h:Number(e&w),l:Number(e>>J&w)}:{h:Number(e>>J&w)|0,l:Number(e&w)|0}}function Se(e,t=!1){const s=e.length;let n=new Uint32Array(s),i=new Uint32Array(s);for(let r=0;r<s;r++){const{h:o,l:a}=we(e[r],t);[n[r],i[r]]=[o,a]}return[n,i]}const Ae=(e,t,s)=>e<<s|t>>>32-s,Ue=(e,t,s)=>t<<s|e>>>32-s,ve=(e,t,s)=>t<<s-32|e>>>64-s,Ce=(e,t,s)=>e<<s-32|t>>>64-s;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Te(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Y(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function S(e,...t){if(!Te(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Z(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function De(e,t){S(e);const s=t.outputLen;if(e.length<s)throw new Error("digestInto() expects output buffer of length at least "+s)}function xe(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function ee(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}const ke=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Re(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Ne(e){for(let t=0;t<e.length;t++)e[t]=Re(e[t]);return e}const te=ke?e=>e:Ne;function Be(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function se(e){return typeof e=="string"&&(e=Be(e)),S(e),e}class $e{}function ze(e){const t=n=>e().update(se(n)).digest(),s=e();return t.outputLen=s.outputLen,t.blockLen=s.blockLen,t.create=()=>e(),t}const Me=BigInt(0),I=BigInt(1),Oe=BigInt(2),je=BigInt(7),Pe=BigInt(256),_e=BigInt(113),ne=[],ie=[],oe=[];for(let e=0,t=I,s=1,n=0;e<24;e++){[s,n]=[n,(2*s+3*n)%5],ne.push(2*(5*n+s)),ie.push((e+1)*(e+2)/2%64);let i=Me;for(let r=0;r<7;r++)t=(t<<I^(t>>je)*_e)%Pe,t&Oe&&(i^=I<<(I<<BigInt(r))-I);oe.push(i)}const re=Se(oe,!0),Fe=re[0],Le=re[1],ae=(e,t,s)=>s>32?ve(e,t,s):Ae(e,t,s),ce=(e,t,s)=>s>32?Ce(e,t,s):Ue(e,t,s);function He(e,t=24){const s=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let o=0;o<10;o++)s[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,d=(o+2)%10,m=s[d],y=s[d+1],mt=ae(m,y,1)^s[a],yt=ce(m,y,1)^s[a+1];for(let A=0;A<50;A+=10)e[o+A]^=mt,e[o+A+1]^=yt}let i=e[2],r=e[3];for(let o=0;o<24;o++){const a=ie[o],d=ae(i,r,a),m=ce(i,r,a),y=ne[o];i=e[y],r=e[y+1],e[y]=d,e[y+1]=m}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)s[a]=e[o+a];for(let a=0;a<10;a++)e[o+a]^=~s[(a+2)%10]&s[(a+4)%10]}e[0]^=Fe[n],e[1]^=Le[n]}ee(s)}class T extends $e{constructor(t,s,n,i=!1,r=24){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,Y(n),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=xe(this.state)}clone(){return this._cloneInto()}keccak(){te(this.state32),He(this.state32,this.rounds),te(this.state32),this.posOut=0,this.pos=0}update(t){Z(this),t=se(t),S(t);const{blockLen:s,state:n}=this,i=t.length;for(let r=0;r<i;){const o=Math.min(s-this.pos,i-r);for(let a=0;a<o;a++)n[this.pos++]^=t[r++];this.pos===s&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:s,pos:n,blockLen:i}=this;t[n]^=s,(s&128)!==0&&n===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){Z(this,!1),S(t),this.finish();const s=this.state,{blockLen:n}=this;for(let i=0,r=t.length;i<r;){this.posOut>=n&&this.keccak();const o=Math.min(n-this.posOut,r-i);t.set(s.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return Y(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(De(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,ee(this.state)}_cloneInto(t){const{blockLen:s,suffix:n,outputLen:i,rounds:r,enableXOF:o}=this;return t||(t=new T(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}}const Ke=(e,t,s)=>ze(()=>new T(t,e,s)),qe=Ke(1,136,256/8);function Ve(e,t){return qe(U(e,{strict:!1})?be(e):e)}class Xe extends f{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class ue extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const s=super.get(t);return super.has(t)&&s!==void 0&&(this.delete(t),super.set(t,s)),s}set(t,s){if(super.set(t,s),this.maxSize&&this.size>this.maxSize){const n=this.keys().next().value;n&&this.delete(n)}return this}}const D=new ue(8192);function le(e,t){if(D.has(`${e}.${t}`))return D.get(`${e}.${t}`);const s=e.substring(2).toLowerCase(),n=Ve(W(s)),i=s.split("");for(let o=0;o<40;o+=2)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());const r=`0x${i.join("")}`;return D.set(`${e}.${t}`,r),r}function g(e,t){if(!Qe(e,{strict:!1}))throw new Xe({address:e});return le(e,t)}const Ge=/^0x[a-fA-F0-9]{40}$/,x=new ue(8192);function Qe(e,t){const{strict:s=!0}=t??{},n=`${e}.${s}`;if(x.has(n))return x.get(n);const i=Ge.test(e)?e.toLowerCase()===e?!0:s?le(e)===e:!0:!1;return x.set(n,i),i}const We={chainId:z.chainId,address:g("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},Je={chainId:$.chainId,address:g("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),symbol:"USDC",name:"USD Coin",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png"},Ye={chainId:L.chainId,address:g("0x5425890298aed601595a70ab815c96711a31bc65"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},Ze={chainId:F.chainId,address:g("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},et={chainId:O.chainId,address:g("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},tt={chainId:M.chainId,address:g("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},st={chainId:j.chainId,address:g("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),symbol:"USDC",decimals:18,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},nt={chainId:_.chainId,address:g("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),symbol:"USDC",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},it={chainId:P.chainId,address:g("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),symbol:"USDC",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},ot={chainId:H.chainId,address:"0x053C91253BC9682c04929cA02ED00b3E423f6710D2ee7e0D5EBB06F3eCF368A8",symbol:"USDC",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},he={ARBITRUM_MAINNET:{...$,tokens:{[h.USDC]:Je},explorer:"https://arbiscan.io"},ARBITRUM_TESTNET:{...z,explorer:"https://sepolia.arbiscan.io",tokens:{[h.USDC]:We}},AVALANCHE_MAINNET:{...F,tokens:{[h.USDC]:Ze},explorer:"https://snowtrace.io"},AVALANCHE_TESTNET:{...L,tokens:{[h.USDC]:Ye},explorer:"https://testnet.snowtrace.io"},BASE_MAINNET:{...M,tokens:{[h.USDC]:tt},explorer:"https://basescan.org"},BASE_TESTNET:{...O,tokens:{[h.USDC]:et},explorer:"https://sepolia.basescan.org"},BSC_MAINNET:{...j,tokens:{[h.USDC]:st},explorer:"https://bscscan.com"},ETHEREUM_MAINNET:{...P,tokens:{[h.USDC]:it},explorer:"https://etherscan.io"},ETHEREUM_TESTNET:{..._,tokens:{[h.USDC]:nt},explorer:"https://sepolia.etherscan.io"},STARKNET_MAINNET:{...H,tokens:{[h.USDC]:ot},explorer:""}};var k=(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))(k||{}),R=(e=>(e.USDC="USDC",e))(R||{});const rt=e=>{const t=e.trim().toUpperCase();if(he[t])return he[t]};function at(e,t){return rt(e)?.tokens[t]?.address}var N=(e=>(e.PRODUCTION="production",e.STAGING="staging",e))(N||{});class c{constructor({api_key:t,env:s,seesion_token:n}){this.api_key=t||"",this.sessionToken=n||"",this.env=s??N.PRODUCTION}static async config(t){if(!c.app){if(!t)throw new Error("Please provide an api_key");c.app=new c(t)}return t&&(t.api_key!==void 0&&(c.app.api_key=t.api_key),t.seesion_token!==void 0&&(c.app.sessionToken=t.seesion_token),t.env!==void 0&&(c.app.env=t.env)),c.app}static getApiKey(){if(!c.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return c.app.api_key}static getSessionToken(){if(!c.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return c.app.sessionToken}static getEnv(){if(!c.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return c.app.env==="internal"?"staging":c.app.env}static getBaseUrl(){if(!c.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");switch(c.app.env){case"production":return"https://api.chainrails.io/api/v1";case"staging":return"https://dev.chainrails.io/api/v1";case"internal":return"https://dev.chainrails.io/api/v1";default:return"https://api.chainrails.io/api/v1"}}static getPayModalUrl(t,s,n,i){if(!c.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");const r=c.app.env==="internal"?"https://chainrails-frontend-git-staging-horus-labs.vercel.app":"https://app.chainrails.io",o=i&&i>0?"/pay/":"/deposit/",a=`_chain_/${t}/_token_/${s}/_to_/${n}${i?"/_amount_/"+i*100:""}`;return r+o+a}}let B=null;function ct(){B=b.create({prefixUrl:c.getBaseUrl(),headers:{"Content-Type":"application/json"},hooks:{beforeRequest:[e=>{const t=c.getSessionToken()||c.getApiKey();e.headers.set("Authorization",`Bearer ${t}`)}],afterResponse:[(e,t,s)=>s]},retry:{limit:2}})}function u(){return B||ct(),B}class ut{async getById(t){return await u().get("intents/"+t).json()}async getForSender(t){return await u().get("intents/user/"+t).json()}async getForAddress(t){return await u().get("intents/address/"+t).json()}async getAll(t){return await u().get("intents",{searchParams:t}).json()}async create(t){return await u().post("intents",{json:t}).json()}async update(t,s){return await u().post("intents",{json:s}).json()}async triggerProcessing(t){return await u().post(`intents/${t}/trigger-processing`).json()}}class lt{async getFromSpecificBridge(t){return await u().get("quotes/single",{searchParams:t}).json()}async getFromAllBridges(t){return await u().get("quotes/multiple",{searchParams:t}).json()}async getBestAcrossBridges(t){return await u().get("quotes/best",{searchParams:t}).json()}async getAll(t){return await u().get("quotes/multi-source",{searchParams:t}).json()}}class ht{async getOptimalRoutes(t){return await u().get("router/optimal-route",{searchParams:t}).json()}async getAllSupportedBridges(){return await u().get("router/supported-bridges/all").json()}async getSupportedBridges(t){return await u().get("router/supported-bridges/route",{searchParams:t}).json()}async getSupportedRoutes(t,s){return await u().get("router/supported-bridges/bridge/"+t,{searchParams:s}).json()}}class dt{async getSupported(t){return await u().get("chains",{searchParams:t}).json()}}class pt{async getClientInfo(){return await u().get("client/auth/client-info").json()}}class gt{getSessionToken(t){const s={recipient:t.recipient,tokenOut:at(k[t.destinationChain],R[t.token]),destinationChain:t.destinationChain,amount:t.amount};return u().post("modal/sessions",{json:s}).json()}}const ft={router:new ht,quotes:new lt,intents:new ut,chains:new dt,client:new pt,auth:new gt};l.Chainrails=c,l.chains=k,l.crapi=ft,l.environment=N,l.tokens=R,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})}));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Auth/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEtE,MAAM,CAAC,OAAO,OAAO,IAAI;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Auth/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAEtE,MAAM,CAAC,OAAO,OAAO,IAAI;IACvB,eAAe,CAAC,KAAK,EAAE,oBAAoB;CAY5C;AAED,cAAc,SAAS,CAAC"}
|