@chainrails/sdk 0.2.9 → 0.2.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- import te from "ky";
1
+ import ne from "ky";
2
2
  const c = {
3
3
  ARBITRUM: "ARBITRUM_MAINNET",
4
4
  ARBITRUM_TESTNET: "ARBITRUM_TESTNET",
@@ -18,27 +18,46 @@ const c = {
18
18
  POLYGON: "POLYGON_MAINNET",
19
19
  STARKNET: "STARKNET_MAINNET",
20
20
  STARKNET_TESTNET: "STARKNET_TESTNET"
21
+ }, ss = {
22
+ ARBITRUM: "ARBITRUM",
23
+ ARBITRUM_TESTNET: "ARBITRUM_TESTNET",
24
+ AVALANCHE: "AVALANCHE",
25
+ AVALANCHE_TESTNET: "AVALANCHE_TESTNET",
26
+ BASE: "BASE",
27
+ BASE_TESTNET: "BASE_TESTNET",
28
+ BSC: "BSC",
29
+ ETHEREUM: "ETHEREUM",
30
+ ETHEREUM_TESTNET: "ETHEREUM_TESTNET",
31
+ HYPEREVM: "HYPEREVM",
32
+ LISK: "LISK",
33
+ MONAD: "MONAD",
34
+ MONAD_TESTNET: "MONAD_TESTNET",
35
+ OPTIMISM: "OPTIMISM",
36
+ OPTIMISM_TESTNET: "OPTIMISM_TESTNET",
37
+ POLYGON: "POLYGON",
38
+ STARKNET: "STARKNET",
39
+ STARKNET_TESTNET: "STARKNET_TESTNET"
21
40
  };
22
- function B(s, { strict: e = !0 } = {}) {
41
+ function N(s, { strict: e = !0 } = {}) {
23
42
  return !s || typeof s != "string" ? !1 : e ? /^0x[0-9a-fA-F]*$/.test(s) : s.startsWith("0x");
24
43
  }
25
- function M(s) {
26
- return B(s, { strict: !1 }) ? Math.ceil((s.length - 2) / 2) : s.length;
44
+ function v(s) {
45
+ return N(s, { strict: !1 }) ? Math.ceil((s.length - 2) / 2) : s.length;
27
46
  }
28
- const $ = "2.43.4";
29
- let C = {
47
+ const L = "2.43.4";
48
+ let I = {
30
49
  getDocsUrl: ({ docsBaseUrl: s, docsPath: e = "", docsSlug: t }) => e ? `${s ?? "https://viem.sh"}${e}${t ? `#${t}` : ""}` : void 0,
31
- version: `viem@${$}`
50
+ version: `viem@${L}`
32
51
  };
33
52
  class T extends Error {
34
53
  constructor(e, t = {}) {
35
- const o = t.cause instanceof T ? t.cause.details : t.cause?.message ? t.cause.message : t.details, a = t.cause instanceof T && t.cause.docsPath || t.docsPath, r = C.getDocsUrl?.({ ...t, docsPath: a }), i = [
54
+ const a = t.cause instanceof T ? t.cause.details : t.cause?.message ? t.cause.message : t.details, o = t.cause instanceof T && t.cause.docsPath || t.docsPath, r = I.getDocsUrl?.({ ...t, docsPath: o }), i = [
36
55
  e || "An error occurred.",
37
56
  "",
38
57
  ...t.metaMessages ? [...t.metaMessages, ""] : [],
39
58
  ...r ? [`Docs: ${r}`] : [],
40
- ...o ? [`Details: ${o}`] : [],
41
- ...C.version ? [`Version: ${C.version}`] : []
59
+ ...a ? [`Details: ${a}`] : [],
60
+ ...I.version ? [`Version: ${I.version}`] : []
42
61
  ].join(`
43
62
  `);
44
63
  super(i, t.cause ? { cause: t.cause } : void 0), Object.defineProperty(this, "details", {
@@ -71,95 +90,95 @@ class T extends Error {
71
90
  configurable: !0,
72
91
  writable: !0,
73
92
  value: "BaseError"
74
- }), this.details = o, this.docsPath = a, this.metaMessages = t.metaMessages, this.name = t.name ?? this.name, this.shortMessage = e, this.version = $;
93
+ }), this.details = a, this.docsPath = o, this.metaMessages = t.metaMessages, this.name = t.name ?? this.name, this.shortMessage = e, this.version = L;
75
94
  }
76
95
  walk(e) {
77
- return z(this, e);
96
+ return _(this, e);
78
97
  }
79
98
  }
80
- function z(s, e) {
81
- return e?.(s) ? s : s && typeof s == "object" && "cause" in s && s.cause !== void 0 ? z(s.cause, e) : e ? null : s;
99
+ function _(s, e) {
100
+ return e?.(s) ? s : s && typeof s == "object" && "cause" in s && s.cause !== void 0 ? _(s.cause, e) : e ? null : s;
82
101
  }
83
- class L extends T {
84
- constructor({ size: e, targetSize: t, type: o }) {
85
- super(`${o.charAt(0).toUpperCase()}${o.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`, { name: "SizeExceedsPaddingSizeError" });
102
+ class j extends T {
103
+ constructor({ size: e, targetSize: t, type: a }) {
104
+ super(`${a.charAt(0).toUpperCase()}${a.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`, { name: "SizeExceedsPaddingSizeError" });
86
105
  }
87
106
  }
88
- function D(s, { dir: e, size: t = 32 } = {}) {
89
- return typeof s == "string" ? ne(s, { dir: e, size: t }) : oe(s, { dir: e, size: t });
107
+ function U(s, { dir: e, size: t = 32 } = {}) {
108
+ return typeof s == "string" ? ae(s, { dir: e, size: t }) : oe(s, { dir: e, size: t });
90
109
  }
91
- function ne(s, { dir: e, size: t = 32 } = {}) {
110
+ function ae(s, { dir: e, size: t = 32 } = {}) {
92
111
  if (t === null)
93
112
  return s;
94
- const o = s.replace("0x", "");
95
- if (o.length > t * 2)
96
- throw new L({
97
- size: Math.ceil(o.length / 2),
113
+ const a = s.replace("0x", "");
114
+ if (a.length > t * 2)
115
+ throw new j({
116
+ size: Math.ceil(a.length / 2),
98
117
  targetSize: t,
99
118
  type: "hex"
100
119
  });
101
- return `0x${o[e === "right" ? "padEnd" : "padStart"](t * 2, "0")}`;
120
+ return `0x${a[e === "right" ? "padEnd" : "padStart"](t * 2, "0")}`;
102
121
  }
103
122
  function oe(s, { dir: e, size: t = 32 } = {}) {
104
123
  if (t === null)
105
124
  return s;
106
125
  if (s.length > t)
107
- throw new L({
126
+ throw new j({
108
127
  size: s.length,
109
128
  targetSize: t,
110
129
  type: "bytes"
111
130
  });
112
- const o = new Uint8Array(t);
113
- for (let a = 0; a < t; a++) {
131
+ const a = new Uint8Array(t);
132
+ for (let o = 0; o < t; o++) {
114
133
  const r = e === "right";
115
- o[r ? a : t - a - 1] = s[r ? a : s.length - a - 1];
134
+ a[r ? o : t - o - 1] = s[r ? o : s.length - o - 1];
116
135
  }
117
- return o;
136
+ return a;
118
137
  }
119
- class ae extends T {
120
- constructor({ max: e, min: t, signed: o, size: a, value: r }) {
121
- super(`Number "${r}" is not in safe ${a ? `${a * 8}-bit ${o ? "signed" : "unsigned"} ` : ""}integer range ${e ? `(${t} to ${e})` : `(above ${t})`}`, { name: "IntegerOutOfRangeError" });
138
+ class ie extends T {
139
+ constructor({ max: e, min: t, signed: a, size: o, value: r }) {
140
+ super(`Number "${r}" is not in safe ${o ? `${o * 8}-bit ${a ? "signed" : "unsigned"} ` : ""}integer range ${e ? `(${t} to ${e})` : `(above ${t})`}`, { name: "IntegerOutOfRangeError" });
122
141
  }
123
142
  }
124
- class ie extends T {
143
+ class re extends T {
125
144
  constructor({ givenSize: e, maxSize: t }) {
126
145
  super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`, { name: "SizeOverflowError" });
127
146
  }
128
147
  }
129
- function w(s, { size: e }) {
130
- if (M(s) > e)
131
- throw new ie({
132
- givenSize: M(s),
148
+ function k(s, { size: e }) {
149
+ if (v(s) > e)
150
+ throw new re({
151
+ givenSize: v(s),
133
152
  maxSize: e
134
153
  });
135
154
  }
136
- function re(s, e = {}) {
137
- const { signed: t, size: o } = e, a = BigInt(s);
155
+ function ce(s, e = {}) {
156
+ const { signed: t, size: a } = e, o = BigInt(s);
138
157
  let r;
139
- o ? t ? r = (1n << BigInt(o) * 8n - 1n) - 1n : r = 2n ** (BigInt(o) * 8n) - 1n : typeof s == "number" && (r = BigInt(Number.MAX_SAFE_INTEGER));
158
+ a ? t ? r = (1n << BigInt(a) * 8n - 1n) - 1n : r = 2n ** (BigInt(a) * 8n) - 1n : typeof s == "number" && (r = BigInt(Number.MAX_SAFE_INTEGER));
140
159
  const i = typeof r == "bigint" && t ? -r - 1n : 0;
141
- if (r && a > r || a < i) {
142
- const m = typeof s == "bigint" ? "n" : "";
143
- throw new ae({
144
- max: r ? `${r}${m}` : void 0,
145
- min: `${i}${m}`,
160
+ if (r && o > r || o < i) {
161
+ const E = typeof s == "bigint" ? "n" : "";
162
+ throw new ie({
163
+ max: r ? `${r}${E}` : void 0,
164
+ min: `${i}${E}`,
146
165
  signed: t,
147
- size: o,
148
- value: `${s}${m}`
166
+ size: a,
167
+ value: `${s}${E}`
149
168
  });
150
169
  }
151
- const l = `0x${(t && a < 0 ? (1n << BigInt(o * 8)) + BigInt(a) : a).toString(16)}`;
152
- return o ? D(l, { size: o }) : l;
153
- }
154
- const ce = /* @__PURE__ */ new TextEncoder();
155
- function de(s, e = {}) {
156
- return typeof s == "number" || typeof s == "bigint" ? ue(s, e) : typeof s == "boolean" ? le(s, e) : B(s) ? j(s, e) : K(s, e);
170
+ const d = `0x${(t && o < 0 ? (1n << BigInt(a * 8)) + BigInt(o) : o).toString(16)}`;
171
+ return a ? U(d, { size: a }) : d;
157
172
  }
173
+ const de = /* @__PURE__ */ new TextEncoder();
158
174
  function le(s, e = {}) {
175
+ return typeof s == "number" || typeof s == "bigint" ? ge(s, e) : typeof s == "boolean" ? ue(s, e) : N(s) ? K(s, e) : W(s, e);
176
+ }
177
+ function ue(s, e = {}) {
159
178
  const t = new Uint8Array(1);
160
- return t[0] = Number(s), typeof e.size == "number" ? (w(t, { size: e.size }), D(t, { size: e.size })) : t;
179
+ return t[0] = Number(s), typeof e.size == "number" ? (k(t, { size: e.size }), U(t, { size: e.size })) : t;
161
180
  }
162
- const h = {
181
+ const f = {
163
182
  zero: 48,
164
183
  nine: 57,
165
184
  A: 65,
@@ -167,72 +186,72 @@ const h = {
167
186
  a: 97,
168
187
  f: 102
169
188
  };
170
- function x(s) {
171
- if (s >= h.zero && s <= h.nine)
172
- return s - h.zero;
173
- if (s >= h.A && s <= h.F)
174
- return s - (h.A - 10);
175
- if (s >= h.a && s <= h.f)
176
- return s - (h.a - 10);
189
+ function M(s) {
190
+ if (s >= f.zero && s <= f.nine)
191
+ return s - f.zero;
192
+ if (s >= f.A && s <= f.F)
193
+ return s - (f.A - 10);
194
+ if (s >= f.a && s <= f.f)
195
+ return s - (f.a - 10);
177
196
  }
178
- function j(s, e = {}) {
197
+ function K(s, e = {}) {
179
198
  let t = s;
180
- e.size && (w(t, { size: e.size }), t = D(t, { dir: "right", size: e.size }));
181
- let o = t.slice(2);
182
- o.length % 2 && (o = `0${o}`);
183
- const a = o.length / 2, r = new Uint8Array(a);
184
- for (let i = 0, l = 0; i < a; i++) {
185
- const m = x(o.charCodeAt(l++)), f = x(o.charCodeAt(l++));
186
- if (m === void 0 || f === void 0)
187
- throw new T(`Invalid byte sequence ("${o[l - 2]}${o[l - 1]}" in "${o}").`);
188
- r[i] = m * 16 + f;
199
+ e.size && (k(t, { size: e.size }), t = U(t, { dir: "right", size: e.size }));
200
+ let a = t.slice(2);
201
+ a.length % 2 && (a = `0${a}`);
202
+ const o = a.length / 2, r = new Uint8Array(o);
203
+ for (let i = 0, d = 0; i < o; i++) {
204
+ const E = M(a.charCodeAt(d++)), S = M(a.charCodeAt(d++));
205
+ if (E === void 0 || S === void 0)
206
+ throw new T(`Invalid byte sequence ("${a[d - 2]}${a[d - 1]}" in "${a}").`);
207
+ r[i] = E * 16 + S;
189
208
  }
190
209
  return r;
191
210
  }
192
- function ue(s, e) {
193
- const t = re(s, e);
194
- return j(t);
211
+ function ge(s, e) {
212
+ const t = ce(s, e);
213
+ return K(t);
195
214
  }
196
- function K(s, e = {}) {
197
- const t = ce.encode(s);
198
- return typeof e.size == "number" ? (w(t, { size: e.size }), D(t, { dir: "right", size: e.size })) : t;
215
+ function W(s, e = {}) {
216
+ const t = de.encode(s);
217
+ return typeof e.size == "number" ? (k(t, { size: e.size }), U(t, { dir: "right", size: e.size })) : t;
199
218
  }
200
- const A = /* @__PURE__ */ BigInt(2 ** 32 - 1), v = /* @__PURE__ */ BigInt(32);
201
- function ge(s, e = !1) {
202
- return e ? { h: Number(s & A), l: Number(s >> v & A) } : { h: Number(s >> v & A) | 0, l: Number(s & A) | 0 };
219
+ const A = /* @__PURE__ */ BigInt(2 ** 32 - 1), O = /* @__PURE__ */ BigInt(32);
220
+ function he(s, e = !1) {
221
+ return e ? { h: Number(s & A), l: Number(s >> O & A) } : { h: Number(s >> O & A) | 0, l: Number(s & A) | 0 };
203
222
  }
204
- function Ee(s, e = !1) {
223
+ function me(s, e = !1) {
205
224
  const t = s.length;
206
- let o = new Uint32Array(t), a = new Uint32Array(t);
225
+ let a = new Uint32Array(t), o = new Uint32Array(t);
207
226
  for (let r = 0; r < t; r++) {
208
- const { h: i, l } = ge(s[r], e);
209
- [o[r], a[r]] = [i, l];
227
+ const { h: i, l: d } = he(s[r], e);
228
+ [a[r], o[r]] = [i, d];
210
229
  }
211
- return [o, a];
230
+ return [a, o];
212
231
  }
213
- const me = (s, e, t) => s << t | e >>> 32 - t, he = (s, e, t) => e << t | s >>> 32 - t, Te = (s, e, t) => e << t - 32 | s >>> 64 - t, fe = (s, e, t) => s << t - 32 | e >>> 64 - t;
232
+ const Ee = (s, e, t) => s << t | e >>> 32 - t, fe = (s, e, t) => e << t | s >>> 32 - t, Te = (s, e, t) => e << t - 32 | s >>> 64 - t, Se = (s, e, t) => s << t - 32 | e >>> 64 - t;
214
233
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
215
- function Se(s) {
234
+ function pe(s) {
216
235
  return s instanceof Uint8Array || ArrayBuffer.isView(s) && s.constructor.name === "Uint8Array";
217
236
  }
218
- function O(s) {
237
+ function F(s) {
219
238
  if (!Number.isSafeInteger(s) || s < 0)
220
239
  throw new Error("positive integer expected, got " + s);
221
240
  }
222
- function U(s, ...e) {
223
- if (!Se(s))
241
+ function D(s, ...e) {
242
+ if (!pe(s))
224
243
  throw new Error("Uint8Array expected");
225
244
  if (e.length > 0 && !e.includes(s.length))
226
245
  throw new Error("Uint8Array expected of length " + e + ", got length=" + s.length);
227
246
  }
228
- function F(s, e = !0) {
247
+ function H(s, e = !0) {
229
248
  if (s.destroyed)
230
249
  throw new Error("Hash instance has been destroyed");
231
250
  if (e && s.finished)
232
251
  throw new Error("Hash#digest() has already been called");
233
252
  }
234
- function pe(s, e) {
235
- U(s);
253
+ function Ce(s, e) {
254
+ D(s);
236
255
  const t = e.outputLen;
237
256
  if (s.length < t)
238
257
  throw new Error("digestInto() expects output buffer of length at least " + t);
@@ -240,72 +259,72 @@ function pe(s, e) {
240
259
  function be(s) {
241
260
  return new Uint32Array(s.buffer, s.byteOffset, Math.floor(s.byteLength / 4));
242
261
  }
243
- function W(...s) {
262
+ function V(...s) {
244
263
  for (let e = 0; e < s.length; e++)
245
264
  s[e].fill(0);
246
265
  }
247
266
  const Ae = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
248
- function Ue(s) {
267
+ function De(s) {
249
268
  return s << 24 & 4278190080 | s << 8 & 16711680 | s >>> 8 & 65280 | s >>> 24 & 255;
250
269
  }
251
- function De(s) {
270
+ function Ue(s) {
252
271
  for (let e = 0; e < s.length; e++)
253
- s[e] = Ue(s[e]);
272
+ s[e] = De(s[e]);
254
273
  return s;
255
274
  }
256
- const H = Ae ? (s) => s : De;
257
- function Ce(s) {
275
+ const P = Ae ? (s) => s : Ue;
276
+ function Ie(s) {
258
277
  if (typeof s != "string")
259
278
  throw new Error("string expected");
260
279
  return new Uint8Array(new TextEncoder().encode(s));
261
280
  }
262
- function V(s) {
263
- return typeof s == "string" && (s = Ce(s)), U(s), s;
281
+ function Y(s) {
282
+ return typeof s == "string" && (s = Ie(s)), D(s), s;
264
283
  }
265
- class Ie {
284
+ class ye {
266
285
  }
267
- function ye(s) {
268
- const e = (o) => s().update(V(o)).digest(), t = s();
286
+ function Re(s) {
287
+ const e = (a) => s().update(Y(a)).digest(), t = s();
269
288
  return e.outputLen = t.outputLen, e.blockLen = t.blockLen, e.create = () => s(), e;
270
289
  }
271
- const Ne = BigInt(0), p = BigInt(1), Re = BigInt(2), Be = BigInt(7), we = BigInt(256), ke = BigInt(113), Y = [], G = [], q = [];
272
- for (let s = 0, e = p, t = 1, o = 0; s < 24; s++) {
273
- [t, o] = [o, (2 * t + 3 * o) % 5], Y.push(2 * (5 * o + t)), G.push((s + 1) * (s + 2) / 2 % 64);
274
- let a = Ne;
290
+ const we = BigInt(0), C = BigInt(1), Be = BigInt(2), Ne = BigInt(7), ke = BigInt(256), xe = BigInt(113), G = [], q = [], X = [];
291
+ for (let s = 0, e = C, t = 1, a = 0; s < 24; s++) {
292
+ [t, a] = [a, (2 * t + 3 * a) % 5], G.push(2 * (5 * a + t)), q.push((s + 1) * (s + 2) / 2 % 64);
293
+ let o = we;
275
294
  for (let r = 0; r < 7; r++)
276
- e = (e << p ^ (e >> Be) * ke) % we, e & Re && (a ^= p << (p << /* @__PURE__ */ BigInt(r)) - p);
277
- q.push(a);
295
+ e = (e << C ^ (e >> Ne) * xe) % ke, e & Be && (o ^= C << (C << /* @__PURE__ */ BigInt(r)) - C);
296
+ X.push(o);
278
297
  }
279
- const X = Ee(q, !0), Me = X[0], xe = X[1], P = (s, e, t) => t > 32 ? Te(s, e, t) : me(s, e, t), _ = (s, e, t) => t > 32 ? fe(s, e, t) : he(s, e, t);
280
- function ve(s, e = 24) {
298
+ const Q = me(X, !0), ve = Q[0], Me = Q[1], $ = (s, e, t) => t > 32 ? Te(s, e, t) : Ee(s, e, t), z = (s, e, t) => t > 32 ? Se(s, e, t) : fe(s, e, t);
299
+ function Oe(s, e = 24) {
281
300
  const t = new Uint32Array(10);
282
- for (let o = 24 - e; o < 24; o++) {
301
+ for (let a = 24 - e; a < 24; a++) {
283
302
  for (let i = 0; i < 10; i++)
284
303
  t[i] = s[i] ^ s[i + 10] ^ s[i + 20] ^ s[i + 30] ^ s[i + 40];
285
304
  for (let i = 0; i < 10; i += 2) {
286
- const l = (i + 8) % 10, m = (i + 2) % 10, f = t[m], S = t[m + 1], ee = P(f, S, 1) ^ t[l], se = _(f, S, 1) ^ t[l + 1];
305
+ const d = (i + 8) % 10, E = (i + 2) % 10, S = t[E], p = t[E + 1], se = $(S, p, 1) ^ t[d], te = z(S, p, 1) ^ t[d + 1];
287
306
  for (let b = 0; b < 50; b += 10)
288
- s[i + b] ^= ee, s[i + b + 1] ^= se;
307
+ s[i + b] ^= se, s[i + b + 1] ^= te;
289
308
  }
290
- let a = s[2], r = s[3];
309
+ let o = s[2], r = s[3];
291
310
  for (let i = 0; i < 24; i++) {
292
- const l = G[i], m = P(a, r, l), f = _(a, r, l), S = Y[i];
293
- a = s[S], r = s[S + 1], s[S] = m, s[S + 1] = f;
311
+ const d = q[i], E = $(o, r, d), S = z(o, r, d), p = G[i];
312
+ o = s[p], r = s[p + 1], s[p] = E, s[p + 1] = S;
294
313
  }
295
314
  for (let i = 0; i < 50; i += 10) {
296
- for (let l = 0; l < 10; l++)
297
- t[l] = s[i + l];
298
- for (let l = 0; l < 10; l++)
299
- s[i + l] ^= ~t[(l + 2) % 10] & t[(l + 4) % 10];
315
+ for (let d = 0; d < 10; d++)
316
+ t[d] = s[i + d];
317
+ for (let d = 0; d < 10; d++)
318
+ s[i + d] ^= ~t[(d + 2) % 10] & t[(d + 4) % 10];
300
319
  }
301
- s[0] ^= Me[o], s[1] ^= xe[o];
320
+ s[0] ^= ve[a], s[1] ^= Me[a];
302
321
  }
303
- W(t);
322
+ V(t);
304
323
  }
305
- class k extends Ie {
324
+ class x extends ye {
306
325
  // NOTE: we accept arguments in bytes instead of bits here.
307
- constructor(e, t, o, a = !1, r = 24) {
308
- if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = e, this.suffix = t, this.outputLen = o, this.enableXOF = a, this.rounds = r, O(o), !(0 < e && e < 200))
326
+ constructor(e, t, a, o = !1, r = 24) {
327
+ if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = e, this.suffix = t, this.outputLen = a, this.enableXOF = o, this.rounds = r, F(a), !(0 < e && e < 200))
309
328
  throw new Error("only keccak-f1600 function is supported");
310
329
  this.state = new Uint8Array(200), this.state32 = be(this.state);
311
330
  }
@@ -313,15 +332,15 @@ class k extends Ie {
313
332
  return this._cloneInto();
314
333
  }
315
334
  keccak() {
316
- H(this.state32), ve(this.state32, this.rounds), H(this.state32), this.posOut = 0, this.pos = 0;
335
+ P(this.state32), Oe(this.state32, this.rounds), P(this.state32), this.posOut = 0, this.pos = 0;
317
336
  }
318
337
  update(e) {
319
- F(this), e = V(e), U(e);
320
- const { blockLen: t, state: o } = this, a = e.length;
321
- for (let r = 0; r < a; ) {
322
- const i = Math.min(t - this.pos, a - r);
323
- for (let l = 0; l < i; l++)
324
- o[this.pos++] ^= e[r++];
338
+ H(this), e = Y(e), D(e);
339
+ const { blockLen: t, state: a } = this, o = e.length;
340
+ for (let r = 0; r < o; ) {
341
+ const i = Math.min(t - this.pos, o - r);
342
+ for (let d = 0; d < i; d++)
343
+ a[this.pos++] ^= e[r++];
325
344
  this.pos === t && this.keccak();
326
345
  }
327
346
  return this;
@@ -330,16 +349,16 @@ class k extends Ie {
330
349
  if (this.finished)
331
350
  return;
332
351
  this.finished = !0;
333
- const { state: e, suffix: t, pos: o, blockLen: a } = this;
334
- e[o] ^= t, (t & 128) !== 0 && o === a - 1 && this.keccak(), e[a - 1] ^= 128, this.keccak();
352
+ const { state: e, suffix: t, pos: a, blockLen: o } = this;
353
+ e[a] ^= t, (t & 128) !== 0 && a === o - 1 && this.keccak(), e[o - 1] ^= 128, this.keccak();
335
354
  }
336
355
  writeInto(e) {
337
- F(this, !1), U(e), this.finish();
338
- const t = this.state, { blockLen: o } = this;
339
- for (let a = 0, r = e.length; a < r; ) {
340
- this.posOut >= o && this.keccak();
341
- const i = Math.min(o - this.posOut, r - a);
342
- e.set(t.subarray(this.posOut, this.posOut + i), a), this.posOut += i, a += i;
356
+ H(this, !1), D(e), this.finish();
357
+ const t = this.state, { blockLen: a } = this;
358
+ for (let o = 0, r = e.length; o < r; ) {
359
+ this.posOut >= a && this.keccak();
360
+ const i = Math.min(a - this.posOut, r - o);
361
+ e.set(t.subarray(this.posOut, this.posOut + i), o), this.posOut += i, o += i;
343
362
  }
344
363
  return e;
345
364
  }
@@ -349,10 +368,10 @@ class k extends Ie {
349
368
  return this.writeInto(e);
350
369
  }
351
370
  xof(e) {
352
- return O(e), this.xofInto(new Uint8Array(e));
371
+ return F(e), this.xofInto(new Uint8Array(e));
353
372
  }
354
373
  digestInto(e) {
355
- if (pe(e, this), this.finished)
374
+ if (Ce(e, this), this.finished)
356
375
  throw new Error("digest() was already called");
357
376
  return this.writeInto(e), this.destroy(), e;
358
377
  }
@@ -360,18 +379,18 @@ class k extends Ie {
360
379
  return this.digestInto(new Uint8Array(this.outputLen));
361
380
  }
362
381
  destroy() {
363
- this.destroyed = !0, W(this.state);
382
+ this.destroyed = !0, V(this.state);
364
383
  }
365
384
  _cloneInto(e) {
366
- const { blockLen: t, suffix: o, outputLen: a, rounds: r, enableXOF: i } = this;
367
- return e || (e = new k(t, o, a, i, r)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = r, e.suffix = o, e.outputLen = a, e.enableXOF = i, e.destroyed = this.destroyed, e;
385
+ const { blockLen: t, suffix: a, outputLen: o, rounds: r, enableXOF: i } = this;
386
+ return e || (e = new x(t, a, o, i, r)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = r, e.suffix = a, e.outputLen = o, e.enableXOF = i, e.destroyed = this.destroyed, e;
368
387
  }
369
388
  }
370
- const Oe = (s, e, t) => ye(() => new k(e, s, t)), Fe = Oe(1, 136, 256 / 8);
371
- function He(s, e) {
372
- return Fe(B(s, { strict: !1 }) ? de(s) : s);
389
+ const Fe = (s, e, t) => Re(() => new x(e, s, t)), He = Fe(1, 136, 256 / 8);
390
+ function Pe(s, e) {
391
+ return He(N(s, { strict: !1 }) ? le(s) : s);
373
392
  }
374
- class Pe extends T {
393
+ class $e extends T {
375
394
  constructor({ address: e }) {
376
395
  super(`Address "${e}" is invalid.`, {
377
396
  metaMessages: [
@@ -382,7 +401,7 @@ class Pe extends T {
382
401
  });
383
402
  }
384
403
  }
385
- class Q extends Map {
404
+ class J extends Map {
386
405
  constructor(e) {
387
406
  super(), Object.defineProperty(this, "maxSize", {
388
407
  enumerable: !0,
@@ -397,34 +416,34 @@ class Q extends Map {
397
416
  }
398
417
  set(e, t) {
399
418
  if (super.set(e, t), this.maxSize && this.size > this.maxSize) {
400
- const o = this.keys().next().value;
401
- o && this.delete(o);
419
+ const a = this.keys().next().value;
420
+ a && this.delete(a);
402
421
  }
403
422
  return this;
404
423
  }
405
424
  }
406
- const I = /* @__PURE__ */ new Q(8192);
407
- function J(s, e) {
408
- if (I.has(`${s}.${e}`))
409
- return I.get(`${s}.${e}`);
410
- const t = s.substring(2).toLowerCase(), o = He(K(t)), a = t.split("");
425
+ const y = /* @__PURE__ */ new J(8192);
426
+ function Z(s, e) {
427
+ if (y.has(`${s}.${e}`))
428
+ return y.get(`${s}.${e}`);
429
+ const t = s.substring(2).toLowerCase(), a = Pe(W(t)), o = t.split("");
411
430
  for (let i = 0; i < 40; i += 2)
412
- o[i >> 1] >> 4 >= 8 && a[i] && (a[i] = a[i].toUpperCase()), (o[i >> 1] & 15) >= 8 && a[i + 1] && (a[i + 1] = a[i + 1].toUpperCase());
413
- const r = `0x${a.join("")}`;
414
- return I.set(`${s}.${e}`, r), r;
431
+ a[i >> 1] >> 4 >= 8 && o[i] && (o[i] = o[i].toUpperCase()), (a[i >> 1] & 15) >= 8 && o[i + 1] && (o[i + 1] = o[i + 1].toUpperCase());
432
+ const r = `0x${o.join("")}`;
433
+ return y.set(`${s}.${e}`, r), r;
415
434
  }
416
- function E(s, e) {
417
- if (!$e(s, { strict: !1 }))
418
- throw new Pe({ address: s });
419
- return J(s, e);
435
+ function h(s, e) {
436
+ if (!Le(s, { strict: !1 }))
437
+ throw new $e({ address: s });
438
+ return Z(s, e);
420
439
  }
421
- const _e = /^0x[a-fA-F0-9]{40}$/, y = /* @__PURE__ */ new Q(8192);
422
- function $e(s, e) {
423
- const { strict: t = !0 } = e ?? {}, o = `${s}.${t}`;
424
- if (y.has(o))
425
- return y.get(o);
426
- const a = _e.test(s) ? s.toLowerCase() === s ? !0 : t ? J(s) === s : !0 : !1;
427
- return y.set(o, a), a;
440
+ const ze = /^0x[a-fA-F0-9]{40}$/, R = /* @__PURE__ */ new J(8192);
441
+ function Le(s, e) {
442
+ const { strict: t = !0 } = e ?? {}, a = `${s}.${t}`;
443
+ if (R.has(a))
444
+ return R.get(a);
445
+ const o = ze.test(s) ? s.toLowerCase() === s ? !0 : t ? Z(s) === s : !0 : !1;
446
+ return R.set(a, o), o;
428
447
  }
429
448
  const n = {
430
449
  USDC: "USDC",
@@ -439,10 +458,10 @@ const n = {
439
458
  LORDS: "LORDS"
440
459
  };
441
460
  n.USDC;
442
- const d = {
461
+ const m = {
443
462
  [c.ARBITRUM]: {
444
463
  [n.DAI]: {
445
- address: E("0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"),
464
+ address: h("0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"),
446
465
  symbol: n.DAI,
447
466
  name: "Dai Stablecoin",
448
467
  decimals: 18,
@@ -458,7 +477,7 @@ const d = {
458
477
  /* ETH */
459
478
  },
460
479
  [n.USDC]: {
461
- address: E("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
480
+ address: h("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
462
481
  symbol: n.USDC,
463
482
  name: "USD Coin",
464
483
  decimals: 6,
@@ -466,7 +485,7 @@ const d = {
466
485
  /* USDC */
467
486
  },
468
487
  [n.USDT]: {
469
- address: E("0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"),
488
+ address: h("0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"),
470
489
  symbol: n.USDT,
471
490
  name: "Tether USD",
472
491
  decimals: 6,
@@ -474,7 +493,7 @@ const d = {
474
493
  /* USDT */
475
494
  },
476
495
  [n.WETH]: {
477
- address: E("0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"),
496
+ address: h("0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"),
478
497
  symbol: n.WETH,
479
498
  name: "Wrapped Ether",
480
499
  decimals: 18,
@@ -484,7 +503,7 @@ const d = {
484
503
  },
485
504
  [c.ARBITRUM_TESTNET]: {
486
505
  [n.USDC]: {
487
- address: E("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),
506
+ address: h("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),
488
507
  symbol: n.USDC,
489
508
  name: "USD Coin",
490
509
  fiatISO: "USD",
@@ -503,7 +522,7 @@ const d = {
503
522
  /* DAI */
504
523
  },
505
524
  [n.USDC]: {
506
- address: E("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),
525
+ address: h("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),
507
526
  symbol: n.USDC,
508
527
  name: "USD Coin",
509
528
  fiatISO: "USD",
@@ -530,7 +549,7 @@ const d = {
530
549
  },
531
550
  [c.AVALANCHE_TESTNET]: {
532
551
  [n.USDC]: {
533
- address: E("0x5425890298aed601595a70AB815c96711a31Bc65"),
552
+ address: h("0x5425890298aed601595a70AB815c96711a31Bc65"),
534
553
  symbol: n.USDC,
535
554
  name: "USD Coin",
536
555
  fiatISO: "USD",
@@ -565,7 +584,7 @@ const d = {
565
584
  /* EURC */
566
585
  },
567
586
  [n.USDC]: {
568
- address: E("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),
587
+ address: h("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),
569
588
  symbol: n.USDC,
570
589
  name: "USD Coin",
571
590
  fiatISO: "USD",
@@ -574,7 +593,7 @@ const d = {
574
593
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
575
594
  },
576
595
  [n.WETH]: {
577
- address: E("0x4200000000000000000000000000000000000006"),
596
+ address: h("0x4200000000000000000000000000000000000006"),
578
597
  symbol: n.WETH,
579
598
  name: "Wrapped Ether",
580
599
  decimals: 18,
@@ -584,7 +603,7 @@ const d = {
584
603
  },
585
604
  [c.BASE_TESTNET]: {
586
605
  [n.USDC]: {
587
- address: E("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),
606
+ address: h("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),
588
607
  symbol: n.USDC,
589
608
  name: "USD Coin",
590
609
  fiatISO: "USD",
@@ -627,7 +646,7 @@ const d = {
627
646
  /* ETH */
628
647
  },
629
648
  [n.USDC]: {
630
- address: E("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),
649
+ address: h("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),
631
650
  symbol: n.USDC,
632
651
  decimals: 18,
633
652
  name: "USD Coin",
@@ -653,7 +672,7 @@ const d = {
653
672
  /* BUSD */
654
673
  },
655
674
  [n.DAI]: {
656
- address: E("0x6B175474E89094C44Da98b954EedeAC495271d0F"),
675
+ address: h("0x6B175474E89094C44Da98b954EedeAC495271d0F"),
657
676
  symbol: n.DAI,
658
677
  name: "Dai Stablecoin",
659
678
  decimals: 18,
@@ -685,7 +704,7 @@ const d = {
685
704
  /* STRK */
686
705
  },
687
706
  [n.USDC]: {
688
- address: E("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
707
+ address: h("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
689
708
  symbol: n.USDC,
690
709
  name: "USD Coin",
691
710
  decimals: 6,
@@ -693,7 +712,7 @@ const d = {
693
712
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
694
713
  },
695
714
  [n.USDT]: {
696
- address: E("0xdAC17F958D2ee523a2206206994597C13D831ec7"),
715
+ address: h("0xdAC17F958D2ee523a2206206994597C13D831ec7"),
697
716
  symbol: n.USDT,
698
717
  name: "Tether USD",
699
718
  decimals: 6,
@@ -701,7 +720,7 @@ const d = {
701
720
  /* USDT */
702
721
  },
703
722
  [n.WETH]: {
704
- address: E("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),
723
+ address: h("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),
705
724
  symbol: n.WETH,
706
725
  name: "Wrapped Ether",
707
726
  decimals: 18,
@@ -711,7 +730,7 @@ const d = {
711
730
  },
712
731
  [c.ETHEREUM_TESTNET]: {
713
732
  [n.USDC]: {
714
- address: E("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),
733
+ address: h("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),
715
734
  symbol: n.USDC,
716
735
  decimals: 6,
717
736
  name: "USD Coin",
@@ -905,90 +924,100 @@ const d = {
905
924
  /* USDC */
906
925
  }
907
926
  }
908
- }, Je = {
909
- ARBITRUM: d[c.ARBITRUM],
910
- ARBITRUM_TESTNET: d[c.ARBITRUM_TESTNET],
911
- AVALANCHE: d[c.AVALANCHE],
912
- AVALANCHE_TESTNET: d[c.AVALANCHE_TESTNET],
913
- BASE: d[c.BASE],
914
- BASE_TESTNET: d[c.BASE_TESTNET],
915
- BSC: d[c.BSC],
916
- ETHEREUM: d[c.ETHEREUM],
917
- ETHEREUM_TESTNET: d[c.ETHEREUM_TESTNET],
918
- STARKNET: d[c.STARKNET]
919
- };
920
- d[c.ARBITRUM], d[c.ARBITRUM_TESTNET], d[c.AVALANCHE], d[c.AVALANCHE_TESTNET], d[c.BASE], d[c.BASE_TESTNET], d[c.BSC], d[c.ETHEREUM], d[c.ETHEREUM_TESTNET], d[c.HYPEREVM], d[c.LISK], d[c.MONAD], d[c.MONAD_TESTNET], d[c.OPTIMISM], d[c.OPTIMISM_TESTNET], d[c.POLYGON], d[c.STARKNET], d[c.STARKNET_TESTNET];
921
- function ze(s, e) {
922
- const t = e.toLowerCase().trim(), o = d[s];
923
- if (!o)
927
+ }, ts = {
928
+ ARBITRUM: m[c.ARBITRUM],
929
+ ARBITRUM_TESTNET: m[c.ARBITRUM_TESTNET],
930
+ AVALANCHE: m[c.AVALANCHE],
931
+ AVALANCHE_TESTNET: m[c.AVALANCHE_TESTNET],
932
+ BASE: m[c.BASE],
933
+ BASE_TESTNET: m[c.BASE_TESTNET],
934
+ BSC: m[c.BSC],
935
+ ETHEREUM: m[c.ETHEREUM],
936
+ ETHEREUM_TESTNET: m[c.ETHEREUM_TESTNET],
937
+ STARKNET: m[c.STARKNET]
938
+ }, _e = new Set(Object.values(c));
939
+ function g(s) {
940
+ if (je(s))
941
+ return s;
942
+ const e = c[s];
943
+ if (!e)
944
+ throw new Error(`Invalid chain: ${s}. Chain must be a valid chain alias or internal chain value from Chains.`);
945
+ return e;
946
+ }
947
+ function je(s) {
948
+ return _e.has(s);
949
+ }
950
+ function Ke(s, e) {
951
+ const t = e.toLowerCase().trim(), a = m[s];
952
+ if (!a)
924
953
  throw new Error(
925
954
  `Chain not found: ${s}. The chain key must be a valid chain identifier.`
926
955
  );
927
- let a;
928
- for (const r in o) {
929
- const i = o[r];
956
+ let o;
957
+ for (const r in a) {
958
+ const i = a[r];
930
959
  if (i && i.address.toLowerCase() === t.toLowerCase()) {
931
- a = i;
960
+ o = i;
932
961
  break;
933
962
  }
934
963
  }
935
- if (!a)
964
+ if (!o)
936
965
  throw new Error(
937
966
  `Token address mismatch: address ${e} does not exist on chain ${s}. The token address must be a valid token address on the specified chain.`
938
967
  );
939
- return a;
968
+ return o;
940
969
  }
941
- function N(s, e, t) {
942
- const o = ze(s, e);
943
- if (o.symbol !== t)
970
+ function w(s, e, t) {
971
+ const a = Ke(s, e);
972
+ if (a.symbol !== t)
944
973
  throw new Error(
945
- `Token address and symbol mismatch: address ${e} on chain ${s} corresponds to token "${o.symbol}", but expected "${t}". The token address must correspond to a token with the expected symbol on the specified chain.`
974
+ `Token address and symbol mismatch: address ${e} on chain ${s} corresponds to token "${a.symbol}", but expected "${t}". The token address must correspond to a token with the expected symbol on the specified chain.`
946
975
  );
947
- return o;
976
+ return a;
948
977
  }
949
- function Le(s, e) {
950
- return d[s]?.[e];
978
+ function We(s, e) {
979
+ return m[s]?.[e];
951
980
  }
952
- function je(s, e) {
953
- return Le(s, e)?.address;
981
+ function Ve(s, e) {
982
+ return We(s, e)?.address;
954
983
  }
955
- var Z = /* @__PURE__ */ ((s) => (s.PRODUCTION = "production", s.STAGING = "staging", s))(Z || {});
956
- class u {
957
- constructor({ api_key: e, env: t, seesion_token: o, props: a }) {
958
- this.api_key = e || "", this.sessionToken = o || "", this.env = t ?? Z.PRODUCTION, this.props = a;
984
+ var ee = /* @__PURE__ */ ((s) => (s.PRODUCTION = "production", s.STAGING = "staging", s))(ee || {});
985
+ class l {
986
+ constructor({ api_key: e, env: t, seesion_token: a, props: o }) {
987
+ this.api_key = e || "", this.sessionToken = a || "", this.env = t ?? ee.PRODUCTION, this.props = o;
959
988
  }
960
989
  static async config(e) {
961
- if (!u.app) {
990
+ if (!l.app) {
962
991
  if (!e)
963
992
  throw new Error("Please provide an api_key");
964
- u.app = new u(e);
993
+ l.app = new l(e);
965
994
  }
966
- return e && (e.api_key !== void 0 && (u.app.api_key = e.api_key), e.seesion_token !== void 0 && (u.app.sessionToken = e.seesion_token), e.env !== void 0 && (u.app.env = e.env), e.props !== void 0 && (u.app.props = e.props)), u.app;
995
+ return e && (e.api_key !== void 0 && (l.app.api_key = e.api_key), e.seesion_token !== void 0 && (l.app.sessionToken = e.seesion_token), e.env !== void 0 && (l.app.env = e.env), e.props !== void 0 && (l.app.props = e.props)), l.app;
967
996
  }
968
997
  static getApiKey() {
969
- if (!u.app)
998
+ if (!l.app)
970
999
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
971
- return u.app.api_key;
1000
+ return l.app.api_key;
972
1001
  }
973
1002
  static getSessionToken() {
974
- if (!u.app)
1003
+ if (!l.app)
975
1004
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
976
- return u.app.sessionToken;
1005
+ return l.app.sessionToken;
977
1006
  }
978
1007
  static getProps() {
979
- if (!u.app)
1008
+ if (!l.app)
980
1009
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
981
- return u.app.props;
1010
+ return l.app.props;
982
1011
  }
983
1012
  static getEnv() {
984
- if (!u.app)
1013
+ if (!l.app)
985
1014
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
986
- return u.app.env === "internal" ? "staging" : u.app.env;
1015
+ return l.app.env === "internal" ? "staging" : l.app.env;
987
1016
  }
988
1017
  static getBaseUrl() {
989
- if (!u.app)
1018
+ if (!l.app)
990
1019
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
991
- switch (u.app.env) {
1020
+ switch (l.app.env) {
992
1021
  case "production":
993
1022
  return "https://api.chainrails.io/api/v1";
994
1023
  case "staging":
@@ -1000,23 +1029,23 @@ class u {
1000
1029
  }
1001
1030
  }
1002
1031
  static getPayModalUrl(e) {
1003
- if (!u.app)
1032
+ if (!l.app)
1004
1033
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
1005
- const t = u.app.env === "internal" ? "https://chainrails-frontend-git-staging-horus-labs.vercel.app" : "https://app.chainrails.io", o = Number(e), a = e && !isNaN(Number(e)) && o > 0 ? "/pay/" : "/deposit/", r = `${e && !isNaN(Number(e)) && o > 0 ? o * 100 : ""}`;
1006
- return t + a + r;
1034
+ const t = l.app.env === "internal" ? "https://chainrails-frontend-git-staging-horus-labs.vercel.app" : "https://app.chainrails.io", a = Number(e), o = e && !isNaN(Number(e)) && a > 0 ? "/pay/" : "/deposit/", r = `${e && !isNaN(Number(e)) && a > 0 ? a * 100 : ""}`;
1035
+ return t + o + r;
1007
1036
  }
1008
1037
  }
1009
- let R = null;
1010
- function Ke() {
1011
- R = te.create({
1012
- prefixUrl: u.getBaseUrl(),
1038
+ let B = null;
1039
+ function Ye() {
1040
+ B = ne.create({
1041
+ prefixUrl: l.getBaseUrl(),
1013
1042
  headers: {
1014
1043
  "Content-Type": "application/json"
1015
1044
  },
1016
1045
  hooks: {
1017
1046
  beforeRequest: [
1018
1047
  (s) => {
1019
- const e = u.getSessionToken() || u.getApiKey();
1048
+ const e = l.getSessionToken() || l.getApiKey();
1020
1049
  s.headers.set("Authorization", `Bearer ${e}`);
1021
1050
  }
1022
1051
  ],
@@ -1027,121 +1056,177 @@ function Ke() {
1027
1056
  }
1028
1057
  });
1029
1058
  }
1030
- function g() {
1031
- return R || Ke(), R;
1059
+ function u() {
1060
+ return B || Ye(), B;
1032
1061
  }
1033
- class We {
1062
+ class Ge {
1034
1063
  async getById(e) {
1035
- return await g().get("intents/" + e).json();
1064
+ return await u().get("intents/" + e).json();
1036
1065
  }
1037
1066
  async getForSender(e) {
1038
- return await g().get("intents/user/" + e).json();
1067
+ return await u().get("intents/user/" + e).json();
1039
1068
  }
1040
1069
  async getForAddress(e) {
1041
- return await g().get("intents/address/" + e).json();
1070
+ return await u().get("intents/address/" + e).json();
1042
1071
  }
1043
1072
  async getForSession(e) {
1044
- return await g().get("modal/sessions/intents/" + e).json();
1073
+ return await u().get("modal/sessions/intents/" + e).json();
1045
1074
  }
1046
1075
  async getAll(e) {
1047
- return await g().get("intents", { searchParams: e }).json();
1076
+ return await u().get("intents", { searchParams: e }).json();
1048
1077
  }
1049
1078
  async create(e) {
1050
- return await g().post("intents", { json: e }).json();
1079
+ const t = g(e.source_chain), a = g(e.destination_chain);
1080
+ return await u().post("intents", {
1081
+ json: {
1082
+ ...e,
1083
+ source_chain: t,
1084
+ destination_chain: a
1085
+ }
1086
+ }).json();
1051
1087
  }
1052
1088
  async createForSession(e) {
1053
- return await g().post("modal/sessions/intents", { json: e }).json();
1089
+ const t = g(e.sourceChain);
1090
+ return await u().post("modal/sessions/intents", {
1091
+ json: { ...e, sourceChain: t }
1092
+ }).json();
1054
1093
  }
1055
1094
  async update(e, t) {
1056
- return await g().post("intents", { json: t }).json();
1095
+ return await u().post("intents", { json: t }).json();
1057
1096
  }
1058
1097
  async triggerProcessing(e) {
1059
- return await g().post(`intents/${e}/trigger-processing`).json();
1098
+ return await u().post(`intents/${e}/trigger-processing`).json();
1060
1099
  }
1061
1100
  async triggerProcessingForSession(e) {
1062
- return await g().post(`modal/sessions/intents/${e}/process`).json();
1101
+ return await u().post(`modal/sessions/intents/${e}/process`).json();
1063
1102
  }
1064
1103
  }
1065
- class Ve {
1104
+ class qe {
1066
1105
  async getFromSpecificBridge(e) {
1067
- return N(e.sourceChain, e.tokenIn, e.amountSymbol), await g().get("quotes/single", { searchParams: e }).json();
1106
+ const t = g(e.sourceChain);
1107
+ w(t, e.tokenIn, e.amountSymbol);
1108
+ const a = g(e.destinationChain);
1109
+ return await u().get("quotes/single", {
1110
+ searchParams: {
1111
+ ...e,
1112
+ sourceChain: t,
1113
+ destinationChain: a
1114
+ }
1115
+ }).json();
1068
1116
  }
1069
1117
  async getFromAllBridges(e) {
1070
- return N(e.sourceChain, e.tokenIn, e.amountSymbol), await g().get("quotes/multiple", { searchParams: e }).json();
1118
+ const t = g(e.sourceChain);
1119
+ w(t, e.tokenIn, e.amountSymbol);
1120
+ const a = g(e.destinationChain);
1121
+ return await u().get("quotes/multiple", {
1122
+ searchParams: {
1123
+ ...e,
1124
+ sourceChain: t,
1125
+ destinationChain: a
1126
+ }
1127
+ }).json();
1071
1128
  }
1072
1129
  async getBestAcrossBridges(e) {
1073
- return N(e.sourceChain, e.tokenIn, e.amountSymbol), await g().get("quotes/best", { searchParams: e }).json();
1130
+ const t = g(e.sourceChain);
1131
+ w(t, e.tokenIn, e.amountSymbol);
1132
+ const a = g(e.destinationChain);
1133
+ return await u().get("quotes/best", { searchParams: {
1134
+ ...e,
1135
+ sourceChain: t,
1136
+ destinationChain: a
1137
+ } }).json();
1074
1138
  }
1075
1139
  async getAll(e) {
1076
- return await g().get("quotes/multi-source", { searchParams: e }).json();
1140
+ const t = g(e.destinationChain);
1141
+ return await u().get("quotes/multi-source", { searchParams: {
1142
+ ...e,
1143
+ destinationChain: t
1144
+ } }).json();
1077
1145
  }
1078
1146
  async getAllForSession(e) {
1079
- return await g().get("modal/sessions/quotes", { searchParams: e }).json();
1147
+ return await u().get("modal/sessions/quotes", { searchParams: e }).json();
1080
1148
  }
1081
1149
  }
1082
- class Ye {
1150
+ class Xe {
1083
1151
  async getOptimalRoutes(e) {
1084
- return await g().get("router/optimal-route", { searchParams: e }).json();
1152
+ const t = g(e.sourceChain), a = g(e.destinationChain);
1153
+ return await u().get("router/optimal-route", {
1154
+ searchParams: {
1155
+ ...e,
1156
+ sourceChain: t,
1157
+ destinationChain: a
1158
+ }
1159
+ }).json();
1085
1160
  }
1086
1161
  async getAllSupportedBridges() {
1087
- return await g().get("router/supported-bridges/all").json();
1162
+ return await u().get("router/supported-bridges/all").json();
1088
1163
  }
1089
1164
  async getSupportedBridges(e) {
1090
- return await g().get("router/supported-bridges/route", { searchParams: e }).json();
1165
+ const t = g(e.sourceChain), a = g(e.destinationChain);
1166
+ return await u().get("router/supported-bridges/route", { searchParams: {
1167
+ ...e,
1168
+ sourceChain: t,
1169
+ destinationChain: a
1170
+ } }).json();
1091
1171
  }
1092
1172
  async getSupportedRoutes(e, t) {
1093
- return await g().get("router/supported-bridges/bridge/" + e, { searchParams: t }).json();
1173
+ const a = g(t.sourceChain), o = g(t.destinationChain);
1174
+ return await u().get("router/supported-routes/bridge/" + e, { searchParams: {
1175
+ ...t,
1176
+ sourceChain: a,
1177
+ destinationChain: o
1178
+ } }).json();
1094
1179
  }
1095
1180
  }
1096
- class Ge {
1181
+ class Qe {
1097
1182
  async getSupported(e) {
1098
- return await g().get("chains", { searchParams: e }).json();
1183
+ return await u().get("chains", { searchParams: e }).json();
1099
1184
  }
1100
1185
  async getBalance(e) {
1101
- return await g().get(`chains/balances/${e.address}`, { searchParams: e }).json();
1186
+ return await u().get(`chains/balances/${e.address}`, { searchParams: e }).json();
1102
1187
  }
1103
1188
  }
1104
- class qe {
1189
+ class Je {
1105
1190
  async getClientInfo() {
1106
- return await g().get("client/auth/client-info").json();
1191
+ return await u().get("client/auth/client-info").json();
1107
1192
  }
1108
1193
  async getClientInfoForSession() {
1109
- return await g().get("modal/sessions/client").json();
1194
+ return await u().get("modal/sessions/client").json();
1110
1195
  }
1111
1196
  }
1112
- class Xe {
1197
+ class Ze {
1113
1198
  async getSessionToken(e) {
1114
- const t = typeof e.destinationChain == "string" ? e.destinationChain.replace("_MAINNET", "") : void 0, o = t ? c[t] : void 0, a = {
1199
+ const t = g(e.destinationChain), a = {
1115
1200
  recipient: e.recipient,
1116
- tokenOut: je(
1117
- o,
1201
+ tokenOut: Ve(
1202
+ t,
1118
1203
  e.token
1119
1204
  ),
1120
- destinationChain: o,
1205
+ destinationChain: t,
1121
1206
  amount: e.amount
1122
1207
  };
1123
- return g().post("modal/sessions", { json: a }).json().then((r) => ({ ...r, amount: a.amount }));
1208
+ return u().post("modal/sessions", { json: a }).json().then((o) => ({ ...o, amount: a.amount }));
1124
1209
  }
1125
1210
  }
1126
- const Ze = {
1211
+ const ns = {
1127
1212
  ACROSS: "ACROSS",
1128
1213
  CCTP: "CCTP",
1129
1214
  GATEWAY: "GATEWAY",
1130
1215
  RHINOFI: "RHINOFI"
1131
- }, es = {
1132
- router: new Ye(),
1133
- quotes: new Ve(),
1134
- intents: new We(),
1135
- chains: new Ge(),
1136
- client: new qe(),
1137
- auth: new Xe()
1216
+ }, as = {
1217
+ router: new Xe(),
1218
+ quotes: new qe(),
1219
+ intents: new Ge(),
1220
+ chains: new Qe(),
1221
+ client: new Je(),
1222
+ auth: new Ze()
1138
1223
  };
1139
1224
  export {
1140
1225
  n as AmountSymbols,
1141
- Ze as Bridges,
1142
- u as Chainrails,
1143
- c as Chains,
1144
- Je as Tokens,
1145
- es as crapi,
1146
- Z as environment
1226
+ ns as Bridges,
1227
+ l as Chainrails,
1228
+ ss as Chains,
1229
+ ts as Tokens,
1230
+ as as crapi,
1231
+ ee as environment
1147
1232
  };