@chainrails/sdk 0.3.6 → 0.3.7

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.
@@ -44,10 +44,10 @@ function v(s, { strict: e = !0 } = {}) {
44
44
  function x(s) {
45
45
  return v(s, { strict: !1 }) ? Math.ceil((s.length - 2) / 2) : s.length;
46
46
  }
47
- const j = "2.43.4";
47
+ const _ = "2.43.4";
48
48
  let I = {
49
49
  getDocsUrl: ({ docsBaseUrl: s, docsPath: e = "", docsSlug: n }) => e ? `${s ?? "https://viem.sh"}${e}${n ? `#${n}` : ""}` : void 0,
50
- version: `viem@${j}`
50
+ version: `viem@${_}`
51
51
  };
52
52
  class T extends Error {
53
53
  constructor(e, n = {}) {
@@ -90,7 +90,7 @@ class T extends Error {
90
90
  configurable: !0,
91
91
  writable: !0,
92
92
  value: "BaseError"
93
- }), this.details = a, this.docsPath = o, this.metaMessages = n.metaMessages, this.name = n.name ?? this.name, this.shortMessage = e, this.version = j;
93
+ }), this.details = a, this.docsPath = o, this.metaMessages = n.metaMessages, this.name = n.name ?? this.name, this.shortMessage = e, this.version = _;
94
94
  }
