@chainrails/common 0.0.24 → 0.0.26

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,59 +1,59 @@
1
1
  var l = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(l || {});
2
- const O = {
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
- }, z = {
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
- }, L = {
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
- }, H = {
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
- }, P = {
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
- }, F = {
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
- }, j = {
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
- }, K = {
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
- }, V = {
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 T(e, { strict: t = !0 } = {}) {
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 D(e) {
68
- return T(e, { strict: !1 }) ? Math.ceil((e.length - 2) / 2) : e.length;
67
+ function _(e) {
68
+ return $(e, { strict: !1 }) ? Math.ceil((e.length - 2) / 2) : e.length;
69
69
  }
70
- const X = "2.43.4";
71
- let S = {
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@${X}`
73
+ version: `viem@${te}`
74
74
  };
75
- class d extends Error {
75
+ class f extends Error {
76
76
  constructor(t, n = {}) {
77
- const s = n.cause instanceof d ? n.cause.details : n.cause?.message ? n.cause.message : n.details, o = n.cause instanceof d && n.cause.docsPath || n.docsPath, r = S.getDocsUrl?.({ ...n, docsPath: o }), i = [
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
- ...S.version ? [`Version: ${S.version}`] : []
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 = X;
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 G(this, t);
119
+ return ne(this, t);
120
120
  }
121
121
  }
122
- function G(e, t) {
123
- return t?.(e) ? e : e && typeof e == "object" && "cause" in e && e.cause !== void 0 ? G(e.cause, t) : t ? null : e;
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 q extends d {
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 y(e, { dir: t, size: n = 32 } = {}) {
131
- return typeof e == "string" ? ae(e, { dir: t, size: n }) : ue(e, { dir: t, size: n });
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 ae(e, { dir: t, size: n = 32 } = {}) {
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 q({
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 ue(e, { dir: t, size: n = 32 } = {}) {
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 q({
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 le extends d {
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 fe extends d {
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 x(e, { size: t }) {
172
- if (D(e) > t)
173
- throw new fe({
174
- givenSize: D(e),
171
+ function M(e, { size: t }) {
172
+ if (_(e) > t)
173
+ throw new Se({
174
+ givenSize: _(e),
175
175
  maxSize: t
176
176
  });
177
177
  }
178
- function he(e, t = {}) {
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 le({
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 ? y(c, { size: s }) : c;
194
+ return s ? S(c, { size: s }) : c;
195
195
  }
196
- const de = /* @__PURE__ */ new TextEncoder();
197
- function pe(e, t = {}) {
198
- return typeof e == "number" || typeof e == "bigint" ? me(e, t) : typeof e == "boolean" ? ge(e, t) : T(e) ? W(e, t) : J(e, t);
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 ge(e, t = {}) {
200
+ function Te(e, t = {}) {
201
201
  const n = new Uint8Array(1);
202
- return n[0] = Number(e), typeof t.size == "number" ? (x(n, { size: t.size }), y(n, { size: t.size })) : n;
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 f = {
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 C(e) {
213
- if (e >= f.zero && e <= f.nine)
214
- return e - f.zero;
215
- if (e >= f.A && e <= f.F)
216
- return e - (f.A - 10);
217
- if (e >= f.a && e <= f.f)
218
- return e - (f.a - 10);
219
- }
220
- function W(e, t = {}) {
212
+ function z(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 && (x(n, { size: t.size }), n = y(n, { dir: "right", size: 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 = C(s.charCodeAt(c++)), p = C(s.charCodeAt(c++));
227
+ const u = z(s.charCodeAt(c++)), p = z(s.charCodeAt(c++));
228
228
  if (u === void 0 || p === void 0)
229
- throw new d(`Invalid byte sequence ("${s[c - 2]}${s[c - 1]}" in "${s}").`);
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 me(e, t) {
235
- const n = he(e, t);
236
- return W(n);
234
+ function xe(e, t) {
235
+ const n = ye(e, t);
236
+ return oe(n);
237
237
  }
238
- function J(e, t = {}) {
239
- const n = de.encode(e);
240
- return typeof t.size == "number" ? (x(n, { size: t.size }), y(n, { dir: "right", size: t.size })) : n;
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 E = /* @__PURE__ */ BigInt(2 ** 32 - 1), v = /* @__PURE__ */ BigInt(32);
243
- function be(e, t = !1) {
244
- return t ? { h: Number(e & E), l: Number(e >> v & E) } : { h: Number(e >> v & E) | 0, l: Number(e & E) | 0 };
242
+ const I = /* @__PURE__ */ BigInt(2 ** 32 - 1), L = /* @__PURE__ */ BigInt(32);
243
+ function we(e, t = !1) {
244
+ return t ? { h: Number(e & I), l: Number(e >> L & I) } : { h: Number(e >> L & I) | 0, l: Number(e & I) | 0 };
245
245
  }
246
- function Ee(e, t = !1) {
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 } = be(e[r], t);
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 Ie = (e, t, n) => e << n | t >>> 32 - n, ye = (e, t, n) => t << n | e >>> 32 - n, Se = (e, t, n) => t << n - 32 | e >>> 64 - n, Ae = (e, t, n) => e << n - 32 | t >>> 64 - n;
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 Ue(e) {
257
+ function Ne(e) {
258
258
  return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
259
259
  }
260
- function B(e) {
260
+ function H(e) {
261
261
  if (!Number.isSafeInteger(e) || e < 0)
262
262
  throw new Error("positive integer expected, got " + e);
263
263
  }
264
- function I(e, ...t) {
265
- if (!Ue(e))
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 k(e, t = !0) {
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 Te(e, t) {
277
- I(e);
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 xe(e) {
282
+ function $e(e) {
283
283
  return new Uint32Array(e.buffer, e.byteOffset, Math.floor(e.byteLength / 4));
284
284
  }
285
- function Q(...e) {
285
+ function re(...e) {
286
286
  for (let t = 0; t < e.length; t++)
287
287
  e[t].fill(0);
288
288
  }
289
- const we = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
290
- function De(e) {
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 Ce(e) {
293
+ function _e(e) {
294
294
  for (let t = 0; t < e.length; t++)
295
- e[t] = De(e[t]);
295
+ e[t] = Oe(e[t]);
296
296
  return e;
297
297
  }
298
- const R = we ? (e) => e : Ce;
299
- function ve(e) {
298
+ const F = Me ? (e) => e : _e;
299
+ function ze(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 Y(e) {
305
- return typeof e == "string" && (e = ve(e)), I(e), e;
304
+ function ce(e) {
305
+ return typeof e == "string" && (e = ze(e)), E(e), e;
306
306
  }
307
- class Be {
307
+ class Le {
308
308
  }
309
- function ke(e) {
310
- const t = (s) => e().update(Y(s)).digest(), n = e();
309
+ function He(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 Re = BigInt(0), m = BigInt(1), Ne = BigInt(2), $e = BigInt(7), Me = BigInt(256), Oe = BigInt(113), Z = [], ee = [], te = [];
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], Z.push(2 * (5 * s + n)), ee.push((e + 1) * (e + 2) / 2 % 64);
316
- let o = Re;
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 >> $e) * Oe) % Me, t & Ne && (o ^= m << (m << /* @__PURE__ */ BigInt(r)) - m);
319
- te.push(o);
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 ne = Ee(te, !0), _e = ne[0], ze = ne[1], N = (e, t, n) => n > 32 ? Se(e, t, n) : Ie(e, t, n), $ = (e, t, n) => n > 32 ? Ae(e, t, n) : ye(e, t, n);
322
- function Le(e, t = 24) {
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], re = N(p, g, 1) ^ n[c], ce = $(p, g, 1) ^ n[c + 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] ^= re, e[i + b + 1] ^= ce;
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 = ee[i], u = N(o, r, c), p = $(o, r, c), g = Z[i];
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] ^= _e[s], e[1] ^= ze[s];
343
+ e[0] ^= Xe[s], e[1] ^= Ge[s];
344
344
  }
345
- Q(n);
345
+ re(n);
346
346
  }
347
- class w extends Be {
347
+ class O extends Le {
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, B(s), !(0 < t && t < 200))
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, H(s), !(0 < t && t < 200))
351
351
  throw new Error("only keccak-f1600 function is supported");
352
- this.state = new Uint8Array(200), this.state32 = xe(this.state);
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
- R(this.state32), Le(this.state32, this.rounds), R(this.state32), this.posOut = 0, this.pos = 0;
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
- k(this), t = Y(t), I(t);
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
- k(this, !1), I(t), this.finish();
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 B(t), this.xofInto(new Uint8Array(t));
394
+ return H(t), this.xofInto(new Uint8Array(t));
395
395
  }
396
396
  digestInto(t) {
397
- if (Te(t, this), this.finished)
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, Q(this.state);
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 w(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;
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 He = (e, t, n) => ke(() => new w(t, e, n)), Pe = He(1, 136, 256 / 8);
413
- function Fe(e, t) {
414
- return Pe(T(e, { strict: !1 }) ? pe(e) : e);
412
+ const We = (e, t, n) => He(() => 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 je extends d {
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 se extends Map {
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 se(8192);
449
- function oe(e, t) {
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 = Fe(J(n)), o = n.split("");
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 h(e, t) {
459
- if (!Ve(e, { strict: !1 }))
460
- throw new je({ address: e });
461
- return oe(e, t);
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 Ke = /^0x[a-fA-F0-9]{40}$/, U = /* @__PURE__ */ new se(8192);
464
- function Ve(e, t) {
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 = Ke.test(e) ? e.toLowerCase() === e ? !0 : n ? oe(e) === e : !0 : !1;
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 Xe = {
472
- chainId: _.chainId,
473
- address: h("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),
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
- }, Ge = {
480
- chainId: O.chainId,
481
- address: h("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
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
- }, qe = {
488
- chainId: K.chainId,
489
- address: h("0x5425890298aed601595a70ab815c96711a31bc65"),
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
- }, We = {
496
- chainId: j.chainId,
497
- address: h("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),
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
- }, Je = {
504
- chainId: L.chainId,
505
- address: h("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),
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
- }, Qe = {
512
- chainId: z.chainId,
513
- address: h("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),
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
- }, Ye = {
520
- chainId: H.chainId,
521
- address: h("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),
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
- }, Ze = {
527
- chainId: F.chainId,
528
- address: h("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),
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
- }, et = {
534
- chainId: P.chainId,
535
- address: h("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
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: V.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
- }, M = {
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
- ...O,
559
+ ...V,
550
560
  tokens: {
551
- [l.USDC]: Ge
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]: Xe
569
+ [l.USDC]: T
560
570
  }
561
571
  },
562
572
  AVALANCHE_MAINNET: {
563
- ...j,
573
+ ...Y,
564
574
  tokens: {
565
- [l.USDC]: We
575
+ [l.USDC]: D
566
576
  },
567
577
  explorer: "https://snowtrace.io"
568
578
  },
569
579
  AVALANCHE_TESTNET: {
570
- ...K,
580
+ ...Z,
571
581
  tokens: {
572
- [l.USDC]: qe
582
+ [l.USDC]: w
573
583
  },
574
584
  explorer: "https://testnet.snowtrace.io"
575
585
  },
576
586
  BASE_MAINNET: {
577
- ...z,
587
+ ...G,
578
588
  tokens: {
579
- [l.USDC]: Qe
589
+ [l.USDC]: v
580
590
  },
581
591
  explorer: "https://basescan.org"
582
592
  },
583
593
  BASE_TESTNET: {
584
- ...L,
594
+ ...q,
585
595
  tokens: {
586
- [l.USDC]: Je
596
+ [l.USDC]: C
587
597
  },
588
598
  explorer: "https://sepolia.basescan.org"
589
599
  },
590
600
  BSC_MAINNET: {
591
- ...H,
601
+ ...W,
592
602
  tokens: {
593
- [l.USDC]: Ye
603
+ [l.USDC]: B
594
604
  },
595
605
  explorer: "https://bscscan.com"
596
606
  },
597
607
  ETHEREUM_MAINNET: {
598
- ...P,
608
+ ...J,
599
609
  tokens: {
600
- [l.USDC]: et
610
+ [l.USDC]: N
601
611
  },
602
612
  explorer: "https://etherscan.io"
603
613
  },
604
614
  ETHEREUM_TESTNET: {
605
- ...F,
615
+ ...Q,
606
616
  tokens: {
607
- [l.USDC]: Ze
617
+ [l.USDC]: k
608
618
  },
609
619
  explorer: "https://sepolia.etherscan.io"
610
620
  },
611
621
  STARKNET_MAINNET: {
612
- ...V,
622
+ ...ee,
613
623
  tokens: {
614
624
  [l.USDC]: tt
615
625
  },
616
626
  explorer: ""
617
627
  }
618
628
  };
619
- var nt = /* @__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))(nt || {}), st = /* @__PURE__ */ ((e) => (e.USDC = "USDC", e))(st || {});
620
- const ot = (e) => {
621
- const t = e.trim().toUpperCase();
622
- if (M[t])
623
- return M[t];
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) => {
634
+ const t = e?.trim().toUpperCase();
635
+ if (R[t])
636
+ return R[t];
624
637
  };
625
- function it(e, t) {
626
- return ot(e)?.tokens[t]?.address;
638
+ function ct(e, t) {
639
+ return it(e)?.tokens[t]?.address;
627
640
  }
628
- var ie = /* @__PURE__ */ ((e) => (e.PRODUCTION = "production", e.STAGING = "staging", e))(ie || {});
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 ?? ie.PRODUCTION;
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) {
@@ -676,10 +689,11 @@ class a {
676
689
  }
677
690
  export {
678
691
  a as Chainrails,
679
- M as allChains,
680
- nt as chains,
681
- ie as environment,
682
- ot as getChainByChainEnum,
683
- it as getTokenAddress,
684
- st as tokens
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
  };