@dhedge/trading-widget 3.6.1 → 3.7.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 +11 -15
- package/core-kit/abi/index.d.ts +0 -1
- package/core-kit/const/config.d.ts +1 -4
- package/core-kit/const/contracts/arbitrum.d.ts +0 -1
- package/core-kit/const/contracts/base.d.ts +0 -1
- package/core-kit/const/flat-money.d.ts +1 -1
- package/core-kit/const/gmx.d.ts +4 -0
- package/core-kit/const/index.d.ts +1 -0
- package/core-kit/const/logger.d.ts +0 -1
- package/core-kit/const/synthetix.d.ts +0 -5
- package/core-kit/hooks/pool/index.d.ts +0 -2
- package/core-kit/hooks/pool/use-pool-dynamic-contract-data.d.ts +3 -4
- package/core-kit/hooks/pool/use-pool-fees.d.ts +2 -3
- package/core-kit/hooks/pool/use-pool-token-price.d.ts +2 -3
- package/core-kit/hooks/trading/index.d.ts +0 -2
- package/core-kit/types/index.d.ts +0 -1
- package/core-kit/types/trading-panel.types.d.ts +1 -1
- package/core-kit/utils/flat-money.d.ts +1 -1
- package/core-kit/utils/gmx.d.ts +7 -0
- package/core-kit/utils/index.d.ts +1 -1
- package/index.cjs +217 -1
- package/index.d.ts +6 -6
- package/index.js +41876 -240
- package/package.json +1 -3
- package/trading-widget/components/deposit/button/valid-deposit-button/valid-deposit-button.hooks.d.ts +0 -4
- package/trading-widget/components/withdraw/init-step/button/valid-init-withdraw-button/valid-init-withdraw-button.hooks.d.ts +0 -7
- package/trading-widget/hooks/index.d.ts +0 -1
- package/trading-widget/hooks/{use-leveraged-flat-money-withdrawal-checks.d.ts → use-leveraged-withdrawal-checks.d.ts} +1 -1
- package/trading-widget/providers/translation-provider/translation-provider.types.d.ts +0 -4
- package/trading-widget/types/index.d.ts +0 -1
- package/core-kit/abi/synthetix-v3/i-trusted-multicall-forwarder.d.ts +0 -41
- package/core-kit/abi/synthetix-v3/ierc-7412.d.ts +0 -53
- package/core-kit/abi/synthetix-v3/index.d.ts +0 -5
- package/core-kit/abi/synthetix-v3/synthetix-v3-asset-guard.d.ts +0 -37
- package/core-kit/abi/synthetix-v3/synthetix-v3-contract-guard.d.ts +0 -45
- package/core-kit/abi/synthetix-v3/synthetix-v3-core.d.ts +0 -41
- package/core-kit/hooks/pool/synthetixV3/use-pool-token-price-mutable.d.ts +0 -8
- package/core-kit/hooks/pool/synthetixV3/use-synthetix-v3-asset-balance.d.ts +0 -8
- package/core-kit/hooks/pool/synthetixV3/use-total-funds-value-mutable.d.ts +0 -8
- package/core-kit/hooks/trading/synthetix-v3/use-available-withdraw-liquidity.d.ts +0 -47
- package/core-kit/hooks/trading/synthetix-v3/use-oracles-update-transaction-data.d.ts +0 -23
- package/core-kit/hooks/trading/synthetix-v3/use-send-oracles-update-transaction.d.ts +0 -4
- package/core-kit/hooks/trading/synthetix-v3/use-synthetix-v3-oracles-update.d.ts +0 -7
- package/core-kit/hooks/trading/synthetix-v3/use-withdraw-liquidity.d.ts +0 -5
- package/core-kit/types/synthetix-v3.types.d.ts +0 -15
- package/core-kit/utils/synthetix-v3/eip-7412.d.ts +0 -21
- package/core-kit/utils/synthetix-v3/parse-error.d.ts +0 -3
- package/core-kit/utils/synthetix-v3/pyth-adapter.d.ts +0 -13
- package/core-kit/utils/synthetix.d.ts +0 -2
- package/index-41d61fb0.js +0 -42941
- package/index-e30df6fa.cjs +0 -217
- package/pyth-adapter-dc7665b9.js +0 -5705
- package/pyth-adapter-f74cde23.cjs +0 -11
- package/trading-widget/components/widget/widget-overlay/trading-overlay/trading-summary/oracles-update-summary.d.ts +0 -2
- package/trading-widget/constants/synthetix-v3.d.ts +0 -2
- package/trading-widget/hooks/use-synthetix-withdrawal-window.d.ts +0 -4
- package/trading-widget/types/synthetix-v3.types.d.ts +0 -24
- package/trading-widget/utils/synthetix-v3.d.ts +0 -39
package/README.md
CHANGED
|
@@ -81,18 +81,18 @@ Top level provider component. Headless part of trading logic. API handles params
|
|
|
81
81
|
<details>
|
|
82
82
|
<summary><code>initialState</code> <code><b>/</b></code> <code>Optional initial state of trading panel</code></summary>
|
|
83
83
|
|
|
84
|
-
> | name | type
|
|
85
|
-
> | ------------------ |
|
|
86
|
-
> | `poolAddress` | Address
|
|
87
|
-
> | `poolConfigMap` | Record<Address, PoolConfig>
|
|
88
|
-
> | `settings` | { slippage: `number \| 'auto'`; minSlippage?: `number`; isInfiniteAllowance: `boolean`; isMultiAssetWithdrawalEnabled: `boolean`; isMaxSlippageLoading: `boolean` }
|
|
89
|
-
> | `type` | 'deposit' \| 'withdraw'
|
|
84
|
+
> | name | type | default value | description |
|
|
85
|
+
> | ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
|
|
86
|
+
> | `poolAddress` | Address | `AddressZero` | Current active pool address |
|
|
87
|
+
> | `poolConfigMap` | Record<Address, PoolConfig> | `{}` | Map of pool configs available for trading |
|
|
88
|
+
> | `settings` | { slippage: `number \| 'auto'`; minSlippage?: `number`; isInfiniteAllowance: `boolean`; isMultiAssetWithdrawalEnabled: `boolean`; isMaxSlippageLoading: `boolean` } | { slippage: `'auto'`; isInfiniteAllowance: `false`; isMultiAssetWithdrawalEnabled: `true`; isMaxSlippageLoading: `false` } | Panel settings |
|
|
89
|
+
> | `type` | 'deposit' \| 'withdraw' | `'deposit'` | Trading type |
|
|
90
90
|
> | `input` | { sendToken: { address: `Address`; symbol: `string`; value: `string`; decimals: `number`; isLoading?: `boolean` }; receiveToken: { address: `Address`; symbol: `string`; value: `string`; decimals: `number`; isLoading?: `boolean` } } | `poolConfigMap[poolAddress]` | Send/receive tokens pair |
|
|
91
|
-
> | `entryFee` | { deposit: `number`; depositWithCustomCooldown: `number`; }
|
|
92
|
-
> | `modal` | { isOpen: `boolean`; status: `'Success' \| 'None' \| 'Mining' \| 'Wallet'`; action: `'deposit' \| 'withdraw' \| 'approve
|
|
93
|
-
> | `transactions` | { action: `'deposit' \| 'withdraw' \| 'approve'`; symbol: `string`; chainId: `ChainId`; txHash?: `Address` }[]
|
|
94
|
-
> | `poolFallbackData` | { address: `Address`; managerLogicAddress?: `Address`; poolCompositions: `PoolComposition[]`; tokenPrice?: `string`; apy?: { value: `number`; currency: `'USD' \| 'ETH'` } }
|
|
95
|
-
> | `defaultChainId` | number (optional)
|
|
91
|
+
> | `entryFee` | { deposit: `number`; depositWithCustomCooldown: `number`; } | { deposit: `0`; depositWithCustomCooldown: `0.1` } | Entry fee config map |
|
|
92
|
+
> | `modal` | { isOpen: `boolean`; status: `'Success' \| 'None' \| 'Mining' \| 'Wallet'`; action: `'deposit' \| 'withdraw' \| 'approve \`; link?: `string`; sendToken: TradingToken \| null; receiveToken: TradingToken \| null } | `{ isOpen: `false`,status: `'None'`, receiveToken: `null`, sendToken: `null` }` | Trading modal state |
|
|
93
|
+
> | `transactions` | { action: `'deposit' \| 'withdraw' \| 'approve'`; symbol: `string`; chainId: `ChainId`; txHash?: `Address` }[] | `[]` | Pending transactions |
|
|
94
|
+
> | `poolFallbackData` | { address: `Address`; managerLogicAddress?: `Address`; poolCompositions: `PoolComposition[]`; tokenPrice?: `string`; apy?: { value: `number`; currency: `'USD' \| 'ETH'` } } | { address: `AddressZero` } | Current active pool fallback data to override or extend contract's response |
|
|
95
|
+
> | `defaultChainId` | number (optional) | undefined | Chain id that will be returned from useNetwork wagmi hook when connected to unsupported network |
|
|
96
96
|
|
|
97
97
|
###### Source: `packages/trading-widget/src/core-kit/providers/index.tsx`
|
|
98
98
|
|
|
@@ -486,10 +486,7 @@ path: `component.meta[name]`
|
|
|
486
486
|
> | `poolDepositsAreMaintenance` | string | {poolSymbol} token is under maintenance. Deposits are temporarily blocked. | |
|
|
487
487
|
> | `poolWithdrawalsAreMaintenance` | string | {poolSymbol} token is under maintenance. Withdrawals are temporarily blocked. | |
|
|
488
488
|
> | `poolIsPrivate` | string | This vault is currently private | |
|
|
489
|
-
> | `updateOracles` | string | Update Oracles | |
|
|
490
|
-
> | `checkingOracles` | string | Checking Oracles | |
|
|
491
489
|
> | `confirmMaxSlippage` | string | Confirm {slippagePercentage}% max slippage | |
|
|
492
|
-
> | `withdrawalWindowDisabled` | string | You can sell your {tokenSymbol} tokens during withdrawal window period starting from {startTime} | |
|
|
493
490
|
> | `withdrawalLiquidityDisabled` | string | Intended withdraw value is greater than available liquidity ({value}) | |
|
|
494
491
|
> | `withdrawCooldown` | string | You can sell your {tokenSymbol} tokens in {cooldownEndTime} | |
|
|
495
492
|
> | `termsOfUse` | string | Terms Of Use | |
|
|
@@ -510,7 +507,6 @@ path: `component.meta[name]`
|
|
|
510
507
|
> | `sendingOrderToWallet` | string | Sending order to your wallet | |
|
|
511
508
|
> | `settingUpTx` | string | Setting up transaction | |
|
|
512
509
|
> | `miningTx` | string | Processing | |
|
|
513
|
-
> | `updateSynthetixOracles` | string | Updating Synthetix Oracles | |
|
|
514
510
|
> | `approveSpending` | string | Approve {symbol} spending | |
|
|
515
511
|
> | `pay` | string | Pay | |
|
|
516
512
|
> | `multiAssetFractions` | string | multi asset fractions | |
|
package/core-kit/abi/index.d.ts
CHANGED
|
@@ -6,7 +6,6 @@ export { PoolFactoryAbi } from './pool-factory';
|
|
|
6
6
|
export { PoolLogicAbi, ComplexWithdrawalAssetSrcDataAbiItem, ComplexWithdrawalDataAbiItem, } from './pool-logic';
|
|
7
7
|
export { PoolManagerLogicAbi } from './pool-manager-logic';
|
|
8
8
|
export { RewardDistributionAbi } from './reward-distribution';
|
|
9
|
-
export { ITrustedMulticallForwarderAbi, IERC7412Abi, SynthetixV3CoreAbi, SynthetixV3AssetGuard, SynthetixV3ContractGuard, } from './synthetix-v3';
|
|
10
9
|
export { FlatcoinPointsModuleAbi } from './flatcoin-points-module';
|
|
11
10
|
export { EasySwapperV2Abi } from './easy-swapper-v2';
|
|
12
11
|
export { LimitOrderAbi } from './limit-order';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Address, ChainId } from 'core-kit/types/web3.types';
|
|
2
|
-
export type ContractId = 'factory' | 'rewardDistribution' | 'aaveLendingPoolV2' | 'aaveLendingPoolV3' | 'stakingV2' | 'poolManagerLogic' | 'erc20' | 'poolLogic' | '
|
|
2
|
+
export type ContractId = 'factory' | 'rewardDistribution' | 'aaveLendingPoolV2' | 'aaveLendingPoolV3' | 'stakingV2' | 'poolManagerLogic' | 'erc20' | 'poolLogic' | 'flatcoinPointsModule' | 'easySwapperV2' | 'limitOrder';
|
|
3
3
|
type ContractsAddressesMap = Readonly<Record<ChainId, {
|
|
4
4
|
[id in ContractId]?: Address;
|
|
5
5
|
}>>;
|
|
@@ -7,7 +7,4 @@ export declare const contractsAddressesMap: ContractsAddressesMap;
|
|
|
7
7
|
export declare const contractsAbisMap: {
|
|
8
8
|
[id in ContractId]: any;
|
|
9
9
|
};
|
|
10
|
-
export declare const QUERY_KEYS: {
|
|
11
|
-
SYNTHETIX_ORACLES_UPDATE: string;
|
|
12
|
-
};
|
|
13
10
|
export {};
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
export declare const FACTORY_ADDRESS_ARBITRUM = "0xffFb5fB14606EB3a548C113026355020dDF27535";
|
|
2
2
|
export declare const AAVE_LENDING_POOL_V3_ADDRESS_ARBITRUM = "0x794a61358D6845594F94dc1DB02A252b5b4814aD";
|
|
3
|
-
export declare const SYNTHETIX_V3_CORE_ADDRESS_ARBITRUM = "0xffffffaEff0B96Ea8e4f94b2253f31abdD875847";
|
|
4
3
|
export declare const EASY_SWAPPER_V2_ADDRESS_ARBITRUM = "0xA5679C4272A056Bb83f039961fae7D99C48529F5";
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export declare const FACTORY_ADDRESS_BASE = "0x49Afe3abCf66CF09Fab86cb1139D8811C8afe56F";
|
|
2
|
-
export declare const SYNTHETIX_V3_CORE_ADDRESS_BASE = "0x32C222A9A159782aFD7529c87FA34b96CA72C696";
|
|
3
2
|
export declare const EASY_SWAPPER_V2_ADDRESS_BASE = "0xf067575Eb60c7587C11e867907AA7284833704d1";
|
|
4
3
|
export declare const FLATCOIN_POINTS_MODULE_ADDRESS_BASE = "0x59525b9b23adc475ef91d98dae06b568ba574ce5";
|
|
5
4
|
export declare const FLATMONEY_EARLY_DEPOSITOR_VAULT_ADDRESS_BASE = "0xa907504d7a4c415b4e6e1d0866d96afe8202f0e5";
|
|
@@ -2,7 +2,6 @@ import type { TransactionAction } from 'core-kit/types';
|
|
|
2
2
|
export declare const TRADING_PANEL_LOG_EVENT: {
|
|
3
3
|
INVEST_INPUT_FOCUS: string;
|
|
4
4
|
APPROVED_TOKEN: string;
|
|
5
|
-
UPDATE_ORACLES: string;
|
|
6
5
|
DEPOSIT: string;
|
|
7
6
|
MULTI_ASSET_WITHDRAW: string;
|
|
8
7
|
SINGLE_ASSET_WITHDRAW: string;
|
|
@@ -1,6 +1 @@
|
|
|
1
|
-
import type { Address, ChainId } from 'core-kit/types';
|
|
2
|
-
export declare const DHEDGE_SYNTHETIX_V3_ASSETS_MAP: Record<ChainId, Address>;
|
|
3
|
-
export declare const DHEDGE_SYNTHETIX_V3_VAULT_ADDRESSES: Address[];
|
|
4
|
-
export declare const SYNTHETIX_V3_VAULTS_WITHDRAW_ASSET_SYMBOL_MAP: Record<string, string>;
|
|
5
|
-
export declare const SYNTHETIX_V3_POSITION_DEBT_ARGUMENTS: Record<string, string[]>;
|
|
6
1
|
export declare const WITHDRAWAL_FEE_MAP: Map<`0x${string}`, number>;
|
|
@@ -7,8 +7,6 @@ export { usePoolManagerLogicData } from './use-pool-manager-logic-data';
|
|
|
7
7
|
export { usePoolCompositionWithFraction } from './use-pool-composition-with-fraction';
|
|
8
8
|
export { usePoolTokenPrice } from './use-pool-token-price';
|
|
9
9
|
export { usePoolFees } from './use-pool-fees';
|
|
10
|
-
export { useSynthetixV3AssetBalance } from './synthetixV3/use-synthetix-v3-asset-balance';
|
|
11
|
-
export { useTotalFundValueMutable } from './synthetixV3/use-total-funds-value-mutable';
|
|
12
10
|
export { useInvalidatePoolContractData } from './use-invalidate-pool-contract-data';
|
|
13
11
|
export { usePoolsDynamic } from './multicall';
|
|
14
12
|
export { useVaultVestedPoints } from './use-vault-vested-points';
|
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import type { Address
|
|
1
|
+
import type { Address } from 'core-kit/types/web3.types';
|
|
2
2
|
interface PoolDynamicContractDataParams {
|
|
3
3
|
address: Address;
|
|
4
|
-
chainId: ChainId;
|
|
5
4
|
}
|
|
6
|
-
export declare const usePoolDynamicContractData: ({ address,
|
|
7
|
-
totalValue: string | undefined;
|
|
5
|
+
export declare const usePoolDynamicContractData: ({ address, }: PoolDynamicContractDataParams) => {
|
|
8
6
|
isFetched: boolean;
|
|
9
7
|
userBalance?: string | undefined;
|
|
10
8
|
tokenPrice?: string | undefined;
|
|
11
9
|
getExitRemainingCooldown?: string | undefined;
|
|
10
|
+
totalValue?: string | undefined;
|
|
12
11
|
totalSupply?: string | undefined;
|
|
13
12
|
isPrivateVault?: boolean | undefined;
|
|
14
13
|
performanceFee?: string | undefined;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type { Address
|
|
1
|
+
import type { Address } from 'core-kit/types/web3.types';
|
|
2
2
|
interface PoolFeesParams {
|
|
3
3
|
address: Address;
|
|
4
|
-
chainId: ChainId;
|
|
5
4
|
}
|
|
6
|
-
export declare const usePoolFees: ({ address
|
|
5
|
+
export declare const usePoolFees: ({ address }: PoolFeesParams) => {
|
|
7
6
|
performanceFee: string;
|
|
8
7
|
streamingFee: string;
|
|
9
8
|
entryFee: string;
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import type { Address
|
|
1
|
+
import type { Address } from 'core-kit/types/web3.types';
|
|
2
2
|
interface PoolTokenPriceParams {
|
|
3
3
|
address: Address;
|
|
4
|
-
chainId: ChainId;
|
|
5
4
|
formatter?: (tokenPrice: bigint) => string;
|
|
6
5
|
disabled?: boolean;
|
|
7
6
|
}
|
|
8
|
-
export declare const usePoolTokenPrice: ({ address,
|
|
7
|
+
export declare const usePoolTokenPrice: ({ address, formatter, }: PoolTokenPriceParams) => string;
|
|
9
8
|
export {};
|
|
@@ -5,10 +5,8 @@ export { useRawAssetPrice } from './use-raw-asset-price';
|
|
|
5
5
|
export { useIsTradingEnabled } from './use-is-trading-enabled';
|
|
6
6
|
export { useExchangeRate } from './use-exchange-rate';
|
|
7
7
|
export { useHandleTrade } from './use-handle-trade';
|
|
8
|
-
export { useSynthetixV3OraclesUpdate } from './synthetix-v3/use-synthetix-v3-oracles-update';
|
|
9
8
|
export { useDepositProjectedEarnings } from './projected-earnings/use-deposit-projected-earnings';
|
|
10
9
|
export { useProjectedEarningsCore } from './projected-earnings/use-projected-earnings-core';
|
|
11
10
|
export { useSwapDataQuery } from './use-swap-data-query';
|
|
12
11
|
export { useSendTokenDebouncedValue } from './use-send-token-debounced-value';
|
|
13
|
-
export { useAvailableWithdrawLiquidity } from './synthetix-v3/use-available-withdraw-liquidity';
|
|
14
12
|
export { useEasySwapperTrackedAssets } from './use-easy-swapper-tracked-assets';
|
|
@@ -27,7 +27,7 @@ type RemoveTransaction = {
|
|
|
27
27
|
} & Partial<PendingTransaction>;
|
|
28
28
|
export type UpdateTransactionsArguments = AddTransaction | UpdateTransaction | RemoveTransaction;
|
|
29
29
|
export type TradingPanelType = 'deposit' | 'withdraw';
|
|
30
|
-
export type TransactionAction = 'deposit' | 'multi_withdraw' | 'single_withdraw' | 'approve' | '
|
|
30
|
+
export type TransactionAction = 'deposit' | 'multi_withdraw' | 'single_withdraw' | 'approve' | 'swap' | 'claim' | 'single_withdraw_and_claim';
|
|
31
31
|
export type SwapEntity = 'token' | 'pool';
|
|
32
32
|
export interface TokenSelectorPayload {
|
|
33
33
|
isOpen: boolean;
|
|
@@ -4,6 +4,6 @@ export declare const isFlatMoneyLeveragedAsset: (address: Address) => boolean;
|
|
|
4
4
|
export declare const getFlatMoneyCollateralByLeverageAddress: (address: string) => {
|
|
5
5
|
symbol: string;
|
|
6
6
|
decimals: number;
|
|
7
|
-
address: string
|
|
7
|
+
address: `0x${string}`;
|
|
8
8
|
};
|
|
9
9
|
export declare const getFlatMoneyLinkByUnitAddress: (address: string) => "https://flat.money/flatcoin" | "https://v1.flat.money/flatcoin";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { Address } from 'viem';
|
|
2
|
+
export declare const isGmxLeveragedAsset: (address: Address) => boolean;
|
|
3
|
+
export declare const getGmxCollateralByLeverageAddress: (address: string) => import("../types").TradingToken | {
|
|
4
|
+
symbol: string;
|
|
5
|
+
decimals: number;
|
|
6
|
+
address: `0x${string}`;
|
|
7
|
+
};
|