@dhedge/trading-widget 6.0.0-canary.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.cjs +1 -1
- package/index.js +56 -48
- package/package.json +1 -1
- package/trading-widget/providers/component-provider/component-provider.d.ts +3 -0
- package/trading-widget/providers/component-provider/component-provider.hooks.d.ts +3 -0
- package/trading-widget/providers/component-provider/component-provider.types.d.ts +3 -0
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 } = $(),
|
|
3740
|
-
[
|
|
3741
|
-
}), { height:
|
|
3742
|
-
if (
|
|
3743
|
-
|
|
3744
|
-
|
|
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:
|
|
3749
|
+
src: m[0],
|
|
3748
3750
|
alt: `${e[0]} icon`,
|
|
3749
|
-
className: C(
|
|
3750
|
-
width:
|
|
3751
|
-
height:
|
|
3752
|
-
onError:
|
|
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 ${
|
|
3758
|
-
children:
|
|
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:
|
|
3762
|
-
alt: `${e[
|
|
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
|
-
|
|
3767
|
-
UT(h, e.length)
|
|
3769
|
+
UT(g, e.length)
|
|
3768
3770
|
),
|
|
3769
|
-
width:
|
|
3770
|
-
height:
|
|
3771
|
-
onError:
|
|
3771
|
+
width: p,
|
|
3772
|
+
height: p,
|
|
3773
|
+
onError: h
|
|
3772
3774
|
},
|
|
3773
|
-
|
|
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
|
-
|
|
3970
|
-
|
|
3971
|
-
|
|
3972
|
-
error: r
|
|
3971
|
+
chainId: e,
|
|
3972
|
+
txHash: t,
|
|
3973
|
+
error: n
|
|
3973
3974
|
}) => {
|
|
3974
|
-
if (e !==
|
|
3975
|
+
if (e !== On.id || !t || !n)
|
|
3975
3976
|
return !1;
|
|
3976
|
-
const
|
|
3977
|
-
return
|
|
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
|
|
3988
|
-
const
|
|
3989
|
-
if (
|
|
3990
|
-
const
|
|
3991
|
-
l !== "update_ondo_prices" && (n({ link:
|
|
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
|
-
},
|
|
3995
|
-
if (
|
|
3996
|
-
const
|
|
3997
|
-
return () => clearTimeout(
|
|
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
|
-
|
|
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
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
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
|
@@ -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
|
}
|