95
95
  walk(e) {
96
96
  return z(this, e);
@@ -158,13 +158,13 @@ function de(s, e = {}) {
158
158
  a ? n ? r = (1n << BigInt(a) * 8n - 1n) - 1n : r = 2n ** (BigInt(a) * 8n) - 1n : typeof s == "number" && (r = BigInt(Number.MAX_SAFE_INTEGER));
159
159
  const i = typeof r == "bigint" && n ? -r - 1n : 0;
160
160
  if (r && o > r || o < i) {
161
- const h = typeof s == "bigint" ? "n" : "";
161
+ const f = typeof s == "bigint" ? "n" : "";
162
162
  throw new re({
163
- max: r ? `${r}${h}` : void 0,
164
- min: `${i}${h}`,
163
+ max: r ? `${r}${f}` : void 0,
164
+ min: `${i}${f}`,
165
165
  signed: n,
166
166
  size: a,
167
- value: `${s}${h}`
167
+ value: `${s}${f}`
168
168
  });
169
169
  }
170
170
  const l = `0x${(n && o < 0 ? (1n << BigInt(a * 8)) + BigInt(o) : o).toString(16)}`;
@@ -201,10 +201,10 @@ function W(s, e = {}) {
201
201
  a.length % 2 && (a = `0${a}`);
202
202
  const o = a.length / 2, r = new Uint8Array(o);
203
203
  for (let i = 0, l = 0; i < o; i++) {
204
- const h = O(a.charCodeAt(l++)), S = O(a.charCodeAt(l++));
205
- if (h === void 0 || S === void 0)
204
+ const f = O(a.charCodeAt(l++)), S = O(a.charCodeAt(l++));
205
+ if (f === void 0 || S === void 0)
206
206
  throw new T(`Invalid byte sequence ("${a[l - 2]}${a[l - 1]}" in "${a}").`);
207
- r[i] = h * 16 + S;
207
+ r[i] = f * 16 + S;
208
208
  }
209
209
  return r;
210
210
  }
@@ -217,14 +217,14 @@ function V(s, e = {}) {
217
217
  return typeof e.size == "number" ? (w(n, { size: e.size }), U(n, { dir: "right", size: e.size })) : n;
218
218
  }
219
219
  const b = /* @__PURE__ */ BigInt(2 ** 32 - 1), M = /* @__PURE__ */ BigInt(32);
220
- function fe(s, e = !1) {
220
+ function he(s, e = !1) {
221
221
  return e ? { h: Number(s & b), l: Number(s >> M & b) } : { h: Number(s >> M & b) | 0, l: Number(s & b) | 0 };
222
222
  }
223
- function he(s, e = !1) {
223
+ function fe(s, e = !1) {
224
224
  const n = s.length;
225
225
  let a = new Uint32Array(n), o = new Uint32Array(n);
226
226
  for (let r = 0; r < n; r++) {
227
- const { h: i, l } = fe(s[r], e);
227
+ const { h: i, l } = he(s[r], e);
228
228
  [a[r], o[r]] = [i, l];
229
229
  }
230
230
  return [a, o];
@@ -295,21 +295,21 @@ for (let s = 0, e = C, n = 1, a = 0; s < 24; s++) {
295
295
  e = (e << C ^ (e >> we) * xe) % Be, e & ve && (o ^= C << (C << /* @__PURE__ */ BigInt(r)) - C);
296
296
  Q.push(o);
297
297
  }
298
- const J = he(Q, !0), Oe = J[0], Me = J[1], $ = (s, e, n) => n > 32 ? Se(s, e, n) : Ee(s, e, n), L = (s, e, n) => n > 32 ? pe(s, e, n) : Te(s, e, n);
298
+ const J = fe(Q, !0), Oe = J[0], Me = J[1], $ = (s, e, n) => n > 32 ? Se(s, e, n) : Ee(s, e, n), j = (s, e, n) => n > 32 ? pe(s, e, n) : Te(s, e, n);
299
299
  function Fe(s, e = 24) {
300
300
  const n = new Uint32Array(10);
301
301
  for (let a = 24 - e; a < 24; a++) {
302
302
  for (let i = 0; i < 10; i++)
303
303
  n[i] = s[i] ^ s[i + 10] ^ s[i + 20] ^ s[i + 30] ^ s[i + 40];
304
304
  for (let i = 0; i < 10; i += 2) {
305
- const l = (i + 8) % 10, h = (i + 2) % 10, S = n[h], p = n[h + 1], ne = $(S, p, 1) ^ n[l], te = L(S, p, 1) ^ n[l + 1];
305
+ const l = (i + 8) % 10, f = (i + 2) % 10, S = n[f], p = n[f + 1], ne = $(S, p, 1) ^ n[l], te = j(S, p, 1) ^ n[l + 1];
306
306
  for (let D = 0; D < 50; D += 10)
307
307
  s[i + D] ^= ne, s[i + D + 1] ^= te;
308
308
  }
309
309
  let o = s[2], r = s[3];
310
310
  for (let i = 0; i < 24; i++) {
311
- const l = X[i], h = $(o, r, l), S = L(o, r, l), p = q[i];
312
- o = s[p], r = s[p + 1], s[p] = h, s[p + 1] = S;
311
+ const l = X[i], f = $(o, r, l), S = j(o, r, l), p = q[i];
312
+ o = s[p], r = s[p + 1], s[p] = f, s[p + 1] = S;
313
313
  }
314
314
  for (let i = 0; i < 50; i += 10) {
315
315
  for (let l = 0; l < 10; l++)
@@ -390,7 +390,7 @@ const Pe = (s, e, n) => ke(() => new B(e, s, n)), He = Pe(1, 136, 256 / 8);
390
390
  function $e(s, e) {
391
391
  return He(v(s, { strict: !1 }) ? ue(s) : s);
392
392
  }
393
- class Le extends T {
393
+ class je extends T {
394
394
  constructor({ address: e }) {
395
395
  super(`Address "${e}" is invalid.`, {
396
396
  metaMessages: [
@@ -433,16 +433,16 @@ function ee(s, e) {
433
433
  return y.set(`${s}.${e}`, r), r;
434
434
  }
435
435
  function g(s, e) {
436
- if (!je(s, { strict: !1 }))
437
- throw new Le({ address: s });
436
+ if (!_e(s, { strict: !1 }))
437
+ throw new je({ address: s });
438
438
  return ee(s, e);
439
439
  }
440
- const _e = /^0x[a-fA-F0-9]{40}$/, R = /* @__PURE__ */ new Z(8192);
441
- function je(s, e) {
440
+ const Le = /^0x[a-fA-F0-9]{40}$/, R = /* @__PURE__ */ new Z(8192);
441
+ function _e(s, e) {
442
442
  const { strict: n = !0 } = e ?? {}, a = `${s}.${n}`;
443
443
  if (R.has(a))
444
444
  return R.get(a);
445
- const o = _e.test(s) ? s.toLowerCase() === s ? !0 : n ? ee(s) === s : !0 : !1;
445
+ const o = Le.test(s) ? s.toLowerCase() === s ? !0 : n ? ee(s) === s : !0 : !1;
446
446
  return R.set(a, o), o;
447
447
  }
448
448
  const t = {
@@ -458,7 +458,7 @@ const t = {
458
458
  LORDS: "LORDS"
459
459
  };
460
460
  t.USDC;
461
- const f = {
461
+ const h = {
462
462
  [d.ARBITRUM]: {
463
463
  [t.DAI]: {
464
464
  address: g("0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"),
@@ -934,16 +934,16 @@ const f = {
934
934
  }
935
935
  }
936
936
  }, os = {
937
- ARBITRUM: f[d.ARBITRUM],
938
- ARBITRUM_TESTNET: f[d.ARBITRUM_TESTNET],
939
- AVALANCHE: f[d.AVALANCHE],
940
- AVALANCHE_TESTNET: f[d.AVALANCHE_TESTNET],
941
- BASE: f[d.BASE],
942
- BASE_TESTNET: f[d.BASE_TESTNET],
943
- BSC: f[d.BSC],
944
- ETHEREUM: f[d.ETHEREUM],
945
- ETHEREUM_TESTNET: f[d.ETHEREUM_TESTNET],
946
- STARKNET: f[d.STARKNET]
937
+ ARBITRUM: h[d.ARBITRUM],
938
+ ARBITRUM_TESTNET: h[d.ARBITRUM_TESTNET],
939
+ AVALANCHE: h[d.AVALANCHE],
940
+ AVALANCHE_TESTNET: h[d.AVALANCHE_TESTNET],
941
+ BASE: h[d.BASE],
942
+ BASE_TESTNET: h[d.BASE_TESTNET],
943
+ BSC: h[d.BSC],
944
+ ETHEREUM: h[d.ETHEREUM],
945
+ ETHEREUM_TESTNET: h[d.ETHEREUM_TESTNET],
946
+ STARKNET: h[d.STARKNET]
947
947
  }, ze = new Set(Object.values(d));
948
948
  function m(s) {
949
949
  if (Ke(s))
@@ -957,7 +957,7 @@ function Ke(s) {
957
957
  return ze.has(s);
958
958
  }
959
959
  function We(s, e) {
960
- const n = e.toLowerCase().trim(), a = f[s];
960
+ const n = e.toLowerCase().trim(), a = h[s];
961
961
  if (!a)
962
962
  throw new Error(
963
963
  `Chain not found: ${s}. The chain key must be a valid chain identifier.`
@@ -985,9 +985,9 @@ function k(s, e, n) {
985
985
  return a;
986
986
  }
987
987
  function Ve(s, e) {
988
- return f[s]?.[e];
988
+ return h[s]?.[e];
989
989
  }
990
- function _(s, e) {
990
+ function L(s, e) {
991
991
  return Ve(s, e)?.address;
992
992
  }
993
993
  var se = /* @__PURE__ */ ((s) => (s.PRODUCTION = "production", s.STAGING = "staging", s))(se || {});
@@ -1201,10 +1201,10 @@ class Je {
1201
1201
  class Ze {
1202
1202
  async getSessionToken(e) {
1203
1203
  const n = m(e.destinationChain);
1204
- let a = _(n, e.token);
1204
+ let a = L(n, e.token);
1205
1205
  a || (console.error(
1206
1206
  `${e.token} on ${e.destinationChain} is currently unsupported, defaulting to usdc`
1207
- ), a = _(n, "USDC"));
1207
+ ), a = L(n, "USDC"));
1208
1208
  const o = {
1209
1209
  recipient: e.recipient,
1210
1210
  tokenOut: a,
@@ -1247,6 +1247,9 @@ class ns {
1247
1247
  async getQuotes(e) {
1248
1248
  return await c().get("ramp/quotes", { searchParams: e }).json();
1249
1249
  }
1250
+ async getQuotesForSession(e) {
1251
+ return await c().get("modal/sessions/ramp/quotes", { searchParams: e }).json();
1252
+ }
1250
1253
  /**
1251
1254
  * Get all supported countries with currency details.
1252
1255
  * Use this as the primary discovery endpoint.
@@ -1254,6 +1257,9 @@ class ns {
1254
1257
  async getCountries(e) {
1255
1258
  return await c().get("ramp/countries", { searchParams: e }).json();
1256
1259
  }
1260
+ async getCountriesForSession(e) {
1261
+ return await c().get("modal/sessions/ramp/countries", { searchParams: e }).json();
1262
+ }
1257
1263
  /**
1258
1264
  * Get a deduplicated list of supported fiat currencies.
1259
1265
  * Useful for currency dropdowns.
@@ -1261,6 +1267,9 @@ class ns {
1261
1267
  async getCurrencies(e) {
1262
1268
  return await c().get("ramp/currencies", { searchParams: e }).json();
1263
1269
  }
1270
+ async getCurrenciesForSession(e) {
1271
+ return await c().get("modal/sessions/ramp/currencies", { searchParams: e }).json();
1272
+ }
1264
1273
  /**
1265
1274
  * Create a fiat-to-crypto order.
1266
1275
  * Returns a provider widget URL for the user to complete payment.
@@ -1268,12 +1277,18 @@ class ns {
1268
1277
  async createOrder(e) {
1269
1278
  return await c().post("ramp/orders", { json: e }).json();
1270
1279
  }
1280
+ async createOrderForSession(e) {
1281
+ return await c().post("modal/sessions/ramp/orders", { json: e }).json();
1282
+ }
1271
1283
  /**
1272
1284
  * Get an order by ID.
1273
1285
  */
1274
1286
  async getOrder(e) {
1275
1287
  return await c().get(`ramp/orders/${e}`).json();
1276
1288
  }
1289
+ async getOrderForSession(e) {
1290
+ return await c().get(`modal/sessions/ramp/orders/${e}`).json();
1291
+ }
1277
1292
  /**
1278
1293
  * Get an order by intent address.
1279
1294
  */
@@ -1292,6 +1307,9 @@ class ns {
1292
1307
  async confirmOrder(e) {
1293
1308
  return await c().post(`ramp/orders/${e}/confirm`).json();
1294
1309
  }
1310
+ async confirmOrderForSession(e) {
1311
+ return await c().post(`modal/sessions/ramp/orders/${e}/confirm`).json();
1312
+ }
1295
1313
  /**
1296
1314
  * Cancel an order if it's still in a cancellable state.
1297
1315
  */
@@ -44,10 +44,10 @@ function v(s, { strict: e = !0 } = {}) {
44
44
  function x(s) {
45
45
  return v(s, { strict: !1 }) ? Math.ceil((s.length - 2) / 2) : s.length;
46
46
  }
47
- const j = "2.43.4";
47
+ const _ = "2.43.4";
48
48
  let I = {
49
49
  getDocsUrl: ({ docsBaseUrl: s, docsPath: e = "", docsSlug: n }) => e ? `${s ?? "https://viem.sh"}${e}${n ? `#${n}` : ""}` : void 0,
50
- version: `viem@${j}`
50
+ version: `viem@${_}`
51
51
  };
52
52
  class T extends Error {
53
53
  constructor(e, n = {}) {
@@ -90,7 +90,7 @@ class T extends Error {
90
90
  configurable: !0,
91
91
  writable: !0,
92
92
  value: "BaseError"
93
- }), this.details = a, this.docsPath = o, this.metaMessages = n.metaMessages, this.name = n.name ?? this.name, this.shortMessage = e, this.version = j;
93
+ }), this.details = a, this.docsPath = o, this.metaMessages = n.metaMessages, this.name = n.name ?? this.name, this.shortMessage = e, this.version = _;
94
94
  }
95
95
  walk(e) {
96
96
  return z(this, e);
@@ -158,13 +158,13 @@ function de(s, e = {}) {
158
158
  a ? n ? r = (1n << BigInt(a) * 8n - 1n) - 1n : r = 2n ** (BigInt(a) * 8n) - 1n : typeof s == "number" && (r = BigInt(Number.MAX_SAFE_INTEGER));
159
159
  const i = typeof r == "bigint" && n ? -r - 1n : 0;
160
160
  if (r && o > r || o < i) {
161
- const h = typeof s == "bigint" ? "n" : "";
161
+ const f = typeof s == "bigint" ? "n" : "";
162
162
  throw new re({
163
- max: r ? `${r}${h}` : void 0,
164
- min: `${i}${h}`,
163
+ max: r ? `${r}${f}` : void 0,
164
+ min: `${i}${f}`,
165
165
  signed: n,
166
166
  size: a,
167
- value: `${s}${h}`
167
+ value: `${s}${f}`
168
168
  });
169
169
  }
170
170
  const l = `0x${(n && o < 0 ? (1n << BigInt(a * 8)) + BigInt(o) : o).toString(16)}`;
@@ -201,10 +201,10 @@ function W(s, e = {}) {
201
201
  a.length % 2 && (a = `0${a}`);
202
202
  const o = a.length / 2, r = new Uint8Array(o);
203
203
  for (let i = 0, l = 0; i < o; i++) {
204
- const h = O(a.charCodeAt(l++)), S = O(a.charCodeAt(l++));
205
- if (h === void 0 || S === void 0)
204
+ const f = O(a.charCodeAt(l++)), S = O(a.charCodeAt(l++));
205
+ if (f === void 0 || S === void 0)
206
206
  throw new T(`Invalid byte sequence ("${a[l - 2]}${a[l - 1]}" in "${a}").`);
207
- r[i] = h * 16 + S;
207
+ r[i] = f * 16 + S;
208
208
  }
209
209
  return r;
210
210
  }
@@ -217,14 +217,14 @@ function V(s, e = {}) {
217
217
  return typeof e.size == "number" ? (w(n, { size: e.size }), U(n, { dir: "right", size: e.size })) : n;
218
218
  }
219
219
  const b = /* @__PURE__ */ BigInt(2 ** 32 - 1), M = /* @__PURE__ */ BigInt(32);
220
- function fe(s, e = !1) {
220
+ function he(s, e = !1) {
221
221
  return e ? { h: Number(s & b), l: Number(s >> M & b) } : { h: Number(s >> M & b) | 0, l: Number(s & b) | 0 };
222
222
  }
223
- function he(s, e = !1) {
223
+ function fe(s, e = !1) {
224
224
  const n = s.length;
225
225
  let a = new Uint32Array(n), o = new Uint32Array(n);
226
226
  for (let r = 0; r < n; r++) {
227
- const { h: i, l } = fe(s[r], e);
227
+ const { h: i, l } = he(s[r], e);
228
228
  [a[r], o[r]] = [i, l];
229
229
  }
230
230
  return [a, o];
@@ -295,21 +295,21 @@ for (let s = 0, e = C, n = 1, a = 0; s < 24; s++) {
295
295
  e = (e << C ^ (e >> we) * xe) % Be, e & ve && (o ^= C << (C << /* @__PURE__ */ BigInt(r)) - C);
296
296
  Q.push(o);
297
297
  }
298
- const J = he(Q, !0), Oe = J[0], Me = J[1], $ = (s, e, n) => n > 32 ? Se(s, e, n) : Ee(s, e, n), L = (s, e, n) => n > 32 ? pe(s, e, n) : Te(s, e, n);
298
+ const J = fe(Q, !0), Oe = J[0], Me = J[1], $ = (s, e, n) => n > 32 ? Se(s, e, n) : Ee(s, e, n), j = (s, e, n) => n > 32 ? pe(s, e, n) : Te(s, e, n);
299
299
  function Fe(s, e = 24) {
300
300
  const n = new Uint32Array(10);
301
301
  for (let a = 24 - e; a < 24; a++) {
302
302
  for (let i = 0; i < 10; i++)
303
303
  n[i] = s[i] ^ s[i + 10] ^ s[i + 20] ^ s[i + 30] ^ s[i + 40];
304
304
  for (let i = 0; i < 10; i += 2) {
305
- const l = (i + 8) % 10, h = (i + 2) % 10, S = n[h], p = n[h + 1], ne = $(S, p, 1) ^ n[l], te = L(S, p, 1) ^ n[l + 1];
305
+ const l = (i + 8) % 10, f = (i + 2) % 10, S = n[f], p = n[f + 1], ne = $(S, p, 1) ^ n[l], te = j(S, p, 1) ^ n[l + 1];
306
306
  for (let D = 0; D < 50; D += 10)
307
307
  s[i + D] ^= ne, s[i + D + 1] ^= te;
308
308
  }
309
309
  let o = s[2], r = s[3];
310
310
  for (let i = 0; i < 24; i++) {
311
- const l = X[i], h = $(o, r, l), S = L(o, r, l), p = q[i];
312
- o = s[p], r = s[p + 1], s[p] = h, s[p + 1] = S;
311
+ const l = X[i], f = $(o, r, l), S = j(o, r, l), p = q[i];
312
+ o = s[p], r = s[p + 1], s[p] = f, s[p + 1] = S;
313
313
  }
314
314
  for (let i = 0; i < 50; i += 10) {
315
315
  for (let l = 0; l < 10; l++)
@@ -390,7 +390,7 @@ const Pe = (s, e, n) => ke(() => new B(e, s, n)), He = Pe(1, 136, 256 / 8);
390
390
  function $e(s, e) {
391
391
  return He(v(s, { strict: !1 }) ? ue(s) : s);
392
392
  }
393
- class Le extends T {
393
+ class je extends T {
394
394
  constructor({ address: e }) {
395
395
  super(`Address "${e}" is invalid.`, {
396
396
  metaMessages: [
@@ -433,16 +433,16 @@ function ee(s, e) {
433
433
  return y.set(`${s}.${e}`, r), r;
434
434
  }
435
435
  function g(s, e) {
436
- if (!je(s, { strict: !1 }))
437
- throw new Le({ address: s });
436
+ if (!_e(s, { strict: !1 }))
437
+ throw new je({ address: s });
438
438
  return ee(s, e);
439
439
  }
440
- const _e = /^0x[a-fA-F0-9]{40}$/, R = /* @__PURE__ */ new Z(8192);
441
- function je(s, e) {
440
+ const Le = /^0x[a-fA-F0-9]{40}$/, R = /* @__PURE__ */ new Z(8192);
441
+ function _e(s, e) {
442
442
  const { strict: n = !0 } = e ?? {}, a = `${s}.${n}`;
443
443
  if (R.has(a))
444
444
  return R.get(a);
445
- const o = _e.test(s) ? s.toLowerCase() === s ? !0 : n ? ee(s) === s : !0 : !1;
445
+ const o = Le.test(s) ? s.toLowerCase() === s ? !0 : n ? ee(s) === s : !0 : !1;
446
446
  return R.set(a, o), o;
447
447
  }
448
448
  const t = {
@@ -458,7 +458,7 @@ const t = {
458
458
  LORDS: "LORDS"
459
459
  };
460
460
  t.USDC;
461
- const f = {
461
+ const h = {
462
462
  [d.ARBITRUM]: {
463
463
  [t.DAI]: {
464
464
  address: g("0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"),
@@ -934,16 +934,16 @@ const f = {
934
934
  }
935
935
  }
936
936
  }, os = {
937
- ARBITRUM: f[d.ARBITRUM],
938
- ARBITRUM_TESTNET: f[d.ARBITRUM_TESTNET],
939
- AVALANCHE: f[d.AVALANCHE],
940
- AVALANCHE_TESTNET: f[d.AVALANCHE_TESTNET],
941
- BASE: f[d.BASE],
942
- BASE_TESTNET: f[d.BASE_TESTNET],
943
- BSC: f[d.BSC],
944
- ETHEREUM: f[d.ETHEREUM],
945
- ETHEREUM_TESTNET: f[d.ETHEREUM_TESTNET],
946
- STARKNET: f[d.STARKNET]
937
+ ARBITRUM: h[d.ARBITRUM],
938
+ ARBITRUM_TESTNET: h[d.ARBITRUM_TESTNET],
939
+ AVALANCHE: h[d.AVALANCHE],
940
+ AVALANCHE_TESTNET: h[d.AVALANCHE_TESTNET],
941
+ BASE: h[d.BASE],
942
+ BASE_TESTNET: h[d.BASE_TESTNET],
943
+ BSC: h[d.BSC],
944
+ ETHEREUM: h[d.ETHEREUM],
945
+ ETHEREUM_TESTNET: h[d.ETHEREUM_TESTNET],
946
+ STARKNET: h[d.STARKNET]
947
947
  }, ze = new Set(Object.values(d));
948
948
  function m(s) {
949
949
  if (Ke(s))
@@ -957,7 +957,7 @@ function Ke(s) {
957
957
  return ze.has(s);
958
958
  }
959
959
  function We(s, e) {
960
- const n = e.toLowerCase().trim(), a = f[s];
960
+ const n = e.toLowerCase().trim(), a = h[s];
961
961
  if (!a)
962
962
  throw new Error(
963
963
  `Chain not found: ${s}. The chain key must be a valid chain identifier.`
@@ -985,9 +985,9 @@ function k(s, e, n) {
985
985
  return a;
986
986
  }
987
987
  function Ve(s, e) {
988
- return f[s]?.[e];
988
+ return h[s]?.[e];
989
989
  }
990
- function _(s, e) {
990
+ function L(s, e) {
991
991
  return Ve(s, e)?.address;
992
992
  }
993
993
  var se = /* @__PURE__ */ ((s) => (s.PRODUCTION = "production", s.STAGING = "staging", s))(se || {});
@@ -1201,10 +1201,10 @@ class Je {
1201
1201
  class Ze {
1202
1202
  async getSessionToken(e) {
1203
1203
  const n = m(e.destinationChain);
1204
- let a = _(n, e.token);
1204
+ let a = L(n, e.token);
1205
1205
  a || (console.error(
1206
1206
  `${e.token} on ${e.destinationChain} is currently unsupported, defaulting to usdc`
1207
- ), a = _(n, "USDC"));
1207
+ ), a = L(n, "USDC"));
1208
1208
  const o = {
1209
1209
  recipient: e.recipient,
1210
1210
  tokenOut: a,
@@ -1247,6 +1247,9 @@ class ns {
1247
1247
  async getQuotes(e) {
1248
1248
  return await c().get("ramp/quotes", { searchParams: e }).json();
1249
1249
  }
1250
+ async getQuotesForSession(e) {
1251
+ return await c().get("modal/sessions/ramp/quotes", { searchParams: e }).json();
1252
+ }
1250
1253
  /**
1251
1254
  * Get all supported countries with currency details.
1252
1255
  * Use this as the primary discovery endpoint.
@@ -1254,6 +1257,9 @@ class ns {
1254
1257
  async getCountries(e) {
1255
1258
  return await c().get("ramp/countries", { searchParams: e }).json();
1256
1259
  }
1260
+ async getCountriesForSession(e) {
1261
+ return await c().get("modal/sessions/ramp/countries", { searchParams: e }).json();
1262
+ }
1257
1263
  /**
1258
1264
  * Get a deduplicated list of supported fiat currencies.
1259
1265
  * Useful for currency dropdowns.
@@ -1261,6 +1267,9 @@ class ns {
1261
1267
  async getCurrencies(e) {
1262
1268
  return await c().get("ramp/currencies", { searchParams: e }).json();
1263
1269
  }
1270
+ async getCurrenciesForSession(e) {
1271
+ return await c().get("modal/sessions/ramp/currencies", { searchParams: e }).json();
1272
+ }
1264
1273
  /**
1265
1274
  * Create a fiat-to-crypto order.
1266
1275
  * Returns a provider widget URL for the user to complete payment.
@@ -1268,12 +1277,18 @@ class ns {
1268
1277
  async createOrder(e) {
1269
1278
  return await c().post("ramp/orders", { json: e }).json();
1270
1279
  }
1280
+ async createOrderForSession(e) {
1281
+ return await c().post("modal/sessions/ramp/orders", { json: e }).json();
1282
+ }
1271
1283
  /**
1272
1284
  * Get an order by ID.
1273
1285
  */
1274
1286
  async getOrder(e) {
1275
1287
  return await c().get(`ramp/orders/${e}`).json();
1276
1288
  }
1289
+ async getOrderForSession(e) {
1290
+ return await c().get(`modal/sessions/ramp/orders/${e}`).json();
1291
+ }
1277
1292
  /**
1278
1293
  * Get an order by intent address.
1279
1294
  */
@@ -1292,6 +1307,9 @@ class ns {
1292
1307
  async confirmOrder(e) {
1293
1308
  return await c().post(`ramp/orders/${e}/confirm`).json();
1294
1309
  }
1310
+ async confirmOrderForSession(e) {
1311
+ return await c().post(`modal/sessions/ramp/orders/${e}/confirm`).json();
1312
+ }
1295
1313
  /**
1296
1314
  * Cancel an order if it's still in a cancellable state.
1297
1315
  */
@@ -1,2 +1,2 @@
1
1
  (function(m,b){typeof exports=="object"&&typeof module<"u"?b(exports,require("ky")):typeof define=="function"&&define.amd?define(["exports","ky"],b):(m=typeof globalThis<"u"?globalThis:m||self,b(m.Chainrails={},m.Ky))})(this,(function(m,b){"use strict";const d={ARBITRUM:"ARBITRUM_MAINNET",ARBITRUM_TESTNET:"ARBITRUM_TESTNET",AVALANCHE:"AVALANCHE_MAINNET",AVALANCHE_TESTNET:"AVALANCHE_TESTNET",BASE:"BASE_MAINNET",BASE_TESTNET:"BASE_TESTNET",BSC:"BSC_MAINNET",ETHEREUM:"ETHEREUM_MAINNET",ETHEREUM_TESTNET:"ETHEREUM_TESTNET",HYPEREVM:"HYPEREVM_MAINNET",LISK:"LISK_MAINNET",MONAD:"MONAD_MAINNET",MONAD_TESTNET:"MONAD_TESTNET",OPTIMISM:"OPTIMISM_MAINNET",OPTIMISM_TESTNET:"OPTIMISM_TESTNET",POLYGON:"POLYGON_MAINNET",STARKNET:"STARKNET_MAINNET",STARKNET_TESTNET:"STARKNET_TESTNET"},ae={ARBITRUM:"ARBITRUM",ARBITRUM_TESTNET:"ARBITRUM_TESTNET",AVALANCHE:"AVALANCHE",AVALANCHE_TESTNET:"AVALANCHE_TESTNET",BASE:"BASE",BASE_TESTNET:"BASE_TESTNET",BSC:"BSC",ETHEREUM:"ETHEREUM",ETHEREUM_TESTNET:"ETHEREUM_TESTNET",HYPEREVM:"HYPEREVM",LISK:"LISK",MONAD:"MONAD",MONAD_TESTNET:"MONAD_TESTNET",OPTIMISM:"OPTIMISM",OPTIMISM_TESTNET:"OPTIMISM_TESTNET",POLYGON:"POLYGON",STARKNET:"STARKNET",STARKNET_TESTNET:"STARKNET_TESTNET"};function R(s,{strict:e=!0}={}){return!s||typeof s!="string"?!1:e?/^0x[0-9a-fA-F]*$/.test(s):s.startsWith("0x")}function F(s){return R(s,{strict:!1})?Math.ceil((s.length-2)/2):s.length}const P="2.43.4";let k={getDocsUrl:({docsBaseUrl:s,docsPath:e="",docsSlug:n})=>e?`${s??"https://viem.sh"}${e}${n?`#${n}`:""}`:void 0,version:`viem@${P}`};class S extends Error{constructor(e,n={}){const a=n.cause instanceof S?n.cause.details:n.cause?.message?n.cause.message:n.details,o=n.cause instanceof S&&n.cause.docsPath||n.docsPath,r=k.getDocsUrl?.({...n,docsPath:o}),i=[e||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...r?[`Docs: ${r}`]:[],...a?[`Details: ${a}`]:[],...k.version?[`Version: ${k.version}`]:[]].join(`
2
- `);super(i,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=a,this.docsPath=o,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=e,this.version=P}walk(e){return H(this,e)}}function H(s,e){return e?.(s)?s:s&&typeof s=="object"&&"cause"in s&&s.cause!==void 0?H(s.cause,e):e?null:s}class $ extends S{constructor({size:e,targetSize:n,type:a}){super(`${a.charAt(0).toUpperCase()}${a.slice(1).toLowerCase()} size (${e}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}}function A(s,{dir:e,size:n=32}={}){return typeof s=="string"?oe(s,{dir:e,size:n}):ie(s,{dir:e,size:n})}function oe(s,{dir:e,size:n=32}={}){if(n===null)return s;const a=s.replace("0x","");if(a.length>n*2)throw new $({size:Math.ceil(a.length/2),targetSize:n,type:"hex"});return`0x${a[e==="right"?"padEnd":"padStart"](n*2,"0")}`}function ie(s,{dir:e,size:n=32}={}){if(n===null)return s;if(s.length>n)throw new $({size:s.length,targetSize:n,type:"bytes"});const a=new Uint8Array(n);for(let o=0;o<n;o++){const r=e==="right";a[r?o:n-o-1]=s[r?o:s.length-o-1]}return a}class re extends S{constructor({max:e,min:n,signed:a,size:o,value:r}){super(`Number "${r}" is not in safe ${o?`${o*8}-bit ${a?"signed":"unsigned"} `:""}integer range ${e?`(${n} to ${e})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}}class ce extends S{constructor({givenSize:e,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function N(s,{size:e}){if(F(s)>e)throw new ce({givenSize:F(s),maxSize:e})}function de(s,e={}){const{signed:n,size:a}=e,o=BigInt(s);let r;a?n?r=(1n<<BigInt(a)*8n-1n)-1n:r=2n**(BigInt(a)*8n)-1n:typeof s=="number"&&(r=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof r=="bigint"&&n?-r-1n:0;if(r&&o>r||o<i){const E=typeof s=="bigint"?"n":"";throw new re({max:r?`${r}${E}`:void 0,min:`${i}${E}`,signed:n,size:a,value:`${s}${E}`})}const l=`0x${(n&&o<0?(1n<<BigInt(a*8))+BigInt(o):o).toString(16)}`;return a?A(l,{size:a}):l}const le=new TextEncoder;function ue(s,e={}){return typeof s=="number"||typeof s=="bigint"?me(s,e):typeof s=="boolean"?ge(s,e):R(s)?j(s,e):_(s,e)}function ge(s,e={}){const n=new Uint8Array(1);return n[0]=Number(s),typeof e.size=="number"?(N(n,{size:e.size}),A(n,{size:e.size})):n}const T={zero:48,nine:57,A:65,F:70,a:97,f:102};function L(s){if(s>=T.zero&&s<=T.nine)return s-T.zero;if(s>=T.A&&s<=T.F)return s-(T.A-10);if(s>=T.a&&s<=T.f)return s-(T.a-10)}function j(s,e={}){let n=s;e.size&&(N(n,{size:e.size}),n=A(n,{dir:"right",size:e.size}));let a=n.slice(2);a.length%2&&(a=`0${a}`);const o=a.length/2,r=new Uint8Array(o);for(let i=0,l=0;i<o;i++){const E=L(a.charCodeAt(l++)),p=L(a.charCodeAt(l++));if(E===void 0||p===void 0)throw new S(`Invalid byte sequence ("${a[l-2]}${a[l-1]}" in "${a}").`);r[i]=E*16+p}return r}function me(s,e){const n=de(s,e);return j(n)}function _(s,e={}){const n=le.encode(s);return typeof e.size=="number"?(N(n,{size:e.size}),A(n,{dir:"right",size:e.size})):n}const U=BigInt(2**32-1),z=BigInt(32);function fe(s,e=!1){return e?{h:Number(s&U),l:Number(s>>z&U)}:{h:Number(s>>z&U)|0,l:Number(s&U)|0}}function he(s,e=!1){const n=s.length;let a=new Uint32Array(n),o=new Uint32Array(n);for(let r=0;r<n;r++){const{h:i,l}=fe(s[r],e);[a[r],o[r]]=[i,l]}return[a,o]}const Ee=(s,e,n)=>s<<n|e>>>32-n,Te=(s,e,n)=>e<<n|s>>>32-n,Se=(s,e,n)=>e<<n-32|s>>>64-n,pe=(s,e,n)=>s<<n-32|e>>>64-n;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ce(s){return s instanceof Uint8Array||ArrayBuffer.isView(s)&&s.constructor.name==="Uint8Array"}function K(s){if(!Number.isSafeInteger(s)||s<0)throw new Error("positive integer expected, got "+s)}function I(s,...e){if(!Ce(s))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(s.length))throw new Error("Uint8Array expected of length "+e+", got length="+s.length)}function W(s,e=!0){if(s.destroyed)throw new Error("Hash instance has been destroyed");if(e&&s.finished)throw new Error("Hash#digest() has already been called")}function be(s,e){I(s);const n=e.outputLen;if(s.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function De(s){return new Uint32Array(s.buffer,s.byteOffset,Math.floor(s.byteLength/4))}function V(...s){for(let e=0;e<s.length;e++)s[e].fill(0)}const Ae=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Ue(s){return s<<24&4278190080|s<<8&16711680|s>>>8&65280|s>>>24&255}function Ie(s){for(let e=0;e<s.length;e++)s[e]=Ue(s[e]);return s}const G=Ae?s=>s:Ie;function ye(s){if(typeof s!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(s))}function Y(s){return typeof s=="string"&&(s=ye(s)),I(s),s}class Re{}function ke(s){const e=a=>s().update(Y(a)).digest(),n=s();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>s(),e}const Ne=BigInt(0),D=BigInt(1),ve=BigInt(2),we=BigInt(7),Be=BigInt(256),Oe=BigInt(113),q=[],X=[],Q=[];for(let s=0,e=D,n=1,a=0;s<24;s++){[n,a]=[a,(2*n+3*a)%5],q.push(2*(5*a+n)),X.push((s+1)*(s+2)/2%64);let o=Ne;for(let r=0;r<7;r++)e=(e<<D^(e>>we)*Oe)%Be,e&ve&&(o^=D<<(D<<BigInt(r))-D);Q.push(o)}const J=he(Q,!0),Me=J[0],xe=J[1],Z=(s,e,n)=>n>32?Se(s,e,n):Ee(s,e,n),ee=(s,e,n)=>n>32?pe(s,e,n):Te(s,e,n);function Fe(s,e=24){const n=new Uint32Array(10);for(let a=24-e;a<24;a++){for(let i=0;i<10;i++)n[i]=s[i]^s[i+10]^s[i+20]^s[i+30]^s[i+40];for(let i=0;i<10;i+=2){const l=(i+8)%10,E=(i+2)%10,p=n[E],C=n[E+1],cs=Z(p,C,1)^n[l],ds=ee(p,C,1)^n[l+1];for(let y=0;y<50;y+=10)s[i+y]^=cs,s[i+y+1]^=ds}let o=s[2],r=s[3];for(let i=0;i<24;i++){const l=X[i],E=Z(o,r,l),p=ee(o,r,l),C=q[i];o=s[C],r=s[C+1],s[C]=E,s[C+1]=p}for(let i=0;i<50;i+=10){for(let l=0;l<10;l++)n[l]=s[i+l];for(let l=0;l<10;l++)s[i+l]^=~n[(l+2)%10]&n[(l+4)%10]}s[0]^=Me[a],s[1]^=xe[a]}V(n)}class v extends Re{constructor(e,n,a,o=!1,r=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=n,this.outputLen=a,this.enableXOF=o,this.rounds=r,K(a),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=De(this.state)}clone(){return this._cloneInto()}keccak(){G(this.state32),Fe(this.state32,this.rounds),G(this.state32),this.posOut=0,this.pos=0}update(e){W(this),e=Y(e),I(e);const{blockLen:n,state:a}=this,o=e.length;for(let r=0;r<o;){const i=Math.min(n-this.pos,o-r);for(let l=0;l<i;l++)a[this.pos++]^=e[r++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:n,pos:a,blockLen:o}=this;e[a]^=n,(n&128)!==0&&a===o-1&&this.keccak(),e[o-1]^=128,this.keccak()}writeInto(e){W(this,!1),I(e),this.finish();const n=this.state,{blockLen:a}=this;for(let o=0,r=e.length;o<r;){this.posOut>=a&&this.keccak();const i=Math.min(a-this.posOut,r-o);e.set(n.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return K(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(be(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,V(this.state)}_cloneInto(e){const{blockLen:n,suffix:a,outputLen:o,rounds:r,enableXOF:i}=this;return e||(e=new v(n,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}}const Pe=(s,e,n)=>ke(()=>new v(e,s,n)),He=Pe(1,136,256/8);function $e(s,e){return He(R(s,{strict:!1})?ue(s):s)}class Le extends S{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class se extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const n=super.get(e);return super.has(e)&&n!==void 0&&(this.delete(e),super.set(e,n)),n}set(e,n){if(super.set(e,n),this.maxSize&&this.size>this.maxSize){const a=this.keys().next().value;a&&this.delete(a)}return this}}const w=new se(8192);function ne(s,e){if(w.has(`${s}.${e}`))return w.get(`${s}.${e}`);const n=s.substring(2).toLowerCase(),a=$e(_(n)),o=n.split("");for(let i=0;i<40;i+=2)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());const r=`0x${o.join("")}`;return w.set(`${s}.${e}`,r),r}function g(s,e){if(!_e(s,{strict:!1}))throw new Le({address:s});return ne(s,e)}const je=/^0x[a-fA-F0-9]{40}$/,B=new se(8192);function _e(s,e){const{strict:n=!0}=e??{},a=`${s}.${n}`;if(B.has(a))return B.get(a);const o=je.test(s)?s.toLowerCase()===s?!0:n?ne(s)===s:!0:!1;return B.set(a,o),o}const t={USDC:"USDC",USDT:"USDT",DAI:"DAI",BUSD:"BUSD",EURC:"EURC",ETH:"ETH",WETH:"WETH",STRK:"STRK",BNB:"BNB",LORDS:"LORDS"};t.USDC;const h={[d.ARBITRUM]:{[t.DAI]:{address:g("0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"),symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!0},[t.USDC]:{address:g("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1},[t.USDT]:{address:g("0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"),symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[t.WETH]:{address:g("0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"),symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[d.ARBITRUM_TESTNET]:{[t.USDC]:{address:g("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),symbol:t.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1}},[d.AVALANCHE]:{[t.DAI]:{address:"0xd586E7F844cEa2F87f50152665BCbc2C279D8d70",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.USDC]:{address:g("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),symbol:t.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[t.USDT]:{address:"0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[t.WETH]:{address:"0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB",symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[d.AVALANCHE_TESTNET]:{[t.USDC]:{address:g("0x5425890298aed601595a70AB815c96711a31Bc65"),symbol:t.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1}},[d.BASE]:{[t.DAI]:{address:"0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!0},[t.EURC]:{address:"0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42",symbol:t.EURC,name:"Euro Coin",decimals:6,logoURI:"/images/tokens/eurc.png",nativeToken:!1},[t.USDC]:{address:g("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),symbol:t.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[t.WETH]:{address:g("0x4200000000000000000000000000000000000006"),symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[d.BASE_TESTNET]:{[t.USDC]:{address:g("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),symbol:t.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1}},[d.BSC]:{[t.BNB]:{address:"0x0000000000000000000000000000000000000000",symbol:t.BNB,name:"BNB",decimals:18,logoURI:"/images/chains/bsc.webp",nativeToken:!0},[t.BUSD]:{address:"0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",symbol:t.BUSD,name:"Binance USD",decimals:18,logoURI:"/images/tokens/busd.png",nativeToken:!1},[t.DAI]:{address:"0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x2170Ed0880ac9A755fd29B2688956BD959F933F8",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!1},[t.USDC]:{address:g("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),symbol:t.USDC,decimals:18,name:"USD Coin",logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[t.USDT]:{address:"0x55d398326f99059fF775485246999027B3197955",symbol:t.USDT,name:"Tether USD",decimals:18,logoURI:"/images/tokens/usdt.png",nativeToken:!1}},[d.ETHEREUM]:{[t.BUSD]:{address:"0x4Fabb145d64652a948d72533023f6E7A623C7C53",symbol:t.BUSD,name:"Binance USD",decimals:18,logoURI:"/images/tokens/busd.png",nativeToken:!1},[t.DAI]:{address:g("0x6B175474E89094C44Da98b954EedeAC495271d0F"),symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!0},[t.EURC]:{address:"0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c",symbol:t.EURC,name:"Euro Coin",decimals:6,logoURI:"/images/tokens/eurc.png",nativeToken:!1},[t.STRK]:{address:"0xCa14007Eff0dB1f8135f4C25B34De49AB0d42766",symbol:t.STRK,name:"Starknet Token",decimals:18,logoURI:"/images/chains/starknet.svg",nativeToken:!1},[t.USDC]:{address:g("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[t.USDT]:{address:g("0xdAC17F958D2ee523a2206206994597C13D831ec7"),symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[t.WETH]:{address:g("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[d.ETHEREUM_TESTNET]:{[t.USDC]:{address:g("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),symbol:t.USDC,decimals:6,name:"USD Coin",logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1}},[d.HYPEREVM]:{[t.USDC]:{address:"0xb88339CB7199b77E23DB6E890353E22632Ba630f",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[d.LISK]:{[t.USDC]:{address:"0xF242275d3a6527d877f2c927a82D9b057609cc71",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[d.MONAD]:{[t.USDC]:{address:"0x754704Bc059F8C67012fEd69BC8A327a5aafb603",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[d.MONAD_TESTNET]:{[t.USDC]:{address:"0x534b2f3A21130d7a60830c2Df862319e593943A3",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[d.OPTIMISM]:{[t.DAI]:{address:"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!0},[t.USDC]:{address:"0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1},[t.USDT]:{address:"0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[t.WETH]:{address:"0x4200000000000000000000000000000000000006",symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[d.OPTIMISM_TESTNET]:{[t.USDC]:{address:"0x5fd84259d66Cd46123540766Be93DFE6D43130D7",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[d.POLYGON]:{[t.DAI]:{address:"0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.USDC]:{address:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1},[t.USDT]:{address:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F",symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[t.WETH]:{address:"0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[d.STARKNET]:{[t.DAI]:{address:"0x05574eb6b8789a91466f902c380d978e472db68170ff82a5b650b95a58ddf4ad",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!1},[t.LORDS]:{address:"0x0124aeb495b947201f5faC96fD1138E326AD86195B98df6DEc9009158A533B49",symbol:t.LORDS,name:"LORDS Token",decimals:18,logoURI:"/images/tokens/lords.png",nativeToken:!1},[t.STRK]:{address:"0x04718f5a0Fc34cC1AF16A1cdee98fFB20C31f5cD61D6Ab07201858f4287c938D",symbol:t.STRK,name:"Starknet Token",decimals:18,logoURI:"/images/chains/starknet.svg",nativeToken:!1},[t.USDC]:{address:"0x033068F6539f8e6e6b131e6B2B814e6c34A5224bC66947c47DaB9dFeE93b35fb",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[t.USDT]:{address:"0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8",symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1}},[d.STARKNET_TESTNET]:{[t.USDC]:{address:"0x0512feAc6339Ff7889822cb5aA2a86C848e9D392bB0E3E237C008674feeD8343",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}}},ze={ARBITRUM:h[d.ARBITRUM],ARBITRUM_TESTNET:h[d.ARBITRUM_TESTNET],AVALANCHE:h[d.AVALANCHE],AVALANCHE_TESTNET:h[d.AVALANCHE_TESTNET],BASE:h[d.BASE],BASE_TESTNET:h[d.BASE_TESTNET],BSC:h[d.BSC],ETHEREUM:h[d.ETHEREUM],ETHEREUM_TESTNET:h[d.ETHEREUM_TESTNET],STARKNET:h[d.STARKNET]},Ke=new Set(Object.values(d));function f(s){if(We(s))return s;const e=d[s];if(!e)throw new Error(`Invalid chain: ${s}. Chain must be a valid chain alias or internal chain value from Chains.`);return e}function We(s){return Ke.has(s)}function Ve(s,e){const n=e.toLowerCase().trim(),a=h[s];if(!a)throw new Error(`Chain not found: ${s}. The chain key must be a valid chain identifier.`);let o;for(const r in a){const i=a[r];if(i&&i.address.toLowerCase()===n.toLowerCase()){o=i;break}}if(!o)throw new Error(`Token address mismatch: address ${e} does not exist on chain ${s}. The token address must be a valid token address on the specified chain.`);return o}function O(s,e,n){const a=Ve(s,e);if(a.symbol!==n)throw new Error(`Token address and symbol mismatch: address ${e} on chain ${s} corresponds to token "${a.symbol}", but expected "${n}". The token address must correspond to a token with the expected symbol on the specified chain.`);return a}function Ge(s,e){return h[s]?.[e]}function te(s,e){return Ge(s,e)?.address}var M=(s=>(s.PRODUCTION="production",s.STAGING="staging",s))(M||{});class u{constructor({api_key:e,env:n,seesion_token:a,props:o}){this.api_key=e||"",this.sessionToken=a||"",this.env=n??M.PRODUCTION,this.props=o}static async config(e){if(!u.app){if(!e)throw new Error("Please provide an api_key");u.app=new u(e)}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}static getApiKey(){if(!u.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return u.app.api_key}static getSessionToken(){if(!u.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return u.app.sessionToken}static getProps(){if(!u.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return u.app.props}static getEnv(){if(!u.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return u.app.env==="internal"?"staging":u.app.env}static getBaseUrl(){if(!u.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");switch(u.app.env){case"production":return"https://api.chainrails.io/api/v1";case"staging":return"https://dev.chainrails.io/api/v1";case"internal":return"https://dev.chainrails.io/api/v1";default:return"https://api.chainrails.io/api/v1"}}static getPayModalUrl(e){if(!u.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");const n=u.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:""}`;return n+o+r}}let x=null;function Ye(){x=b.create({prefixUrl:u.getBaseUrl(),headers:{"Content-Type":"application/json"},hooks:{beforeRequest:[s=>{const e=u.getSessionToken()||u.getApiKey();s.headers.set("Authorization",`Bearer ${e}`)}],afterResponse:[(s,e,n)=>n]},retry:{limit:2}})}function c(){return x||Ye(),x}class qe{async getById(e){return await c().get("intents/"+e).json()}async getForSender(e){return await c().get("intents/user/"+e).json()}async getForAddress(e){return await c().get("intents/address/"+e).json()}async getForSession(e){return await c().get("modal/sessions/intents/"+e).json()}async getAll(e){return await c().get("intents",{searchParams:e}).json()}async create(e){const n=f(e.source_chain),a=f(e.destination_chain);return await c().post("intents",{json:{...e,source_chain:n,destination_chain:a}}).json()}async createForSession(e){const n=f(e.sourceChain);return await c().post("modal/sessions/intents",{json:{...e,sourceChain:n}}).json()}async update(e,n){return await c().post("intents",{json:n}).json()}async triggerProcessing(e){return await c().post(`intents/${e}/trigger-processing`).json()}async triggerProcessingForSession(e){return await c().post(`modal/sessions/intents/${e}/process`).json()}}class Xe{async getFromSpecificBridge(e){const n=f(e.sourceChain);O(n,e.tokenIn,e.amountSymbol);const a=f(e.destinationChain);return await c().get("quotes/single",{searchParams:{...e,sourceChain:n,destinationChain:a}}).json()}async getFromAllBridges(e){const n=f(e.sourceChain);O(n,e.tokenIn,e.amountSymbol);const a=f(e.destinationChain);return await c().get("quotes/multiple",{searchParams:{...e,sourceChain:n,destinationChain:a}}).json()}async getBestAcrossBridges(e){const n=f(e.sourceChain);O(n,e.tokenIn,e.amountSymbol);const a=f(e.destinationChain);return await c().get("quotes/best",{searchParams:{...e,sourceChain:n,destinationChain:a}}).json()}async getAll(e){const n=f(e.destinationChain);return await c().get("quotes/multi-source",{searchParams:{...e,destinationChain:n}}).json()}async getAllForSession(e){return await c().get("modal/sessions/quotes",{searchParams:e}).json()}}class Qe{async getOptimalRoutes(e){const n=f(e.sourceChain),a=f(e.destinationChain);return await c().get("router/optimal-route",{searchParams:{...e,sourceChain:n,destinationChain:a}}).json()}async getAllSupportedBridges(){return await c().get("router/supported-bridges/all").json()}async getSupportedBridges(e){const n=f(e.sourceChain),a=f(e.destinationChain);return await c().get("router/supported-bridges/route",{searchParams:{...e,sourceChain:n,destinationChain:a}}).json()}async getSupportedRoutes(e){return await c().get("router/supported-routes/bridge/"+e).json()}}class Je{async getSupported(e){return await c().get("chains",{searchParams:e}).json()}async getBalance(e){return await c().get(`chains/balances/${e.address}`,{searchParams:e}).json()}}class Ze{async getClientInfo(){return await c().get("client/auth/client-info").json()}async getClientInfoForSession(){return await c().get("modal/sessions/client").json()}}class es{async getSessionToken(e){const n=f(e.destinationChain);let a=te(n,e.token);a||(console.error(`${e.token} on ${e.destinationChain} is currently unsupported, defaulting to usdc`),a=te(n,"USDC"));const o={recipient:e.recipient,tokenOut:a,destinationChain:n,amount:e.amount};return c().post("modal/sessions",{json:o}).json().then(r=>({...r,amount:o.amount}))}async getHandOffToken(){return c().post("modal/sessions/handoff-token").json()}async resumeSession(e){return c().post(`modal/sessions/${e.sessionId}/resume`,{json:e}).json()}}const ss="modal/sessions/history";class ns{async getHistoryForSession(e){return c().post(ss,{json:e}).json()}}const ts={FONBNK:"FONBNK",ONRAMP_MONEY:"ONRAMP_MONEY"},as={PENDING:"PENDING",INITIATED:"INITIATED",PROCESSING:"PROCESSING",COMPLETED:"COMPLETED",FAILED:"FAILED",CANCELLED:"CANCELLED",EXPIRED:"EXPIRED",REFUNDED:"REFUNDED"};class os{async getQuotes(e){return await c().get("ramp/quotes",{searchParams:e}).json()}async getCountries(e){return await c().get("ramp/countries",{searchParams:e}).json()}async getCurrencies(e){return await c().get("ramp/currencies",{searchParams:e}).json()}async createOrder(e){return await c().post("ramp/orders",{json:e}).json()}async getOrder(e){return await c().get(`ramp/orders/${e}`).json()}async getOrderByIntent(e){return await c().get(`ramp/orders/by-intent/${e}`).json()}async listOrders(e){return await c().get("ramp/orders",{searchParams:e}).json()}async confirmOrder(e){return await c().post(`ramp/orders/${e}/confirm`).json()}async cancelOrder(e){return await c().post(`ramp/orders/${e}/cancel`).json()}}const is={ACROSS:"ACROSS",CCTP:"CCTP",GATEWAY:"GATEWAY",RHINOFI:"RHINOFI"},rs={router:new Qe,quotes:new Xe,intents:new qe,chains:new Je,client:new Ze,auth:new es,history:new ns,ramp:new os};m.AmountSymbols=t,m.Bridges=is,m.Chainrails=u,m.Chains=ae,m.RampOrderStatuses=as,m.RampProviders=ts,m.Tokens=ze,m.crapi=rs,m.environment=M,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})}));
2
+ `);super(i,n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=a,this.docsPath=o,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=e,this.version=P}walk(e){return H(this,e)}}function H(s,e){return e?.(s)?s:s&&typeof s=="object"&&"cause"in s&&s.cause!==void 0?H(s.cause,e):e?null:s}class $ extends S{constructor({size:e,targetSize:n,type:a}){super(`${a.charAt(0).toUpperCase()}${a.slice(1).toLowerCase()} size (${e}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}}function A(s,{dir:e,size:n=32}={}){return typeof s=="string"?oe(s,{dir:e,size:n}):ie(s,{dir:e,size:n})}function oe(s,{dir:e,size:n=32}={}){if(n===null)return s;const a=s.replace("0x","");if(a.length>n*2)throw new $({size:Math.ceil(a.length/2),targetSize:n,type:"hex"});return`0x${a[e==="right"?"padEnd":"padStart"](n*2,"0")}`}function ie(s,{dir:e,size:n=32}={}){if(n===null)return s;if(s.length>n)throw new $({size:s.length,targetSize:n,type:"bytes"});const a=new Uint8Array(n);for(let o=0;o<n;o++){const r=e==="right";a[r?o:n-o-1]=s[r?o:s.length-o-1]}return a}class re extends S{constructor({max:e,min:n,signed:a,size:o,value:r}){super(`Number "${r}" is not in safe ${o?`${o*8}-bit ${a?"signed":"unsigned"} `:""}integer range ${e?`(${n} to ${e})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}}class ce extends S{constructor({givenSize:e,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function N(s,{size:e}){if(F(s)>e)throw new ce({givenSize:F(s),maxSize:e})}function de(s,e={}){const{signed:n,size:a}=e,o=BigInt(s);let r;a?n?r=(1n<<BigInt(a)*8n-1n)-1n:r=2n**(BigInt(a)*8n)-1n:typeof s=="number"&&(r=BigInt(Number.MAX_SAFE_INTEGER));const i=typeof r=="bigint"&&n?-r-1n:0;if(r&&o>r||o<i){const E=typeof s=="bigint"?"n":"";throw new re({max:r?`${r}${E}`:void 0,min:`${i}${E}`,signed:n,size:a,value:`${s}${E}`})}const l=`0x${(n&&o<0?(1n<<BigInt(a*8))+BigInt(o):o).toString(16)}`;return a?A(l,{size:a}):l}const le=new TextEncoder;function ue(s,e={}){return typeof s=="number"||typeof s=="bigint"?me(s,e):typeof s=="boolean"?ge(s,e):R(s)?L(s,e):_(s,e)}function ge(s,e={}){const n=new Uint8Array(1);return n[0]=Number(s),typeof e.size=="number"?(N(n,{size:e.size}),A(n,{size:e.size})):n}const T={zero:48,nine:57,A:65,F:70,a:97,f:102};function j(s){if(s>=T.zero&&s<=T.nine)return s-T.zero;if(s>=T.A&&s<=T.F)return s-(T.A-10);if(s>=T.a&&s<=T.f)return s-(T.a-10)}function L(s,e={}){let n=s;e.size&&(N(n,{size:e.size}),n=A(n,{dir:"right",size:e.size}));let a=n.slice(2);a.length%2&&(a=`0${a}`);const o=a.length/2,r=new Uint8Array(o);for(let i=0,l=0;i<o;i++){const E=j(a.charCodeAt(l++)),p=j(a.charCodeAt(l++));if(E===void 0||p===void 0)throw new S(`Invalid byte sequence ("${a[l-2]}${a[l-1]}" in "${a}").`);r[i]=E*16+p}return r}function me(s,e){const n=de(s,e);return L(n)}function _(s,e={}){const n=le.encode(s);return typeof e.size=="number"?(N(n,{size:e.size}),A(n,{dir:"right",size:e.size})):n}const U=BigInt(2**32-1),z=BigInt(32);function fe(s,e=!1){return e?{h:Number(s&U),l:Number(s>>z&U)}:{h:Number(s>>z&U)|0,l:Number(s&U)|0}}function he(s,e=!1){const n=s.length;let a=new Uint32Array(n),o=new Uint32Array(n);for(let r=0;r<n;r++){const{h:i,l}=fe(s[r],e);[a[r],o[r]]=[i,l]}return[a,o]}const Ee=(s,e,n)=>s<<n|e>>>32-n,Te=(s,e,n)=>e<<n|s>>>32-n,Se=(s,e,n)=>e<<n-32|s>>>64-n,pe=(s,e,n)=>s<<n-32|e>>>64-n;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function Ce(s){return s instanceof Uint8Array||ArrayBuffer.isView(s)&&s.constructor.name==="Uint8Array"}function K(s){if(!Number.isSafeInteger(s)||s<0)throw new Error("positive integer expected, got "+s)}function y(s,...e){if(!Ce(s))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(s.length))throw new Error("Uint8Array expected of length "+e+", got length="+s.length)}function W(s,e=!0){if(s.destroyed)throw new Error("Hash instance has been destroyed");if(e&&s.finished)throw new Error("Hash#digest() has already been called")}function be(s,e){y(s);const n=e.outputLen;if(s.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function De(s){return new Uint32Array(s.buffer,s.byteOffset,Math.floor(s.byteLength/4))}function V(...s){for(let e=0;e<s.length;e++)s[e].fill(0)}const Ae=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Ue(s){return s<<24&4278190080|s<<8&16711680|s>>>8&65280|s>>>24&255}function ye(s){for(let e=0;e<s.length;e++)s[e]=Ue(s[e]);return s}const G=Ae?s=>s:ye;function Ie(s){if(typeof s!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(s))}function Y(s){return typeof s=="string"&&(s=Ie(s)),y(s),s}class Re{}function ke(s){const e=a=>s().update(Y(a)).digest(),n=s();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>s(),e}const Ne=BigInt(0),D=BigInt(1),ve=BigInt(2),we=BigInt(7),Be=BigInt(256),Oe=BigInt(113),q=[],X=[],Q=[];for(let s=0,e=D,n=1,a=0;s<24;s++){[n,a]=[a,(2*n+3*a)%5],q.push(2*(5*a+n)),X.push((s+1)*(s+2)/2%64);let o=Ne;for(let r=0;r<7;r++)e=(e<<D^(e>>we)*Oe)%Be,e&ve&&(o^=D<<(D<<BigInt(r))-D);Q.push(o)}const J=he(Q,!0),Me=J[0],xe=J[1],Z=(s,e,n)=>n>32?Se(s,e,n):Ee(s,e,n),ee=(s,e,n)=>n>32?pe(s,e,n):Te(s,e,n);function Fe(s,e=24){const n=new Uint32Array(10);for(let a=24-e;a<24;a++){for(let i=0;i<10;i++)n[i]=s[i]^s[i+10]^s[i+20]^s[i+30]^s[i+40];for(let i=0;i<10;i+=2){const l=(i+8)%10,E=(i+2)%10,p=n[E],C=n[E+1],cs=Z(p,C,1)^n[l],ds=ee(p,C,1)^n[l+1];for(let I=0;I<50;I+=10)s[i+I]^=cs,s[i+I+1]^=ds}let o=s[2],r=s[3];for(let i=0;i<24;i++){const l=X[i],E=Z(o,r,l),p=ee(o,r,l),C=q[i];o=s[C],r=s[C+1],s[C]=E,s[C+1]=p}for(let i=0;i<50;i+=10){for(let l=0;l<10;l++)n[l]=s[i+l];for(let l=0;l<10;l++)s[i+l]^=~n[(l+2)%10]&n[(l+4)%10]}s[0]^=Me[a],s[1]^=xe[a]}V(n)}class v extends Re{constructor(e,n,a,o=!1,r=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=n,this.outputLen=a,this.enableXOF=o,this.rounds=r,K(a),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=De(this.state)}clone(){return this._cloneInto()}keccak(){G(this.state32),Fe(this.state32,this.rounds),G(this.state32),this.posOut=0,this.pos=0}update(e){W(this),e=Y(e),y(e);const{blockLen:n,state:a}=this,o=e.length;for(let r=0;r<o;){const i=Math.min(n-this.pos,o-r);for(let l=0;l<i;l++)a[this.pos++]^=e[r++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:n,pos:a,blockLen:o}=this;e[a]^=n,(n&128)!==0&&a===o-1&&this.keccak(),e[o-1]^=128,this.keccak()}writeInto(e){W(this,!1),y(e),this.finish();const n=this.state,{blockLen:a}=this;for(let o=0,r=e.length;o<r;){this.posOut>=a&&this.keccak();const i=Math.min(a-this.posOut,r-o);e.set(n.subarray(this.posOut,this.posOut+i),o),this.posOut+=i,o+=i}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return K(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(be(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,V(this.state)}_cloneInto(e){const{blockLen:n,suffix:a,outputLen:o,rounds:r,enableXOF:i}=this;return e||(e=new v(n,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}}const Pe=(s,e,n)=>ke(()=>new v(e,s,n)),He=Pe(1,136,256/8);function $e(s,e){return He(R(s,{strict:!1})?ue(s):s)}class je extends S{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class se extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const n=super.get(e);return super.has(e)&&n!==void 0&&(this.delete(e),super.set(e,n)),n}set(e,n){if(super.set(e,n),this.maxSize&&this.size>this.maxSize){const a=this.keys().next().value;a&&this.delete(a)}return this}}const w=new se(8192);function ne(s,e){if(w.has(`${s}.${e}`))return w.get(`${s}.${e}`);const n=s.substring(2).toLowerCase(),a=$e(_(n)),o=n.split("");for(let i=0;i<40;i+=2)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());const r=`0x${o.join("")}`;return w.set(`${s}.${e}`,r),r}function g(s,e){if(!_e(s,{strict:!1}))throw new je({address:s});return ne(s,e)}const Le=/^0x[a-fA-F0-9]{40}$/,B=new se(8192);function _e(s,e){const{strict:n=!0}=e??{},a=`${s}.${n}`;if(B.has(a))return B.get(a);const o=Le.test(s)?s.toLowerCase()===s?!0:n?ne(s)===s:!0:!1;return B.set(a,o),o}const t={USDC:"USDC",USDT:"USDT",DAI:"DAI",BUSD:"BUSD",EURC:"EURC",ETH:"ETH",WETH:"WETH",STRK:"STRK",BNB:"BNB",LORDS:"LORDS"};t.USDC;const h={[d.ARBITRUM]:{[t.DAI]:{address:g("0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1"),symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!0},[t.USDC]:{address:g("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1},[t.USDT]:{address:g("0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9"),symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[t.WETH]:{address:g("0x82aF49447D8a07e3bd95BD0d56f35241523fBab1"),symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[d.ARBITRUM_TESTNET]:{[t.USDC]:{address:g("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),symbol:t.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1}},[d.AVALANCHE]:{[t.DAI]:{address:"0xd586E7F844cEa2F87f50152665BCbc2C279D8d70",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.USDC]:{address:g("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),symbol:t.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[t.USDT]:{address:"0x9702230A8Ea53601f5cD2dc00fDBc13d4dF4A8c7",symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[t.WETH]:{address:"0x49D5c2BdFfac6CE2BFdB6640F4F80f226bc10bAB",symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[d.AVALANCHE_TESTNET]:{[t.USDC]:{address:g("0x5425890298aed601595a70AB815c96711a31Bc65"),symbol:t.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1}},[d.BASE]:{[t.DAI]:{address:"0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!0},[t.EURC]:{address:"0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42",symbol:t.EURC,name:"Euro Coin",decimals:6,logoURI:"/images/tokens/eurc.png",nativeToken:!1},[t.USDC]:{address:g("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),symbol:t.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[t.WETH]:{address:g("0x4200000000000000000000000000000000000006"),symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[d.BASE_TESTNET]:{[t.USDC]:{address:g("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),symbol:t.USDC,name:"USD Coin",fiatISO:"USD",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1}},[d.BSC]:{[t.BNB]:{address:"0x0000000000000000000000000000000000000000",symbol:t.BNB,name:"BNB",decimals:18,logoURI:"/images/chains/bsc.webp",nativeToken:!0},[t.BUSD]:{address:"0xe9e7CEA3DedcA5984780Bafc599bD69ADd087D56",symbol:t.BUSD,name:"Binance USD",decimals:18,logoURI:"/images/tokens/busd.png",nativeToken:!1},[t.DAI]:{address:"0x1AF3F329e8BE154074D8769D1FFa4eE058B1DBc3",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x2170Ed0880ac9A755fd29B2688956BD959F933F8",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!1},[t.USDC]:{address:g("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),symbol:t.USDC,decimals:18,name:"USD Coin",logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[t.USDT]:{address:"0x55d398326f99059fF775485246999027B3197955",symbol:t.USDT,name:"Tether USD",decimals:18,logoURI:"/images/tokens/usdt.png",nativeToken:!1}},[d.ETHEREUM]:{[t.BUSD]:{address:"0x4Fabb145d64652a948d72533023f6E7A623C7C53",symbol:t.BUSD,name:"Binance USD",decimals:18,logoURI:"/images/tokens/busd.png",nativeToken:!1},[t.DAI]:{address:g("0x6B175474E89094C44Da98b954EedeAC495271d0F"),symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!0},[t.EURC]:{address:"0x1aBaEA1f7C830bD89Acc67eC4af516284b1bC33c",symbol:t.EURC,name:"Euro Coin",decimals:6,logoURI:"/images/tokens/eurc.png",nativeToken:!1},[t.STRK]:{address:"0xCa14007Eff0dB1f8135f4C25B34De49AB0d42766",symbol:t.STRK,name:"Starknet Token",decimals:18,logoURI:"/images/chains/starknet.svg",nativeToken:!1},[t.USDC]:{address:g("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[t.USDT]:{address:g("0xdAC17F958D2ee523a2206206994597C13D831ec7"),symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[t.WETH]:{address:g("0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"),symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[d.ETHEREUM_TESTNET]:{[t.USDC]:{address:g("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),symbol:t.USDC,decimals:6,name:"USD Coin",logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1}},[d.HYPEREVM]:{[t.USDC]:{address:"0xb88339CB7199b77E23DB6E890353E22632Ba630f",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[d.LISK]:{[t.USDC]:{address:"0xF242275d3a6527d877f2c927a82D9b057609cc71",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[d.MONAD]:{[t.USDC]:{address:"0x754704Bc059F8C67012fEd69BC8A327a5aafb603",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[d.MONAD_TESTNET]:{[t.USDC]:{address:"0x534b2f3A21130d7a60830c2Df862319e593943A3",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[d.OPTIMISM]:{[t.DAI]:{address:"0xDA10009cBd5D07dd0CeCc66161FC93D7c9000da1",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x0000000000000000000000000000000000000000",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!0},[t.USDC]:{address:"0x0b2C639c533813f4Aa9D7837CAf62653d097Ff85",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1},[t.USDT]:{address:"0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[t.WETH]:{address:"0x4200000000000000000000000000000000000006",symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[d.OPTIMISM_TESTNET]:{[t.USDC]:{address:"0x5fd84259d66Cd46123540766Be93DFE6D43130D7",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}},[d.POLYGON]:{[t.DAI]:{address:"0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.USDC]:{address:"0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1},[t.USDT]:{address:"0xc2132D05D31c914a87C6611C10748AEb04B58e8F",symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1},[t.WETH]:{address:"0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619",symbol:t.WETH,name:"Wrapped Ether",decimals:18,logoURI:"/images/tokens/weth.png",nativeToken:!1}},[d.STARKNET]:{[t.DAI]:{address:"0x05574eb6b8789a91466f902c380d978e472db68170ff82a5b650b95a58ddf4ad",symbol:t.DAI,name:"Dai Stablecoin",decimals:18,logoURI:"/images/tokens/dai.png",nativeToken:!1},[t.ETH]:{address:"0x049d36570d4e46f48e99674bd3fcc84644ddd6b96f7c741b1562b82f9e004dc7",symbol:t.ETH,name:"Ethereum",decimals:18,logoURI:"/images/chains/ethereum.svg",nativeToken:!1},[t.LORDS]:{address:"0x0124aeb495b947201f5faC96fD1138E326AD86195B98df6DEc9009158A533B49",symbol:t.LORDS,name:"LORDS Token",decimals:18,logoURI:"/images/tokens/lords.png",nativeToken:!1},[t.STRK]:{address:"0x04718f5a0Fc34cC1AF16A1cdee98fFB20C31f5cD61D6Ab07201858f4287c938D",symbol:t.STRK,name:"Starknet Token",decimals:18,logoURI:"/images/chains/starknet.svg",nativeToken:!1},[t.USDC]:{address:"0x033068F6539f8e6e6b131e6B2B814e6c34A5224bC66947c47DaB9dFeE93b35fb",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png",nativeToken:!1},[t.USDT]:{address:"0x068f5c6a61780768455de69077e07e89787839bf8166decfbf92b645209c0fb8",symbol:t.USDT,name:"Tether USD",decimals:6,logoURI:"/images/tokens/usdt.png",nativeToken:!1}},[d.STARKNET_TESTNET]:{[t.USDC]:{address:"0x0512feAc6339Ff7889822cb5aA2a86C848e9D392bB0E3E237C008674feeD8343",symbol:t.USDC,name:"USD Coin",decimals:6,logoURI:"/images/tokens/usdc.svg",nativeToken:!1}}},ze={ARBITRUM:h[d.ARBITRUM],ARBITRUM_TESTNET:h[d.ARBITRUM_TESTNET],AVALANCHE:h[d.AVALANCHE],AVALANCHE_TESTNET:h[d.AVALANCHE_TESTNET],BASE:h[d.BASE],BASE_TESTNET:h[d.BASE_TESTNET],BSC:h[d.BSC],ETHEREUM:h[d.ETHEREUM],ETHEREUM_TESTNET:h[d.ETHEREUM_TESTNET],STARKNET:h[d.STARKNET]},Ke=new Set(Object.values(d));function f(s){if(We(s))return s;const e=d[s];if(!e)throw new Error(`Invalid chain: ${s}. Chain must be a valid chain alias or internal chain value from Chains.`);return e}function We(s){return Ke.has(s)}function Ve(s,e){const n=e.toLowerCase().trim(),a=h[s];if(!a)throw new Error(`Chain not found: ${s}. The chain key must be a valid chain identifier.`);let o;for(const r in a){const i=a[r];if(i&&i.address.toLowerCase()===n.toLowerCase()){o=i;break}}if(!o)throw new Error(`Token address mismatch: address ${e} does not exist on chain ${s}. The token address must be a valid token address on the specified chain.`);return o}function O(s,e,n){const a=Ve(s,e);if(a.symbol!==n)throw new Error(`Token address and symbol mismatch: address ${e} on chain ${s} corresponds to token "${a.symbol}", but expected "${n}". The token address must correspond to a token with the expected symbol on the specified chain.`);return a}function Ge(s,e){return h[s]?.[e]}function te(s,e){return Ge(s,e)?.address}var M=(s=>(s.PRODUCTION="production",s.STAGING="staging",s))(M||{});class u{constructor({api_key:e,env:n,seesion_token:a,props:o}){this.api_key=e||"",this.sessionToken=a||"",this.env=n??M.PRODUCTION,this.props=o}static async config(e){if(!u.app){if(!e)throw new Error("Please provide an api_key");u.app=new u(e)}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}static getApiKey(){if(!u.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return u.app.api_key}static getSessionToken(){if(!u.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return u.app.sessionToken}static getProps(){if(!u.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return u.app.props}static getEnv(){if(!u.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return u.app.env==="internal"?"staging":u.app.env}static getBaseUrl(){if(!u.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");switch(u.app.env){case"production":return"https://api.chainrails.io/api/v1";case"staging":return"https://dev.chainrails.io/api/v1";case"internal":return"https://dev.chainrails.io/api/v1";default:return"https://api.chainrails.io/api/v1"}}static getPayModalUrl(e){if(!u.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");const n=u.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:""}`;return n+o+r}}let x=null;function Ye(){x=b.create({prefixUrl:u.getBaseUrl(),headers:{"Content-Type":"application/json"},hooks:{beforeRequest:[s=>{const e=u.getSessionToken()||u.getApiKey();s.headers.set("Authorization",`Bearer ${e}`)}],afterResponse:[(s,e,n)=>n]},retry:{limit:2}})}function c(){return x||Ye(),x}class qe{async getById(e){return await c().get("intents/"+e).json()}async getForSender(e){return await c().get("intents/user/"+e).json()}async getForAddress(e){return await c().get("intents/address/"+e).json()}async getForSession(e){return await c().get("modal/sessions/intents/"+e).json()}async getAll(e){return await c().get("intents",{searchParams:e}).json()}async create(e){const n=f(e.source_chain),a=f(e.destination_chain);return await c().post("intents",{json:{...e,source_chain:n,destination_chain:a}}).json()}async createForSession(e){const n=f(e.sourceChain);return await c().post("modal/sessions/intents",{json:{...e,sourceChain:n}}).json()}async update(e,n){return await c().post("intents",{json:n}).json()}async triggerProcessing(e){return await c().post(`intents/${e}/trigger-processing`).json()}async triggerProcessingForSession(e){return await c().post(`modal/sessions/intents/${e}/process`).json()}}class Xe{async getFromSpecificBridge(e){const n=f(e.sourceChain);O(n,e.tokenIn,e.amountSymbol);const a=f(e.destinationChain);return await c().get("quotes/single",{searchParams:{...e,sourceChain:n,destinationChain:a}}).json()}async getFromAllBridges(e){const n=f(e.sourceChain);O(n,e.tokenIn,e.amountSymbol);const a=f(e.destinationChain);return await c().get("quotes/multiple",{searchParams:{...e,sourceChain:n,destinationChain:a}}).json()}async getBestAcrossBridges(e){const n=f(e.sourceChain);O(n,e.tokenIn,e.amountSymbol);const a=f(e.destinationChain);return await c().get("quotes/best",{searchParams:{...e,sourceChain:n,destinationChain:a}}).json()}async getAll(e){const n=f(e.destinationChain);return await c().get("quotes/multi-source",{searchParams:{...e,destinationChain:n}}).json()}async getAllForSession(e){return await c().get("modal/sessions/quotes",{searchParams:e}).json()}}class Qe{async getOptimalRoutes(e){const n=f(e.sourceChain),a=f(e.destinationChain);return await c().get("router/optimal-route",{searchParams:{...e,sourceChain:n,destinationChain:a}}).json()}async getAllSupportedBridges(){return await c().get("router/supported-bridges/all").json()}async getSupportedBridges(e){const n=f(e.sourceChain),a=f(e.destinationChain);return await c().get("router/supported-bridges/route",{searchParams:{...e,sourceChain:n,destinationChain:a}}).json()}async getSupportedRoutes(e){return await c().get("router/supported-routes/bridge/"+e).json()}}class Je{async getSupported(e){return await c().get("chains",{searchParams:e}).json()}async getBalance(e){return await c().get(`chains/balances/${e.address}`,{searchParams:e}).json()}}class Ze{async getClientInfo(){return await c().get("client/auth/client-info").json()}async getClientInfoForSession(){return await c().get("modal/sessions/client").json()}}class es{async getSessionToken(e){const n=f(e.destinationChain);let a=te(n,e.token);a||(console.error(`${e.token} on ${e.destinationChain} is currently unsupported, defaulting to usdc`),a=te(n,"USDC"));const o={recipient:e.recipient,tokenOut:a,destinationChain:n,amount:e.amount};return c().post("modal/sessions",{json:o}).json().then(r=>({...r,amount:o.amount}))}async getHandOffToken(){return c().post("modal/sessions/handoff-token").json()}async resumeSession(e){return c().post(`modal/sessions/${e.sessionId}/resume`,{json:e}).json()}}const ss="modal/sessions/history";class ns{async getHistoryForSession(e){return c().post(ss,{json:e}).json()}}const ts={FONBNK:"FONBNK",ONRAMP_MONEY:"ONRAMP_MONEY"},as={PENDING:"PENDING",INITIATED:"INITIATED",PROCESSING:"PROCESSING",COMPLETED:"COMPLETED",FAILED:"FAILED",CANCELLED:"CANCELLED",EXPIRED:"EXPIRED",REFUNDED:"REFUNDED"};class os{async getQuotes(e){return await c().get("ramp/quotes",{searchParams:e}).json()}async getQuotesForSession(e){return await c().get("modal/sessions/ramp/quotes",{searchParams:e}).json()}async getCountries(e){return await c().get("ramp/countries",{searchParams:e}).json()}async getCountriesForSession(e){return await c().get("modal/sessions/ramp/countries",{searchParams:e}).json()}async getCurrencies(e){return await c().get("ramp/currencies",{searchParams:e}).json()}async getCurrenciesForSession(e){return await c().get("modal/sessions/ramp/currencies",{searchParams:e}).json()}async createOrder(e){return await c().post("ramp/orders",{json:e}).json()}async createOrderForSession(e){return await c().post("modal/sessions/ramp/orders",{json:e}).json()}async getOrder(e){return await c().get(`ramp/orders/${e}`).json()}async getOrderForSession(e){return await c().get(`modal/sessions/ramp/orders/${e}`).json()}async getOrderByIntent(e){return await c().get(`ramp/orders/by-intent/${e}`).json()}async listOrders(e){return await c().get("ramp/orders",{searchParams:e}).json()}async confirmOrder(e){return await c().post(`ramp/orders/${e}/confirm`).json()}async confirmOrderForSession(e){return await c().post(`modal/sessions/ramp/orders/${e}/confirm`).json()}async cancelOrder(e){return await c().post(`ramp/orders/${e}/cancel`).json()}}const is={ACROSS:"ACROSS",CCTP:"CCTP",GATEWAY:"GATEWAY",RHINOFI:"RHINOFI"},rs={router:new Qe,quotes:new Xe,intents:new qe,chains:new Je,client:new Ze,auth:new es,history:new ns,ramp:new os};m.AmountSymbols=t,m.Bridges=is,m.Chainrails=u,m.Chains=ae,m.RampOrderStatuses=as,m.RampProviders=ts,m.Tokens=ze,m.crapi=rs,m.environment=M,Object.defineProperty(m,Symbol.toStringTag,{value:"Module"})}));
@@ -5,25 +5,30 @@ export default class Ramp {
5
5
  * Fans out to multiple providers and picks the cheapest path.
6
6
  */
7
7
  getQuotes(input: getQuotesInput): Promise<getQuotesOutput>;
8
+ getQuotesForSession(input: getQuotesInput): Promise<getQuotesOutput>;
8
9
  /**
9
10
  * Get all supported countries with currency details.
10
11
  * Use this as the primary discovery endpoint.
11
12
  */
12
13
  getCountries(input?: getCountriesInput): Promise<getCountriesOutput>;
14
+ getCountriesForSession(input?: getCountriesInput): Promise<getCountriesOutput>;
13
15
  /**
14
16
  * Get a deduplicated list of supported fiat currencies.
15
17
  * Useful for currency dropdowns.
16
18
  */
17
19
  getCurrencies(input?: getCurrenciesInput): Promise<getCurrenciesOutput>;
20
+ getCurrenciesForSession(input?: getCurrenciesInput): Promise<getCurrenciesOutput>;
18
21
  /**
19
22
  * Create a fiat-to-crypto order.
20
23
  * Returns a provider widget URL for the user to complete payment.
21
24
  */
22
25
  createOrder(input: createRampOrderInput): Promise<createRampOrderOutput>;
26
+ createOrderForSession(input: createRampOrderInput): Promise<createRampOrderOutput>;
23
27
  /**
24
28
  * Get an order by ID.
25
29
  */
26
30
  getOrder(id: string): Promise<getRampOrderOutput>;
31
+ getOrderForSession(id: string): Promise<getRampOrderOutput>;
27
32
  /**
28
33
  * Get an order by intent address.
29
34
  */
@@ -36,6 +41,7 @@ export default class Ramp {
36
41
  * Confirm an order after the user completes the deposit action.
37
42
  */
38
43
  confirmOrder(id: string): Promise<confirmRampOrderOutput>;
44
+ confirmOrderForSession(id: string): Promise<confirmRampOrderOutput>;
39
45
  /**
40
46
  * Cancel an order if it's still in a cancellable state.
41
47
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Ramp/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,0BAA0B,EAC3B,MAAM,SAAS,CAAC;AAEjB,MAAM,CAAC,OAAO,OAAO,IAAI;IACvB;;;OAGG;IACG,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IAIhE;;;OAGG;IACG,YAAY,CAAC,KAAK,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAI1E;;;OAGG;IACG,aAAa,CAAC,KAAK,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAI7E;;;OAGG;IACG,WAAW,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAI9E;;OAEG;IACG,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAIvD;;OAEG;IACG,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAIlF;;OAEG;IACG,UAAU,CAAC,KAAK,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAI5E;;OAEG;IACG,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAI/D;;OAEG;IACG,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAG9D;AAED,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/Ramp/index.ts"],"names":[],"mappings":"AACA,OAAO,EACL,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,qBAAqB,EACrB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,0BAA0B,EAC3B,MAAM,SAAS,CAAC;AAEjB,MAAM,CAAC,OAAO,OAAO,IAAI;IACvB;;;OAGG;IACG,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IAG1D,mBAAmB,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IAI1E;;;OAGG;IACG,YAAY,CAAC,KAAK,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAGpE,sBAAsB,CAAC,KAAK,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAIpF;;;OAGG;IACG,aAAa,CAAC,KAAK,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAGvE,uBAAuB,CAAC,KAAK,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAIvF;;;OAGG;IACG,WAAW,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAGxE,qBAAqB,CAAC,KAAK,EAAE,oBAAoB,GAAG,OAAO,CAAC,qBAAqB,CAAC;IAIxF;;OAEG;IACG,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAGjD,kBAAkB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAIjE;;OAEG;IACG,gBAAgB,CAAC,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,CAAC;IAIlF;;OAEG;IACG,UAAU,CAAC,KAAK,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAI5E;;OAEG;IACG,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAGzD,sBAAsB,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAIzE;;OAEG;IACG,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC;CAG9D;AAED,cAAc,SAAS,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chainrails/sdk",
3
3
  "sideEffects": false,
4
- "version": "0.3.6",
4
+ "version": "0.3.7",
5
5
  "main": "./dist/chainrails-sdk.umd.js",
6
6
  "module": "./dist/chainrails-sdk.es.mjs",
7
7
  "license": "MIT",