@chainrails/common 0.0.26 → 0.2.0

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.
@@ -64,7 +64,7 @@ const V = {
64
64
  function $(e, { strict: t = !0 } = {}) {
65
65
  return !e || typeof e != "string" ? !1 : t ? /^0x[0-9a-fA-F]*$/.test(e) : e.startsWith("0x");
66
66
  }
67
- function _(e) {
67
+ function z(e) {
68
68
  return $(e, { strict: !1 }) ? Math.ceil((e.length - 2) / 2) : e.length;
69
69
  }
70
70
  const te = "2.43.4";
@@ -169,9 +169,9 @@ class Se extends f {
169
169
  }
170
170
  }
171
171
  function M(e, { size: t }) {
172
- if (_(e) > t)
172
+ if (z(e) > t)
173
173
  throw new Se({
174
- givenSize: _(e),
174
+ givenSize: z(e),
175
175
  maxSize: t
176
176
  });
177
177
  }
@@ -209,7 +209,7 @@ const h = {
209
209
  a: 97,
210
210
  f: 102
211
211
  };
212
- function z(e) {
212
+ function L(e) {
213
213
  if (e >= h.zero && e <= h.nine)
214
214
  return e - h.zero;
215
215
  if (e >= h.A && e <= h.F)
@@ -224,7 +224,7 @@ function oe(e, t = {}) {
224
224
  s.length % 2 && (s = `0${s}`);
225
225
  const o = s.length / 2, r = new Uint8Array(o);
226
226
  for (let i = 0, c = 0; i < o; i++) {
227
- const u = z(s.charCodeAt(c++)), p = z(s.charCodeAt(c++));
227
+ const u = L(s.charCodeAt(c++)), p = L(s.charCodeAt(c++));
228
228
  if (u === void 0 || p === void 0)
229
229
  throw new f(`Invalid byte sequence ("${s[c - 2]}${s[c - 1]}" in "${s}").`);
230
230
  r[i] = u * 16 + p;
@@ -239,9 +239,9 @@ function ie(e, t = {}) {
239
239
  const n = Ae.encode(e);
240
240
  return typeof t.size == "number" ? (M(n, { size: t.size }), S(n, { dir: "right", size: t.size })) : n;
241
241
  }
242
- const I = /* @__PURE__ */ BigInt(2 ** 32 - 1), L = /* @__PURE__ */ BigInt(32);
242
+ const I = /* @__PURE__ */ BigInt(2 ** 32 - 1), H = /* @__PURE__ */ BigInt(32);
243
243
  function we(e, t = !1) {
244
- return t ? { h: Number(e & I), l: Number(e >> L & I) } : { h: Number(e >> L & I) | 0, l: Number(e & I) | 0 };
244
+ return t ? { h: Number(e & I), l: Number(e >> H & I) } : { h: Number(e >> H & I) | 0, l: Number(e & I) | 0 };
245
245
  }
246
246
  function De(e, t = !1) {
247
247
  const n = e.length;
@@ -257,7 +257,7 @@ const Ce = (e, t, n) => e << n | t >>> 32 - n, ve = (e, t, n) => t << n | e >>>
257
257
  function Ne(e) {
258
258
  return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
259
259
  }
260
- function H(e) {
260
+ function _(e) {
261
261
  if (!Number.isSafeInteger(e) || e < 0)
262
262
  throw new Error("positive integer expected, got " + e);
263
263
  }
@@ -290,23 +290,23 @@ const Me = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
290
290
  function Oe(e) {
291
291
  return e << 24 & 4278190080 | e << 8 & 16711680 | e >>> 8 & 65280 | e >>> 24 & 255;
292
292
  }
293
- function _e(e) {
293
+ function ze(e) {
294
294
  for (let t = 0; t < e.length; t++)
295
295
  e[t] = Oe(e[t]);
296
296
  return e;
297
297
  }
298
- const F = Me ? (e) => e : _e;
299
- function ze(e) {
298
+ const F = Me ? (e) => e : ze;
299
+ function Le(e) {
300
300
  if (typeof e != "string")
301
301
  throw new Error("string expected");
302
302
  return new Uint8Array(new TextEncoder().encode(e));
303
303
  }
304
304
  function ce(e) {
305
- return typeof e == "string" && (e = ze(e)), E(e), e;
305
+ return typeof e == "string" && (e = Le(e)), E(e), e;
306
306
  }
307
- class Le {
307
+ class He {
308
308
  }
309
- function He(e) {
309
+ function _e(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
  }
@@ -344,10 +344,10 @@ function qe(e, t = 24) {
344
344
  }
345
345
  re(n);
346
346
  }
347
- class O extends Le {
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, H(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, _(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
  }
@@ -391,7 +391,7 @@ class O extends Le {
391
391
  return this.writeInto(t);
392
392
  }
393
393
  xof(t) {
394
- return H(t), this.xofInto(new Uint8Array(t));
394
+ return _(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 Le {
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) => He(() => new O(t, e, n)), Je = We(1, 136, 256 / 8);
412
+ const We = (e, t, n) => _e(() => 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
  }
@@ -680,11 +680,11 @@ class a {
680
680
  return "https://api.chainrails.io/api/v1";
681
681
  }
682
682
  }
683
- static getPayModalUrl(t, n, s, o) {
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 r = a.app.env === "internal" ? "https://chainrails-frontend-git-staging-horus-labs.vercel.app" : "https://app.chainrails.io", i = o && o > 0 ? "/pay/" : "/deposit/", c = `_chain_/${t}/_token_/${n}/_to_/${s}${o ? "/_amount_/" + o * 100 : ""}`;
687
- return r + i + c;
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;
688
688
  }
689
689
  }
690
690
  export {
@@ -64,7 +64,7 @@ const V = {
64
64
  function $(e, { strict: t = !0 } = {}) {
65
65
  return !e || typeof e != "string" ? !1 : t ? /^0x[0-9a-fA-F]*$/.test(e) : e.startsWith("0x");
66
66
  }
67
- function _(e) {
67
+ function z(e) {
68
68
  return $(e, { strict: !1 }) ? Math.ceil((e.length - 2) / 2) : e.length;
69
69
  }
70
70
  const te = "2.43.4";
@@ -169,9 +169,9 @@ class Se extends f {
169
169
  }
170
170
  }
171
171
  function M(e, { size: t }) {
172
- if (_(e) > t)
172
+ if (z(e) > t)
173
173
  throw new Se({
174
- givenSize: _(e),
174
+ givenSize: z(e),
175
175
  maxSize: t
176
176
  });
177
177
  }
@@ -209,7 +209,7 @@ const h = {
209
209
  a: 97,
210
210
  f: 102
211
211
  };
212
- function z(e) {
212
+ function L(e) {
213
213
  if (e >= h.zero && e <= h.nine)
214
214
  return e - h.zero;
215
215
  if (e >= h.A && e <= h.F)
@@ -224,7 +224,7 @@ function oe(e, t = {}) {
224
224
  s.length % 2 && (s = `0${s}`);
225
225
  const o = s.length / 2, r = new Uint8Array(o);
226
226
  for (let i = 0, c = 0; i < o; i++) {
227
- const u = z(s.charCodeAt(c++)), p = z(s.charCodeAt(c++));
227
+ const u = L(s.charCodeAt(c++)), p = L(s.charCodeAt(c++));
228
228
  if (u === void 0 || p === void 0)
229
229
  throw new f(`Invalid byte sequence ("${s[c - 2]}${s[c - 1]}" in "${s}").`);
230
230
  r[i] = u * 16 + p;
@@ -239,9 +239,9 @@ function ie(e, t = {}) {
239
239
  const n = Ae.encode(e);
240
240
  return typeof t.size == "number" ? (M(n, { size: t.size }), S(n, { dir: "right", size: t.size })) : n;
241
241
  }
242
- const I = /* @__PURE__ */ BigInt(2 ** 32 - 1), L = /* @__PURE__ */ BigInt(32);
242
+ const I = /* @__PURE__ */ BigInt(2 ** 32 - 1), H = /* @__PURE__ */ BigInt(32);
243
243
  function we(e, t = !1) {
244
- return t ? { h: Number(e & I), l: Number(e >> L & I) } : { h: Number(e >> L & I) | 0, l: Number(e & I) | 0 };
244
+ return t ? { h: Number(e & I), l: Number(e >> H & I) } : { h: Number(e >> H & I) | 0, l: Number(e & I) | 0 };
245
245
  }
246
246
  function De(e, t = !1) {
247
247
  const n = e.length;
@@ -257,7 +257,7 @@ const Ce = (e, t, n) => e << n | t >>> 32 - n, ve = (e, t, n) => t << n | e >>>
257
257
  function Ne(e) {
258
258
  return e instanceof Uint8Array || ArrayBuffer.isView(e) && e.constructor.name === "Uint8Array";
259
259
  }
260
- function H(e) {
260
+ function _(e) {
261
261
  if (!Number.isSafeInteger(e) || e < 0)
262
262
  throw new Error("positive integer expected, got " + e);
263
263
  }
@@ -290,23 +290,23 @@ const Me = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
290
290
  function Oe(e) {
291
291
  return e << 24 & 4278190080 | e << 8 & 16711680 | e >>> 8 & 65280 | e >>> 24 & 255;
292
292
  }
293
- function _e(e) {
293
+ function ze(e) {
294
294
  for (let t = 0; t < e.length; t++)
295
295
  e[t] = Oe(e[t]);
296
296
  return e;
297
297
  }
298
- const F = Me ? (e) => e : _e;
299
- function ze(e) {
298
+ const F = Me ? (e) => e : ze;
299
+ function Le(e) {
300
300
  if (typeof e != "string")
301
301
  throw new Error("string expected");
302
302
  return new Uint8Array(new TextEncoder().encode(e));
303
303
  }
304
304
  function ce(e) {
305
- return typeof e == "string" && (e = ze(e)), E(e), e;
305
+ return typeof e == "string" && (e = Le(e)), E(e), e;
306
306
  }
307
- class Le {
307
+ class He {
308
308
  }
309
- function He(e) {
309
+ function _e(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
  }
@@ -344,10 +344,10 @@ function qe(e, t = 24) {
344
344
  }
345
345
  re(n);
346
346
  }
347
- class O extends Le {
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, H(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, _(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
  }
@@ -391,7 +391,7 @@ class O extends Le {
391
391
  return this.writeInto(t);
392
392
  }
393
393
  xof(t) {
394
- return H(t), this.xofInto(new Uint8Array(t));
394
+ return _(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 Le {
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) => He(() => new O(t, e, n)), Je = We(1, 136, 256 / 8);
412
+ const We = (e, t, n) => _e(() => 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
  }
@@ -680,11 +680,11 @@ class a {
680
680
  return "https://api.chainrails.io/api/v1";
681
681
  }
682
682
  }
683
- static getPayModalUrl(t, n, s, o) {
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 r = a.app.env === "internal" ? "https://chainrails-frontend-git-staging-horus-labs.vercel.app" : "https://app.chainrails.io", i = o && o > 0 ? "/pay/" : "/deposit/", c = `_chain_/${t}/_token_/${n}/_to_/${s}${o ? "/_amount_/" + o * 100 : ""}`;
687
- return r + i + c;
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;
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 L={type:"evm",chainId:42161,name:"Arbitrum",cctpDomain:3,logoURI:"/images/chains/arbitrum.svg"},H={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 _e=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function ze(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}function Le(e){for(let t=0;t<e.length;t++)e[t]=ze(e[t]);return e}const re=_e?e=>e:Le;function He(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=He(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:H.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:L.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"},_={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,[_.chainId]:_,[M.chainId]:M},S={ARBITRUM_MAINNET:{...L,tokens:{[u.USDC]:k},explorer:"https://arbiscan.io"},ARBITRUM_TESTNET:{...H,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]:_},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 z=(e=>(e.PRODUCTION="production",e.STAGING="staging",e))(z||{});class a{constructor({api_key:t,env:n,seesion_token:s}){this.api_key=t||"",this.sessionToken=s||"",this.env=n??z.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,n,s,i){if(!a.app)throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");const r=a.app.env==="internal"?"https://chainrails-frontend-git-staging-horus-labs.vercel.app":"https://app.chainrails.io",o=i&&i>0?"/pay/":"/deposit/",c=`_chain_/${t}/_token_/${n}/_to_/${s}${i?"/_amount_/"+i*100:""}`;return r+o+c}}l.Chainrails=a,l.allChains=S,l.chains=me,l.environment=z,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"},_={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"})}));
@@ -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(chain: string, token: string, to: string, amount?: number): string;
18
+ static getPayModalUrl(amount?: number): 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,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM;CAehG"}
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"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@chainrails/common",
3
3
  "sideEffects": false,
4
- "version": "0.0.26",
4
+ "version": "0.2.0",
5
5
  "main": "./dist/chainrails-common.umd.js",
6
6
  "module": "./dist/chainrails-common.es.mjs",
7
7
  "license": "MIT",