@chainrails/common 0.2.0 → 0.2.2

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.
@@ -252,22 +252,22 @@ function De(e, t = !1) {
252
252
  }
253
253
  return [s, o];
254
254
  }
255
- const Ce = (e, t, n) => e << n | t >>> 32 - n, ve = (e, t, n) => t << n | e >>> 32 - n, Be = (e, t, n) => t << n - 32 | e >>> 64 - n, ke = (e, t, n) => e << n - 32 | t >>> 64 - n;
255
+ const Ce = (e, t, n) => e << n | t >>> 32 - n, ve = (e, t, n) => t << n | e >>> 32 - n, Ne = (e, t, n) => t << n - 32 | e >>> 64 - n, Be = (e, t, n) => e << n - 32 | t >>> 64 - n;
256
256
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
257
- function Ne(e) {
257
+ function ke(e) {
258
258
  return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
259
259
  }
260
- function _(e) {
260
+ function P(e) {
261
261
  if (!Number.isSafeInteger(e) || e < 0)
262
262
  throw new Error("positive integer expected, got " + e);
263
263
  }
264
264
  function E(e, ...t) {
265
- if (!Ne(e))
265
+ if (!ke(e))
266
266
  throw new Error("Uint8Array expected");
267
267
  if (t.length > 0 && !t.includes(e.length))
268
268
  throw new Error("Uint8Array expected of length " + t + ", got length=" + e.length);
269
269
  }
270
- function P(e, t = !0) {
270
+ function _(e, t = !0) {
271
271
  if (e.destroyed)
272
272
  throw new Error("Hash instance has been destroyed");
273
273
  if (t && e.finished)
@@ -306,19 +306,19 @@ function ce(e) {
306
306
  }
307
307
  class He {
308
308
  }
309
- function _e(e) {
309
+ function Pe(e) {
310
310
  const t = (s) => e().update(ce(s)).digest(), n = e();
311
311
  return t.outputLen = n.outputLen, t.blockLen = n.blockLen, t.create = () => e(), t;
312
312
  }
313
- const Pe = BigInt(0), m = BigInt(1), Fe = BigInt(2), je = BigInt(7), Ke = BigInt(256), Ve = BigInt(113), ae = [], ue = [], le = [];
313
+ const _e = BigInt(0), m = BigInt(1), Fe = BigInt(2), je = BigInt(7), Ke = BigInt(256), Ve = BigInt(113), ae = [], ue = [], le = [];
314
314
  for (let e = 0, t = m, n = 1, s = 0; e < 24; e++) {
315
315
  [n, s] = [s, (2 * n + 3 * s) % 5], ae.push(2 * (5 * s + n)), ue.push((e + 1) * (e + 2) / 2 % 64);
316
- let o = Pe;
316
+ let o = _e;
317
317
  for (let r = 0; r < 7; r++)
318
318
  t = (t << m ^ (t >> je) * Ve) % Ke, t & Fe && (o ^= m << (m << /* @__PURE__ */ BigInt(r)) - m);
319
319
  le.push(o);
320
320
  }
321
- const he = De(le, !0), Xe = he[0], Ge = he[1], j = (e, t, n) => n > 32 ? Be(e, t, n) : Ce(e, t, n), K = (e, t, n) => n > 32 ? ke(e, t, n) : ve(e, t, n);
321
+ const he = De(le, !0), Xe = he[0], Ge = he[1], j = (e, t, n) => n > 32 ? Ne(e, t, n) : Ce(e, t, n), K = (e, t, n) => n > 32 ? Be(e, t, n) : ve(e, t, n);
322
322
  function qe(e, t = 24) {
323
323
  const n = new Uint32Array(10);
324
324
  for (let s = 24 - t; s < 24; s++) {
@@ -347,7 +347,7 @@ function qe(e, t = 24) {
347
347
  class O extends He {
348
348
  // NOTE: we accept arguments in bytes instead of bits here.
349
349
  constructor(t, n, s, o = !1, r = 24) {
350
- if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = t, this.suffix = n, this.outputLen = s, this.enableXOF = o, this.rounds = r, _(s), !(0 < t && t < 200))
350
+ if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = t, this.suffix = n, this.outputLen = s, this.enableXOF = o, this.rounds = r, P(s), !(0 < t && t < 200))
351
351
  throw new Error("only keccak-f1600 function is supported");
352
352
  this.state = new Uint8Array(200), this.state32 = $e(this.state);
353
353
  }
@@ -358,7 +358,7 @@ class O extends He {
358
358
  F(this.state32), qe(this.state32, this.rounds), F(this.state32), this.posOut = 0, this.pos = 0;
359
359
  }
360
360
  update(t) {
361
- P(this), t = ce(t), E(t);
361
+ _(this), t = ce(t), E(t);
362
362
  const { blockLen: n, state: s } = this, o = t.length;
363
363
  for (let r = 0; r < o; ) {
364
364
  const i = Math.min(n - this.pos, o - r);
@@ -376,7 +376,7 @@ class O extends He {
376
376
  t[s] ^= n, (n & 128) !== 0 && s === o - 1 && this.keccak(), t[o - 1] ^= 128, this.keccak();
377
377
  }
378
378
  writeInto(t) {
379
- P(this, !1), E(t), this.finish();
379
+ _(this, !1), E(t), this.finish();
380
380
  const n = this.state, { blockLen: s } = this;
381
381
  for (let o = 0, r = t.length; o < r; ) {
382
382
  this.posOut >= s && this.keccak();
@@ -391,7 +391,7 @@ class O extends He {
391
391
  return this.writeInto(t);
392
392
  }
393
393
  xof(t) {
394
- return _(t), this.xofInto(new Uint8Array(t));
394
+ return P(t), this.xofInto(new Uint8Array(t));
395
395
  }
396
396
  digestInto(t) {
397
397
  if (Re(t, this), this.finished)
@@ -409,7 +409,7 @@ class O extends He {
409
409
  return t || (t = new O(n, s, o, i, r)), t.state32.set(this.state32), t.pos = this.pos, t.posOut = this.posOut, t.finished = this.finished, t.rounds = r, t.suffix = s, t.outputLen = o, t.enableXOF = i, t.destroyed = this.destroyed, t;
410
410
  }
411
411
  }
412
- const We = (e, t, n) => _e(() => new O(t, e, n)), Je = We(1, 136, 256 / 8);
412
+ const We = (e, t, n) => Pe(() => new O(t, e, n)), Je = We(1, 136, 256 / 8);
413
413
  function Qe(e, t) {
414
414
  return Je($(e, { strict: !1 }) ? Ue(e) : e);
415
415
  }
@@ -516,21 +516,21 @@ const T = {
516
516
  decimals: 6,
517
517
  logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
518
518
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
519
- }, B = {
519
+ }, N = {
520
520
  chainId: W.chainId,
521
521
  address: d("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),
522
522
  symbol: "USDC",
523
523
  decimals: 18,
524
524
  logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
525
525
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
526
- }, k = {
526
+ }, B = {
527
527
  chainId: Q.chainId,
528
528
  address: d("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),
529
529
  symbol: "USDC",
530
530
  decimals: 6,
531
531
  logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
532
532
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
533
- }, N = {
533
+ }, k = {
534
534
  chainId: J.chainId,
535
535
  address: d("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
536
536
  symbol: "USDC",
@@ -551,9 +551,9 @@ const T = {
551
551
  [D.chainId]: D,
552
552
  [C.chainId]: C,
553
553
  [v.chainId]: v,
554
+ [B.chainId]: B,
554
555
  [k.chainId]: k,
555
- [N.chainId]: N,
556
- [B.chainId]: B
556
+ [N.chainId]: N
557
557
  }, R = {
558
558
  ARBITRUM_MAINNET: {
559
559
  ...V,
@@ -600,21 +600,21 @@ const T = {
600
600
  BSC_MAINNET: {
601
601
  ...W,
602
602
  tokens: {
603
- [l.USDC]: B
603
+ [l.USDC]: N
604
604
  },
605
605
  explorer: "https://bscscan.com"
606
606
  },
607
607
  ETHEREUM_MAINNET: {
608
608
  ...J,
609
609
  tokens: {
610
- [l.USDC]: N
610
+ [l.USDC]: k
611
611
  },
612
612
  explorer: "https://etherscan.io"
613
613
  },
614
614
  ETHEREUM_TESTNET: {
615
615
  ...Q,
616
616
  tokens: {
617
- [l.USDC]: k
617
+ [l.USDC]: B
618
618
  },
619
619
  explorer: "https://sepolia.etherscan.io"
620
620
  },
@@ -683,8 +683,8 @@ class a {
683
683
  static getPayModalUrl(t) {
684
684
  if (!a.app)
685
685
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
686
- const n = a.app.env === "internal" ? "https://chainrails-frontend-git-staging-horus-labs.vercel.app" : "https://app.chainrails.io", s = t && t > 0 ? "/pay/" : "/deposit/", o = `${t ? t * 100 : ""}`;
687
- return n + s + o;
686
+ const n = a.app.env === "internal" ? "https://chainrails-frontend-git-staging-horus-labs.vercel.app" : "https://app.chainrails.io", s = Number(t), o = t && !isNaN(Number(t)) && s > 0 ? "/pay/" : "/deposit/", r = `${t && !isNaN(Number(t)) && s > 0 ? s * 100 : ""}`;
687
+ return n + o + r;
688
688
  }
689
689
  }
690
690
  export {
@@ -252,22 +252,22 @@ function De(e, t = !1) {
252
252
  }
253
253
  return [s, o];
254
254
  }
255
- const Ce = (e, t, n) => e << n | t >>> 32 - n, ve = (e, t, n) => t << n | e >>> 32 - n, Be = (e, t, n) => t << n - 32 | e >>> 64 - n, ke = (e, t, n) => e << n - 32 | t >>> 64 - n;
255
+ const Ce = (e, t, n) => e << n | t >>> 32 - n, ve = (e, t, n) => t << n | e >>> 32 - n, Ne = (e, t, n) => t << n - 32 | e >>> 64 - n, Be = (e, t, n) => e << n - 32 | t >>> 64 - n;
256
256
  /*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
257
- function Ne(e) {
257
+ function ke(e) {
258
258
  return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
259
259
  }
260
- function _(e) {
260
+ function P(e) {
261
261
  if (!Number.isSafeInteger(e) || e < 0)
262
262
  throw new Error("positive integer expected, got " + e);
263
263
  }
264
264
  function E(e, ...t) {
265
- if (!Ne(e))
265
+ if (!ke(e))
266
266
  throw new Error("Uint8Array expected");
267
267
  if (t.length > 0 && !t.includes(e.length))
268
268
  throw new Error("Uint8Array expected of length " + t + ", got length=" + e.length);
269
269
  }
270
- function P(e, t = !0) {
270
+ function _(e, t = !0) {
271
271
  if (e.destroyed)
272
272
  throw new Error("Hash instance has been destroyed");
273
273
  if (t && e.finished)
@@ -306,19 +306,19 @@ function ce(e) {
306
306
  }
307
307
  class He {
308
308
  }
309
- function _e(e) {
309
+ function Pe(e) {
310
310
  const t = (s) => e().update(ce(s)).digest(), n = e();
311
311
  return t.outputLen = n.outputLen, t.blockLen = n.blockLen, t.create = () => e(), t;
312
312
  }
313
- const Pe = BigInt(0), m = BigInt(1), Fe = BigInt(2), je = BigInt(7), Ke = BigInt(256), Ve = BigInt(113), ae = [], ue = [], le = [];
313
+ const _e = BigInt(0), m = BigInt(1), Fe = BigInt(2), je = BigInt(7), Ke = BigInt(256), Ve = BigInt(113), ae = [], ue = [], le = [];
314
314
  for (let e = 0, t = m, n = 1, s = 0; e < 24; e++) {
315
315
  [n, s] = [s, (2 * n + 3 * s) % 5], ae.push(2 * (5 * s + n)), ue.push((e + 1) * (e + 2) / 2 % 64);
316
- let o = Pe;
316
+ let o = _e;
317
317
  for (let r = 0; r < 7; r++)
318
318
  t = (t << m ^ (t >> je) * Ve) % Ke, t & Fe && (o ^= m << (m << /* @__PURE__ */ BigInt(r)) - m);
319
319
  le.push(o);
320
320
  }
321
- const he = De(le, !0), Xe = he[0], Ge = he[1], j = (e, t, n) => n > 32 ? Be(e, t, n) : Ce(e, t, n), K = (e, t, n) => n > 32 ? ke(e, t, n) : ve(e, t, n);
321
+ const he = De(le, !0), Xe = he[0], Ge = he[1], j = (e, t, n) => n > 32 ? Ne(e, t, n) : Ce(e, t, n), K = (e, t, n) => n > 32 ? Be(e, t, n) : ve(e, t, n);
322
322
  function qe(e, t = 24) {
323
323
  const n = new Uint32Array(10);
324
324
  for (let s = 24 - t; s < 24; s++) {
@@ -347,7 +347,7 @@ function qe(e, t = 24) {
347
347
  class O extends He {
348
348
  // NOTE: we accept arguments in bytes instead of bits here.
349
349
  constructor(t, n, s, o = !1, r = 24) {
350
- if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = t, this.suffix = n, this.outputLen = s, this.enableXOF = o, this.rounds = r, _(s), !(0 < t && t < 200))
350
+ if (super(), this.pos = 0, this.posOut = 0, this.finished = !1, this.destroyed = !1, this.enableXOF = !1, this.blockLen = t, this.suffix = n, this.outputLen = s, this.enableXOF = o, this.rounds = r, P(s), !(0 < t && t < 200))
351
351
  throw new Error("only keccak-f1600 function is supported");
352
352
  this.state = new Uint8Array(200), this.state32 = $e(this.state);
353
353
  }
@@ -358,7 +358,7 @@ class O extends He {
358
358
  F(this.state32), qe(this.state32, this.rounds), F(this.state32), this.posOut = 0, this.pos = 0;
359
359
  }
360
360
  update(t) {
361
- P(this), t = ce(t), E(t);
361
+ _(this), t = ce(t), E(t);
362
362
  const { blockLen: n, state: s } = this, o = t.length;
363
363
  for (let r = 0; r < o; ) {
364
364
  const i = Math.min(n - this.pos, o - r);
@@ -376,7 +376,7 @@ class O extends He {
376
376
  t[s] ^= n, (n & 128) !== 0 && s === o - 1 && this.keccak(), t[o - 1] ^= 128, this.keccak();
377
377
  }
378
378
  writeInto(t) {
379
- P(this, !1), E(t), this.finish();
379
+ _(this, !1), E(t), this.finish();
380
380
  const n = this.state, { blockLen: s } = this;
381
381
  for (let o = 0, r = t.length; o < r; ) {
382
382
  this.posOut >= s && this.keccak();
@@ -391,7 +391,7 @@ class O extends He {
391
391
  return this.writeInto(t);
392
392
  }
393
393
  xof(t) {
394
- return _(t), this.xofInto(new Uint8Array(t));
394
+ return P(t), this.xofInto(new Uint8Array(t));
395
395
  }
396
396
  digestInto(t) {
397
397
  if (Re(t, this), this.finished)
@@ -409,7 +409,7 @@ class O extends He {
409
409
  return t || (t = new O(n, s, o, i, r)), t.state32.set(this.state32), t.pos = this.pos, t.posOut = this.posOut, t.finished = this.finished, t.rounds = r, t.suffix = s, t.outputLen = o, t.enableXOF = i, t.destroyed = this.destroyed, t;
410
410
  }
411
411
  }
412
- const We = (e, t, n) => _e(() => new O(t, e, n)), Je = We(1, 136, 256 / 8);
412
+ const We = (e, t, n) => Pe(() => new O(t, e, n)), Je = We(1, 136, 256 / 8);
413
413
  function Qe(e, t) {
414
414
  return Je($(e, { strict: !1 }) ? Ue(e) : e);
415
415
  }
@@ -516,21 +516,21 @@ const T = {
516
516
  decimals: 6,
517
517
  logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
518
518
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
519
- }, B = {
519
+ }, N = {
520
520
  chainId: W.chainId,
521
521
  address: d("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),
522
522
  symbol: "USDC",
523
523
  decimals: 18,
524
524
  logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
525
525
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
526
- }, k = {
526
+ }, B = {
527
527
  chainId: Q.chainId,
528
528
  address: d("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),
529
529
  symbol: "USDC",
530
530
  decimals: 6,
531
531
  logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
532
532
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
533
- }, N = {
533
+ }, k = {
534
534
  chainId: J.chainId,
535
535
  address: d("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
536
536
  symbol: "USDC",
@@ -551,9 +551,9 @@ const T = {
551
551
  [D.chainId]: D,
552
552
  [C.chainId]: C,
553
553
  [v.chainId]: v,
554
+ [B.chainId]: B,
554
555
  [k.chainId]: k,
555
- [N.chainId]: N,
556
- [B.chainId]: B
556
+ [N.chainId]: N
557
557
  }, R = {
558
558
  ARBITRUM_MAINNET: {
559
559
  ...V,
@@ -600,21 +600,21 @@ const T = {
600
600
  BSC_MAINNET: {
601
601
  ...W,
602
602
  tokens: {
603
- [l.USDC]: B
603
+ [l.USDC]: N
604
604
  },
605
605
  explorer: "https://bscscan.com"
606
606
  },
607
607
  ETHEREUM_MAINNET: {
608
608
  ...J,
609
609
  tokens: {
610
- [l.USDC]: N
610
+ [l.USDC]: k
611
611
  },
612
612
  explorer: "https://etherscan.io"
613
613
  },
614
614
  ETHEREUM_TESTNET: {
615
615
  ...Q,
616
616
  tokens: {
617
- [l.USDC]: k
617
+ [l.USDC]: B
618
618
  },
619
619
  explorer: "https://sepolia.etherscan.io"
620
620
  },
@@ -683,8 +683,8 @@ class a {
683
683
  static getPayModalUrl(t) {
684
684
  if (!a.app)
685
685
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
686
- const n = a.app.env === "internal" ? "https://chainrails-frontend-git-staging-horus-labs.vercel.app" : "https://app.chainrails.io", s = t && t > 0 ? "/pay/" : "/deposit/", o = `${t ? t * 100 : ""}`;
687
- return n + s + o;
686
+ const n = a.app.env === "internal" ? "https://chainrails-frontend-git-staging-horus-labs.vercel.app" : "https://app.chainrails.io", s = Number(t), o = t && !isNaN(Number(t)) && s > 0 ? "/pay/" : "/deposit/", r = `${t && !isNaN(Number(t)) && s > 0 ? s * 100 : ""}`;
687
+ return n + o + r;
688
688
  }
689
689
  }
690
690
  export {
@@ -1,2 +1,2 @@
1
- (function(l,u){typeof exports=="object"&&typeof module<"u"?u(exports):typeof define=="function"&&define.amd?define(["exports"],u):(l=typeof globalThis<"u"?globalThis:l||self,u(l.Chainrails={}))})(this,(function(l){"use strict";var u=(e=>(e.USDC="USDC",e))(u||{});const H={type:"evm",chainId:42161,name:"Arbitrum",cctpDomain:3,logoURI:"/images/chains/arbitrum.svg"},_={type:"evm",chainId:421614,name:"Arbitrum Sepolia",cctpDomain:3,logoURI:"/images/chains/arbitrum.svg"},P={type:"evm",chainId:8453,name:"Base",cctpDomain:6,logoURI:"/images/chains/base.webp"},F={type:"evm",chainId:84532,name:"Base Sepolia",cctpDomain:6,logoURI:"/images/chains/base.webp"},j={type:"evm",chainId:56,name:"BNB Chain",cctpDomain:null,logoURI:"/images/chains/bsc.webp"},K={type:"evm",chainId:1,name:"Ethereum",cctpDomain:0,logoURI:"/images/chains/ethereum.svg"},V={type:"evm",chainId:11155111,name:"Ethereum Sepolia",cctpDomain:0,logoURI:"/images/chains/ethereum.svg"},X={type:"evm",chainId:43114,name:"Avalanche",cctpDomain:1,logoURI:"/images/chains/avalanche.svg"},G={type:"evm",chainId:43113,name:"Avalanche Fuji",cctpDomain:1,logoURI:"/images/chains/avalanche.svg"},q={type:"starknet",chainId:"0x534e5f4d41494e",name:"Starknet",cctpDomain:null,logoURI:"/images/chains/starknet.svg"};function U(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function W(e){return U(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const J="2.43.4";let T={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${J}`};class p extends Error{constructor(t,n={}){const s=n.cause instanceof p?n.cause.details:n.cause?.message?n.cause.message:n.details,i=n.cause instanceof p&&n.cause.docsPath||n.docsPath,r=T.getDocsUrl?.({...n,docsPath:i}),o=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...r?[`Docs: ${r}`]:[],...s?[`Details: ${s}`]:[],...T.version?[`Version: ${T.version}`]:[]].join(`
2
- `);super(o,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=s,this.docsPath=i,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=J}walk(t){return Q(this,t)}}function Q(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Q(e.cause,t):t?null:e}class Y extends p{constructor({size:t,targetSize:n,type:s}){super(`${s.charAt(0).toUpperCase()}${s.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}}function I(e,{dir:t,size:n=32}={}){return typeof e=="string"?ye(e,{dir:t,size:n}):Ee(e,{dir:t,size:n})}function ye(e,{dir:t,size:n=32}={}){if(n===null)return e;const s=e.replace("0x","");if(s.length>n*2)throw new Y({size:Math.ceil(s.length/2),targetSize:n,type:"hex"});return`0x${s[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function Ee(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new Y({size:e.length,targetSize:n,type:"bytes"});const s=new Uint8Array(n);for(let i=0;i<n;i++){const r=t==="right";s[r?i:n-i-1]=e[r?i:e.length-i-1]}return s}class Se extends p{constructor({max:t,min:n,signed:s,size:i,value:r}){super(`Number "${r}" is not in safe ${i?`${i*8}-bit ${s?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}}class Ae extends p{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function w(e,{size:t}){if(W(e)>t)throw new Ae({givenSize:W(e),maxSize:t})}function Ue(e,t={}){const{signed:n,size:s}=t,i=BigInt(e);let r;s?n?r=(1n<<BigInt(s)*8n-1n)-1n:r=2n**(BigInt(s)*8n)-1n:typeof e=="number"&&(r=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof r=="bigint"&&n?-r-1n:0;if(r&&i>r||i<o){const d=typeof e=="bigint"?"n":"";throw new Se({max:r?`${r}${d}`:void 0,min:`${o}${d}`,signed:n,size:s,value:`${e}${d}`})}const c=`0x${(n&&i<0?(1n<<BigInt(s*8))+BigInt(i):i).toString(16)}`;return s?I(c,{size:s}):c}const Te=new TextEncoder;function we(e,t={}){return typeof e=="number"||typeof e=="bigint"?Ce(e,t):typeof e=="boolean"?xe(e,t):U(e)?ee(e,t):te(e,t)}function xe(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(w(n,{size:t.size}),I(n,{size:t.size})):n}const h={zero:48,nine:57,A:65,F:70,a:97,f:102};function Z(e){if(e>=h.zero&&e<=h.nine)return e-h.zero;if(e>=h.A&&e<=h.F)return e-(h.A-10);if(e>=h.a&&e<=h.f)return e-(h.a-10)}function ee(e,t={}){let n=e;t.size&&(w(n,{size:t.size}),n=I(n,{dir:"right",size:t.size}));let s=n.slice(2);s.length%2&&(s=`0${s}`);const i=s.length/2,r=new Uint8Array(i);for(let o=0,c=0;o<i;o++){const d=Z(s.charCodeAt(c++)),g=Z(s.charCodeAt(c++));if(d===void 0||g===void 0)throw new p(`Invalid byte sequence ("${s[c-2]}${s[c-1]}" in "${s}").`);r[o]=d*16+g}return r}function Ce(e,t){const n=Ue(e,t);return ee(n)}function te(e,t={}){const n=Te.encode(e);return typeof t.size=="number"?(w(n,{size:t.size}),I(n,{dir:"right",size:t.size})):n}const y=BigInt(2**32-1),ne=BigInt(32);function De(e,t=!1){return t?{h:Number(e&y),l:Number(e>>ne&y)}:{h:Number(e>>ne&y)|0,l:Number(e&y)|0}}function ve(e,t=!1){const n=e.length;let s=new Uint32Array(n),i=new Uint32Array(n);for(let r=0;r<n;r++){const{h:o,l:c}=De(e[r],t);[s[r],i[r]]=[o,c]}return[s,i]}const ke=(e,t,n)=>e<<n|t>>>32-n,Be=(e,t,n)=>t<<n|e>>>32-n,Ne=(e,t,n)=>t<<n-32|e>>>64-n,Re=(e,t,n)=>e<<n-32|t>>>64-n;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function $e(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function se(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function E(e,...t){if(!$e(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function ie(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Me(e,t){E(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Oe(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function oe(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}const ze=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Le(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function He(e){for(let t=0;t<e.length;t++)e[t]=Le(e[t]);return e}const re=ze?e=>e:He;function _e(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function ce(e){return typeof e=="string"&&(e=_e(e)),E(e),e}class Pe{}function Fe(e){const t=s=>e().update(ce(s)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}const je=BigInt(0),b=BigInt(1),Ke=BigInt(2),Ve=BigInt(7),Xe=BigInt(256),Ge=BigInt(113),ae=[],ue=[],le=[];for(let e=0,t=b,n=1,s=0;e<24;e++){[n,s]=[s,(2*n+3*s)%5],ae.push(2*(5*s+n)),ue.push((e+1)*(e+2)/2%64);let i=je;for(let r=0;r<7;r++)t=(t<<b^(t>>Ve)*Ge)%Xe,t&Ke&&(i^=b<<(b<<BigInt(r))-b);le.push(i)}const de=ve(le,!0),qe=de[0],We=de[1],he=(e,t,n)=>n>32?Ne(e,t,n):ke(e,t,n),fe=(e,t,n)=>n>32?Re(e,t,n):Be(e,t,n);function Je(e,t=24){const n=new Uint32Array(10);for(let s=24-t;s<24;s++){for(let o=0;o<10;o++)n[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const c=(o+8)%10,d=(o+2)%10,g=n[d],m=n[d+1],ct=he(g,m,1)^n[c],at=fe(g,m,1)^n[c+1];for(let A=0;A<50;A+=10)e[o+A]^=ct,e[o+A+1]^=at}let i=e[2],r=e[3];for(let o=0;o<24;o++){const c=ue[o],d=he(i,r,c),g=fe(i,r,c),m=ae[o];i=e[m],r=e[m+1],e[m]=d,e[m+1]=g}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)n[c]=e[o+c];for(let c=0;c<10;c++)e[o+c]^=~n[(c+2)%10]&n[(c+4)%10]}e[0]^=qe[s],e[1]^=We[s]}oe(n)}class x extends Pe{constructor(t,n,s,i=!1,r=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=n,this.outputLen=s,this.enableXOF=i,this.rounds=r,se(s),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Oe(this.state)}clone(){return this._cloneInto()}keccak(){re(this.state32),Je(this.state32,this.rounds),re(this.state32),this.posOut=0,this.pos=0}update(t){ie(this),t=ce(t),E(t);const{blockLen:n,state:s}=this,i=t.length;for(let r=0;r<i;){const o=Math.min(n-this.pos,i-r);for(let c=0;c<o;c++)s[this.pos++]^=t[r++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:s,blockLen:i}=this;t[s]^=n,(n&128)!==0&&s===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){ie(this,!1),E(t),this.finish();const n=this.state,{blockLen:s}=this;for(let i=0,r=t.length;i<r;){this.posOut>=s&&this.keccak();const o=Math.min(s-this.posOut,r-i);t.set(n.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return se(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Me(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,oe(this.state)}_cloneInto(t){const{blockLen:n,suffix:s,outputLen:i,rounds:r,enableXOF:o}=this;return t||(t=new x(n,s,i,o,r)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=r,t.suffix=s,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}}const Qe=(e,t,n)=>Fe(()=>new x(t,e,n)),Ye=Qe(1,136,256/8);function Ze(e,t){return Ye(U(e,{strict:!1})?we(e):e)}class et extends p{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class pe extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const s=this.keys().next().value;s&&this.delete(s)}return this}}const C=new pe(8192);function ge(e,t){if(C.has(`${e}.${t}`))return C.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),s=Ze(te(n)),i=n.split("");for(let o=0;o<40;o+=2)s[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(s[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const r=`0x${i.join("")}`;return C.set(`${e}.${t}`,r),r}function f(e,t){if(!nt(e,{strict:!1}))throw new et({address:e});return ge(e,t)}const tt=/^0x[a-fA-F0-9]{40}$/,D=new pe(8192);function nt(e,t){const{strict:n=!0}=t??{},s=`${e}.${n}`;if(D.has(s))return D.get(s);const i=tt.test(e)?e.toLowerCase()===e?!0:n?ge(e)===e:!0:!1;return D.set(s,i),i}const v={chainId:_.chainId,address:f("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},k={chainId:H.chainId,address:f("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),symbol:"USDC",name:"USD Coin",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png"},B={chainId:G.chainId,address:f("0x5425890298aed601595a70ab815c96711a31bc65"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},N={chainId:X.chainId,address:f("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},R={chainId:F.chainId,address:f("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},$={chainId:P.chainId,address:f("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},M={chainId:j.chainId,address:f("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),symbol:"USDC",decimals:18,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},O={chainId:V.chainId,address:f("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),symbol:"USDC",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},z={chainId:K.chainId,address:f("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),symbol:"USDC",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},st={chainId:q.chainId,address:"0x053C91253BC9682c04929cA02ED00b3E423f6710D2ee7e0D5EBB06F3eCF368A8",symbol:"USDC",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},it={[v.chainId]:v,[k.chainId]:k,[B.chainId]:B,[N.chainId]:N,[R.chainId]:R,[$.chainId]:$,[O.chainId]:O,[z.chainId]:z,[M.chainId]:M},S={ARBITRUM_MAINNET:{...H,tokens:{[u.USDC]:k},explorer:"https://arbiscan.io"},ARBITRUM_TESTNET:{..._,explorer:"https://sepolia.arbiscan.io",tokens:{[u.USDC]:v}},AVALANCHE_MAINNET:{...X,tokens:{[u.USDC]:N},explorer:"https://snowtrace.io"},AVALANCHE_TESTNET:{...G,tokens:{[u.USDC]:B},explorer:"https://testnet.snowtrace.io"},BASE_MAINNET:{...P,tokens:{[u.USDC]:$},explorer:"https://basescan.org"},BASE_TESTNET:{...F,tokens:{[u.USDC]:R},explorer:"https://sepolia.basescan.org"},BSC_MAINNET:{...j,tokens:{[u.USDC]:M},explorer:"https://bscscan.com"},ETHEREUM_MAINNET:{...K,tokens:{[u.USDC]:z},explorer:"https://etherscan.io"},ETHEREUM_TESTNET:{...V,tokens:{[u.USDC]:O},explorer:"https://sepolia.etherscan.io"},STARKNET_MAINNET:{...q,tokens:{[u.USDC]:st},explorer:""}};var me=(e=>(e.ARBITRUM="ARBITRUM_MAINNET",e.ARBITRUM_TESTNET="ARBITRUM_TESTNET",e.AVALANCHE="AVALANCHE_MAINNET",e.AVALANCHE_TESTNET="AVALANCHE_TESTNET",e.BASE="BASE_MAINNET",e.BASE_TESTNET="BASE_TESTNET",e.BSC="BSC_MAINNET",e.ETHEREUM="ETHEREUM_MAINNET",e.ETHEREUM_TESTNET="ETHEREUM_TESTNET",e.STARKNET="STARKNET_MAINNET",e))(me||{}),be=(e=>(e.USDC="USDC",e))(be||{});function ot(e){return it[S[e||""].chainId]?.decimals||6}const Ie=e=>{const t=e?.trim().toUpperCase();if(S[t])return S[t]};function rt(e,t){return Ie(e)?.tokens[t]?.address}var L=(e=>(e.PRODUCTION="production",e.STAGING="staging",e))(L||{});class a{constructor({api_key:t,env:n,seesion_token:s}){this.api_key=t||"",this.sessionToken=s||"",this.env=n??L.PRODUCTION}static async config(t){if(!a.app){if(!t)throw new Error("Please provide an api_key");a.app=new a(t)}return t&&(t.api_key!==void 0&&(a.app.api_key=t.api_key),t.seesion_token!==void 0&&(a.app.sessionToken=t.seesion_token),t.env!==void 0&&(a.app.env=t.env)),a.app}static getApiKey(){if(!a.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return a.app.api_key}static getSessionToken(){if(!a.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return a.app.sessionToken}static getEnv(){if(!a.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return a.app.env==="internal"?"staging":a.app.env}static getBaseUrl(){if(!a.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");switch(a.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(t){if(!a.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");const n=a.app.env==="internal"?"https://chainrails-frontend-git-staging-horus-labs.vercel.app":"https://app.chainrails.io",s=t&&t>0?"/pay/":"/deposit/",i=`${t?t*100:""}`;return n+s+i}}l.Chainrails=a,l.allChains=S,l.chains=me,l.environment=L,l.getChainByChainEnum=Ie,l.getTokenAddress=rt,l.getTokenDecimals=ot,l.tokens=be,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(l,u){typeof exports=="object"&&typeof module<"u"?u(exports):typeof define=="function"&&define.amd?define(["exports"],u):(l=typeof globalThis<"u"?globalThis:l||self,u(l.Chainrails={}))})(this,(function(l){"use strict";var u=(e=>(e.USDC="USDC",e))(u||{});const H={type:"evm",chainId:42161,name:"Arbitrum",cctpDomain:3,logoURI:"/images/chains/arbitrum.svg"},P={type:"evm",chainId:421614,name:"Arbitrum Sepolia",cctpDomain:3,logoURI:"/images/chains/arbitrum.svg"},_={type:"evm",chainId:8453,name:"Base",cctpDomain:6,logoURI:"/images/chains/base.webp"},F={type:"evm",chainId:84532,name:"Base Sepolia",cctpDomain:6,logoURI:"/images/chains/base.webp"},j={type:"evm",chainId:56,name:"BNB Chain",cctpDomain:null,logoURI:"/images/chains/bsc.webp"},K={type:"evm",chainId:1,name:"Ethereum",cctpDomain:0,logoURI:"/images/chains/ethereum.svg"},V={type:"evm",chainId:11155111,name:"Ethereum Sepolia",cctpDomain:0,logoURI:"/images/chains/ethereum.svg"},X={type:"evm",chainId:43114,name:"Avalanche",cctpDomain:1,logoURI:"/images/chains/avalanche.svg"},G={type:"evm",chainId:43113,name:"Avalanche Fuji",cctpDomain:1,logoURI:"/images/chains/avalanche.svg"},q={type:"starknet",chainId:"0x534e5f4d41494e",name:"Starknet",cctpDomain:null,logoURI:"/images/chains/starknet.svg"};function U(e,{strict:t=!0}={}){return!e||typeof e!="string"?!1:t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x")}function W(e){return U(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}const J="2.43.4";let T={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:n})=>t?`${e??"https://viem.sh"}${t}${n?`#${n}`:""}`:void 0,version:`viem@${J}`};class p extends Error{constructor(t,n={}){const s=n.cause instanceof p?n.cause.details:n.cause?.message?n.cause.message:n.details,i=n.cause instanceof p&&n.cause.docsPath||n.docsPath,r=T.getDocsUrl?.({...n,docsPath:i}),o=[t||"An error occurred.","",...n.metaMessages?[...n.metaMessages,""]:[],...r?[`Docs: ${r}`]:[],...s?[`Details: ${s}`]:[],...T.version?[`Version: ${T.version}`]:[]].join(`
2
+ `);super(o,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=s,this.docsPath=i,this.metaMessages=n.metaMessages,this.name=n.name??this.name,this.shortMessage=t,this.version=J}walk(t){return Q(this,t)}}function Q(e,t){return t?.(e)?e:e&&typeof e=="object"&&"cause"in e&&e.cause!==void 0?Q(e.cause,t):t?null:e}class Y extends p{constructor({size:t,targetSize:n,type:s}){super(`${s.charAt(0).toUpperCase()}${s.slice(1).toLowerCase()} size (${t}) exceeds padding size (${n}).`,{name:"SizeExceedsPaddingSizeError"})}}function I(e,{dir:t,size:n=32}={}){return typeof e=="string"?ye(e,{dir:t,size:n}):Ee(e,{dir:t,size:n})}function ye(e,{dir:t,size:n=32}={}){if(n===null)return e;const s=e.replace("0x","");if(s.length>n*2)throw new Y({size:Math.ceil(s.length/2),targetSize:n,type:"hex"});return`0x${s[t==="right"?"padEnd":"padStart"](n*2,"0")}`}function Ee(e,{dir:t,size:n=32}={}){if(n===null)return e;if(e.length>n)throw new Y({size:e.length,targetSize:n,type:"bytes"});const s=new Uint8Array(n);for(let i=0;i<n;i++){const r=t==="right";s[r?i:n-i-1]=e[r?i:e.length-i-1]}return s}class Se extends p{constructor({max:t,min:n,signed:s,size:i,value:r}){super(`Number "${r}" is not in safe ${i?`${i*8}-bit ${s?"signed":"unsigned"} `:""}integer range ${t?`(${n} to ${t})`:`(above ${n})`}`,{name:"IntegerOutOfRangeError"})}}class Ae extends p{constructor({givenSize:t,maxSize:n}){super(`Size cannot exceed ${n} bytes. Given size: ${t} bytes.`,{name:"SizeOverflowError"})}}function w(e,{size:t}){if(W(e)>t)throw new Ae({givenSize:W(e),maxSize:t})}function Ue(e,t={}){const{signed:n,size:s}=t,i=BigInt(e);let r;s?n?r=(1n<<BigInt(s)*8n-1n)-1n:r=2n**(BigInt(s)*8n)-1n:typeof e=="number"&&(r=BigInt(Number.MAX_SAFE_INTEGER));const o=typeof r=="bigint"&&n?-r-1n:0;if(r&&i>r||i<o){const d=typeof e=="bigint"?"n":"";throw new Se({max:r?`${r}${d}`:void 0,min:`${o}${d}`,signed:n,size:s,value:`${e}${d}`})}const c=`0x${(n&&i<0?(1n<<BigInt(s*8))+BigInt(i):i).toString(16)}`;return s?I(c,{size:s}):c}const Te=new TextEncoder;function we(e,t={}){return typeof e=="number"||typeof e=="bigint"?Ce(e,t):typeof e=="boolean"?xe(e,t):U(e)?ee(e,t):te(e,t)}function xe(e,t={}){const n=new Uint8Array(1);return n[0]=Number(e),typeof t.size=="number"?(w(n,{size:t.size}),I(n,{size:t.size})):n}const h={zero:48,nine:57,A:65,F:70,a:97,f:102};function Z(e){if(e>=h.zero&&e<=h.nine)return e-h.zero;if(e>=h.A&&e<=h.F)return e-(h.A-10);if(e>=h.a&&e<=h.f)return e-(h.a-10)}function ee(e,t={}){let n=e;t.size&&(w(n,{size:t.size}),n=I(n,{dir:"right",size:t.size}));let s=n.slice(2);s.length%2&&(s=`0${s}`);const i=s.length/2,r=new Uint8Array(i);for(let o=0,c=0;o<i;o++){const d=Z(s.charCodeAt(c++)),g=Z(s.charCodeAt(c++));if(d===void 0||g===void 0)throw new p(`Invalid byte sequence ("${s[c-2]}${s[c-1]}" in "${s}").`);r[o]=d*16+g}return r}function Ce(e,t){const n=Ue(e,t);return ee(n)}function te(e,t={}){const n=Te.encode(e);return typeof t.size=="number"?(w(n,{size:t.size}),I(n,{dir:"right",size:t.size})):n}const y=BigInt(2**32-1),ne=BigInt(32);function De(e,t=!1){return t?{h:Number(e&y),l:Number(e>>ne&y)}:{h:Number(e>>ne&y)|0,l:Number(e&y)|0}}function ve(e,t=!1){const n=e.length;let s=new Uint32Array(n),i=new Uint32Array(n);for(let r=0;r<n;r++){const{h:o,l:c}=De(e[r],t);[s[r],i[r]]=[o,c]}return[s,i]}const Ne=(e,t,n)=>e<<n|t>>>32-n,ke=(e,t,n)=>t<<n|e>>>32-n,Be=(e,t,n)=>t<<n-32|e>>>64-n,Re=(e,t,n)=>e<<n-32|t>>>64-n;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function $e(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function se(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function E(e,...t){if(!$e(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function ie(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Me(e,t){E(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Oe(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function oe(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}const ze=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function Le(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function He(e){for(let t=0;t<e.length;t++)e[t]=Le(e[t]);return e}const re=ze?e=>e:He;function Pe(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function ce(e){return typeof e=="string"&&(e=Pe(e)),E(e),e}class _e{}function Fe(e){const t=s=>e().update(ce(s)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}const je=BigInt(0),b=BigInt(1),Ke=BigInt(2),Ve=BigInt(7),Xe=BigInt(256),Ge=BigInt(113),ae=[],ue=[],le=[];for(let e=0,t=b,n=1,s=0;e<24;e++){[n,s]=[s,(2*n+3*s)%5],ae.push(2*(5*s+n)),ue.push((e+1)*(e+2)/2%64);let i=je;for(let r=0;r<7;r++)t=(t<<b^(t>>Ve)*Ge)%Xe,t&Ke&&(i^=b<<(b<<BigInt(r))-b);le.push(i)}const de=ve(le,!0),qe=de[0],We=de[1],he=(e,t,n)=>n>32?Be(e,t,n):Ne(e,t,n),fe=(e,t,n)=>n>32?Re(e,t,n):ke(e,t,n);function Je(e,t=24){const n=new Uint32Array(10);for(let s=24-t;s<24;s++){for(let o=0;o<10;o++)n[o]=e[o]^e[o+10]^e[o+20]^e[o+30]^e[o+40];for(let o=0;o<10;o+=2){const c=(o+8)%10,d=(o+2)%10,g=n[d],m=n[d+1],ct=he(g,m,1)^n[c],at=fe(g,m,1)^n[c+1];for(let A=0;A<50;A+=10)e[o+A]^=ct,e[o+A+1]^=at}let i=e[2],r=e[3];for(let o=0;o<24;o++){const c=ue[o],d=he(i,r,c),g=fe(i,r,c),m=ae[o];i=e[m],r=e[m+1],e[m]=d,e[m+1]=g}for(let o=0;o<50;o+=10){for(let c=0;c<10;c++)n[c]=e[o+c];for(let c=0;c<10;c++)e[o+c]^=~n[(c+2)%10]&n[(c+4)%10]}e[0]^=qe[s],e[1]^=We[s]}oe(n)}class x extends _e{constructor(t,n,s,i=!1,r=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=t,this.suffix=n,this.outputLen=s,this.enableXOF=i,this.rounds=r,se(s),!(0<t&&t<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=Oe(this.state)}clone(){return this._cloneInto()}keccak(){re(this.state32),Je(this.state32,this.rounds),re(this.state32),this.posOut=0,this.pos=0}update(t){ie(this),t=ce(t),E(t);const{blockLen:n,state:s}=this,i=t.length;for(let r=0;r<i;){const o=Math.min(n-this.pos,i-r);for(let c=0;c<o;c++)s[this.pos++]^=t[r++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:t,suffix:n,pos:s,blockLen:i}=this;t[s]^=n,(n&128)!==0&&s===i-1&&this.keccak(),t[i-1]^=128,this.keccak()}writeInto(t){ie(this,!1),E(t),this.finish();const n=this.state,{blockLen:s}=this;for(let i=0,r=t.length;i<r;){this.posOut>=s&&this.keccak();const o=Math.min(s-this.posOut,r-i);t.set(n.subarray(this.posOut,this.posOut+o),i),this.posOut+=o,i+=o}return t}xofInto(t){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(t)}xof(t){return se(t),this.xofInto(new Uint8Array(t))}digestInto(t){if(Me(t,this),this.finished)throw new Error("digest() was already called");return this.writeInto(t),this.destroy(),t}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,oe(this.state)}_cloneInto(t){const{blockLen:n,suffix:s,outputLen:i,rounds:r,enableXOF:o}=this;return t||(t=new x(n,s,i,o,r)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=r,t.suffix=s,t.outputLen=i,t.enableXOF=o,t.destroyed=this.destroyed,t}}const Qe=(e,t,n)=>Fe(()=>new x(t,e,n)),Ye=Qe(1,136,256/8);function Ze(e,t){return Ye(U(e,{strict:!1})?we(e):e)}class et extends p{constructor({address:t}){super(`Address "${t}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class pe extends Map{constructor(t){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=t}get(t){const n=super.get(t);return super.has(t)&&n!==void 0&&(this.delete(t),super.set(t,n)),n}set(t,n){if(super.set(t,n),this.maxSize&&this.size>this.maxSize){const s=this.keys().next().value;s&&this.delete(s)}return this}}const C=new pe(8192);function ge(e,t){if(C.has(`${e}.${t}`))return C.get(`${e}.${t}`);const n=e.substring(2).toLowerCase(),s=Ze(te(n)),i=n.split("");for(let o=0;o<40;o+=2)s[o>>1]>>4>=8&&i[o]&&(i[o]=i[o].toUpperCase()),(s[o>>1]&15)>=8&&i[o+1]&&(i[o+1]=i[o+1].toUpperCase());const r=`0x${i.join("")}`;return C.set(`${e}.${t}`,r),r}function f(e,t){if(!nt(e,{strict:!1}))throw new et({address:e});return ge(e,t)}const tt=/^0x[a-fA-F0-9]{40}$/,D=new pe(8192);function nt(e,t){const{strict:n=!0}=t??{},s=`${e}.${n}`;if(D.has(s))return D.get(s);const i=tt.test(e)?e.toLowerCase()===e?!0:n?ge(e)===e:!0:!1;return D.set(s,i),i}const v={chainId:P.chainId,address:f("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},N={chainId:H.chainId,address:f("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),symbol:"USDC",name:"USD Coin",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png"},k={chainId:G.chainId,address:f("0x5425890298aed601595a70ab815c96711a31bc65"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},B={chainId:X.chainId,address:f("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},R={chainId:F.chainId,address:f("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},$={chainId:_.chainId,address:f("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),symbol:"USDC",fiatISO:"USD",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},M={chainId:j.chainId,address:f("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),symbol:"USDC",decimals:18,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},O={chainId:V.chainId,address:f("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),symbol:"USDC",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},z={chainId:K.chainId,address:f("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),symbol:"USDC",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},st={chainId:q.chainId,address:"0x053C91253BC9682c04929cA02ED00b3E423f6710D2ee7e0D5EBB06F3eCF368A8",symbol:"USDC",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png",logoSourceURI:"https://pay.daimo.com/coin-logos/usdc.png"},it={[v.chainId]:v,[N.chainId]:N,[k.chainId]:k,[B.chainId]:B,[R.chainId]:R,[$.chainId]:$,[O.chainId]:O,[z.chainId]:z,[M.chainId]:M},S={ARBITRUM_MAINNET:{...H,tokens:{[u.USDC]:N},explorer:"https://arbiscan.io"},ARBITRUM_TESTNET:{...P,explorer:"https://sepolia.arbiscan.io",tokens:{[u.USDC]:v}},AVALANCHE_MAINNET:{...X,tokens:{[u.USDC]:B},explorer:"https://snowtrace.io"},AVALANCHE_TESTNET:{...G,tokens:{[u.USDC]:k},explorer:"https://testnet.snowtrace.io"},BASE_MAINNET:{..._,tokens:{[u.USDC]:$},explorer:"https://basescan.org"},BASE_TESTNET:{...F,tokens:{[u.USDC]:R},explorer:"https://sepolia.basescan.org"},BSC_MAINNET:{...j,tokens:{[u.USDC]:M},explorer:"https://bscscan.com"},ETHEREUM_MAINNET:{...K,tokens:{[u.USDC]:z},explorer:"https://etherscan.io"},ETHEREUM_TESTNET:{...V,tokens:{[u.USDC]:O},explorer:"https://sepolia.etherscan.io"},STARKNET_MAINNET:{...q,tokens:{[u.USDC]:st},explorer:""}};var me=(e=>(e.ARBITRUM="ARBITRUM_MAINNET",e.ARBITRUM_TESTNET="ARBITRUM_TESTNET",e.AVALANCHE="AVALANCHE_MAINNET",e.AVALANCHE_TESTNET="AVALANCHE_TESTNET",e.BASE="BASE_MAINNET",e.BASE_TESTNET="BASE_TESTNET",e.BSC="BSC_MAINNET",e.ETHEREUM="ETHEREUM_MAINNET",e.ETHEREUM_TESTNET="ETHEREUM_TESTNET",e.STARKNET="STARKNET_MAINNET",e))(me||{}),be=(e=>(e.USDC="USDC",e))(be||{});function ot(e){return it[S[e||""].chainId]?.decimals||6}const Ie=e=>{const t=e?.trim().toUpperCase();if(S[t])return S[t]};function rt(e,t){return Ie(e)?.tokens[t]?.address}var L=(e=>(e.PRODUCTION="production",e.STAGING="staging",e))(L||{});class a{constructor({api_key:t,env:n,seesion_token:s}){this.api_key=t||"",this.sessionToken=s||"",this.env=n??L.PRODUCTION}static async config(t){if(!a.app){if(!t)throw new Error("Please provide an api_key");a.app=new a(t)}return t&&(t.api_key!==void 0&&(a.app.api_key=t.api_key),t.seesion_token!==void 0&&(a.app.sessionToken=t.seesion_token),t.env!==void 0&&(a.app.env=t.env)),a.app}static getApiKey(){if(!a.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return a.app.api_key}static getSessionToken(){if(!a.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return a.app.sessionToken}static getEnv(){if(!a.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return a.app.env==="internal"?"staging":a.app.env}static getBaseUrl(){if(!a.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");switch(a.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(t){if(!a.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");const n=a.app.env==="internal"?"https://chainrails-frontend-git-staging-horus-labs.vercel.app":"https://app.chainrails.io",s=Number(t),i=t&&!isNaN(Number(t))&&s>0?"/pay/":"/deposit/",r=`${t&&!isNaN(Number(t))&&s>0?s*100:""}`;return n+i+r}}l.Chainrails=a,l.allChains=S,l.chains=me,l.environment=L,l.getChainByChainEnum=Ie,l.getTokenAddress=rt,l.getTokenDecimals=ot,l.tokens=be,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})}));
@@ -15,7 +15,7 @@ export declare class Chainrails {
15
15
  static getSessionToken(): string;
16
16
  static getEnv(): EnvType;
17
17
  static getBaseUrl(): string;
18
- static getPayModalUrl(amount?: number): string;
18
+ static getPayModalUrl(_amount?: string): string;
19
19
  }
20
20
  export {};
21
21
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEtD,UAAU,gBAAgB;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAC,GAAG,CAAa;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,OAAO,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IAErB,OAAO;WAMa,MAAM,CAAC,KAAK,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC;WAqB3D,SAAS,IAAI,MAAM;WAOnB,eAAe,IAAI,MAAM;WAOzB,MAAM,IAAI,OAAO;WAQjB,UAAU,IAAI,MAAM;WAgBpB,cAAc,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM;CAetD"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/app/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,OAAO,EAAE,MAAM,gBAAgB,CAAC;AAEtD,UAAU,gBAAgB;IACxB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAC,GAAG,CAAa;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,GAAG,EAAE,OAAO,CAAC;IACb,YAAY,EAAE,MAAM,CAAC;IAErB,OAAO;WAMa,MAAM,CAAC,KAAK,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC;WAqB3D,SAAS,IAAI,MAAM;WAOnB,eAAe,IAAI,MAAM;WAOzB,MAAM,IAAI,OAAO;WAQjB,UAAU,IAAI,MAAM;WAgBpB,cAAc,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM;CAgBvD"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chainrails/common",
3
3
  "sideEffects": false,
4
- "version": "0.2.0",
4
+ "version": "0.2.2",
5
5
  "main": "./dist/chainrails-common.umd.js",
6
6
  "module": "./dist/chainrails-common.es.mjs",
7
7
  "license": "MIT",