@chainrails/react 0.0.32 → 0.0.34

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.
@@ -164,9 +164,9 @@ const Ie = (t) => new ye(t), Be = {
164
164
  duplex: "half",
165
165
  body: ge(t.body, r, e)
166
166
  });
167
- }, b = (t) => t !== null && typeof t == "object", N = (...t) => {
167
+ }, E = (t) => t !== null && typeof t == "object", k = (...t) => {
168
168
  for (const e of t)
169
- if ((!b(e) || Array.isArray(e)) && e !== void 0)
169
+ if ((!E(e) || Array.isArray(e)) && e !== void 0)
170
170
  throw new TypeError("The `options` argument must be an object");
171
171
  return Y({}, ...t);
172
172
  }, me = (t = {}, e = {}) => {
@@ -175,14 +175,14 @@ const Ie = (t) => new ye(t), Be = {
175
175
  r && o === "undefined" || o === void 0 ? s.delete(i) : s.set(i, o);
176
176
  return s;
177
177
  };
178
- function q(t, e, s) {
178
+ function N(t, e, s) {
179
179
  return Object.hasOwn(e, s) && e[s] === void 0 ? [] : Y(t[s] ?? [], e[s] ?? []);
180
180
  }
181
181
  const we = (t = {}, e = {}) => ({
182
- beforeRequest: q(t, e, "beforeRequest"),
183
- beforeRetry: q(t, e, "beforeRetry"),
184
- afterResponse: q(t, e, "afterResponse"),
185
- beforeError: q(t, e, "beforeError")
182
+ beforeRequest: N(t, e, "beforeRequest"),
183
+ beforeRetry: N(t, e, "beforeRetry"),
184
+ afterResponse: N(t, e, "afterResponse"),
185
+ beforeError: N(t, e, "beforeError")
186
186
  }), Ye = (t, e) => {
187
187
  const s = new URLSearchParams();
188
188
  for (const r of [t, e])
@@ -196,7 +196,7 @@ const we = (t = {}, e = {}) => ({
196
196
  throw new TypeError("Array search parameters must be provided in [[key, value], ...] format");
197
197
  s.append(String(n[0]), String(n[1]));
198
198
  }
199
- else if (b(r))
199
+ else if (E(r))
200
200
  for (const [n, i] of Object.entries(r))
201
201
  i !== void 0 && s.append(n, String(i));
202
202
  else {
@@ -211,14 +211,14 @@ const we = (t = {}, e = {}) => ({
211
211
  for (const o of t)
212
212
  if (Array.isArray(o))
213
213
  Array.isArray(e) || (e = []), e = [...e, ...o];
214
- else if (b(o)) {
214
+ else if (E(o)) {
215
215
  for (let [a, c] of Object.entries(o)) {
216
216
  if (a === "signal" && c instanceof globalThis.AbortSignal) {
217
217
  i.push(c);
218
218
  continue;
219
219
  }
220
220
  if (a === "context") {
221
- if (c != null && (!b(c) || Array.isArray(c)))
221
+ if (c != null && (!E(c) || Array.isArray(c)))
222
222
  throw new TypeError("The `context` option must be an object");
223
223
  e = {
224
224
  ...e,
@@ -230,9 +230,9 @@ const we = (t = {}, e = {}) => ({
230
230
  c == null ? n = void 0 : n = n === void 0 ? c : Ye(n, c);
231
231
  continue;
232
232
  }
233
- b(c) && a in e && (c = Y(e[a], c)), e = { ...e, [a]: c };
233
+ E(c) && a in e && (c = Y(e[a], c)), e = { ...e, [a]: c };
234
234
  }
235
- b(o.hooks) && (r = we(r, o.hooks), e.hooks = r), b(o.headers) && (s = me(s, o.headers), e.headers = s);
235
+ E(o.hooks) && (r = we(r, o.hooks), e.hooks = r), E(o.headers) && (s = me(s, o.headers), e.headers = s);
236
236
  }
237
237
  return n !== void 0 && (e.searchParams = n), i.length > 0 && (i.length === 1 ? e.signal = i[0] : he ? e.signal = AbortSignal.any(i) : e.signal = i.at(-1)), e.context === void 0 && (e.context = {}), e;
238
238
  }, ze = (t) => de.includes(t) ? t.toUpperCase() : t, Ve = ["get", "put", "head", "delete", "options", "trace"], Je = [408, 413, 429, 500, 502, 503, 504], Ge = [413, 429, 503], ne = {
@@ -499,23 +499,23 @@ class O {
499
499
  }
500
500
  /*! MIT License © Sindre Sorhus */
501
501
  const B = (t) => {
502
- const e = (s, r) => O.create(s, N(t, r));
502
+ const e = (s, r) => O.create(s, k(t, r));
503
503
  for (const s of de)
504
- e[s] = (r, n) => O.create(r, N(t, n, { method: s }));
505
- return e.create = (s) => B(N(s)), e.extend = (s) => (typeof s == "function" && (s = s(t ?? {})), B(N(t, s))), e.stop = pe, e.retry = Ie, e;
504
+ e[s] = (r, n) => O.create(r, k(t, n, { method: s }));
505
+ return e.create = (s) => B(k(s)), e.extend = (s) => (typeof s == "function" && (s = s(t ?? {})), B(k(t, s))), e.stop = pe, e.retry = Ie, e;
506
506
  }, nt = B();
507
507
  var ot = /* @__PURE__ */ ((t) => (t.ARBITRUM = "ARBITRUM_MAINNET", t.ARBITRUM_TESTNET = "ARBITRUM_TESTNET", t.AVALANCHE = "AVALANCHE_MAINNET", t.AVALANCHE_TESTNET = "AVALANCHE_TESTNET", t.BASE = "BASE_MAINNET", t.BASE_TESTNET = "BASE_TESTNET", t.BSC = "BSC_MAINNET", t.ETHEREUM = "ETHEREUM_MAINNET", t.ETHEREUM_TESTNET = "ETHEREUM_TESTNET", t.STARKNET = "STARKNET_MAINNET", t))(ot || {}), it = /* @__PURE__ */ ((t) => (t.USDC = "USDC", t))(it || {}), z = /* @__PURE__ */ ((t) => (t.PRODUCTION = "production", t.STAGING = "staging", t))(z || {});
508
- class h {
508
+ class d {
509
509
  constructor({ api_key: e, env: s }) {
510
510
  this.api_key = e, this.jwt = "", this.env = s ?? z.PRODUCTION;
511
511
  }
512
512
  static async config(e) {
513
- if (!h.app) {
513
+ if (!d.app) {
514
514
  if (!e)
515
515
  throw new Error("Please provide an api_key");
516
- h.app = new h(e);
516
+ d.app = new d(e);
517
517
  }
518
- return e && (h.app.api_key = e.api_key, e.env !== void 0 && (h.app.env = e.env), await this.updateJWT(), setInterval(this.updateJWT.bind(this), 1500 * 1e3)), h.app;
518
+ return e && (d.app.api_key = e.api_key, e.env !== void 0 && (d.app.env = e.env), await this.updateJWT(), setInterval(this.updateJWT.bind(this), 1500 * 1e3)), d.app;
519
519
  }
520
520
  static async updateJWT() {
521
521
  try {
@@ -525,7 +525,7 @@ class h {
525
525
  "content-type": "application/json"
526
526
  },
527
527
  body: JSON.stringify({
528
- apiKey: h.app.api_key
528
+ apiKey: d.app.api_key
529
529
  })
530
530
  })).json();
531
531
  this.app.jwt = e.token;
@@ -533,22 +533,22 @@ class h {
533
533
  }
534
534
  }
535
535
  static getApiKey() {
536
- if (!h.app)
536
+ if (!d.app)
537
537
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
538
- return h.app.api_key;
538
+ return d.app.api_key;
539
539
  }
540
540
  static getSessionKey() {
541
- return h.app.jwt;
541
+ return d.app.jwt;
542
542
  }
543
543
  static getEnv() {
544
- if (!h.app)
544
+ if (!d.app)
545
545
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
546
- return h.app.env === "internal" ? "staging" : h.app.env;
546
+ return d.app.env === "internal" ? "staging" : d.app.env;
547
547
  }
548
548
  static getBaseUrl() {
549
- if (!h.app)
549
+ if (!d.app)
550
550
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
551
- switch (h.app.env) {
551
+ switch (d.app.env) {
552
552
  case "production":
553
553
  return "https://api.chainrails.io/api/v1";
554
554
  case "staging":
@@ -560,23 +560,23 @@ class h {
560
560
  }
561
561
  }
562
562
  static getPayModalUrl(e, s, r, n) {
563
- if (!h.app)
563
+ if (!d.app)
564
564
  throw new Error("Chainrails SDK not configured. Please call Chainrails.config() first.");
565
- const i = h.app.env === "internal" ? "https://chainrails-frontend-git-staging-horus-labs.vercel.app" : "https://app.chainrails.io", o = n && n > 0 ? "/pay/" : "/deposit/", a = `_chain_/${e}/_token_/${s}/_to_/${r}${n ? "/_amount_/" + n * 100 : ""}`;
565
+ const i = d.app.env === "internal" ? "https://chainrails-frontend-git-staging-horus-labs.vercel.app" : "https://app.chainrails.io", o = n && n > 0 ? "/pay/" : "/deposit/", a = `_chain_/${e}/_token_/${s}/_to_/${r}${n ? "/_amount_/" + n * 100 : ""}`;
566
566
  return i + o + a;
567
567
  }
568
568
  }
569
569
  let H = null;
570
570
  function at() {
571
571
  H = nt.create({
572
- prefixUrl: h.getBaseUrl(),
572
+ prefixUrl: d.getBaseUrl(),
573
573
  headers: {
574
574
  "Content-Type": "application/json"
575
575
  },
576
576
  hooks: {
577
577
  beforeRequest: [
578
578
  (t) => {
579
- const e = h.getSessionKey();
579
+ const e = d.getSessionKey();
580
580
  t.headers.set("Authorization", `Bearer ${e}`);
581
581
  }
582
582
  ],
@@ -587,68 +587,68 @@ function at() {
587
587
  }
588
588
  });
589
589
  }
590
- function m() {
590
+ function g() {
591
591
  return H || at(), H;
592
592
  }
593
593
  class ct {
594
594
  async getById(e) {
595
- return await m().get("intents/" + e).json();
595
+ return await g().get("intents/" + e).json();
596
596
  }
597
597
  async getForSender(e) {
598
- return await m().get("intents/user/" + e).json();
598
+ return await g().get("intents/user/" + e).json();
599
599
  }
600
600
  async getForAddress(e) {
601
- return await m().get("intents/address/" + e).json();
601
+ return await g().get("intents/address/" + e).json();
602
602
  }
603
603
  async getAll(e) {
604
- return await m().get("intents", { searchParams: e }).json();
604
+ return await g().get("intents", { searchParams: e }).json();
605
605
  }
606
606
  async create(e) {
607
- return await m().post("intents", { json: e }).json();
607
+ return await g().post("intents", { json: e }).json();
608
608
  }
609
609
  async update(e, s) {
610
- return await m().post("intents", { json: s }).json();
610
+ return await g().post("intents", { json: s }).json();
611
611
  }
612
612
  async triggerProcessing(e) {
613
- return await m().post(`intents/${e}/trigger-processing`).json();
613
+ return await g().post(`intents/${e}/trigger-processing`).json();
614
614
  }
615
615
  }
616
616
  class ut {
617
617
  async getFromSpecificBridge(e) {
618
- return await m().get("quotes/single", { searchParams: e }).json();
618
+ return await g().get("quotes/single", { searchParams: e }).json();
619
619
  }
620
620
  async getFromAllBridges(e) {
621
- return await m().get("quotes/multiple", { searchParams: e }).json();
621
+ return await g().get("quotes/multiple", { searchParams: e }).json();
622
622
  }
623
623
  async getBestAcrossBridges(e) {
624
- return await m().get("quotes/best", { searchParams: e }).json();
624
+ return await g().get("quotes/best", { searchParams: e }).json();
625
625
  }
626
626
  async getAll(e) {
627
- return await m().get("quotes/multi-source", { searchParams: e }).json();
627
+ return await g().get("quotes/multi-source", { searchParams: e }).json();
628
628
  }
629
629
  }
630
630
  class lt {
631
631
  async getOptimalRoutes(e) {
632
- return await m().get("router/optimal-route", { searchParams: e }).json();
632
+ return await g().get("router/optimal-route", { searchParams: e }).json();
633
633
  }
634
634
  async getAllSupportedBridges() {
635
- return await m().get("router/supported-bridges/all").json();
635
+ return await g().get("router/supported-bridges/all").json();
636
636
  }
637
637
  async getSupportedBridges(e) {
638
- return await m().get("router/supported-bridges/route", { searchParams: e }).json();
638
+ return await g().get("router/supported-bridges/route", { searchParams: e }).json();
639
639
  }
640
640
  async getSupportedRoutes(e, s) {
641
- return await m().get("router/supported-bridges/bridge/" + e, { searchParams: s }).json();
641
+ return await g().get("router/supported-bridges/bridge/" + e, { searchParams: s }).json();
642
642
  }
643
643
  }
644
644
  class ft {
645
645
  async getSupported(e) {
646
- return await m().get("chains", { searchParams: e }).json();
646
+ return await g().get("chains", { searchParams: e }).json();
647
647
  }
648
648
  }
649
649
  class ht {
650
650
  async getClientInfo() {
651
- return await m().get("client/auth/client-info").json();
651
+ return await g().get("client/auth/client-info").json();
652
652
  }
653
653
  }
654
654
  const xt = {
@@ -678,38 +678,39 @@ function Lt(t) {
678
678
  chain: r,
679
679
  amount: n,
680
680
  isOpen: i,
681
- open: o,
682
- close: a,
683
- onCancel: c,
684
- onSuccess: u,
685
- session_token: d
686
- } = t, [w, y] = le(!0), g = W(null);
681
+ isPending: o,
682
+ open: a,
683
+ close: c,
684
+ onCancel: u,
685
+ onSuccess: y,
686
+ data: w
687
+ } = t, [p, m] = le(!0), R = W(null);
687
688
  F(() => {
688
- C();
689
- const l = document.body.style.overflow;
690
- i ? (document.body.style.overflow = "hidden", document.body.style.overflow = "hidden") : document.body.style.overflow = l || "";
691
- const p = (f) => {
692
- f.data === "closed" && (a(), c?.()), f.data === "completed" && (window.setTimeout(a, 2e3), u?.());
689
+ l();
690
+ const f = document.body.style.overflow;
691
+ i ? (document.body.style.overflow = "hidden", document.body.style.overflow = "hidden") : document.body.style.overflow = f || "";
692
+ const h = (T) => {
693
+ T.data === "closed" && (c(), u?.()), T.data === "completed" && (window.setTimeout(c, 2e3), y?.());
693
694
  };
694
- return window.addEventListener("message", p), () => {
695
- document.body.style.overflow = l || "", window.removeEventListener("message", p);
695
+ return window.addEventListener("message", h), () => {
696
+ document.body.style.overflow = f || "", window.removeEventListener("message", h);
696
697
  };
697
- }, [i, c, u]);
698
- function P() {
699
- y(!1), C();
698
+ }, [i, u, y]);
699
+ function j() {
700
+ m(!1), l();
700
701
  }
701
- function C() {
702
- if (!d) return;
703
- const l = {
702
+ function l() {
703
+ if (!w?.sessionToken) return;
704
+ const f = {
704
705
  type: "session",
705
- session_token: d,
706
- environment: h.getEnv() || z.PRODUCTION
706
+ session_token: w.sessionToken,
707
+ environment: d.getEnv() || z.PRODUCTION
707
708
  };
708
- g.current?.contentWindow?.postMessage(l, "https://app.chainrails.io"), g.current?.contentWindow?.postMessage(l, "https://chainrails-frontend-git-staging-horus-labs.vercel.app");
709
+ R.current?.contentWindow?.postMessage(f, "https://app.chainrails.io"), R.current?.contentWindow?.postMessage(f, "https://chainrails-frontend-git-staging-horus-labs.vercel.app");
709
710
  }
710
- return d ? /* @__PURE__ */ se("div", {
711
- className: dt("payment-modal-wrapper", w ? "loading" : "not-loading", i ? "open" : "closed"),
712
- children: [w && /* @__PURE__ */ S("div", {
711
+ return w?.sessionToken ? /* @__PURE__ */ se("div", {
712
+ className: dt("payment-modal-wrapper", p || o ? "loading" : "not-loading", i ? "open" : "closed"),
713
+ children: [(p || o) && /* @__PURE__ */ S("div", {
713
714
  role: "status",
714
715
  className: "payment-modal-loader",
715
716
  children: /* @__PURE__ */ se("svg", {
@@ -728,17 +729,17 @@ function Lt(t) {
728
729
  })
729
730
  }), /* @__PURE__ */ S("iframe", {
730
731
  allow: "clipboard-read *; clipboard-write *",
731
- src: h.getPayModalUrl(r, s, e, n),
732
- onLoad: P,
733
- className: `payment-modal ${w ? "invisible" : "visible"}`,
732
+ src: d.getPayModalUrl(r, s, e, n),
733
+ onLoad: j,
734
+ className: `payment-modal ${p || o ? "invisible" : "visible"}`,
734
735
  "data-id": n,
735
- ref: g
736
+ ref: R
736
737
  })]
737
738
  }) : /* @__PURE__ */ S(Ue, {});
738
739
  }
739
740
  const pt = Symbol(), V = Symbol(), A = "a", Re = "f", oe = "p", be = "c", Ee = "t", J = "h", v = "w", G = "o", X = "k";
740
741
  let yt = (t, e) => new Proxy(t, e);
741
- const K = Object.getPrototypeOf, $ = /* @__PURE__ */ new WeakMap(), Pe = (t) => t && ($.has(t) ? $.get(t) : K(t) === Object.prototype || K(t) === Array.prototype), _ = (t) => typeof t == "object" && t !== null, gt = (t) => Object.values(Object.getOwnPropertyDescriptors(t)).some((e) => !e.configurable && !e.writable), mt = (t) => {
742
+ const K = Object.getPrototypeOf, $ = /* @__PURE__ */ new WeakMap(), Pe = (t) => t && ($.has(t) ? $.get(t) : K(t) === Object.prototype || K(t) === Array.prototype), q = (t) => typeof t == "object" && t !== null, gt = (t) => Object.values(Object.getOwnPropertyDescriptors(t)).some((e) => !e.configurable && !e.writable), mt = (t) => {
742
743
  if (Array.isArray(t))
743
744
  return Array.from(t);
744
745
  const e = Object.getOwnPropertyDescriptors(t);
@@ -756,8 +757,8 @@ const K = Object.getPrototypeOf, $ = /* @__PURE__ */ new WeakMap(), Pe = (t) =>
756
757
  if (u || (u = {}, s[A].set(t, u)), a === v)
757
758
  u[v] = !0;
758
759
  else {
759
- let d = u[a];
760
- d || (d = /* @__PURE__ */ new Set(), u[a] = d), d.add(c);
760
+ let y = u[a];
761
+ y || (y = /* @__PURE__ */ new Set(), u[a] = y), y.add(c);
761
762
  }
762
763
  }
763
764
  }, i = () => {
@@ -798,7 +799,7 @@ const K = Object.getPrototypeOf, $ = /* @__PURE__ */ new WeakMap(), Pe = (t) =>
798
799
  }, Ae = (t, e, s, r, n = Object.is) => {
799
800
  if (n(t, e))
800
801
  return !1;
801
- if (!_(t) || !_(e))
802
+ if (!q(t) || !q(e))
802
803
  return !0;
803
804
  const i = s.get(Z(t));
804
805
  if (!i)
@@ -831,30 +832,30 @@ const K = Object.getPrototypeOf, $ = /* @__PURE__ */ new WeakMap(), Pe = (t) =>
831
832
  $.set(t, e);
832
833
  }, bt = (t, e, s) => {
833
834
  const r = [], n = /* @__PURE__ */ new WeakSet(), i = (o, a) => {
834
- var c, u, d;
835
+ var c, u, y;
835
836
  if (n.has(o))
836
837
  return;
837
- _(o) && n.add(o);
838
- const w = _(o) && e.get(Z(o));
838
+ q(o) && n.add(o);
839
+ const w = q(o) && e.get(Z(o));
839
840
  if (w) {
840
- if ((c = w[J]) === null || c === void 0 || c.forEach((y) => {
841
- const g = `:has(${String(y)})`;
842
- r.push(a ? [...a, g] : [g]);
841
+ if ((c = w[J]) === null || c === void 0 || c.forEach((p) => {
842
+ const m = `:has(${String(p)})`;
843
+ r.push(a ? [...a, m] : [m]);
843
844
  }), w[v] === !0) {
844
- const y = ":ownKeys";
845
- r.push(a ? [...a, y] : [y]);
845
+ const p = ":ownKeys";
846
+ r.push(a ? [...a, p] : [p]);
846
847
  } else
847
- (u = w[G]) === null || u === void 0 || u.forEach((y) => {
848
- const g = `:hasOwn(${String(y)})`;
849
- r.push(a ? [...a, g] : [g]);
848
+ (u = w[G]) === null || u === void 0 || u.forEach((p) => {
849
+ const m = `:hasOwn(${String(p)})`;
850
+ r.push(a ? [...a, m] : [m]);
850
851
  });
851
- (d = w[X]) === null || d === void 0 || d.forEach((y) => {
852
- "value" in (Object.getOwnPropertyDescriptor(o, y) || {}) && i(o[y], a ? [...a, y] : [y]);
852
+ (y = w[X]) === null || y === void 0 || y.forEach((p) => {
853
+ "value" in (Object.getOwnPropertyDescriptor(o, p) || {}) && i(o[p], a ? [...a, p] : [p]);
853
854
  });
854
855
  } else a && r.push(a);
855
856
  };
856
857
  return i(t), r;
857
- }, U = {}, Q = (t) => typeof t == "object" && t !== null, Et = (t) => Q(t) && !ee.has(t) && (Array.isArray(t) || !(Symbol.iterator in t)) && !(t instanceof WeakMap) && !(t instanceof WeakSet) && !(t instanceof Error) && !(t instanceof Number) && !(t instanceof Date) && !(t instanceof String) && !(t instanceof RegExp) && !(t instanceof ArrayBuffer) && !(t instanceof Promise), ve = (t, e) => {
858
+ }, _ = {}, Q = (t) => typeof t == "object" && t !== null, Et = (t) => Q(t) && !ee.has(t) && (Array.isArray(t) || !(Symbol.iterator in t)) && !(t instanceof WeakMap) && !(t instanceof WeakSet) && !(t instanceof Error) && !(t instanceof Number) && !(t instanceof Date) && !(t instanceof String) && !(t instanceof RegExp) && !(t instanceof ArrayBuffer) && !(t instanceof Promise), ve = (t, e) => {
858
859
  const s = ae.get(t);
859
860
  if (s?.[0] === e)
860
861
  return s[1];
@@ -874,8 +875,8 @@ const K = Object.getPrototypeOf, $ = /* @__PURE__ */ new WeakMap(), Pe = (t) =>
874
875
  };
875
876
  if (ee.has(i))
876
877
  ie(i, !1);
877
- else if (E.has(i)) {
878
- const [c, u] = E.get(
878
+ else if (P.has(i)) {
879
+ const [c, u] = P.get(
879
880
  i
880
881
  );
881
882
  a.value = ve(c, u());
@@ -891,81 +892,81 @@ const K = Object.getPrototypeOf, $ = /* @__PURE__ */ new WeakMap(), Pe = (t) =>
891
892
  },
892
893
  set(n, i, o, a) {
893
894
  const c = !t() && Reflect.has(n, i), u = Reflect.get(n, i, a);
894
- if (c && (ce(u, o) || j.has(o) && ce(u, j.get(o))))
895
+ if (c && (ce(u, o) || U.has(o) && ce(u, U.get(o))))
895
896
  return !0;
896
897
  s(i), Q(o) && (o = Rt(o) || o);
897
- const d = !E.has(o) && At(o) ? Oe(o) : o;
898
- return e(i, d), Reflect.set(n, i, d, a), r(["set", [i], o, u]), !0;
898
+ const y = !P.has(o) && At(o) ? Oe(o) : o;
899
+ return e(i, y), Reflect.set(n, i, y, a), r(["set", [i], o, u]), !0;
899
900
  }
900
- }), E = /* @__PURE__ */ new WeakMap(), ee = /* @__PURE__ */ new WeakSet(), ae = /* @__PURE__ */ new WeakMap(), L = [1], j = /* @__PURE__ */ new WeakMap();
901
+ }), P = /* @__PURE__ */ new WeakMap(), ee = /* @__PURE__ */ new WeakSet(), ae = /* @__PURE__ */ new WeakMap(), L = [1], U = /* @__PURE__ */ new WeakMap();
901
902
  let ce = Object.is, St = (t, e) => new Proxy(t, e), At = Et, vt = ve, Ot = Pt;
902
903
  function Oe(t = {}) {
903
904
  if (!Q(t))
904
905
  throw new Error("object required");
905
- const e = j.get(t);
906
+ const e = U.get(t);
906
907
  if (e)
907
908
  return e;
908
909
  let s = L[0];
909
- const r = /* @__PURE__ */ new Set(), n = (l, p = ++L[0]) => {
910
- s !== p && (i = s = p, r.forEach((f) => f(l, p)));
910
+ const r = /* @__PURE__ */ new Set(), n = (l, f = ++L[0]) => {
911
+ s !== f && (i = s = f, r.forEach((h) => h(l, f)));
911
912
  };
912
913
  let i = s;
913
- const o = (l = L[0]) => (i !== l && (i = l, c.forEach(([p]) => {
914
- const f = p[1](l);
915
- f > s && (s = f);
916
- })), s), a = (l) => (p, f) => {
917
- const T = [...p];
918
- T[1] = [l, ...T[1]], n(T, f);
919
- }, c = /* @__PURE__ */ new Map(), u = (l, p) => {
920
- const f = !ee.has(p) && E.get(p);
921
- if (f) {
922
- if ((U ? "production" : void 0) !== "production" && c.has(l))
914
+ const o = (l = L[0]) => (i !== l && (i = l, c.forEach(([f]) => {
915
+ const h = f[1](l);
916
+ h > s && (s = h);
917
+ })), s), a = (l) => (f, h) => {
918
+ const T = [...f];
919
+ T[1] = [l, ...T[1]], n(T, h);
920
+ }, c = /* @__PURE__ */ new Map(), u = (l, f) => {
921
+ const h = !ee.has(f) && P.get(f);
922
+ if (h) {
923
+ if ((_ ? "production" : void 0) !== "production" && c.has(l))
923
924
  throw new Error("prop listener already exists");
924
925
  if (r.size) {
925
- const T = f[2](a(l));
926
- c.set(l, [f, T]);
926
+ const T = h[2](a(l));
927
+ c.set(l, [h, T]);
927
928
  } else
928
- c.set(l, [f]);
929
+ c.set(l, [h]);
929
930
  }
930
- }, d = (l) => {
931
- var p;
932
- const f = c.get(l);
933
- f && (c.delete(l), (p = f[1]) == null || p.call(f));
934
- }, w = (l) => (r.add(l), r.size === 1 && c.forEach(([f, T], k) => {
935
- if ((U ? "production" : void 0) !== "production" && T)
931
+ }, y = (l) => {
932
+ var f;
933
+ const h = c.get(l);
934
+ h && (c.delete(l), (f = h[1]) == null || f.call(h));
935
+ }, w = (l) => (r.add(l), r.size === 1 && c.forEach(([h, T], C) => {
936
+ if ((_ ? "production" : void 0) !== "production" && T)
936
937
  throw new Error("remove already exists");
937
- const Ce = f[2](a(k));
938
- c.set(k, [f, Ce]);
938
+ const Ce = h[2](a(C));
939
+ c.set(C, [h, Ce]);
939
940
  }), () => {
940
- r.delete(l), r.size === 0 && c.forEach(([f, T], k) => {
941
- T && (T(), c.set(k, [f]));
941
+ r.delete(l), r.size === 0 && c.forEach(([h, T], C) => {
942
+ T && (T(), c.set(C, [h]));
942
943
  });
943
944
  });
944
- let y = !0;
945
- const g = Ot(
946
- () => y,
945
+ let p = !0;
946
+ const m = Ot(
947
+ () => p,
947
948
  u,
948
- d,
949
+ y,
949
950
  n
950
- ), P = St(t, g);
951
- j.set(t, P);
952
- const C = [t, o, w];
953
- return E.set(P, C), Reflect.ownKeys(t).forEach((l) => {
954
- const p = Object.getOwnPropertyDescriptor(
951
+ ), R = St(t, m);
952
+ U.set(t, R);
953
+ const j = [t, o, w];
954
+ return P.set(R, j), Reflect.ownKeys(t).forEach((l) => {
955
+ const f = Object.getOwnPropertyDescriptor(
955
956
  t,
956
957
  l
957
958
  );
958
- "value" in p && p.writable && (P[l] = t[l]);
959
- }), y = !1, P;
959
+ "value" in f && f.writable && (R[l] = t[l]);
960
+ }), p = !1, R;
960
961
  }
961
962
  function Ct(t, e, s) {
962
- const r = E.get(t);
963
- (U ? "production" : void 0) !== "production" && !r && console.warn("Please use proxy object");
963
+ const r = P.get(t);
964
+ (_ ? "production" : void 0) !== "production" && !r && console.warn("Please use proxy object");
964
965
  let n;
965
966
  const i = [], o = r[2];
966
967
  let a = !1;
967
- const u = o((d) => {
968
- i.push(d), n || (n = Promise.resolve().then(() => {
968
+ const u = o((y) => {
969
+ i.push(y), n || (n = Promise.resolve().then(() => {
969
970
  n = void 0, a && e(i.splice(0));
970
971
  }));
971
972
  });
@@ -974,8 +975,8 @@ function Ct(t, e, s) {
974
975
  };
975
976
  }
976
977
  function ue(t) {
977
- const e = E.get(t);
978
- (U ? "production" : void 0) !== "production" && !e && console.warn("Please use proxy object");
978
+ const e = P.get(t);
979
+ (_ ? "production" : void 0) !== "production" && !e && console.warn("Please use proxy object");
979
980
  const [s, r] = e;
980
981
  return vt(s, r());
981
982
  }
@@ -1021,7 +1022,7 @@ function Ut(t, e) {
1021
1022
  const a = te(() => /* @__PURE__ */ new WeakMap(), []);
1022
1023
  return Se(o, r, a, _t);
1023
1024
  }
1024
- const R = Oe({
1025
+ const b = Oe({
1025
1026
  data: null,
1026
1027
  isPending: !1,
1027
1028
  error: null
@@ -1035,15 +1036,15 @@ function Dt({
1035
1036
  onCancel: i,
1036
1037
  onSuccess: o
1037
1038
  }) {
1038
- const a = Ut(R), [c, u] = le(!1);
1039
- function d() {
1039
+ const a = Ut(b), [c, u] = le(!1);
1040
+ function y() {
1040
1041
  u(!0);
1041
1042
  }
1042
1043
  function w() {
1043
1044
  u(!1);
1044
1045
  }
1045
- const y = () => {
1046
- R.isPending = !0, R.error = null, fetch(t, {
1046
+ const p = () => {
1047
+ b.isPending = !0, b.error = null, fetch(t, {
1047
1048
  method: "POST",
1048
1049
  headers: {
1049
1050
  "Content-Type": "application/json"
@@ -1054,27 +1055,27 @@ function Dt({
1054
1055
  amount: r,
1055
1056
  to: n
1056
1057
  })
1057
- }).then((g) => g.json()).then((g) => {
1058
- R.data = g, R.isPending = !1;
1059
- }).catch((g) => {
1060
- R.error = g?.toString(), R.isPending = !1;
1058
+ }).then((m) => m.json()).then((m) => {
1059
+ b.data = m, b.isPending = !1;
1060
+ }).catch((m) => {
1061
+ b.error = m?.toString(), b.isPending = !1;
1061
1062
  });
1062
1063
  };
1063
- return F(y, []), {
1064
+ return F(p, [e, s, r, n]), {
1064
1065
  ...a,
1065
1066
  chain: e,
1066
1067
  token: s,
1067
1068
  to: n,
1068
1069
  isOpen: c,
1069
- open: d,
1070
+ open: y,
1070
1071
  close: w,
1071
- refetch: y,
1072
+ refetch: p,
1072
1073
  onSuccess: o,
1073
1074
  onCancel: i
1074
1075
  };
1075
1076
  }
1076
1077
  export {
1077
- h as Chainrails,
1078
+ d as Chainrails,
1078
1079
  Lt as PaymentModal,
1079
1080
  ot as chains,
1080
1081
  xt as crapi,