@chainrails/sdk 0.0.45 → 0.0.46
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 +196 -182
- package/dist/chainrails-sdk.es.mjs +196 -182
- package/dist/chainrails-sdk.umd.js +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,60 +1,60 @@
|
|
|
1
|
-
import
|
|
1
|
+
import Ee from "ky";
|
|
2
2
|
var h = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(h || {});
|
|
3
|
-
const
|
|
3
|
+
const G = {
|
|
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
|
+
}, Q = {
|
|
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
|
+
}, W = {
|
|
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
|
+
}, J = {
|
|
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
|
+
}, Y = {
|
|
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
|
+
}, Z = {
|
|
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
|
+
}, ee = {
|
|
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
|
+
}, te = {
|
|
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
|
+
}, se = {
|
|
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
|
+
}, ne = {
|
|
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 O(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 F(e) {
|
|
69
|
+
return O(e, { strict: !1 }) ? Math.ceil((e.length - 2) / 2) : e.length;
|
|
70
70
|
}
|
|
71
|
-
const
|
|
71
|
+
const ie = "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@${ie}`
|
|
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 = ie;
|
|
118
118
|
}
|
|
119
119
|
walk(t) {
|
|
120
|
-
return
|
|
120
|
+
return oe(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 oe(e, t) {
|
|
124
|
+
return t?.(e) ? e : e && typeof e == "object" && "cause" in e && e.cause !== void 0 ? oe(e.cause, t) : t ? null : e;
|
|
125
125
|
}
|
|
126
|
-
class
|
|
126
|
+
class re 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 E(e, { dir: t, size: s = 32 } = {}) {
|
|
132
|
-
return typeof e == "string" ?
|
|
132
|
+
return typeof e == "string" ? Se(e, { dir: t, size: s }) : Ae(e, { dir: t, size: s });
|
|
133
133
|
}
|
|
134
|
-
function
|
|
134
|
+
function Se(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 re({
|
|
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 Ae(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 re({
|
|
151
151
|
size: e.length,
|
|
152
152
|
targetSize: s,
|
|
153
153
|
type: "bytes"
|
|
@@ -159,31 +159,31 @@ function ge(e, { dir: t, size: s = 32 } = {}) {
|
|
|
159
159
|
}
|
|
160
160
|
return n;
|
|
161
161
|
}
|
|
162
|
-
class
|
|
162
|
+
class Ue 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 ve 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 j(e, { size: t }) {
|
|
173
|
+
if (F(e) > t)
|
|
174
|
+
throw new ve({
|
|
175
|
+
givenSize: F(e),
|
|
176
176
|
maxSize: t
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
|
-
function
|
|
179
|
+
function Ce(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 Ue({
|
|
187
187
|
max: r ? `${r}${l}` : void 0,
|
|
188
188
|
min: `${o}${l}`,
|
|
189
189
|
signed: s,
|
|
@@ -194,13 +194,13 @@ function ye(e, t = {}) {
|
|
|
194
194
|
const a = `0x${(s && i < 0 ? (1n << BigInt(n * 8)) + BigInt(i) : i).toString(16)}`;
|
|
195
195
|
return n ? E(a, { size: n }) : a;
|
|
196
196
|
}
|
|
197
|
-
const
|
|
198
|
-
function
|
|
199
|
-
return typeof e == "number" || typeof e == "bigint" ?
|
|
197
|
+
const Te = /* @__PURE__ */ new TextEncoder();
|
|
198
|
+
function De(e, t = {}) {
|
|
199
|
+
return typeof e == "number" || typeof e == "bigint" ? ke(e, t) : typeof e == "boolean" ? xe(e, t) : O(e) ? ae(e, t) : ce(e, t);
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function xe(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" ? (j(s, { size: t.size }), E(s, { size: t.size })) : s;
|
|
204
204
|
}
|
|
205
205
|
const d = {
|
|
206
206
|
zero: 48,
|
|
@@ -210,7 +210,7 @@ const d = {
|
|
|
210
210
|
a: 97,
|
|
211
211
|
f: 102
|
|
212
212
|
};
|
|
213
|
-
function
|
|
213
|
+
function _(e) {
|
|
214
214
|
if (e >= d.zero && e <= d.nine)
|
|
215
215
|
return e - d.zero;
|
|
216
216
|
if (e >= d.A && e <= d.F)
|
|
@@ -218,121 +218,121 @@ function k(e) {
|
|
|
218
218
|
if (e >= d.a && e <= d.f)
|
|
219
219
|
return e - (d.a - 10);
|
|
220
220
|
}
|
|
221
|
-
function
|
|
221
|
+
function ae(e, t = {}) {
|
|
222
222
|
let s = e;
|
|
223
|
-
t.size && (
|
|
223
|
+
t.size && (j(s, { size: t.size }), s = E(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 = _(n.charCodeAt(a++)), f = _(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 ke(e, t) {
|
|
236
|
+
const s = Ce(e, t);
|
|
237
|
+
return ae(s);
|
|
238
238
|
}
|
|
239
|
-
function
|
|
240
|
-
const s =
|
|
241
|
-
return typeof t.size == "number" ? (
|
|
239
|
+
function ce(e, t = {}) {
|
|
240
|
+
const s = Te.encode(e);
|
|
241
|
+
return typeof t.size == "number" ? (j(s, { size: t.size }), E(s, { dir: "right", size: t.size })) : s;
|
|
242
242
|
}
|
|
243
|
-
const
|
|
244
|
-
function
|
|
245
|
-
return t ? { h: Number(e &
|
|
243
|
+
const b = /* @__PURE__ */ BigInt(2 ** 32 - 1), L = /* @__PURE__ */ BigInt(32);
|
|
244
|
+
function Re(e, t = !1) {
|
|
245
|
+
return t ? { h: Number(e & b), l: Number(e >> L & b) } : { h: Number(e >> L & b) | 0, l: Number(e & b) | 0 };
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function Ne(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 } = Re(e[r], t);
|
|
252
252
|
[n[r], i[r]] = [o, a];
|
|
253
253
|
}
|
|
254
254
|
return [n, i];
|
|
255
255
|
}
|
|
256
|
-
const
|
|
256
|
+
const Be = (e, t, s) => e << s | t >>> 32 - s, $e = (e, t, s) => t << s | e >>> 32 - s, ze = (e, t, s) => t << s - 32 | e >>> 64 - s, Me = (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 Oe(e) {
|
|
259
259
|
return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
|
|
260
260
|
}
|
|
261
|
-
function
|
|
261
|
+
function H(e) {
|
|
262
262
|
if (!Number.isSafeInteger(e) || e < 0)
|
|
263
263
|
throw new Error("positive integer expected, got " + e);
|
|
264
264
|
}
|
|
265
265
|
function w(e, ...t) {
|
|
266
|
-
if (!
|
|
266
|
+
if (!Oe(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 q(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 je(e, t) {
|
|
278
278
|
w(e);
|
|
279
279
|
const s = t.outputLen;
|
|
280
280
|
if (e.length < s)
|
|
281
281
|
throw new Error("digestInto() expects output buffer of length at least " + s);
|
|
282
282
|
}
|
|
283
|
-
function
|
|
283
|
+
function Pe(e) {
|
|
284
284
|
return new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4));
|
|
285
285
|
}
|
|
286
|
-
function
|
|
286
|
+
function ue(...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 Fe = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
291
|
+
function _e(e) {
|
|
292
292
|
return e << 24 & 4278190080 | e << 8 & 16711680 | e >>> 8 & 65280 | e >>> 24 & 255;
|
|
293
293
|
}
|
|
294
|
-
function
|
|
294
|
+
function Le(e) {
|
|
295
295
|
for (let t = 0; t < e.length; t++)
|
|
296
|
-
e[t] =
|
|
296
|
+
e[t] = _e(e[t]);
|
|
297
297
|
return e;
|
|
298
298
|
}
|
|
299
|
-
const
|
|
300
|
-
function
|
|
299
|
+
const K = Fe ? (e) => e : Le;
|
|
300
|
+
function He(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 le(e) {
|
|
306
|
+
return typeof e == "string" && (e = He(e)), w(e), e;
|
|
307
307
|
}
|
|
308
|
-
class
|
|
308
|
+
class qe {
|
|
309
309
|
}
|
|
310
|
-
function
|
|
311
|
-
const t = (n) => e().update(
|
|
310
|
+
function Ke(e) {
|
|
311
|
+
const t = (n) => e().update(le(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 Ve = BigInt(0), y = BigInt(1), Xe = BigInt(2), Ge = BigInt(7), Qe = BigInt(256), We = BigInt(113), he = [], de = [], pe = [];
|
|
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], he.push(2 * (5 * n + s)), de.push((e + 1) * (e + 2) / 2 % 64);
|
|
317
|
+
let i = Ve;
|
|
318
318
|
for (let r = 0; r < 7; r++)
|
|
319
|
-
t = (t << y ^ (t >>
|
|
320
|
-
|
|
319
|
+
t = (t << y ^ (t >> Ge) * We) % Qe, t & Xe && (i ^= y << (y << /* @__PURE__ */ BigInt(r)) - y);
|
|
320
|
+
pe.push(i);
|
|
321
321
|
}
|
|
322
|
-
const
|
|
323
|
-
function
|
|
322
|
+
const ge = Ne(pe, !0), Je = ge[0], Ye = ge[1], V = (e, t, s) => s > 32 ? ze(e, t, s) : Be(e, t, s), X = (e, t, s) => s > 32 ? Me(e, t, s) : $e(e, t, s);
|
|
323
|
+
function Ze(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],
|
|
330
|
-
for (let
|
|
331
|
-
e[o +
|
|
329
|
+
const a = (o + 8) % 10, l = (o + 2) % 10, f = s[l], m = s[l + 1], be = V(f, m, 1) ^ s[a], we = X(f, m, 1) ^ s[a + 1];
|
|
330
|
+
for (let I = 0; I < 50; I += 10)
|
|
331
|
+
e[o + I] ^= be, e[o + I + 1] ^= we;
|
|
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 = de[o], l = V(i, r, a), f = X(i, r, a), m = he[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 qe(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] ^= Je[n], e[1] ^= Ye[n];
|
|
345
345
|
}
|
|
346
|
-
|
|
346
|
+
ue(s);
|
|
347
347
|
}
|
|
348
|
-
class
|
|
348
|
+
class P extends qe {
|
|
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, H(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 = Pe(this.state);
|
|
354
354
|
}
|
|
355
355
|
clone() {
|
|
356
356
|
return this._cloneInto();
|
|
357
357
|
}
|
|
358
358
|
keccak() {
|
|
359
|
-
|
|
359
|
+
K(this.state32), Ze(this.state32, this.rounds), K(this.state32), this.posOut = 0, this.pos = 0;
|
|
360
360
|
}
|
|
361
361
|
update(t) {
|
|
362
|
-
|
|
362
|
+
q(this), t = le(t), w(t);
|
|
363
363
|
const { blockLen: s, state: n } = this, i = t.length;
|
|
364
364
|
for (let r = 0; r < i; ) {
|
|
365
365
|
const o = Math.min(s - this.pos, i - r);
|
|
@@ -377,7 +377,7 @@ class D extends ze {
|
|
|
377
377
|
t[n] ^= s, (s & 128) !== 0 && n === i - 1 && this.keccak(), t[i - 1] ^= 128, this.keccak();
|
|
378
378
|
}
|
|
379
379
|
writeInto(t) {
|
|
380
|
-
|
|
380
|
+
q(this, !1), w(t), this.finish();
|
|
381
381
|
const s = this.state, { blockLen: n } = this;
|
|
382
382
|
for (let i = 0, r = t.length; i < r; ) {
|
|
383
383
|
this.posOut >= n && this.keccak();
|
|
@@ -392,10 +392,10 @@ class D extends ze {
|
|
|
392
392
|
return this.writeInto(t);
|
|
393
393
|
}
|
|
394
394
|
xof(t) {
|
|
395
|
-
return
|
|
395
|
+
return H(t), this.xofInto(new Uint8Array(t));
|
|
396
396
|
}
|
|
397
397
|
digestInto(t) {
|
|
398
|
-
if (
|
|
398
|
+
if (je(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 D extends ze {
|
|
|
403
403
|
return this.digestInto(new Uint8Array(this.outputLen));
|
|
404
404
|
}
|
|
405
405
|
destroy() {
|
|
406
|
-
this.destroyed = !0,
|
|
406
|
+
this.destroyed = !0, ue(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 P(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 et = (e, t, s) => Ke(() => new P(t, e, s)), tt = et(1, 136, 256 / 8);
|
|
414
|
+
function st(e, t) {
|
|
415
|
+
return tt(O(e, { strict: !1 }) ? De(e) : e);
|
|
416
416
|
}
|
|
417
|
-
class
|
|
417
|
+
class nt extends g {
|
|
418
418
|
constructor({ address: t }) {
|
|
419
419
|
super(`Address "${t}" is invalid.`, {
|
|
420
420
|
metaMessages: [
|
|
@@ -425,7 +425,7 @@ class Ge extends g {
|
|
|
425
425
|
});
|
|
426
426
|
}
|
|
427
427
|
}
|
|
428
|
-
class
|
|
428
|
+
class fe extends Map {
|
|
429
429
|
constructor(t) {
|
|
430
430
|
super(), Object.defineProperty(this, "maxSize", {
|
|
431
431
|
enumerable: !0,
|
|
@@ -446,190 +446,203 @@ class re extends Map {
|
|
|
446
446
|
return this;
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
|
-
const A = /* @__PURE__ */ new
|
|
450
|
-
function
|
|
449
|
+
const A = /* @__PURE__ */ new fe(8192);
|
|
450
|
+
function me(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 = st(ce(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 p(e, t) {
|
|
460
|
-
if (!
|
|
461
|
-
throw new
|
|
462
|
-
return
|
|
460
|
+
if (!ot(e, { strict: !1 }))
|
|
461
|
+
throw new nt({ address: e });
|
|
462
|
+
return me(e, t);
|
|
463
463
|
}
|
|
464
|
-
const
|
|
465
|
-
function
|
|
464
|
+
const it = /^0x[a-fA-F0-9]{40}$/, U = /* @__PURE__ */ new fe(8192);
|
|
465
|
+
function ot(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 = it.test(e) ? e.toLowerCase() === e ? !0 : s ? me(e) === e : !0 : !1;
|
|
470
470
|
return U.set(n, i), i;
|
|
471
471
|
}
|
|
472
|
-
const
|
|
473
|
-
chainId:
|
|
472
|
+
const v = {
|
|
473
|
+
chainId: Q.chainId,
|
|
474
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:
|
|
480
|
+
}, C = {
|
|
481
|
+
chainId: G.chainId,
|
|
482
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:
|
|
488
|
+
}, T = {
|
|
489
|
+
chainId: se.chainId,
|
|
490
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:
|
|
496
|
+
}, D = {
|
|
497
|
+
chainId: te.chainId,
|
|
498
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:
|
|
504
|
+
}, x = {
|
|
505
|
+
chainId: J.chainId,
|
|
506
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:
|
|
512
|
+
}, k = {
|
|
513
|
+
chainId: W.chainId,
|
|
514
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:
|
|
520
|
+
}, R = {
|
|
521
|
+
chainId: Y.chainId,
|
|
522
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:
|
|
527
|
+
}, N = {
|
|
528
|
+
chainId: ee.chainId,
|
|
529
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:
|
|
534
|
+
}, B = {
|
|
535
|
+
chainId: Z.chainId,
|
|
536
536
|
address: p("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
|
|
537
537
|
symbol: "USDC",
|
|
538
538
|
decimals: 6,
|
|
539
539
|
logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
|
|
540
540
|
logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
|
|
541
541
|
}, rt = {
|
|
542
|
-
chainId:
|
|
542
|
+
chainId: ne.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
|
+
}, at = {
|
|
549
|
+
[v.chainId]: v,
|
|
550
|
+
[C.chainId]: C,
|
|
551
|
+
[T.chainId]: T,
|
|
552
|
+
[D.chainId]: D,
|
|
553
|
+
[x.chainId]: x,
|
|
554
|
+
[k.chainId]: k,
|
|
555
|
+
[N.chainId]: N,
|
|
556
|
+
[B.chainId]: B,
|
|
557
|
+
[R.chainId]: R
|
|
558
|
+
}, $ = {
|
|
549
559
|
ARBITRUM_MAINNET: {
|
|
550
|
-
...
|
|
560
|
+
...G,
|
|
551
561
|
tokens: {
|
|
552
|
-
[h.USDC]:
|
|
562
|
+
[h.USDC]: C
|
|
553
563
|
},
|
|
554
564
|
explorer: "https://arbiscan.io"
|
|
555
565
|
},
|
|
556
566
|
ARBITRUM_TESTNET: {
|
|
557
|
-
...
|
|
567
|
+
...Q,
|
|
558
568
|
explorer: "https://sepolia.arbiscan.io",
|
|
559
569
|
tokens: {
|
|
560
|
-
[h.USDC]:
|
|
570
|
+
[h.USDC]: v
|
|
561
571
|
}
|
|
562
572
|
},
|
|
563
573
|
AVALANCHE_MAINNET: {
|
|
564
|
-
...
|
|
574
|
+
...te,
|
|
565
575
|
tokens: {
|
|
566
|
-
[h.USDC]:
|
|
576
|
+
[h.USDC]: D
|
|
567
577
|
},
|
|
568
578
|
explorer: "https://snowtrace.io"
|
|
569
579
|
},
|
|
570
580
|
AVALANCHE_TESTNET: {
|
|
571
|
-
...
|
|
581
|
+
...se,
|
|
572
582
|
tokens: {
|
|
573
|
-
[h.USDC]:
|
|
583
|
+
[h.USDC]: T
|
|
574
584
|
},
|
|
575
585
|
explorer: "https://testnet.snowtrace.io"
|
|
576
586
|
},
|
|
577
587
|
BASE_MAINNET: {
|
|
578
|
-
...
|
|
588
|
+
...W,
|
|
579
589
|
tokens: {
|
|
580
|
-
[h.USDC]:
|
|
590
|
+
[h.USDC]: k
|
|
581
591
|
},
|
|
582
592
|
explorer: "https://basescan.org"
|
|
583
593
|
},
|
|
584
594
|
BASE_TESTNET: {
|
|
585
|
-
...
|
|
595
|
+
...J,
|
|
586
596
|
tokens: {
|
|
587
|
-
[h.USDC]:
|
|
597
|
+
[h.USDC]: x
|
|
588
598
|
},
|
|
589
599
|
explorer: "https://sepolia.basescan.org"
|
|
590
600
|
},
|
|
591
601
|
BSC_MAINNET: {
|
|
592
|
-
...
|
|
602
|
+
...Y,
|
|
593
603
|
tokens: {
|
|
594
|
-
[h.USDC]:
|
|
604
|
+
[h.USDC]: R
|
|
595
605
|
},
|
|
596
606
|
explorer: "https://bscscan.com"
|
|
597
607
|
},
|
|
598
608
|
ETHEREUM_MAINNET: {
|
|
599
|
-
...
|
|
609
|
+
...Z,
|
|
600
610
|
tokens: {
|
|
601
|
-
[h.USDC]:
|
|
611
|
+
[h.USDC]: B
|
|
602
612
|
},
|
|
603
613
|
explorer: "https://etherscan.io"
|
|
604
614
|
},
|
|
605
615
|
ETHEREUM_TESTNET: {
|
|
606
|
-
...
|
|
616
|
+
...ee,
|
|
607
617
|
tokens: {
|
|
608
|
-
[h.USDC]:
|
|
618
|
+
[h.USDC]: N
|
|
609
619
|
},
|
|
610
620
|
explorer: "https://sepolia.etherscan.io"
|
|
611
621
|
},
|
|
612
622
|
STARKNET_MAINNET: {
|
|
613
|
-
...
|
|
623
|
+
...ne,
|
|
614
624
|
tokens: {
|
|
615
625
|
[h.USDC]: rt
|
|
616
626
|
},
|
|
617
627
|
explorer: ""
|
|
618
628
|
}
|
|
619
629
|
};
|
|
620
|
-
var
|
|
621
|
-
|
|
630
|
+
var z = /* @__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))(z || {}), ye = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(ye || {});
|
|
631
|
+
function It(e) {
|
|
632
|
+
return at[$[e || ""].chainId]?.decimals || 6;
|
|
633
|
+
}
|
|
634
|
+
const ct = (e) => {
|
|
622
635
|
const t = e?.trim().toUpperCase();
|
|
623
|
-
if (
|
|
624
|
-
return
|
|
636
|
+
if ($[t])
|
|
637
|
+
return $[t];
|
|
625
638
|
};
|
|
626
|
-
function
|
|
627
|
-
return
|
|
639
|
+
function ut(e, t) {
|
|
640
|
+
return ct(e)?.tokens[t]?.address;
|
|
628
641
|
}
|
|
629
|
-
var
|
|
642
|
+
var Ie = /* @__PURE__ */ ((e) => (e.PRODUCTION = "production", e.STAGING = "staging", e))(Ie || {});
|
|
630
643
|
class c {
|
|
631
644
|
constructor({ api_key: t, env: s, seesion_token: n }) {
|
|
632
|
-
this.api_key = t || "", this.sessionToken = n || "", this.env = s ??
|
|
645
|
+
this.api_key = t || "", this.sessionToken = n || "", this.env = s ?? Ie.PRODUCTION;
|
|
633
646
|
}
|
|
634
647
|
static async config(t) {
|
|
635
648
|
if (!c.app) {
|
|
@@ -675,9 +688,9 @@ class c {
|
|
|
675
688
|
return r + o + a;
|
|
676
689
|
}
|
|
677
690
|
}
|
|
678
|
-
let
|
|
679
|
-
function
|
|
680
|
-
|
|
691
|
+
let M = null;
|
|
692
|
+
function lt() {
|
|
693
|
+
M = Ee.create({
|
|
681
694
|
prefixUrl: c.getBaseUrl(),
|
|
682
695
|
headers: {
|
|
683
696
|
"Content-Type": "application/json"
|
|
@@ -697,9 +710,9 @@ function ut() {
|
|
|
697
710
|
});
|
|
698
711
|
}
|
|
699
712
|
function u() {
|
|
700
|
-
return
|
|
713
|
+
return M || lt(), M;
|
|
701
714
|
}
|
|
702
|
-
class
|
|
715
|
+
class ht {
|
|
703
716
|
async getById(t) {
|
|
704
717
|
return await u().get("intents/" + t).json();
|
|
705
718
|
}
|
|
@@ -731,7 +744,7 @@ class lt {
|
|
|
731
744
|
return await u().post(`modal/sessions/intents/${t}/process`).json();
|
|
732
745
|
}
|
|
733
746
|
}
|
|
734
|
-
class
|
|
747
|
+
class dt {
|
|
735
748
|
async getFromSpecificBridge(t) {
|
|
736
749
|
return await u().get("quotes/single", { searchParams: t }).json();
|
|
737
750
|
}
|
|
@@ -748,7 +761,7 @@ class ht {
|
|
|
748
761
|
return await u().get("modal/sessions/quotes", { searchParams: t }).json();
|
|
749
762
|
}
|
|
750
763
|
}
|
|
751
|
-
class
|
|
764
|
+
class pt {
|
|
752
765
|
async getOptimalRoutes(t) {
|
|
753
766
|
return await u().get("router/optimal-route", { searchParams: t }).json();
|
|
754
767
|
}
|
|
@@ -762,42 +775,43 @@ class dt {
|
|
|
762
775
|
return await u().get("router/supported-bridges/bridge/" + t, { searchParams: s }).json();
|
|
763
776
|
}
|
|
764
777
|
}
|
|
765
|
-
class
|
|
778
|
+
class gt {
|
|
766
779
|
async getSupported(t) {
|
|
767
780
|
return await u().get("chains", { searchParams: t }).json();
|
|
768
781
|
}
|
|
769
782
|
}
|
|
770
|
-
class
|
|
783
|
+
class ft {
|
|
771
784
|
async getClientInfo() {
|
|
772
785
|
return await u().get("client/auth/client-info").json();
|
|
773
786
|
}
|
|
774
787
|
}
|
|
775
|
-
class
|
|
788
|
+
class mt {
|
|
776
789
|
getSessionToken(t) {
|
|
777
790
|
const s = {
|
|
778
791
|
recipient: t.recipient,
|
|
779
|
-
tokenOut:
|
|
780
|
-
|
|
781
|
-
|
|
792
|
+
tokenOut: ut(
|
|
793
|
+
z[t.destinationChain],
|
|
794
|
+
ye[t.token]
|
|
782
795
|
),
|
|
783
|
-
destinationChain:
|
|
796
|
+
destinationChain: z[t.destinationChain],
|
|
784
797
|
amount: t.amount
|
|
785
798
|
};
|
|
786
799
|
return u().post("modal/sessions", { json: s }).json();
|
|
787
800
|
}
|
|
788
801
|
}
|
|
789
|
-
const
|
|
790
|
-
router: new
|
|
791
|
-
quotes: new
|
|
792
|
-
intents: new
|
|
793
|
-
chains: new
|
|
794
|
-
client: new
|
|
795
|
-
auth: new
|
|
802
|
+
const bt = {
|
|
803
|
+
router: new pt(),
|
|
804
|
+
quotes: new dt(),
|
|
805
|
+
intents: new ht(),
|
|
806
|
+
chains: new gt(),
|
|
807
|
+
client: new ft(),
|
|
808
|
+
auth: new mt()
|
|
796
809
|
};
|
|
797
810
|
export {
|
|
798
811
|
c as Chainrails,
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
812
|
+
z as chains,
|
|
813
|
+
bt as crapi,
|
|
814
|
+
Ie as environment,
|
|
815
|
+
It as getTokenDecimals,
|
|
816
|
+
ye as tokens
|
|
803
817
|
};
|