@chainrails/common 0.2.3 → 0.2.4

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.
@@ -201,7 +201,7 @@ function Te(e, t = {}) {
201
201
  const n = new Uint8Array(1);
202
202
  return n[0] = Number(e), typeof t.size == "number" ? (M(n, { size: t.size }), S(n, { size: t.size })) : n;
203
203
  }
204
- const h = {
204
+ const d = {
205
205
  zero: 48,
206
206
  nine: 57,
207
207
  A: 65,
@@ -210,12 +210,12 @@ const h = {
210
210
  f: 102
211
211
  };
212
212
  function L(e) {
213
- if (e >= h.zero && e <= h.nine)
214
- return e - h.zero;
215
- if (e >= h.A && e <= h.F)
216
- return e - (h.A - 10);
217
- if (e >= h.a && e <= h.f)
218
- return e - (h.a - 10);
213
+ if (e >= d.zero && e <= d.nine)
214
+ return e - d.zero;
215
+ if (e >= d.A && e <= d.F)
216
+ return e - (d.A - 10);
217
+ if (e >= d.a && e <= d.f)
218
+ return e - (d.a - 10);
219
219
  }
220
220
  function oe(e, t = {}) {
221
221
  let n = e;
@@ -318,7 +318,7 @@ for (let e = 0, t = m, n = 1, s = 0; e < 24; e++) {
318
318
  t = (t << m ^ (t >> Ke) * Ve) % je, 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], K = (e, t, n) => n > 32 ? Ne(e, t, n) : Ce(e, t, n), j = (e, t, n) => n > 32 ? Be(e, t, n) : ve(e, t, n);
321
+ const de = De(le, !0), Xe = de[0], Ge = de[1], K = (e, t, n) => n > 32 ? Ne(e, t, n) : Ce(e, t, n), j = (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++) {
@@ -424,7 +424,7 @@ class Ye extends f {
424
424
  });
425
425
  }
426
426
  }
427
- class de extends Map {
427
+ class he extends Map {
428
428
  constructor(t) {
429
429
  super(), Object.defineProperty(this, "maxSize", {
430
430
  enumerable: !0,
@@ -445,7 +445,7 @@ class de extends Map {
445
445
  return this;
446
446
  }
447
447
  }
448
- const A = /* @__PURE__ */ new de(8192);
448
+ const A = /* @__PURE__ */ new he(8192);
449
449
  function fe(e, t) {
450
450
  if (A.has(`${e}.${t}`))
451
451
  return A.get(`${e}.${t}`);
@@ -455,12 +455,12 @@ function fe(e, t) {
455
455
  const r = `0x${o.join("")}`;
456
456
  return A.set(`${e}.${t}`, r), r;
457
457
  }
458
- function d(e, t) {
458
+ function h(e, t) {
459
459
  if (!et(e, { strict: !1 }))
460
460
  throw new Ye({ address: e });
461
461
  return fe(e, t);
462
462
  }
463
- const Ze = /^0x[a-fA-F0-9]{40}$/, U = /* @__PURE__ */ new de(8192);
463
+ const Ze = /^0x[a-fA-F0-9]{40}$/, U = /* @__PURE__ */ new he(8192);
464
464
  function et(e, t) {
465
465
  const { strict: n = !0 } = t ?? {}, s = `${e}.${n}`;
466
466
  if (U.has(s))
@@ -470,7 +470,7 @@ function et(e, t) {
470
470
  }
471
471
  const T = {
472
472
  chainId: X.chainId,
473
- address: d("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),
473
+ address: h("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),
474
474
  symbol: "USDC",
475
475
  fiatISO: "USD",
476
476
  decimals: 6,
@@ -478,7 +478,7 @@ const T = {
478
478
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
479
479
  }, x = {
480
480
  chainId: V.chainId,
481
- address: d("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
481
+ address: h("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
482
482
  symbol: "USDC",
483
483
  name: "USD Coin",
484
484
  decimals: 6,
@@ -486,7 +486,7 @@ const T = {
486
486
  /* USDC */
487
487
  }, w = {
488
488
  chainId: Z.chainId,
489
- address: d("0x5425890298aed601595a70ab815c96711a31bc65"),
489
+ address: h("0x5425890298aed601595a70ab815c96711a31bc65"),
490
490
  symbol: "USDC",
491
491
  fiatISO: "USD",
492
492
  decimals: 6,
@@ -494,7 +494,7 @@ const T = {
494
494
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
495
495
  }, D = {
496
496
  chainId: Y.chainId,
497
- address: d("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),
497
+ address: h("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),
498
498
  symbol: "USDC",
499
499
  fiatISO: "USD",
500
500
  decimals: 6,
@@ -502,7 +502,7 @@ const T = {
502
502
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
503
503
  }, C = {
504
504
  chainId: q.chainId,
505
- address: d("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),
505
+ address: h("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),
506
506
  symbol: "USDC",
507
507
  fiatISO: "USD",
508
508
  decimals: 6,
@@ -510,7 +510,7 @@ const T = {
510
510
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
511
511
  }, v = {
512
512
  chainId: G.chainId,
513
- address: d("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),
513
+ address: h("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),
514
514
  symbol: "USDC",
515
515
  fiatISO: "USD",
516
516
  decimals: 6,
@@ -518,28 +518,28 @@ const T = {
518
518
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
519
519
  }, N = {
520
520
  chainId: W.chainId,
521
- address: d("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),
521
+ address: h("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
526
  }, B = {
527
527
  chainId: Q.chainId,
528
- address: d("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),
528
+ address: h("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
533
  }, k = {
534
534
  chainId: J.chainId,
535
- address: d("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
535
+ address: h("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
536
536
  symbol: "USDC",
537
537
  decimals: 6,
538
538
  logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
539
539
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
540
540
  }, tt = {
541
541
  chainId: ee.chainId,
542
- address: "0x053C91253BC9682c04929cA02ED00b3E423f6710D2ee7e0D5EBB06F3eCF368A8",
542
+ address: "0x033068F6539f8e6e6b131e6B2B814e6c34A5224bC66947c47DaB9dFeE93b35fb",
543
543
  symbol: "USDC",
544
544
  decimals: 6,
545
545
  logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
@@ -201,7 +201,7 @@ function Te(e, t = {}) {
201
201
  const n = new Uint8Array(1);
202
202
  return n[0] = Number(e), typeof t.size == "number" ? (M(n, { size: t.size }), S(n, { size: t.size })) : n;
203
203
  }
204
- const h = {
204
+ const d = {
205
205
  zero: 48,
206
206
  nine: 57,
207
207
  A: 65,
@@ -210,12 +210,12 @@ const h = {
210
210
  f: 102
211
211
  };
212
212
  function L(e) {
213
- if (e >= h.zero && e <= h.nine)
214
- return e - h.zero;
215
- if (e >= h.A && e <= h.F)
216
- return e - (h.A - 10);
217
- if (e >= h.a && e <= h.f)
218
- return e - (h.a - 10);
213
+ if (e >= d.zero && e <= d.nine)
214
+ return e - d.zero;
215
+ if (e >= d.A && e <= d.F)
216
+ return e - (d.A - 10);
217
+ if (e >= d.a && e <= d.f)
218
+ return e - (d.a - 10);
219
219
  }
220
220
  function oe(e, t = {}) {
221
221
  let n = e;
@@ -318,7 +318,7 @@ for (let e = 0, t = m, n = 1, s = 0; e < 24; e++) {
318
318
  t = (t << m ^ (t >> Ke) * Ve) % je, 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], K = (e, t, n) => n > 32 ? Ne(e, t, n) : Ce(e, t, n), j = (e, t, n) => n > 32 ? Be(e, t, n) : ve(e, t, n);
321
+ const de = De(le, !0), Xe = de[0], Ge = de[1], K = (e, t, n) => n > 32 ? Ne(e, t, n) : Ce(e, t, n), j = (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++) {
@@ -424,7 +424,7 @@ class Ye extends f {
424
424
  });
425
425
  }
426
426
  }
427
- class de extends Map {
427
+ class he extends Map {
428
428
  constructor(t) {
429
429
  super(), Object.defineProperty(this, "maxSize", {
430
430
  enumerable: !0,
@@ -445,7 +445,7 @@ class de extends Map {
445
445
  return this;
446
446
  }
447
447
  }
448
- const A = /* @__PURE__ */ new de(8192);
448
+ const A = /* @__PURE__ */ new he(8192);
449
449
  function fe(e, t) {
450
450
  if (A.has(`${e}.${t}`))
451
451
  return A.get(`${e}.${t}`);
@@ -455,12 +455,12 @@ function fe(e, t) {
455
455
  const r = `0x${o.join("")}`;
456
456
  return A.set(`${e}.${t}`, r), r;
457
457
  }
458
- function d(e, t) {
458
+ function h(e, t) {
459
459
  if (!et(e, { strict: !1 }))
460
460
  throw new Ye({ address: e });
461
461
  return fe(e, t);
462
462
  }
463
- const Ze = /^0x[a-fA-F0-9]{40}$/, U = /* @__PURE__ */ new de(8192);
463
+ const Ze = /^0x[a-fA-F0-9]{40}$/, U = /* @__PURE__ */ new he(8192);
464
464
  function et(e, t) {
465
465
  const { strict: n = !0 } = t ?? {}, s = `${e}.${n}`;
466
466
  if (U.has(s))
@@ -470,7 +470,7 @@ function et(e, t) {
470
470
  }
471
471
  const T = {
472
472
  chainId: X.chainId,
473
- address: d("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),
473
+ address: h("0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d"),
474
474
  symbol: "USDC",
475
475
  fiatISO: "USD",
476
476
  decimals: 6,
@@ -478,7 +478,7 @@ const T = {
478
478
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
479
479
  }, x = {
480
480
  chainId: V.chainId,
481
- address: d("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
481
+ address: h("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),
482
482
  symbol: "USDC",
483
483
  name: "USD Coin",
484
484
  decimals: 6,
@@ -486,7 +486,7 @@ const T = {
486
486
  /* USDC */
487
487
  }, w = {
488
488
  chainId: Z.chainId,
489
- address: d("0x5425890298aed601595a70ab815c96711a31bc65"),
489
+ address: h("0x5425890298aed601595a70ab815c96711a31bc65"),
490
490
  symbol: "USDC",
491
491
  fiatISO: "USD",
492
492
  decimals: 6,
@@ -494,7 +494,7 @@ const T = {
494
494
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
495
495
  }, D = {
496
496
  chainId: Y.chainId,
497
- address: d("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),
497
+ address: h("0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E"),
498
498
  symbol: "USDC",
499
499
  fiatISO: "USD",
500
500
  decimals: 6,
@@ -502,7 +502,7 @@ const T = {
502
502
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
503
503
  }, C = {
504
504
  chainId: q.chainId,
505
- address: d("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),
505
+ address: h("0x036CbD53842c5426634e7929541eC2318f3dCF7e"),
506
506
  symbol: "USDC",
507
507
  fiatISO: "USD",
508
508
  decimals: 6,
@@ -510,7 +510,7 @@ const T = {
510
510
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
511
511
  }, v = {
512
512
  chainId: G.chainId,
513
- address: d("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),
513
+ address: h("0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913"),
514
514
  symbol: "USDC",
515
515
  fiatISO: "USD",
516
516
  decimals: 6,
@@ -518,28 +518,28 @@ const T = {
518
518
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
519
519
  }, N = {
520
520
  chainId: W.chainId,
521
- address: d("0x8AC76a51cc950d9822D68b83fE1Ad97B32Cd580d"),
521
+ address: h("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
526
  }, B = {
527
527
  chainId: Q.chainId,
528
- address: d("0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238"),
528
+ address: h("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
533
  }, k = {
534
534
  chainId: J.chainId,
535
- address: d("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
535
+ address: h("0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"),
536
536
  symbol: "USDC",
537
537
  decimals: 6,
538
538
  logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
539
539
  logoSourceURI: "https://pay.daimo.com/coin-logos/usdc.png"
540
540
  }, tt = {
541
541
  chainId: ee.chainId,
542
- address: "0x053C91253BC9682c04929cA02ED00b3E423f6710D2ee7e0D5EBB06F3eCF368A8",
542
+ address: "0x033068F6539f8e6e6b131e6B2B814e6c34A5224bC66947c47DaB9dFeE93b35fb",
543
543
  symbol: "USDC",
544
544
  decimals: 6,
545
545
  logoURI: "https://pay.daimo.com/coin-logos/usdc.png",
@@ -1,2 +1,2 @@
1
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"?Ee(e,{dir:t,size:n}):ye(e,{dir:t,size:n})}function Ee(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 ye(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"?De(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 f={zero:48,nine:57,A:65,F:70,a:97,f:102};function Z(e){if(e>=f.zero&&e<=f.nine)return e-f.zero;if(e>=f.A&&e<=f.F)return e-(f.A-10);if(e>=f.a&&e<=f.f)return e-(f.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 De(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 E=BigInt(2**32-1),ne=BigInt(32);function Ce(e,t=!1){return t?{h:Number(e&E),l:Number(e>>ne&E)}:{h:Number(e>>ne&E)|0,l:Number(e&E)|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}=Ce(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 y(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){y(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)),y(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],fe=(e,t,n)=>n>32?Be(e,t,n):Ne(e,t,n),he=(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=fe(g,m,1)^n[c],at=he(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=fe(i,r,c),g=he(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),y(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),y(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 D=new pe(8192);function ge(e,t){if(D.has(`${e}.${t}`))return D.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 D.set(`${e}.${t}`,r),r}function h(e,t){if(!nt(e,{strict:!1}))throw new et({address:e});return ge(e,t)}const tt=/^0x[a-fA-F0-9]{40}$/,C=new pe(8192);function nt(e,t){const{strict:n=!0}=t??{},s=`${e}.${n}`;if(C.has(s))return C.get(s);const i=tt.test(e)?e.toLowerCase()===e?!0:n?ge(e)===e:!0:!1;return C.set(s,i),i}const v={chainId:P.chainId,address:h("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:h("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),symbol:"USDC",name:"USD Coin",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png"},k={chainId:G.chainId,address:h("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:h("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:h("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:h("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:h("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:h("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:h("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,props:i}){this.api_key=t||"",this.sessionToken=s||"",this.env=n??L.PRODUCTION,this.props=i}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),t.props!==void 0&&(a.app.props=t.props)),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 getProps(){if(!a.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return a.app.props}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"})}));
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}):Se(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 Se(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 Ee 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 Ee({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"?De(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 f={zero:48,nine:57,A:65,F:70,a:97,f:102};function Z(e){if(e>=f.zero&&e<=f.nine)return e-f.zero;if(e>=f.A&&e<=f.F)return e-(f.A-10);if(e>=f.a&&e<=f.f)return e-(f.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 De(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 Ce(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}=Ce(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 S(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){S(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)),S(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],fe=(e,t,n)=>n>32?Be(e,t,n):Ne(e,t,n),he=(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=fe(g,m,1)^n[c],at=he(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=fe(i,r,c),g=he(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),S(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),S(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 D=new pe(8192);function ge(e,t){if(D.has(`${e}.${t}`))return D.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 D.set(`${e}.${t}`,r),r}function h(e,t){if(!nt(e,{strict:!1}))throw new et({address:e});return ge(e,t)}const tt=/^0x[a-fA-F0-9]{40}$/,C=new pe(8192);function nt(e,t){const{strict:n=!0}=t??{},s=`${e}.${n}`;if(C.has(s))return C.get(s);const i=tt.test(e)?e.toLowerCase()===e?!0:n?ge(e)===e:!0:!1;return C.set(s,i),i}const v={chainId:P.chainId,address:h("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:h("0xaf88d065e77c8cC2239327C5EDb3A432268e5831"),symbol:"USDC",name:"USD Coin",decimals:6,logoURI:"https://pay.daimo.com/coin-logos/usdc.png"},k={chainId:G.chainId,address:h("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:h("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:h("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:h("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:h("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:h("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:h("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:"0x033068F6539f8e6e6b131e6B2B814e6c34A5224bC66947c47DaB9dFeE93b35fb",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},E={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[E[e||""].chainId]?.decimals||6}const Ie=e=>{const t=e?.trim().toUpperCase();if(E[t])return E[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,props:i}){this.api_key=t||"",this.sessionToken=s||"",this.env=n??L.PRODUCTION,this.props=i}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),t.props!==void 0&&(a.app.props=t.props)),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 getProps(){if(!a.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");return a.app.props}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=E,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"})}));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chainrails/common",
3
3
  "sideEffects": false,
4
- "version": "0.2.3",
4
+ "version": "0.2.4",
5
5
  "main": "./dist/chainrails-common.umd.js",
6
6
  "module": "./dist/chainrails-common.es.mjs",
7
7
  "license": "MIT",