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