@dhedge/trading-widget 2.0.2 → 2.0.4
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 +79 -78
- package/core-kit/abi/index.d.ts +1 -1
- package/core-kit/abi/synthetix-v3/ierc-7412.d.ts +12 -0
- package/core-kit/abi/synthetix-v3/index.d.ts +0 -1
- package/core-kit/const/default-data.d.ts +1 -1
- package/core-kit/const/tokens/arbitrum.d.ts +2 -0
- package/core-kit/const/tokens/base.d.ts +2 -0
- package/core-kit/const/tokens/optimism.d.ts +2 -0
- package/core-kit/const/tokens/polygon.d.ts +1 -0
- package/core-kit/hooks/trading/index.d.ts +1 -0
- package/core-kit/hooks/trading/synthetix-v3/use-available-withdraw-liquidity.d.ts +47 -0
- package/core-kit/hooks/trading/synthetix-v3/use-oracles-update-transaction-data.d.ts +10 -2
- package/core-kit/hooks/trading/synthetix-v3/use-withdraw-liquidity.d.ts +5 -0
- package/core-kit/types/pool.types.d.ts +1 -0
- package/core-kit/types/synthetix-v3.types.d.ts +8 -2
- package/core-kit/types/web3.types.d.ts +1 -1
- package/core-kit/utils/formatter.d.ts +1 -1
- package/core-kit/utils/synthetix-v3/eip-7412.d.ts +21 -10
- package/core-kit/utils/synthetix-v3/parse-error.d.ts +1 -1
- package/core-kit/utils/synthetix-v3/pyth-adapter.d.ts +10 -9
- package/{index-12329f48.js → index-6f9f1263.js} +9580 -9406
- package/index-fcb38d25.cjs +207 -0
- package/index.cjs +1 -1
- package/index.d.ts +3 -3
- package/index.js +206 -199
- package/package.json +1 -1
- package/{pyth-adapter-6c8739a2.cjs → pyth-adapter-919fe86e.cjs} +6 -6
- package/{pyth-adapter-f139cf42.js → pyth-adapter-9c02b4f7.js} +53 -40
- package/trading-widget/components/withdraw/button/valid-withdraw-button/valid-withdraw-button.hooks.d.ts +3 -0
- package/trading-widget/providers/translation-provider/translation-provider.types.d.ts +1 -0
- package/core-kit/abi/synthetix-v3/ierc-2771-context.d.ts +0 -15
- package/core-kit/utils/synthetix-v3/multicall-forwarder-batcher.d.ts +0 -8
- package/index-e8439723.cjs +0 -207
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var on = Object.defineProperty;
|
|
2
2
|
var sn = (e, t, i) => t in e ? on(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i;
|
|
3
3
|
var I = (e, t, i) => (sn(e, typeof t != "symbol" ? t + "" : t, i), i);
|
|
4
|
-
import { c as fe } from "./index-
|
|
4
|
+
import { c as fe } from "./index-6f9f1263.js";
|
|
5
5
|
import { decodeAbiParameters as at, encodeAbiParameters as Kt } from "viem";
|
|
6
6
|
import "react";
|
|
7
7
|
import "wagmi";
|
|
@@ -4052,53 +4052,66 @@ class _o {
|
|
|
4052
4052
|
return "PYTH";
|
|
4053
4053
|
}
|
|
4054
4054
|
async fetchOffchainData(t, i, o) {
|
|
4055
|
-
const
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
)
|
|
4059
|
-
|
|
4060
|
-
|
|
4061
|
-
|
|
4062
|
-
{ name: "updateType", type: "uint8" },
|
|
4063
|
-
{ name: "stalenessTolerance", type: "uint64" },
|
|
4064
|
-
{ name: "priceIds", type: "bytes32[]" }
|
|
4065
|
-
],
|
|
4066
|
-
o
|
|
4067
|
-
), E = f, g = await this.connection.getPriceFeedsUpdateData(
|
|
4068
|
-
u
|
|
4055
|
+
const c = [];
|
|
4056
|
+
let l = BigInt(86400), f = BigInt(0);
|
|
4057
|
+
const u = [];
|
|
4058
|
+
for (const E of o ?? []) {
|
|
4059
|
+
const [g] = at(
|
|
4060
|
+
[{ name: "updateType", type: "uint8" }],
|
|
4061
|
+
E.query
|
|
4069
4062
|
);
|
|
4070
|
-
|
|
4071
|
-
[
|
|
4072
|
-
|
|
4073
|
-
|
|
4074
|
-
|
|
4075
|
-
|
|
4076
|
-
|
|
4077
|
-
|
|
4063
|
+
if (g === 1) {
|
|
4064
|
+
const [, w, d] = at(
|
|
4065
|
+
[
|
|
4066
|
+
{ name: "updateType", type: "uint8" },
|
|
4067
|
+
{ name: "stalenessTolerance", type: "uint64" },
|
|
4068
|
+
{ name: "priceIds", type: "bytes32[]" }
|
|
4069
|
+
],
|
|
4070
|
+
E.query
|
|
4071
|
+
);
|
|
4072
|
+
c.push(...d), l = w < l ? w : l, f = f + (E.fee ?? BigInt(1));
|
|
4073
|
+
} else if (g === 2) {
|
|
4074
|
+
const [, w, d] = at(
|
|
4075
|
+
[
|
|
4076
|
+
{ name: "updateType", type: "uint8" },
|
|
4077
|
+
{ name: "requestedTime", type: "uint64" },
|
|
4078
|
+
{ name: "priceIds", type: "bytes32" }
|
|
4079
|
+
],
|
|
4080
|
+
E.query
|
|
4081
|
+
), [B] = await this.connection.getVaa(
|
|
4082
|
+
d,
|
|
4083
|
+
Number(w.toString())
|
|
4084
|
+
), S = "0x" + Buffer.from(B, "base64").toString("hex");
|
|
4085
|
+
u.push({
|
|
4086
|
+
arg: Kt(
|
|
4087
|
+
[
|
|
4088
|
+
{ type: "uint8", name: "updateType" },
|
|
4089
|
+
{ type: "uint64", name: "timestamp" },
|
|
4090
|
+
{ type: "bytes32[]", name: "priceIds" },
|
|
4091
|
+
{ type: "bytes[]", name: "updateData" }
|
|
4092
|
+
],
|
|
4093
|
+
[2, w, [d], [S]]
|
|
4094
|
+
),
|
|
4095
|
+
fee: E.fee ?? BigInt(1)
|
|
4096
|
+
});
|
|
4097
|
+
} else
|
|
4098
|
+
throw new Error(`update type ${g} not supported`);
|
|
4099
|
+
}
|
|
4100
|
+
if (c.length > 0) {
|
|
4101
|
+
const E = await this.connection.getPriceFeedsUpdateData(
|
|
4102
|
+
c
|
|
4078
4103
|
);
|
|
4079
|
-
|
|
4080
|
-
const [l, f, u] = at(
|
|
4081
|
-
[
|
|
4082
|
-
{ name: "updateType", type: "uint8" },
|
|
4083
|
-
{ name: "requestedTime", type: "uint64" },
|
|
4084
|
-
{ name: "priceIds", type: "bytes32" }
|
|
4085
|
-
],
|
|
4086
|
-
o
|
|
4087
|
-
), [E] = await this.connection.getVaa(
|
|
4088
|
-
u,
|
|
4089
|
-
Number(f.toString())
|
|
4090
|
-
), g = "0x" + Buffer.from(E, "base64").toString("hex");
|
|
4091
|
-
return Kt(
|
|
4104
|
+
return [{ arg: Kt(
|
|
4092
4105
|
[
|
|
4093
4106
|
{ type: "uint8", name: "updateType" },
|
|
4094
|
-
{ type: "uint64", name: "
|
|
4107
|
+
{ type: "uint64", name: "stalenessTolerance" },
|
|
4095
4108
|
{ type: "bytes32[]", name: "priceIds" },
|
|
4096
4109
|
{ type: "bytes[]", name: "updateData" }
|
|
4097
4110
|
],
|
|
4098
|
-
[
|
|
4099
|
-
);
|
|
4111
|
+
[1, l, c, E]
|
|
4112
|
+
), fee: f }, ...u];
|
|
4100
4113
|
} else
|
|
4101
|
-
|
|
4114
|
+
return u;
|
|
4102
4115
|
}
|
|
4103
4116
|
}
|
|
4104
4117
|
export {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export declare const useValidWithdrawButton: () => {
|
|
2
2
|
requiresWithdrawalWindow: boolean;
|
|
3
|
+
requiresWithdrawalLiquidity: boolean;
|
|
3
4
|
requiresEndOfCooldown: boolean;
|
|
4
5
|
requiresApprove: boolean;
|
|
5
6
|
requiresHighSlippageConfirm: boolean;
|
|
@@ -8,6 +9,8 @@ export declare const useValidWithdrawButton: () => {
|
|
|
8
9
|
slippageToBeUsed: number;
|
|
9
10
|
cooldownEndsInTime: string;
|
|
10
11
|
withdrawalWindowStartTime: string;
|
|
12
|
+
withdrawalLiquidity: string;
|
|
13
|
+
withdrawalLiquiditySymbol: string | undefined;
|
|
11
14
|
approve: () => Promise<void>;
|
|
12
15
|
updateOracles: () => Promise<void>;
|
|
13
16
|
handleHighSlippageClick: () => void;
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
export declare const IERC2771ContextAbi: readonly [{
|
|
2
|
-
readonly type: "function";
|
|
3
|
-
readonly name: "isTrustedForwarder";
|
|
4
|
-
readonly inputs: readonly [{
|
|
5
|
-
readonly name: "forwarder";
|
|
6
|
-
readonly type: "address";
|
|
7
|
-
readonly internalType: "address";
|
|
8
|
-
}];
|
|
9
|
-
readonly outputs: readonly [{
|
|
10
|
-
readonly name: "";
|
|
11
|
-
readonly type: "bool";
|
|
12
|
-
readonly internalType: "bool";
|
|
13
|
-
}];
|
|
14
|
-
readonly stateMutability: "view";
|
|
15
|
-
}];
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { Address, Batcher, PublicClient, TransactionRequest } from 'core-kit/types';
|
|
2
|
-
export declare class TrustedMulticallForwarderBatcher implements Batcher {
|
|
3
|
-
isSupported: Map<Address, boolean | undefined>;
|
|
4
|
-
constructor();
|
|
5
|
-
batchable(client: PublicClient, transactions: TransactionRequest[]): Promise<boolean>;
|
|
6
|
-
batch(transactions: TransactionRequest[]): TransactionRequest;
|
|
7
|
-
checkSupport(client: PublicClient, address: Address): Promise<boolean>;
|
|
8
|
-
}
|