@dhedge/trading-widget 6.0.0 → 6.0.1

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.
package/index.js CHANGED
@@ -3736,41 +3736,43 @@ const ST = /* @__PURE__ */ Dn(AT), gi = ({
3736
3736
  size: t = "m",
3737
3737
  className: n = ""
3738
3738
  }) => {
3739
- const { Image: r = ci } = $(), o = e.join(""), [a, i] = W({
3740
- [o]: !1
3741
- }), { height: l, width: c, diameter: d } = zT(t), p = CT(e);
3742
- if (!p?.length || !p[0] || a[o]) return null;
3743
- const u = () => i((m) => ({ ...m, [o]: !0 }));
3744
- return p.length === 1 ? /* @__PURE__ */ s(
3739
+ const { Image: r = ci, customIcons: o } = $(), a = e.join(""), [i, l] = W({
3740
+ [a]: !1
3741
+ }), { height: c, width: d, diameter: p } = zT(t), u = e.length === 1 ? o?.[e[0]] : void 0, m = CT(u ? [] : e);
3742
+ if (u)
3743
+ return /* @__PURE__ */ s(u, { className: C(c, d, n) });
3744
+ if (!m?.length || !m[0] || i[a]) return null;
3745
+ const h = () => l((v) => ({ ...v, [a]: !0 }));
3746
+ return m.length === 1 ? /* @__PURE__ */ s(
3745
3747
  r,
3746
3748
  {
3747
- src: p[0],
3749
+ src: m[0],
3748
3750
  alt: `${e[0]} icon`,
3749
- className: C(l, c, n),
3750
- width: d,
3751
- height: d,
3752
- onError: u
3751
+ className: C(c, d, n),
3752
+ width: p,
3753
+ height: p,
3754
+ onError: h
3753
3755
  }
3754
3756
  ) : /* @__PURE__ */ s(
3755
3757
  "span",
3756
3758
  {
3757
- className: `dtw-flex-no-wrap dtw-z-0 dtw-flex ${l} ${n}`,
3758
- children: p.map((m, h) => /* @__PURE__ */ s(
3759
+ className: `dtw-flex-no-wrap dtw-z-0 dtw-flex ${c} ${n}`,
3760
+ children: m.map((v, g) => /* @__PURE__ */ s(
3759
3761
  r,
3760
3762
  {
3761
- src: m,
3762
- alt: `${e[h]} icon`,
3763
+ src: v,
3764
+ alt: `${e[g]} icon`,
3763
3765
  className: C(
3764
3766
  "dtw-inline-block dtw-overflow-visible dtw-rounded-full",
3767
+ d,
3765
3768
  c,
3766
- l,
3767
- UT(h, e.length)
3769
+ UT(g, e.length)
3768
3770
  ),
3769
- width: d,
3770
- height: d,
3771
- onError: u
3771
+ width: p,
3772
+ height: p,
3773
+ onError: h
3772
3774
  },
3773
- h
3775
+ g
3774
3776
  ))
3775
3777
  }
3776
3778
  );
@@ -3966,17 +3968,16 @@ function Kn(e, t, n) {
3966
3968
  }
3967
3969
  }
3968
3970
  const qT = ({
3969
- action: e,
3970
- chainId: t,
3971
- txHash: n,
3972
- error: r
3971
+ chainId: e,
3972
+ txHash: t,
3973
+ error: n
3973
3974
  }) => {
3974
- if (e !== "update_ondo_prices" || t !== On.id || !n || !r)
3975
+ if (e !== On.id || !t || !n)
3975
3976
  return !1;
3976
- const o = r instanceof Error ? r.message : String(r);
3977
- return /UnknownRpcError|\bNo Result\b/i.test(o);
3977
+ const r = n instanceof Error ? n.message : String(n);
3978
+ return /\bNo Result\b/i.test(r);
3978
3979
  }, KT = () => {
3979
- const [e, t] = se(), n = Z()[1], r = Vd(), o = qd(), [a] = e, i = a?.txHash, l = a?.action, c = l === "approve", d = a?.chainId, { invalidateTradingQueries: p, invalidateAllowanceQueries: u } = Zt(), { data: m, error: h } = mt({
3980
+ const [e, t] = se(), n = Z()[1], r = Vd(), o = qd(), [a] = e, i = a?.txHash, l = a?.action, c = l === "approve", d = a?.chainId, { invalidateTradingQueries: p, invalidateAllowanceQueries: u } = Zt(), { data: m, error: h, refetch: v } = mt({
3980
3981
  hash: i,
3981
3982
  chainId: d,
3982
3983
  pollingInterval: Gt,
@@ -3984,19 +3985,19 @@ const qT = ({
3984
3985
  });
3985
3986
  N(() => {
3986
3987
  if (!m) return;
3987
- const v = () => {
3988
- const b = m.transactionHash;
3989
- if (b) {
3990
- const T = Kn(b, "transaction", d);
3991
- l !== "update_ondo_prices" && (n({ link: T, status: "Success", action: l }), o?.(m, l, T)), t({ type: "remove", status: "success", txHash: b });
3988
+ const g = () => {
3989
+ const T = m.transactionHash;
3990
+ if (T) {
3991
+ const x = Kn(T, "transaction", d);
3992
+ l !== "update_ondo_prices" && (n({ link: x, status: "Success", action: l }), o?.(m, l, x)), t({ type: "remove", status: "success", txHash: T });
3992
3993
  }
3993
3994
  c ? u() : p();
3994
- }, g = d ? Lr[d] ?? 0 : 0;
3995
- if (g > 0) {
3996
- const b = setTimeout(v, g);
3997
- return () => clearTimeout(b);
3995
+ }, b = d ? Lr[d] ?? 0 : 0;
3996
+ if (b > 0) {
3997
+ const T = setTimeout(g, b);
3998
+ return () => clearTimeout(T);
3998
3999
  } else
3999
- v();
4000
+ g();
4000
4001
  }, [
4001
4002
  m,
4002
4003
  c,
@@ -4008,14 +4009,20 @@ const qT = ({
4008
4009
  u,
4009
4010
  p
4010
4011
  ]), N(() => {
4011
- !h || qT({ action: l, chainId: d, txHash: i, error: h }) || (n({
4012
- isOpen: !1,
4013
- status: "None",
4014
- link: "",
4015
- action: l,
4016
- sendTokens: null,
4017
- receiveTokens: null
4018
- }), t({ type: "remove", status: "fail" }), r?.(h, l, d, i));
4012
+ if (h) {
4013
+ if (qT({ chainId: d, txHash: i, error: h })) {
4014
+ v();
4015
+ return;
4016
+ }
4017
+ n({
4018
+ isOpen: !1,
4019
+ status: "None",
4020
+ link: "",
4021
+ action: l,
4022
+ sendTokens: null,
4023
+ receiveTokens: null
4024
+ }), t({ type: "remove", status: "fail" }), r?.(h, l, d, i);
4025
+ }
4019
4026
  }, [
4020
4027
  h,
4021
4028
  c,
@@ -4024,7 +4031,8 @@ const qT = ({
4024
4031
  i,
4025
4032
  n,
4026
4033
  t,
4027
- r
4034
+ r,
4035
+ v
4028
4036
  ]);
4029
4037
  }, je = ({
4030
4038
  action: e,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dhedge/trading-widget",
3
- "version": "6.0.0",
3
+ "version": "6.0.1",
4
4
  "dependencies": {
5
5
  "@headlessui/react": "^2.1.2",
6
6
  "@heroicons/react": "^2.1.5",
@@ -15,5 +15,8 @@ export declare const ComponentProviderContext: import("react").Context<Partial<{
15
15
  OnDemandWithdrawAlert?: import("react").ComponentType | undefined;
16
16
  BecomeReferrerButton?: import("react").ComponentType<import('../../providers/component-provider/component-provider.types').BecomeReferrerButtonProps> | undefined;
17
17
  DeriveSuccessBanner?: import("react").ComponentType | undefined;
18
+ customIcons?: Record<string, import("react").ComponentType<{
19
+ className?: string | undefined;
20
+ }>> | undefined;
18
21
  } | undefined>>;
19
22
  export declare const ComponentProvider: FC<PropsWithChildren<ComponentProviderProps>>;
@@ -14,4 +14,7 @@ export declare const useComponentContext: () => Partial<{
14
14
  OnDemandWithdrawAlert?: import("react").ComponentType | undefined;
15
15
  BecomeReferrerButton?: import("react").ComponentType<import("./component-provider.types").BecomeReferrerButtonProps> | undefined;
16
16
  DeriveSuccessBanner?: import("react").ComponentType | undefined;
17
+ customIcons?: Record<string, import("react").ComponentType<{
18
+ className?: string | undefined;
19
+ }>> | undefined;
17
20
  }>;
@@ -45,5 +45,8 @@ export interface ComponentProviderProps {
45
45
  OnDemandWithdrawAlert?: ComponentType;
46
46
  BecomeReferrerButton?: ComponentType<BecomeReferrerButtonProps>;
47
47
  DeriveSuccessBanner?: ComponentType;
48
+ customIcons?: Record<string, ComponentType<{
49
+ className?: string;
50
+ }>>;
48
51
  };
49
52
  }