@dhedge/trading-widget 5.9.0 → 5.12.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.
- package/README.md +68 -42
- package/const.cjs +1 -1
- package/const.js +21 -20
- package/core-kit/const/default-data.d.ts +1 -0
- package/core-kit/const/logger.d.ts +2 -5
- package/core-kit/const/storage.d.ts +0 -1
- package/core-kit/hooks/state/action.d.ts +0 -1
- package/core-kit/hooks/trading/deposit-v2/deposit-transaction/use-deposit-common.d.ts +1 -1
- package/core-kit/hooks/trading/deposit-v2/use-get-vault-deposit-transaction-arguments.d.ts +1 -1
- package/core-kit/hooks/trading/deposit-v2/use-vault-deposit-tokens.d.ts +5 -1
- package/core-kit/hooks/trading/index.d.ts +0 -1
- package/core-kit/hooks/trading/withdraw-v2/init-step/use-fetch-init-withdraw-complex-asset-data.d.ts +2 -1
- package/core-kit/hooks/web3/index.d.ts +0 -1
- package/core-kit/types/state.types.d.ts +0 -1
- package/core-kit/types/trading-panel.types.d.ts +2 -3
- package/core-kit/utils/complex-withdraw-asset-data.d.ts +6 -0
- package/core-kit/utils/deposit.d.ts +4 -2
- package/core-kit/utils/index.d.ts +1 -1
- package/core-kit/utils/slippage-auto-simulation.d.ts +8 -0
- package/core-kit/utils/transaction.d.ts +2 -1
- package/{storage-C0zg_Mfy.js → gmx-3UudxpaT.js} +186 -178
- package/gmx-Bmop5mtI.cjs +1 -0
- package/index.cjs +1 -1
- package/index.d.ts +4 -2
- package/index.js +7814 -6931
- package/limit-orders/common/network-check-button.d.ts +7 -0
- package/limit-orders/common/network-check-button.hooks.d.ts +4 -0
- package/limit-orders/common/utils.d.ts +2 -0
- package/limit-orders/index.d.ts +9 -5
- package/limit-orders/limit-buys/component/input-group/input-amount-field.d.ts +2 -0
- package/limit-orders/limit-buys/component/input-group/input-amount-field.hooks.d.ts +11 -0
- package/limit-orders/limit-buys/component/input-group/input-group.d.ts +2 -0
- package/limit-orders/limit-buys/component/input-group/input-group.hooks.d.ts +15 -0
- package/limit-orders/limit-buys/component/input-group/slippage-deadline-fields.d.ts +2 -0
- package/limit-orders/limit-buys/component/input-group/slippage-deadline-fields.hooks.d.ts +5 -0
- package/limit-orders/limit-buys/component/input-group/token-select-overlay.d.ts +10 -0
- package/limit-orders/limit-buys/component/limit-buy-button/sign-limit-buy-button.d.ts +6 -0
- package/limit-orders/limit-buys/component/limit-buy-button/sign-limit-buy-button.hooks.d.ts +6 -0
- package/limit-orders/limit-buys/component/limit-buy-content.d.ts +6 -0
- package/limit-orders/limit-buys/component/limit-buy-order-modal.d.ts +14 -0
- package/limit-orders/limit-buys/component/limit-buy-overlay.d.ts +11 -0
- package/limit-orders/limit-buys/component/terms-confirmation.d.ts +8 -0
- package/limit-orders/limit-buys/constants.d.ts +55 -0
- package/limit-orders/limit-buys/hooks/state.d.ts +2 -0
- package/limit-orders/limit-buys/hooks/use-approve-and-sign-limit-buy.d.ts +7 -0
- package/limit-orders/limit-buys/hooks/use-is-permit2-approved.d.ts +1 -0
- package/limit-orders/limit-buys/hooks/use-permit2-approve-transaction.d.ts +5 -0
- package/limit-orders/limit-buys/hooks/use-sign-limit-buy-order.d.ts +3 -0
- package/limit-orders/limit-buys/providers/state-provider/reducer.d.ts +3 -0
- package/limit-orders/limit-buys/providers/state-provider/state-provider.d.ts +6 -0
- package/limit-orders/limit-buys/providers/state-provider/state-provider.types.d.ts +69 -0
- package/limit-orders/limit-buys/providers/translation-provider/index.d.ts +3 -0
- package/limit-orders/limit-buys/providers/translation-provider/translation-provider.d.ts +4 -0
- package/limit-orders/limit-buys/providers/translation-provider/translation-provider.defaults.d.ts +2 -0
- package/limit-orders/limit-buys/providers/translation-provider/translation-provider.hooks.d.ts +1 -0
- package/limit-orders/limit-buys/providers/translation-provider/translation-provider.types.d.ts +29 -0
- package/limit-orders/limit-buys/types.d.ts +27 -0
- package/limit-orders/limit-buys/utils.d.ts +4 -0
- package/limit-orders/{component → limit-sells/component}/input-group/input-group.hooks.d.ts +0 -2
- package/limit-orders/{component → limit-sells/component}/limit-order-button/approve-and-create-limit-order-button.d.ts +1 -0
- package/limit-orders/{component → limit-sells/component}/limit-order-content.d.ts +1 -1
- package/limit-orders/{component → limit-sells/component}/limit-order-overlay.d.ts +3 -3
- package/limit-orders/{component/limit-order-modal.d.ts → limit-sells/component/limit-sell-order-modal.d.ts} +5 -5
- package/limit-orders/limit-sells/component/terms-confirmation.d.ts +8 -0
- package/limit-orders/{constants.d.ts → limit-sells/constants.d.ts} +2 -2
- package/limit-orders/limit-sells/hooks/use-invalidate-limit-sell-order-query.d.ts +1 -0
- package/limit-orders/{hooks → limit-sells/hooks}/use-on-limit-order-settled.d.ts +1 -1
- package/limit-orders/{hooks/use-user-limit-order.d.ts → limit-sells/hooks/use-user-limit-sell-order.d.ts} +3 -3
- package/limit-orders/{providers → limit-sells/providers}/state-provider/reducer.d.ts +1 -1
- package/limit-orders/{providers → limit-sells/providers}/state-provider/state-provider.d.ts +1 -1
- package/limit-orders/{providers → limit-sells/providers}/state-provider/state-provider.types.d.ts +1 -1
- package/limit-orders/{utils.d.ts → limit-sells/utils.d.ts} +3 -3
- package/limit-orders/providers/translation-provider/translation-provider.types.d.ts +1 -0
- package/package.json +1 -1
- package/slippage-auto-simulation-B0sf5jE_.js +400 -0
- package/slippage-auto-simulation-yZX7Qmre.cjs +1 -0
- package/{derive-BmKPodpX.js → storage-CSc9iE5L.js} +6 -2
- package/storage-DHoO5PX_.cjs +1 -0
- package/style.css +1 -1
- package/trading-widget/components/deposit/button/valid-deposit-button/valid-deposit-button.hooks.d.ts +0 -2
- package/trading-widget/components/widget/widget-buttons/index.d.ts +1 -0
- package/trading-widget/components/widget/widget-buttons/limit-buy-button/limit-buy-button.d.ts +3 -0
- package/trading-widget/components/widget/widget-overlay/hyper-evm-warning-overlay/hyper-evm-warning-overlay.d.ts +3 -0
- package/trading-widget/components/widget/widget-overlay/index.d.ts +2 -0
- package/trading-widget/components/widget/widget-overlay/limit-buys-overlay/limit-buys-overlay.d.ts +3 -0
- package/trading-widget/components/widget/widget-overlay/limit-buys-overlay/limit-buys-overlay.hooks.d.ts +17 -0
- package/trading-widget/components/widget/widget-settings/index.d.ts +0 -1
- package/trading-widget/components/widget/widget-settings/slippage-selector/slippage-selector.hooks.d.ts +0 -1
- package/trading-widget/hooks/index.d.ts +3 -1
- package/trading-widget/hooks/use-display-limit-buy-overlay.d.ts +1 -0
- package/trading-widget/hooks/use-open-limit-buys-overlay.d.ts +4 -0
- package/trading-widget/hooks/use-show-hyper-evm-deposit-warning.d.ts +1 -0
- package/trading-widget/providers/config-provider/config-provider.types.d.ts +4 -1
- package/trading-widget/providers/config-provider/index.d.ts +1 -0
- package/trading-widget/providers/config-provider/use-resolved-default-swap-transaction-slippage.d.ts +1 -0
- package/trading-widget/providers/translation-provider/translation-provider.types.d.ts +7 -5
- package/trading-widget/types/overlay.types.d.ts +2 -0
- package/utils.cjs +1 -1
- package/utils.js +29 -29
- package/complex-withdraw-asset-data-D8GMw8ql.js +0 -391
- package/complex-withdraw-asset-data-DSjzOaBD.cjs +0 -1
- package/core-kit/hooks/trading/deposit-v2/deposit-transaction/use-batch-approve-transaction.d.ts +0 -141
- package/core-kit/hooks/trading/deposit-v2/deposit-transaction/use-batch-deposit.d.ts +0 -1
- package/core-kit/hooks/trading/trade-handlers/use-batch-trading-settle-handler.d.ts +0 -5
- package/core-kit/hooks/trading/use-is-batch-contract-writes-trading.d.ts +0 -1
- package/core-kit/hooks/web3/use-custom-send-calls.d.ts +0 -14
- package/core-kit/hooks/web3/use-is-batch-contract-writes-supported.d.ts +0 -1
- package/core-kit/utils/batch-transactions.d.ts +0 -2
- package/derive-CsdqSZEg.cjs +0 -1
- package/limit-orders/component/input-group/terms-content.d.ts +0 -6
- package/limit-orders/component/limit-order-button/network-check-button.d.ts +0 -2
- package/limit-orders/component/limit-order-button/network-check-button.hooks.d.ts +0 -4
- package/limit-orders/hooks/use-invalidate-limit-order-query.d.ts +0 -1
- package/storage-B9jNfIvl.cjs +0 -1
- package/trading-widget/components/deposit/button/batch-trade-button.d.ts +0 -2
- package/trading-widget/components/widget/widget-settings/batch-transactions-switch/batch-transactions-switch.d.ts +0 -2
- package/trading-widget/components/widget/widget-settings/batch-transactions-switch/batch-transactions-switch.hooks.d.ts +0 -1
- package/trading-widget/hooks/use-trading-type-name.d.ts +0 -2
- /package/limit-orders/{component/common → common}/action-button.d.ts +0 -0
- /package/limit-orders/{component/common → common}/asset-price-panel.d.ts +0 -0
- /package/limit-orders/{component/common → common}/modal-content.d.ts +0 -0
- /package/limit-orders/{component/common → common}/modal-dialog.d.ts +0 -0
- /package/limit-orders/{component/common → common}/percentage-input.d.ts +0 -0
- /package/limit-orders/{component/common → common}/price-input.d.ts +0 -0
- /package/limit-orders/{component/common → common}/switch-panel.d.ts +0 -0
- /package/limit-orders/{component → limit-sells/component}/input-group/input-group.d.ts +0 -0
- /package/limit-orders/{component → limit-sells/component}/limit-order-button/approve-and-create-limit-order-button.hooks.d.ts +0 -0
- /package/limit-orders/{component → limit-sells/component}/limit-order-button/limit-order-delete-button.d.ts +0 -0
- /package/limit-orders/{component → limit-sells/component}/limit-order-button/limit-order-delete-button.hooks.d.ts +0 -0
- /package/limit-orders/{component → limit-sells/component}/limit-order-content.hooks.d.ts +0 -0
- /package/limit-orders/{component → limit-sells/component}/limit-order-modal.hooks.d.ts +0 -0
- /package/limit-orders/{hooks → limit-sells/hooks}/state.d.ts +0 -0
- /package/limit-orders/{hooks → limit-sells/hooks}/use-approve-and-create-limit-order.d.ts +0 -0
- /package/limit-orders/{hooks → limit-sells/hooks}/use-create-limit-order-transaction.d.ts +0 -0
- /package/limit-orders/{hooks → limit-sells/hooks}/use-existing-limit-order-default-prices.d.ts +0 -0
- /package/limit-orders/{hooks → limit-sells/hooks}/use-is-limit-order-approved.d.ts +0 -0
- /package/limit-orders/{hooks → limit-sells/hooks}/use-limit-order-approve-transaction.d.ts +0 -0
- /package/limit-orders/{hooks → limit-sells/hooks}/use-limit-order-covered-vault-amount.d.ts +0 -0
- /package/limit-orders/{hooks → limit-sells/hooks}/use-listen-limit-order-execution.d.ts +0 -0
|
@@ -1,391 +0,0 @@
|
|
|
1
|
-
import i from "bignumber.js";
|
|
2
|
-
import { ak as B, ai as R, aj as O, b as T, q as _, al as b, am as C, a4 as F, c as M, a8 as v, ae as P, ad as $, Z as x, an as h, f as U, e as K, M as W, R as Y, P as V, ao as G, ap as H, Q as Z, N as k, ab as g, $ as Q, W as j, X as z, U as X, _ as y } from "./storage-C0zg_Mfy.js";
|
|
3
|
-
import { stringToHex as p, encodeAbiParameters as f } from "viem";
|
|
4
|
-
const q = () => typeof window < "u";
|
|
5
|
-
function J() {
|
|
6
|
-
return q() && typeof window.ethereum < "u";
|
|
7
|
-
}
|
|
8
|
-
async function _t(t) {
|
|
9
|
-
try {
|
|
10
|
-
if (J())
|
|
11
|
-
return window.ethereum.request({
|
|
12
|
-
method: "wallet_watchAsset",
|
|
13
|
-
params: {
|
|
14
|
-
type: "ERC20",
|
|
15
|
-
options: t
|
|
16
|
-
}
|
|
17
|
-
});
|
|
18
|
-
} catch {
|
|
19
|
-
return !1;
|
|
20
|
-
}
|
|
21
|
-
return !1;
|
|
22
|
-
}
|
|
23
|
-
const d = (t, e) => t?.toLowerCase() === e?.toLowerCase(), pt = (t) => d(t, B), tt = (t, e) => O[e]?.[t] ?? T, ft = (t) => R[t], Et = (t) => t && `${t.substring(0, 6)}...${t.substring(
|
|
24
|
-
t.length - 4,
|
|
25
|
-
t.length
|
|
26
|
-
)}`, Nt = ({
|
|
27
|
-
address: t,
|
|
28
|
-
chainId: e
|
|
29
|
-
}) => {
|
|
30
|
-
const s = tt(
|
|
31
|
-
"aaveLendingPoolV3",
|
|
32
|
-
e
|
|
33
|
-
);
|
|
34
|
-
return d(t, s);
|
|
35
|
-
}, et = ({
|
|
36
|
-
sourceAddress: t,
|
|
37
|
-
amount: e
|
|
38
|
-
}) => `${t}_${e}`, Dt = (t, e) => {
|
|
39
|
-
const s = t.slice(0, e), a = t.slice(e);
|
|
40
|
-
return { firstPart: s, secondPart: a };
|
|
41
|
-
}, st = (t, e) => t / e * 100, wt = (t) => t < 1 ? 4 : t < 10 ? 3 : 2, ht = (t, e = _) => new i(t.toString()).shiftedBy(e).toFixed(0), yt = (t, e, s, a) => new i(e).dividedBy(s).multipliedBy(t).shiftedBy(-(a || _)).toNumber(), It = (t) => BigInt(
|
|
42
|
-
new i(t || "0").shiftedBy(_).toFixed(0, i.ROUND_DOWN)
|
|
43
|
-
), Lt = (t) => {
|
|
44
|
-
const e = new i(0.01), s = new i(t), a = !s.isZero() && s.lt(e) ? e : s;
|
|
45
|
-
return BigInt(a.multipliedBy(100).toFixed(0));
|
|
46
|
-
}, Bt = ({
|
|
47
|
-
vaultAddress: t,
|
|
48
|
-
swapData: e,
|
|
49
|
-
sendTokenAddress: s,
|
|
50
|
-
sendTokenAmount: a,
|
|
51
|
-
vaultDepositTokenAddress: n,
|
|
52
|
-
minVaultTokensReceivedAmount: r,
|
|
53
|
-
routerKey: o = "ONE_INCH",
|
|
54
|
-
swapDestinationAmount: c,
|
|
55
|
-
swapSlippage: u
|
|
56
|
-
}) => {
|
|
57
|
-
const l = new i(c).multipliedBy(1 - u / 100).toFixed(0), A = [p(o, { size: 32 }), e];
|
|
58
|
-
return [t, [[s, a, A], [n, l]], r];
|
|
59
|
-
}, Rt = ({
|
|
60
|
-
receiveAssetAddress: t,
|
|
61
|
-
assets: e,
|
|
62
|
-
swapData: s
|
|
63
|
-
}) => {
|
|
64
|
-
const a = {
|
|
65
|
-
srcData: [],
|
|
66
|
-
destAmount: new i("0")
|
|
67
|
-
}, { srcData: n } = e?.reduce((r, o) => {
|
|
68
|
-
const c = s?.[o.address];
|
|
69
|
-
if (!c)
|
|
70
|
-
return r;
|
|
71
|
-
const u = [
|
|
72
|
-
p(c.routerKey, { size: 32 }),
|
|
73
|
-
c.rawTransaction.data
|
|
74
|
-
], l = [o.address, o.rawBalance, u];
|
|
75
|
-
return {
|
|
76
|
-
srcData: [...r.srcData, l],
|
|
77
|
-
destAmount: r.destAmount.plus(c.destinationAmount)
|
|
78
|
-
};
|
|
79
|
-
}, a) ?? a;
|
|
80
|
-
return [
|
|
81
|
-
n,
|
|
82
|
-
[
|
|
83
|
-
t,
|
|
84
|
-
// destAmount.times(1 - slippage / 100).toFixed(0, BigNumber.ROUND_DOWN),
|
|
85
|
-
// Use 0 to allow swaps with incorrectly increased destination amounts. Slippage protection is handled at a higher level using minExpectedReceiveAmount.
|
|
86
|
-
"0"
|
|
87
|
-
]
|
|
88
|
-
];
|
|
89
|
-
}, at = ({
|
|
90
|
-
assetAddress: t,
|
|
91
|
-
swapQuotes: e,
|
|
92
|
-
swapParams: s,
|
|
93
|
-
slippageToleranceForContractTransaction: a,
|
|
94
|
-
routerKey: n
|
|
95
|
-
}) => {
|
|
96
|
-
if (!s)
|
|
97
|
-
return {
|
|
98
|
-
supportedAsset: t,
|
|
99
|
-
withdrawData: "",
|
|
100
|
-
slippageTolerance: BigInt(0)
|
|
101
|
-
};
|
|
102
|
-
const { srcData: r, dstData: o } = s, c = r.map(({ asset: A, amount: m }) => {
|
|
103
|
-
const S = e?.[et({
|
|
104
|
-
sourceAddress: A,
|
|
105
|
-
amount: m.toString()
|
|
106
|
-
})]?.find((L) => L.routerKey === n);
|
|
107
|
-
return {
|
|
108
|
-
asset: A,
|
|
109
|
-
amount: m,
|
|
110
|
-
swapData: {
|
|
111
|
-
routerKey: p(S?.routerKey ?? "", { size: 32 }),
|
|
112
|
-
txData: S?.rawTransaction.data ?? "0x"
|
|
113
|
-
}
|
|
114
|
-
};
|
|
115
|
-
}), u = f(
|
|
116
|
-
b,
|
|
117
|
-
[c]
|
|
118
|
-
), l = f(C, [
|
|
119
|
-
{
|
|
120
|
-
encodedSrcData: u,
|
|
121
|
-
dstData: {
|
|
122
|
-
dstAddress: o.asset,
|
|
123
|
-
dstAmount: o.amount
|
|
124
|
-
},
|
|
125
|
-
slippage: a
|
|
126
|
-
}
|
|
127
|
-
]);
|
|
128
|
-
return {
|
|
129
|
-
supportedAsset: t,
|
|
130
|
-
withdrawData: l,
|
|
131
|
-
slippageTolerance: a
|
|
132
|
-
};
|
|
133
|
-
}, Ot = (t, e) => M[e]?.nativeTokenSymbol === t, bt = ({
|
|
134
|
-
nativeTokenBalance: t,
|
|
135
|
-
tokenDecimals: e,
|
|
136
|
-
gasPrice: s
|
|
137
|
-
}) => {
|
|
138
|
-
const a = new i(s).multipliedBy(F).shiftedBy(-e), n = new i(t).minus(
|
|
139
|
-
a
|
|
140
|
-
);
|
|
141
|
-
return n.gt("0") ? n : new i("0");
|
|
142
|
-
}, Ct = (t) => v.includes(t), Ft = (t) => {
|
|
143
|
-
const e = Object.values(t).reduce(
|
|
144
|
-
(s, { type: a }) => (s[a] = s[a] + 1, s),
|
|
145
|
-
{ string: 0, number: 0 }
|
|
146
|
-
);
|
|
147
|
-
if (e.string > 10)
|
|
148
|
-
throw new Error("logger params must contain up to 10 string values");
|
|
149
|
-
if (e.number > 40)
|
|
150
|
-
throw new Error("logger params must contain up to 40 numeric values");
|
|
151
|
-
return !0;
|
|
152
|
-
}, nt = (t, e = 150) => t.length > e ? t.substring(0, e) : t, E = (t, e = P) => {
|
|
153
|
-
const s = t.toLowerCase();
|
|
154
|
-
return e.sort((a, n) => n.length - a.length).find((a) => s.includes(a.toLowerCase()));
|
|
155
|
-
}, N = (t) => $[t] ?? x[t], Mt = ({
|
|
156
|
-
errorMessage: t,
|
|
157
|
-
abiErrors: e
|
|
158
|
-
}) => {
|
|
159
|
-
if (!t || t.includes("User rejected"))
|
|
160
|
-
return null;
|
|
161
|
-
const s = e.find((r) => t.includes(r));
|
|
162
|
-
if (s && E(s))
|
|
163
|
-
return N(s);
|
|
164
|
-
const a = E(t);
|
|
165
|
-
if (a)
|
|
166
|
-
return N(a);
|
|
167
|
-
const [n] = t.split(s ? "." : "Contract").map((r) => r.trim());
|
|
168
|
-
return {
|
|
169
|
-
title: "Transaction failed",
|
|
170
|
-
hint: `${nt(n ?? "")} ${s ? `: ${s}` : ""}`
|
|
171
|
-
};
|
|
172
|
-
}, vt = (t) => typeof t == "number" && Number.isFinite(t), Pt = (t) => typeof t == "bigint" && t !== BigInt(0), rt = (t, e = h) => new i(t).shiftedBy(-e).toNumber(), ot = (t) => !isNaN(parseFloat(t)) && !isNaN(t), it = ({
|
|
173
|
-
value: t,
|
|
174
|
-
minimumFractionDigits: e = 2,
|
|
175
|
-
maximumFractionDigits: s = 2,
|
|
176
|
-
compact: a = !1,
|
|
177
|
-
normalize: n = !1
|
|
178
|
-
}) => new Intl.NumberFormat("en-US", {
|
|
179
|
-
style: "currency",
|
|
180
|
-
currency: "USD",
|
|
181
|
-
notation: a ? "compact" : void 0,
|
|
182
|
-
minimumFractionDigits: e,
|
|
183
|
-
maximumFractionDigits: s
|
|
184
|
-
}).format(n ? rt(t) : Number(t)), D = (t) => ot(t) ? new i(t).toFixed() : "", w = ["₀", "₁", "₂", "₃", "₄", "₅", "₆", "₇", "₈", "₉"], ct = ({
|
|
185
|
-
value: t,
|
|
186
|
-
decimals: e = 4
|
|
187
|
-
}) => {
|
|
188
|
-
const s = new i(t);
|
|
189
|
-
if (s.isGreaterThan(1) || s.isZero())
|
|
190
|
-
return D(s.toFixed(e));
|
|
191
|
-
const n = (/e/i.test(t.toString()) ? parseFloat(t.toString()).toFixed(h) : t.toString()).match(/^0\.(0+)(\d+)$/);
|
|
192
|
-
if (n) {
|
|
193
|
-
const [, r, o] = n;
|
|
194
|
-
if (r.length >= e && r.length < w.length)
|
|
195
|
-
return `0.0${w[r.length]}${o.slice(0, 3)}`;
|
|
196
|
-
}
|
|
197
|
-
return D(s.toFixed(e));
|
|
198
|
-
}, ut = (t, e = 0) => `${t.toLocaleString("en-US", { maximumFractionDigits: e })}%`, $t = (t) => t.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ","), xt = (t, e, s = 0) => {
|
|
199
|
-
const a = st(+t, e);
|
|
200
|
-
return ut(a, s);
|
|
201
|
-
}, Ut = ({
|
|
202
|
-
currency: t,
|
|
203
|
-
value: e
|
|
204
|
-
}) => t === "USD" ? it({ value: e }) : `${U[t]} ${ct({
|
|
205
|
-
value: e,
|
|
206
|
-
decimals: K[t]
|
|
207
|
-
})}`, dt = (t, e) => new i(
|
|
208
|
-
new i(t).toFixed(e, i.ROUND_DOWN)
|
|
209
|
-
).toString(), lt = (t, e = 3, s = 2) => {
|
|
210
|
-
if (t.length <= 5)
|
|
211
|
-
return t;
|
|
212
|
-
const a = "...";
|
|
213
|
-
return t.length <= e + s + a.length ? t : `${t.slice(0, e)}${a}${t.slice(-s)}`;
|
|
214
|
-
}, Kt = ({
|
|
215
|
-
balance: t,
|
|
216
|
-
symbol: e,
|
|
217
|
-
precision: s,
|
|
218
|
-
truncateSymbol: a
|
|
219
|
-
}) => `${dt(t, s)} ${a ? lt(e) : e}`, Wt = (t) => {
|
|
220
|
-
if (!t)
|
|
221
|
-
return;
|
|
222
|
-
const e = t.match(/0x[a-fA-F0-9]{64}/);
|
|
223
|
-
if (!e)
|
|
224
|
-
return;
|
|
225
|
-
const s = e[0];
|
|
226
|
-
return `${s.slice(0, 4)}...${s.slice(-3)}`;
|
|
227
|
-
}, I = typeof window < "u", Yt = (t) => d(G, t) || d(H, t), Vt = (t) => k.some(
|
|
228
|
-
(e) => d(e, t)
|
|
229
|
-
), Gt = (t) => W[t.toLowerCase()] ?? {
|
|
230
|
-
symbol: "",
|
|
231
|
-
decimals: 18,
|
|
232
|
-
address: T
|
|
233
|
-
}, Ht = (t) => d(t, Z) ? Y : V, At = (t) => `eth_${t}`, Zt = ({
|
|
234
|
-
action: t,
|
|
235
|
-
log: e,
|
|
236
|
-
symbol: s,
|
|
237
|
-
vaultAddress: a,
|
|
238
|
-
chainId: n
|
|
239
|
-
}) => {
|
|
240
|
-
const r = {
|
|
241
|
-
[g.SYMBOL.NAME]: s,
|
|
242
|
-
[g.CHAIN_ID.NAME]: n,
|
|
243
|
-
[g.ADDRESS.NAME]: At(a)
|
|
244
|
-
};
|
|
245
|
-
Q[t].forEach((o) => {
|
|
246
|
-
e?.(o, r);
|
|
247
|
-
});
|
|
248
|
-
}, kt = (t) => X.some((e) => d(e, t)), Qt = (t) => j[t.toLowerCase()] ?? {
|
|
249
|
-
symbol: "",
|
|
250
|
-
decimals: 18,
|
|
251
|
-
address: T
|
|
252
|
-
}, jt = (t) => z[t.toLowerCase()];
|
|
253
|
-
function zt() {
|
|
254
|
-
if (I)
|
|
255
|
-
try {
|
|
256
|
-
const t = localStorage.getItem(
|
|
257
|
-
y.IS_BATCH_TRANSACTIONS_ENABLED
|
|
258
|
-
);
|
|
259
|
-
return t ? JSON.parse(t) : void 0;
|
|
260
|
-
} catch {
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
function Xt(t) {
|
|
265
|
-
if (I)
|
|
266
|
-
try {
|
|
267
|
-
localStorage.setItem(
|
|
268
|
-
y.IS_BATCH_TRANSACTIONS_ENABLED,
|
|
269
|
-
JSON.stringify(t)
|
|
270
|
-
);
|
|
271
|
-
} catch (e) {
|
|
272
|
-
console.error("[core-kit]: Failed to persist batch transactions setting", e);
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
const qt = (t) => {
|
|
276
|
-
const e = t.find(
|
|
277
|
-
({ swapQuotes: s }) => s
|
|
278
|
-
);
|
|
279
|
-
return e?.swapQuotes ? Object.values(e.swapQuotes)[0]?.map(
|
|
280
|
-
({ routerKey: s }) => s
|
|
281
|
-
) ?? [] : [];
|
|
282
|
-
}, mt = (t, e, s) => t.map(({ asset: a, swapParams: n, swapQuotes: r }) => !n || !r ? {
|
|
283
|
-
supportedAsset: a,
|
|
284
|
-
withdrawData: "",
|
|
285
|
-
slippageTolerance: s
|
|
286
|
-
} : at({
|
|
287
|
-
assetAddress: a,
|
|
288
|
-
swapQuotes: r,
|
|
289
|
-
swapParams: n,
|
|
290
|
-
slippageToleranceForContractTransaction: s,
|
|
291
|
-
routerKey: e
|
|
292
|
-
})), Jt = async (t, e, s, a, n) => {
|
|
293
|
-
for (const r of t) {
|
|
294
|
-
const o = mt(
|
|
295
|
-
e,
|
|
296
|
-
r,
|
|
297
|
-
s
|
|
298
|
-
), { error: c } = await a(...n, o);
|
|
299
|
-
if (!c)
|
|
300
|
-
return o;
|
|
301
|
-
}
|
|
302
|
-
return null;
|
|
303
|
-
}, te = (t, e) => (t ?? []).map((s) => ({
|
|
304
|
-
supportedAsset: s,
|
|
305
|
-
withdrawData: "",
|
|
306
|
-
slippageTolerance: e
|
|
307
|
-
})), ee = async (t, e, {
|
|
308
|
-
fetchAaveSwapParams: s,
|
|
309
|
-
fetchAaveSwapQuotes: a,
|
|
310
|
-
withdrawAmountD18: n,
|
|
311
|
-
slippage: r
|
|
312
|
-
}) => Promise.all(
|
|
313
|
-
(t ?? []).map(async (o) => {
|
|
314
|
-
if (!d(o, e))
|
|
315
|
-
return { asset: o };
|
|
316
|
-
try {
|
|
317
|
-
const u = await s({
|
|
318
|
-
withdrawAmountD18: n,
|
|
319
|
-
slippage: r
|
|
320
|
-
});
|
|
321
|
-
if (u?.srcData.length) {
|
|
322
|
-
const l = await a({
|
|
323
|
-
swapParams: u,
|
|
324
|
-
slippage: r
|
|
325
|
-
});
|
|
326
|
-
return { asset: o, swapParams: u, swapQuotes: l };
|
|
327
|
-
}
|
|
328
|
-
return { asset: o };
|
|
329
|
-
} catch (u) {
|
|
330
|
-
return console.error(u), { asset: o };
|
|
331
|
-
}
|
|
332
|
-
})
|
|
333
|
-
);
|
|
334
|
-
export {
|
|
335
|
-
ot as $,
|
|
336
|
-
Wt as A,
|
|
337
|
-
Nt as B,
|
|
338
|
-
Vt as C,
|
|
339
|
-
Yt as D,
|
|
340
|
-
kt as E,
|
|
341
|
-
Ot as F,
|
|
342
|
-
Ct as G,
|
|
343
|
-
Zt as H,
|
|
344
|
-
It as I,
|
|
345
|
-
Mt as J,
|
|
346
|
-
Xt as K,
|
|
347
|
-
ht as L,
|
|
348
|
-
Et as M,
|
|
349
|
-
Dt as N,
|
|
350
|
-
At as O,
|
|
351
|
-
lt as P,
|
|
352
|
-
Jt as Q,
|
|
353
|
-
Ft as R,
|
|
354
|
-
pt as S,
|
|
355
|
-
d as T,
|
|
356
|
-
it as U,
|
|
357
|
-
Pt as V,
|
|
358
|
-
rt as W,
|
|
359
|
-
vt as X,
|
|
360
|
-
ct as Y,
|
|
361
|
-
_t as Z,
|
|
362
|
-
ut as _,
|
|
363
|
-
mt as a,
|
|
364
|
-
$t as a0,
|
|
365
|
-
D as a1,
|
|
366
|
-
at as b,
|
|
367
|
-
et as c,
|
|
368
|
-
Rt as d,
|
|
369
|
-
Bt as e,
|
|
370
|
-
I as f,
|
|
371
|
-
te as g,
|
|
372
|
-
ee as h,
|
|
373
|
-
qt as i,
|
|
374
|
-
dt as j,
|
|
375
|
-
Ut as k,
|
|
376
|
-
xt as l,
|
|
377
|
-
Kt as m,
|
|
378
|
-
ft as n,
|
|
379
|
-
tt as o,
|
|
380
|
-
wt as p,
|
|
381
|
-
E as q,
|
|
382
|
-
Gt as r,
|
|
383
|
-
Ht as s,
|
|
384
|
-
Qt as t,
|
|
385
|
-
jt as u,
|
|
386
|
-
bt as v,
|
|
387
|
-
st as w,
|
|
388
|
-
yt as x,
|
|
389
|
-
Lt as y,
|
|
390
|
-
zt as z
|
|
391
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const c=require("bignumber.js"),s=require("./storage-B9jNfIvl.cjs"),m=require("viem"),P=()=>typeof window<"u";function x(){return P()&&typeof window.ethereum<"u"}async function U(t){try{if(x())return window.ethereum.request({method:"wallet_watchAsset",params:{type:"ERC20",options:t}})}catch{return!1}return!1}const A=(t,e)=>t?.toLowerCase()===e?.toLowerCase(),$=t=>A(t,s.AddressZero$1),f=(t,e)=>s.contractsAddressesMap[e]?.[t]??s.AddressZero,G=t=>s.contractsAbisMap[t],W=t=>t&&`${t.substring(0,6)}...${t.substring(t.length-4,t.length)}`,K=({address:t,chainId:e})=>{const r=f("aaveLendingPoolV3",e);return A(t,r)},y=({sourceAddress:t,amount:e})=>`${t}_${e}`,V=(t,e)=>{const r=t.slice(0,e),n=t.slice(e);return{firstPart:r,secondPart:n}},w=(t,e)=>t/e*100,Y=t=>t<1?4:t<10?3:2,Z=(t,e=s.DEFAULT_PRECISION)=>new c(t.toString()).shiftedBy(e).toFixed(0),H=(t,e,r,n)=>new c(e).dividedBy(r).multipliedBy(t).shiftedBy(-(n||s.DEFAULT_PRECISION)).toNumber(),k=t=>BigInt(new c(t||"0").shiftedBy(s.DEFAULT_PRECISION).toFixed(0,c.ROUND_DOWN)),Q=t=>{const e=new c(.01),r=new c(t),n=!r.isZero()&&r.lt(e)?e:r;return BigInt(n.multipliedBy(100).toFixed(0))},q=({vaultAddress:t,swapData:e,sendTokenAddress:r,sendTokenAmount:n,vaultDepositTokenAddress:o,minVaultTokensReceivedAmount:a,routerKey:i="ONE_INCH",swapDestinationAmount:d,swapSlippage:u})=>{const l=new c(d).multipliedBy(1-u/100).toFixed(0),g=[m.stringToHex(i,{size:32}),e];return[t,[[r,n,g],[o,l]],a]},z=({receiveAssetAddress:t,assets:e,swapData:r})=>{const n={srcData:[],destAmount:new c("0")},{srcData:o}=e?.reduce((a,i)=>{const d=r?.[i.address];if(!d)return a;const u=[m.stringToHex(d.routerKey,{size:32}),d.rawTransaction.data],l=[i.address,i.rawBalance,u];return{srcData:[...a.srcData,l],destAmount:a.destAmount.plus(d.destinationAmount)}},n)??n;return[o,[t,"0"]]},h=({assetAddress:t,swapQuotes:e,swapParams:r,slippageToleranceForContractTransaction:n,routerKey:o})=>{if(!r)return{supportedAsset:t,withdrawData:"",slippageTolerance:BigInt(0)};const{srcData:a,dstData:i}=r,d=a.map(({asset:g,amount:T})=>{const S=e?.[y({sourceAddress:g,amount:T.toString()})]?.find(M=>M.routerKey===o);return{asset:g,amount:T,swapData:{routerKey:m.stringToHex(S?.routerKey??"",{size:32}),txData:S?.rawTransaction.data??"0x"}}}),u=m.encodeAbiParameters(s.ComplexWithdrawalAssetSrcDataAbiItem,[d]),l=m.encodeAbiParameters(s.ComplexWithdrawalDataAbiItem,[{encodedSrcData:u,dstData:{dstAddress:i.asset,dstAmount:i.amount},slippage:n}]);return{supportedAsset:t,withdrawData:l,slippageTolerance:n}},j=(t,e)=>s.CHAIN_NATIVE_TOKENS[e]?.nativeTokenSymbol===t,X=({nativeTokenBalance:t,tokenDecimals:e,gasPrice:r})=>{const n=new c(r).multipliedBy(s.NATIVE_TOKEN_DEPOSIT_GAS_LIMIT).shiftedBy(-e),o=new c(t).minus(n);return o.gt("0")?o:new c("0")},J=t=>s.STABLE_TOKEN_SYMBOLS.includes(t),tt=t=>{const e=Object.values(t).reduce((r,{type:n})=>(r[n]=r[n]+1,r),{string:0,number:0});if(e.string>10)throw new Error("logger params must contain up to 10 string values");if(e.number>40)throw new Error("logger params must contain up to 40 numeric values");return!0},et=(t,e=150)=>t.length>e?t.substring(0,e):t,E=(t,e=s.TRANSACTION_ERROR_KEYS)=>{const r=t.toLowerCase();return e.sort((n,o)=>o.length-n.length).find(n=>r.includes(n.toLowerCase()))},D=t=>s.TRANSACTION_ERRORS[t]??s.LIMIT_ORDER_TRANSACTION_ERRORS[t],rt=({errorMessage:t,abiErrors:e})=>{if(!t||t.includes("User rejected"))return null;const r=e.find(a=>t.includes(a));if(r&&E(r))return D(r);const n=E(t);if(n)return D(n);const[o]=t.split(r?".":"Contract").map(a=>a.trim());return{title:"Transaction failed",hint:`${et(o??"")} ${r?`: ${r}`:""}`}},nt=t=>typeof t=="number"&&Number.isFinite(t),st=t=>typeof t=="bigint"&&t!==BigInt(0),B=(t,e=s.DEFAULT_PRECISION$1)=>new c(t).shiftedBy(-e).toNumber(),I=t=>!isNaN(parseFloat(t))&&!isNaN(t),L=({value:t,minimumFractionDigits:e=2,maximumFractionDigits:r=2,compact:n=!1,normalize:o=!1})=>new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",notation:n?"compact":void 0,minimumFractionDigits:e,maximumFractionDigits:r}).format(o?B(t):Number(t)),_=t=>I(t)?new c(t).toFixed():"",N=["₀","₁","₂","₃","₄","₅","₆","₇","₈","₉"],b=({value:t,decimals:e=4})=>{const r=new c(t);if(r.isGreaterThan(1)||r.isZero())return _(r.toFixed(e));const o=(/e/i.test(t.toString())?parseFloat(t.toString()).toFixed(s.DEFAULT_PRECISION$1):t.toString()).match(/^0\.(0+)(\d+)$/);if(o){const[,a,i]=o;if(a.length>=e&&a.length<N.length)return`0.0${N[a.length]}${i.slice(0,3)}`}return _(r.toFixed(e))},R=(t,e=0)=>`${t.toLocaleString("en-US",{maximumFractionDigits:e})}%`,ot=t=>t.toString().replace(/\B(?=(\d{3})+(?!\d))/g,","),at=(t,e,r=0)=>{const n=w(+t,e);return R(n,r)},it=({currency:t,value:e})=>t==="USD"?L({value:e}):`${s.CURRENCY_SYMBOL_MAP[t]} ${b({value:e,decimals:s.CURRENCY_DECIMALS_MAP[t]})}`,C=(t,e)=>new c(new c(t).toFixed(e,c.ROUND_DOWN)).toString(),O=(t,e=3,r=2)=>{if(t.length<=5)return t;const n="...";return t.length<=e+r+n.length?t:`${t.slice(0,e)}${n}${t.slice(-r)}`},ct=({balance:t,symbol:e,precision:r,truncateSymbol:n})=>`${C(t,r)} ${n?O(e):e}`,dt=t=>{if(!t)return;const e=t.match(/0x[a-fA-F0-9]{64}/);if(!e)return;const r=e[0];return`${r.slice(0,4)}...${r.slice(-3)}`},p=typeof window<"u",ut=t=>A(s.FLATMONEY_EARLY_DEPOSITOR_VAULT_ADDRESS_BASE,t)||A(s.FLATMONEY_DHT_STAKING_VAULT_ADDRESS_BASE,t),At=t=>s.FLAT_MONEY_LEVERAGED_ASSET_ADDRESSES.some(e=>A(e,t)),lt=t=>s.FLAT_MONEY_COLLATERAL_MAP[t.toLowerCase()]??{symbol:"",decimals:18,address:s.AddressZero},mt=t=>A(t,s.FLAT_MONEY_V1_UNIT_ADDRESS)?s.FLAT_MONEY_V1_UNIT_LINK:s.FLAT_MONEY_UNIT_LINK,F=t=>`eth_${t}`,gt=({action:t,log:e,symbol:r,vaultAddress:n,chainId:o})=>{const a={[s.TRADING_LOG_EVENT_PARAM.SYMBOL.NAME]:r,[s.TRADING_LOG_EVENT_PARAM.CHAIN_ID.NAME]:o,[s.TRADING_LOG_EVENT_PARAM.ADDRESS.NAME]:F(n)};s.LOG_EVENT_BY_TRANSACTION_ACTION_MAP[t].forEach(i=>{e?.(i,a)})},Tt=t=>s.GMX_MARKET_ASSETS.some(e=>A(e,t)),St=t=>s.GMX_WITHDRAW_ASSET_MAP[t.toLowerCase()]??{symbol:"",decimals:18,address:s.AddressZero},Et=t=>s.GMX_WITHDRAW_ASSET_MAP_BY_VAULT_ADDRESS[t.toLowerCase()];function _t(){if(p)try{const t=localStorage.getItem(s.LOCAL_STORAGE_KEYS.IS_BATCH_TRANSACTIONS_ENABLED);return t?JSON.parse(t):void 0}catch{return}}function pt(t){if(p)try{localStorage.setItem(s.LOCAL_STORAGE_KEYS.IS_BATCH_TRANSACTIONS_ENABLED,JSON.stringify(t))}catch(e){console.error("[core-kit]: Failed to persist batch transactions setting",e)}}const Dt=t=>{const e=t.find(({swapQuotes:r})=>r);return e?.swapQuotes?Object.values(e.swapQuotes)[0]?.map(({routerKey:r})=>r)??[]:[]},v=(t,e,r)=>t.map(({asset:n,swapParams:o,swapQuotes:a})=>!o||!a?{supportedAsset:n,withdrawData:"",slippageTolerance:r}:h({assetAddress:n,swapQuotes:a,swapParams:o,slippageToleranceForContractTransaction:r,routerKey:e})),Nt=async(t,e,r,n,o)=>{for(const a of t){const i=v(e,a,r),{error:d}=await n(...o,i);if(!d)return i}return null},ft=(t,e)=>(t??[]).map(r=>({supportedAsset:r,withdrawData:"",slippageTolerance:e})),yt=async(t,e,{fetchAaveSwapParams:r,fetchAaveSwapQuotes:n,withdrawAmountD18:o,slippage:a})=>Promise.all((t??[]).map(async i=>{if(!A(i,e))return{asset:i};try{const u=await r({withdrawAmountD18:o,slippage:a});if(u?.srcData.length){const l=await n({swapParams:u,slippage:a});return{asset:i,swapParams:u,swapQuotes:l}}return{asset:i}}catch(u){return console.error(u),{asset:i}}}));exports.addTokenToWallet=U;exports.buildAaveWithdrawAssetTransactionData=h;exports.buildComplexAssetDataForRouter=v;exports.buildSwapQuoteKeyForAave=y;exports.buildSwapWithdrawTransactionData=z;exports.buildZapDepositTransactionArguments=q;exports.clientSide=p;exports.commify=ot;exports.createDefaultComplexAssetData=ft;exports.enrichAssetsWithSwapQuotes=yt;exports.extractAvailableRouterKeys=Dt;exports.formatBalance=C;exports.formatByCurrency=it;exports.formatNumberToLimitedDecimals=b;exports.formatNumeratorToPercentage=at;exports.formatPercentage=R;exports.formatToUsd=L;exports.formatTokenBalance=ct;exports.getContractAbiById=G;exports.getContractAddressById=f;exports.getConventionalTokenPriceDecimals=Y;exports.getErrorKey=E;exports.getFlatMoneyCollateralByLeverageAddress=lt;exports.getFlatMoneyLinkByUnitAddress=mt;exports.getGmxWithdrawAssetByLeverageAddress=St;exports.getGmxWithdrawAssetByVaultAddress=Et;exports.getNativeTokenInvestableBalance=X;exports.getPercent=w;exports.getPoolFraction=H;exports.getSlippageToleranceForContractTransaction=Q;exports.getStoredBatchTransactionsEnabled=_t;exports.getTxHashShort=dt;exports.isAaveLendAndBorrowAsset=K;exports.isEqualAddress=A;exports.isFlatMoneyLeveragedAsset=At;exports.isFmpAirdropVaultAddress=ut;exports.isGmxLeveragedAsset=Tt;exports.isNativeToken=j;exports.isNumberType=nt;exports.isNumeric=I;exports.isStableSymbol=J;exports.isZeroAddress=$;exports.logTransactionByActionType=gt;exports.nonZeroBigInt=st;exports.normalizeNumber=B;exports.parseAmountToD18=k;exports.parseContractErrorMessage=rt;exports.persistBatchTransactionsEnabled=pt;exports.removeInsignificantTrailingZeros=_;exports.shiftBy=Z;exports.shortenAddress=W;exports.sliceByIndex=V;exports.transformAddressForAnalytics=F;exports.truncateString=O;exports.tryEstimateWithRouters=Nt;exports.validateLoggerEventParams=tt;
|
package/core-kit/hooks/trading/deposit-v2/deposit-transaction/use-batch-approve-transaction.d.ts
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
export declare const useBatchApproveTransaction: () => {
|
|
2
|
-
address: `0x${string}`;
|
|
3
|
-
abi: readonly [{
|
|
4
|
-
readonly type: "event";
|
|
5
|
-
readonly name: "Approval";
|
|
6
|
-
readonly inputs: readonly [{
|
|
7
|
-
readonly indexed: true;
|
|
8
|
-
readonly name: "owner";
|
|
9
|
-
readonly type: "address";
|
|
10
|
-
}, {
|
|
11
|
-
readonly indexed: true;
|
|
12
|
-
readonly name: "spender";
|
|
13
|
-
readonly type: "address";
|
|
14
|
-
}, {
|
|
15
|
-
readonly indexed: false;
|
|
16
|
-
readonly name: "value";
|
|
17
|
-
readonly type: "uint256";
|
|
18
|
-
}];
|
|
19
|
-
}, {
|
|
20
|
-
readonly type: "event";
|
|
21
|
-
readonly name: "Transfer";
|
|
22
|
-
readonly inputs: readonly [{
|
|
23
|
-
readonly indexed: true;
|
|
24
|
-
readonly name: "from";
|
|
25
|
-
readonly type: "address";
|
|
26
|
-
}, {
|
|
27
|
-
readonly indexed: true;
|
|
28
|
-
readonly name: "to";
|
|
29
|
-
readonly type: "address";
|
|
30
|
-
}, {
|
|
31
|
-
readonly indexed: false;
|
|
32
|
-
readonly name: "value";
|
|
33
|
-
readonly type: "uint256";
|
|
34
|
-
}];
|
|
35
|
-
}, {
|
|
36
|
-
readonly type: "function";
|
|
37
|
-
readonly name: "allowance";
|
|
38
|
-
readonly stateMutability: "view";
|
|
39
|
-
readonly inputs: readonly [{
|
|
40
|
-
readonly name: "owner";
|
|
41
|
-
readonly type: "address";
|
|
42
|
-
}, {
|
|
43
|
-
readonly name: "spender";
|
|
44
|
-
readonly type: "address";
|
|
45
|
-
}];
|
|
46
|
-
readonly outputs: readonly [{
|
|
47
|
-
readonly type: "uint256";
|
|
48
|
-
}];
|
|
49
|
-
}, {
|
|
50
|
-
readonly type: "function";
|
|
51
|
-
readonly name: "approve";
|
|
52
|
-
readonly stateMutability: "nonpayable";
|
|
53
|
-
readonly inputs: readonly [{
|
|
54
|
-
readonly name: "spender";
|
|
55
|
-
readonly type: "address";
|
|
56
|
-
}, {
|
|
57
|
-
readonly name: "amount";
|
|
58
|
-
readonly type: "uint256";
|
|
59
|
-
}];
|
|
60
|
-
readonly outputs: readonly [{
|
|
61
|
-
readonly type: "bool";
|
|
62
|
-
}];
|
|
63
|
-
}, {
|
|
64
|
-
readonly type: "function";
|
|
65
|
-
readonly name: "balanceOf";
|
|
66
|
-
readonly stateMutability: "view";
|
|
67
|
-
readonly inputs: readonly [{
|
|
68
|
-
readonly name: "account";
|
|
69
|
-
readonly type: "address";
|
|
70
|
-
}];
|
|
71
|
-
readonly outputs: readonly [{
|
|
72
|
-
readonly type: "uint256";
|
|
73
|
-
}];
|
|
74
|
-
}, {
|
|
75
|
-
readonly type: "function";
|
|
76
|
-
readonly name: "decimals";
|
|
77
|
-
readonly stateMutability: "view";
|
|
78
|
-
readonly inputs: readonly [];
|
|
79
|
-
readonly outputs: readonly [{
|
|
80
|
-
readonly type: "uint8";
|
|
81
|
-
}];
|
|
82
|
-
}, {
|
|
83
|
-
readonly type: "function";
|
|
84
|
-
readonly name: "name";
|
|
85
|
-
readonly stateMutability: "view";
|
|
86
|
-
readonly inputs: readonly [];
|
|
87
|
-
readonly outputs: readonly [{
|
|
88
|
-
readonly type: "string";
|
|
89
|
-
}];
|
|
90
|
-
}, {
|
|
91
|
-
readonly type: "function";
|
|
92
|
-
readonly name: "symbol";
|
|
93
|
-
readonly stateMutability: "view";
|
|
94
|
-
readonly inputs: readonly [];
|
|
95
|
-
readonly outputs: readonly [{
|
|
96
|
-
readonly type: "string";
|
|
97
|
-
}];
|
|
98
|
-
}, {
|
|
99
|
-
readonly type: "function";
|
|
100
|
-
readonly name: "totalSupply";
|
|
101
|
-
readonly stateMutability: "view";
|
|
102
|
-
readonly inputs: readonly [];
|
|
103
|
-
readonly outputs: readonly [{
|
|
104
|
-
readonly type: "uint256";
|
|
105
|
-
}];
|
|
106
|
-
}, {
|
|
107
|
-
readonly type: "function";
|
|
108
|
-
readonly name: "transfer";
|
|
109
|
-
readonly stateMutability: "nonpayable";
|
|
110
|
-
readonly inputs: readonly [{
|
|
111
|
-
readonly name: "recipient";
|
|
112
|
-
readonly type: "address";
|
|
113
|
-
}, {
|
|
114
|
-
readonly name: "amount";
|
|
115
|
-
readonly type: "uint256";
|
|
116
|
-
}];
|
|
117
|
-
readonly outputs: readonly [{
|
|
118
|
-
readonly type: "bool";
|
|
119
|
-
}];
|
|
120
|
-
}, {
|
|
121
|
-
readonly type: "function";
|
|
122
|
-
readonly name: "transferFrom";
|
|
123
|
-
readonly stateMutability: "nonpayable";
|
|
124
|
-
readonly inputs: readonly [{
|
|
125
|
-
readonly name: "sender";
|
|
126
|
-
readonly type: "address";
|
|
127
|
-
}, {
|
|
128
|
-
readonly name: "recipient";
|
|
129
|
-
readonly type: "address";
|
|
130
|
-
}, {
|
|
131
|
-
readonly name: "amount";
|
|
132
|
-
readonly type: "uint256";
|
|
133
|
-
}];
|
|
134
|
-
readonly outputs: readonly [{
|
|
135
|
-
readonly type: "bool";
|
|
136
|
-
}];
|
|
137
|
-
}];
|
|
138
|
-
functionName: string;
|
|
139
|
-
chainId: number;
|
|
140
|
-
args: string[];
|
|
141
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useBatchDeposit: () => () => Promise<void>;
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import type { UseSendCallsParameters } from 'wagmi';
|
|
2
|
-
import type { PendingTransaction } from '../../../types/trading-panel.types';
|
|
3
|
-
type BatchTradingSettleHandler = Required<Required<UseSendCallsParameters>['mutation']>['onSettled'];
|
|
4
|
-
export declare const useBatchTradingSettleHandler: (action: PendingTransaction['action']) => BatchTradingSettleHandler;
|
|
5
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useIsBatchContractWritesTrading: () => boolean;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { Address } from 'viem';
|
|
2
|
-
import { type UseSendCallsParameters } from 'wagmi';
|
|
3
|
-
interface ContractsFunctionsOptions {
|
|
4
|
-
onSettled?: Required<UseSendCallsParameters>['mutation']['onSettled'];
|
|
5
|
-
}
|
|
6
|
-
interface SendCallsParams {
|
|
7
|
-
address: Address;
|
|
8
|
-
abi: any;
|
|
9
|
-
functionName: string;
|
|
10
|
-
args: unknown[];
|
|
11
|
-
value?: bigint;
|
|
12
|
-
}
|
|
13
|
-
export declare const useCustomSendCalls: ({ onSettled, }: ContractsFunctionsOptions) => (contracts: SendCallsParams[]) => Promise<void>;
|
|
14
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useIsBatchContractWritesSupported: () => boolean;
|
package/derive-CsdqSZEg.cjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";const E=new Set(["0x2fbadd08ade2e8a24cf1fe3a58fe918336b39a72"]);exports.COVERED_CALL_VAULT_ADDRESSES=E;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const useInvalidateLimitOrderQuery: () => () => void;
|