@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
package/README.md
CHANGED
|
@@ -54,21 +54,21 @@ Top level provider component. Headless part of trading logic. API handles params
|
|
|
54
54
|
<details>
|
|
55
55
|
<summary><code>actions</code> <code><b>/</b></code> <code>Optional General callbacks to interact with 3rd party services</code></summary>
|
|
56
56
|
|
|
57
|
-
> | name | type
|
|
58
|
-
> | ------------------------------ |
|
|
59
|
-
> | `onUpdateSendTokenInput` | (payload: Partial\<{ address: `Address`; symbol: `string`; value: `string`; decimals: `number`; isLoading?: `boolean` }\>) => void
|
|
60
|
-
> | `onUpdateTradingSettings` | (payload: Partial\<{ slippage: `number \| 'auto'`; minSlippage?: `number` isInfiniteAllowance: `boolean`; isMultiAssetWithdrawalEnabled: `boolean`; isCustomDepositOptionsDisabled?: `boolean`; isMaxSlippageLoading: `boolean` }\>) => void
|
|
61
|
-
> | `onSetTradingType` | (payload: `'deposit' \| 'withdraw'`) => void
|
|
62
|
-
> | `onUpdateTradingModal` | (payload: Partial\<{ isOpen: `boolean`; status: `'Success' \| 'None' \| 'Mining' \| 'Wallet'` }\>) => void
|
|
63
|
-
> | `onUpdateTransactions` | (payload: AddTransaction \| UpdateTransaction \| RemoveTransaction) => void
|
|
64
|
-
> | `onTradingSettleError` | (error: `Error`) => void
|
|
65
|
-
> | `onTransactionError` | (error: `Error`, action: `TransactionAction` \| `undefined`, chainId?: `ChainId`, txHash?: `Address`) => void
|
|
66
|
-
> | `onTransactionSuccess` | (data: `WaitForTransactionReceiptReturnType`, action: `TransactionAction` \| `undefined`, link?: `string`) => void
|
|
67
|
-
> | `onTransactionEstimationError` | (error: `EstimationError`, address: `Address`, chainId?: `ChainId`, account?: `Address`) => void
|
|
68
|
-
> | `onTokenSelector` | (payload: { isOpen: `boolean`; entity: `'token' \| 'pool'` }) => void
|
|
69
|
-
> | `onLog` | (eventName: `string`, payload?: `Record<string, unknown>`) => void
|
|
70
|
-
> | `onSimulateTransaction` | (payload: { chainId: `ChainId`; from: `Address`: to: `Address`; input: `string`; gas: `number`; value?: `string` }) => Promise<{ link?: `string`; simulation: { status: `boolean`; error_message: `string` } } \| null>
|
|
71
|
-
> | `getSwapQuotes` | ({ signal: `AbortSignal`, variables: { chainId: `number`; sourceAddress: `Address`; destinationAddress: `Address`; walletAddress: `Address`; fromAddress: `Address`; amount: `string`; slippage: `string` } }) => Promise<Array <{ destinationAmount: `string`; rawTransaction: `{ data: string }` ; routerKey: `'ONE_INCH' / '
|
|
57
|
+
> | name | type | default value | description |
|
|
58
|
+
> | ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------- | --------------------------------------------------------------------------------- |
|
|
59
|
+
> | `onUpdateSendTokenInput` | (payload: Partial\<{ address: `Address`; symbol: `string`; value: `string`; decimals: `number`; isLoading?: `boolean` }\>) => void | undefined | triggers on send token change |
|
|
60
|
+
> | `onUpdateTradingSettings` | (payload: Partial\<{ slippage: `number \| 'auto'`; minSlippage?: `number` isInfiniteAllowance: `boolean`; isMultiAssetWithdrawalEnabled: `boolean`; isCustomDepositOptionsDisabled?: `boolean`; isMaxSlippageLoading: `boolean` }\>) => void | undefined | triggers on trading settings change |
|
|
61
|
+
> | `onSetTradingType` | (payload: `'deposit' \| 'withdraw'`) => void | undefined | triggers on trading type change |
|
|
62
|
+
> | `onUpdateTradingModal` | (payload: Partial\<{ isOpen: `boolean`; status: `'Success' \| 'None' \| 'Mining' \| 'Wallet'` }\>) => void | undefined | triggers on trading modal change |
|
|
63
|
+
> | `onUpdateTransactions` | (payload: AddTransaction \| UpdateTransaction \| RemoveTransaction) => void | undefined | triggers on transaction action change |
|
|
64
|
+
> | `onTradingSettleError` | (error: `Error`) => void | undefined | triggers on trading settle error |
|
|
65
|
+
> | `onTransactionError` | (error: `Error`, action: `TransactionAction` \| `undefined`, chainId?: `ChainId`, txHash?: `Address`) => void | undefined | triggers on transaction error |
|
|
66
|
+
> | `onTransactionSuccess` | (data: `WaitForTransactionReceiptReturnType`, action: `TransactionAction` \| `undefined`, link?: `string`) => void | undefined | triggers on transaction success |
|
|
67
|
+
> | `onTransactionEstimationError` | (error: `EstimationError`, address: `Address`, chainId?: `ChainId`, account?: `Address`) => void | undefined | triggers on transaction estimation error |
|
|
68
|
+
> | `onTokenSelector` | (payload: { isOpen: `boolean`; entity: `'token' \| 'pool'` }) => void | undefined | triggers on token selector change |
|
|
69
|
+
> | `onLog` | (eventName: `string`, payload?: `Record<string, unknown>`) => void | undefined | triggers on log event |
|
|
70
|
+
> | `onSimulateTransaction` | (payload: { chainId: `ChainId`; from: `Address`: to: `Address`; input: `string`; gas: `number`; value?: `string` }) => Promise<{ link?: `string`; simulation: { status: `boolean`; error_message: `string` } } \| null> | undefined | triggers to simulate transaction and get error details after failed tx estimation |
|
|
71
|
+
> | `getSwapQuotes` | ({ signal: `AbortSignal`, variables: { chainId: `number`; sourceAddress: `Address`; destinationAddress: `Address`; walletAddress: `Address`; fromAddress: `Address`; amount: `string`; slippage: `string` } }) => Promise<Array <{ destinationAmount: `string`; rawTransaction: `{ data: string }` ; routerKey: `'ONE_INCH' / 'PARASWAP_V6' / 'KYBER_SWAP_V2'` } }> \| null> | undefined | provides off chain swap quotes based on send token value |
|
|
72
72
|
|
|
73
73
|
###### Source: `packages/trading-widget/src/core-kit/providers/index.tsx`
|
|
74
74
|
|
|
@@ -154,8 +154,8 @@ The optional `settings.aggregatorLimitPerChain` field allows restricting which a
|
|
|
154
154
|
<TradingPanelProvider
|
|
155
155
|
initialState={{
|
|
156
156
|
settings: {
|
|
157
|
-
availableAggregators: ['
|
|
158
|
-
selectedAggregators: ['
|
|
157
|
+
availableAggregators: ['ParaSwap', '1inch', 'KyberSwap'],
|
|
158
|
+
selectedAggregators: ['ParaSwap', '1inch', 'KyberSwap'],
|
|
159
159
|
aggregatorLimitPerChain: {
|
|
160
160
|
[hyperEvm.id]: ['KyberSwap'], // hyperEVM only uses KyberSwap
|
|
161
161
|
},
|
|
@@ -176,6 +176,35 @@ The `useEffectiveAggregators` hook (exported from the widget) can be used to rea
|
|
|
176
176
|
|
|
177
177
|
---
|
|
178
178
|
|
|
179
|
+
#### Auto Slippage Simulation
|
|
180
|
+
|
|
181
|
+
When `settings.slippage` is set to `'auto'`, the widget runs a **simulation-based search** at transaction-build time to find the minimum slippage value that allows the transaction to pass gas estimation. This replaces the pre-existing heuristic (price-diff calculation) for the actual on-chain call, while the displayed value in the UI still comes from the heuristic.
|
|
182
|
+
|
|
183
|
+
The mechanism mirrors the existing **router selection loop** (`tryEstimateWithRouters`): candidate slippage values are tried from lowest to highest, and the first one whose `estimate()` call succeeds is used for the transaction.
|
|
184
|
+
|
|
185
|
+
**Candidate generation:**
|
|
186
|
+
|
|
187
|
+
The full candidate pool is exported as `SLIPPAGE_AUTO_SIMULATION_CANDIDATES` from `core-kit/const`:
|
|
188
|
+
|
|
189
|
+
At runtime, `getAutoSlippageSimulationCandidates({ maxSlippage })` filters this list to values ≤ the resolved max slippage (from `useAppliedDepositSlippage` / `useAppliedWithdrawSlippage`), rounds to two decimals, and always includes the resolved max itself as the final candidate.
|
|
190
|
+
|
|
191
|
+
**Flows covered:**
|
|
192
|
+
|
|
193
|
+
| Flow | Simulation shape | Fallback when all candidates fail |
|
|
194
|
+
| ----------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ---------------------------------------------------------------------------------------------- |
|
|
195
|
+
| Zap deposit — single (`useDeposit`) | Outer slippage loop × inner swap-quote router loop in `buildZapDepositArguments` | Falls through to the standard router loop with the resolved `depositSlippage` |
|
|
196
|
+
| Init withdraw — Aave vaults | Outer slippage loop (`tryEstimateWithSlippageValues`) re-fetches swap quotes per candidate × inner `tryEstimateWithRouters` in `useFetchInitWithdrawComplexAssetData` | `createDefaultComplexAssetData` with the resolved `slippageTolerance` (pre-simulation default) |
|
|
197
|
+
| Complete withdraw — swap | Outer slippage loop × inner router loop in `useCompleteWithdrawTransaction` | Returns empty args (no transaction sent) |
|
|
198
|
+
|
|
199
|
+
**Not covered / by design:**
|
|
200
|
+
|
|
201
|
+
- **Zap deposit — batch** (`useBatchDeposit`): batch path uses a fixed quote index with no `estimate`, by design.
|
|
202
|
+
- **Non-zap deposit** (`deposit`, `nativeDeposit`): slippage here is a min-vault-tokens gap, not a DEX swap tolerance — no estimation loop is possible.
|
|
203
|
+
- **Init withdraw — non-Aave vaults**: no swap quotes involved; the `complexAssetData` is built with a single `slippageTolerance` value via `createDefaultComplexAssetData` — no estimation loop.
|
|
204
|
+
- **Limit order withdraw**: uses price bounds, not DEX slippage.
|
|
205
|
+
|
|
206
|
+
---
|
|
207
|
+
|
|
179
208
|
<details>
|
|
180
209
|
<summary><code>PoolConfig</code> <code><b>/</b></code> <code>Vault configuration schema</code></summary>
|
|
181
210
|
|
|
@@ -208,28 +237,28 @@ UI configuration provider. Manages params to configure custom styling, component
|
|
|
208
237
|
|
|
209
238
|
##### params
|
|
210
239
|
|
|
211
|
-
> | name | type | default value
|
|
212
|
-
> | ---------------------------------- | -------------------------------------------------------------- |
|
|
213
|
-
> | `isGeoBlocked` | `boolean` | `false`
|
|
214
|
-
> | `isSanctioned` | `boolean` | `false`
|
|
215
|
-
> | `depositQuoteDiffWarningThreshold` | `number` | `1.5`
|
|
216
|
-
> | `depositQuoteDiffErrorThreshold` | `number` | `3`
|
|
217
|
-
> | `defaultWithdrawSlippage` | `number
|
|
218
|
-
> | `defaultSwapTransactionSlippage` | `number
|
|
219
|
-
> | `defaultNoSwapMinDepositAmountGap` | `number` | `0.1`
|
|
220
|
-
> | `defaultNotificationDuration` | `number` | `10000`
|
|
221
|
-
> | `defaultLockTime` | `string` | `'24 hours'`
|
|
222
|
-
> | `customLockTime` | `string` | `'15 minutes'`
|
|
223
|
-
> | `stablePrecision` | `number` | `3`
|
|
224
|
-
> | `defaultPrecision` | `number` | `6`
|
|
225
|
-
> | `termsOfUseAccepted` | `boolean` | `true`
|
|
226
|
-
> | `standalone` | `boolean` | `true`
|
|
227
|
-
> | `isAllAssetsWithdrawOptionDefault` | `boolean` | `false`
|
|
228
|
-
> | `isCustomDepositOptionsDisabled` | `boolean` | `false`
|
|
229
|
-
> | `chainConfig` | `Partial<Record<ChainId, { name: string; iconPath: string }>>` | `{}`
|
|
230
|
-
> | `getFallbackIconPath` | `(tokenName: string) => string` | `buildIconLink`
|
|
231
|
-
> | `minLimitOrderValue` | `number` | `0`
|
|
232
|
-
> | `limitOrderThemeConfig` | `ThemeProviderConfigProps` | `{}`
|
|
240
|
+
> | name | type | default value | description |
|
|
241
|
+
> | ---------------------------------- | -------------------------------------------------------------- | --------------- | -------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
242
|
+
> | `isGeoBlocked` | `boolean` | `false` | Restricts depositing action button and conditionally renders GeoBlockAlert component |
|
|
243
|
+
> | `isSanctioned` | `boolean` | `false` | Restricts depositing action button and conditionally renders SanctionedAlert component |
|
|
244
|
+
> | `depositQuoteDiffWarningThreshold` | `number` | `1.5` | Deposit slippage absolute percent value warning threshold, Affects styling to warn user |
|
|
245
|
+
> | `depositQuoteDiffErrorThreshold` | `number` | `3` | Deposit slippage absolute percent value error threshold, Affects styling to warn user |
|
|
246
|
+
> | `defaultWithdrawSlippage` | `number \| Partial<Record<ChainId, number>>` | `0.5` | Initial withdraw slippage absolute percent. Accepts a single number or a per-chain map. Further adjustments are available in panel settings |
|
|
247
|
+
> | `defaultSwapTransactionSlippage` | `number \| Partial<Record<ChainId, number>>` | `0.5` | Default slippage (%) applied to swap transaction. Accepts a single number or a per-chain map. |
|
|
248
|
+
> | `defaultNoSwapMinDepositAmountGap` | `number` | `0.1` | Default gap (%) for min received vault tokens during no swap deposits. |
|
|
249
|
+
> | `defaultNotificationDuration` | `number` | `10000` | Notification duration in ms |
|
|
250
|
+
> | `defaultLockTime` | `string` | `'24 hours'` | Formatted default deposit lock time to be displayed in panel (Long lockup period is used to bypass entry fee and can be managed in panel settings) |
|
|
251
|
+
> | `customLockTime` | `string` | `'15 minutes'` | Formatted custom deposit lock time alternative to be displayed in panel |
|
|
252
|
+
> | `stablePrecision` | `number` | `3` | Number of decimals to be displayed in stables (e.g USDC balance) |
|
|
253
|
+
> | `defaultPrecision` | `number` | `6` | Number of decimals to be displayed in token values |
|
|
254
|
+
> | `termsOfUseAccepted` | `boolean` | `true` | Requires user to confirm terms of use by rendering DepositTermsOfUse component before deposit action |
|
|
255
|
+
> | `standalone` | `boolean` | `true` | Handles token selection in SPA mode |
|
|
256
|
+
> | `isAllAssetsWithdrawOptionDefault` | `boolean` | `false` | Sets "All Assets" withdraw option by default |
|
|
257
|
+
> | `isCustomDepositOptionsDisabled` | `boolean` | `false` | When enabled, excludes custom deposit tokens and native tokens from deposit options. Only vault's default deposit tokens are available. |
|
|
258
|
+
> | `chainConfig` | `Partial<Record<ChainId, { name: string; iconPath: string }>>` | `{}` | Sets map of chain `name` and `iconPath` |
|
|
259
|
+
> | `getFallbackIconPath` | `(tokenName: string) => string` | `buildIconLink` | Fallback token icon path getter |
|
|
260
|
+
> | `minLimitOrderValue` | `number` | `0` | Minimum USD value required to create a limit sell order |
|
|
261
|
+
> | `limitOrderThemeConfig` | `ThemeProviderConfigProps` | `{}` | Limit sell overlay content theme config |
|
|
233
262
|
|
|
234
263
|
##### actions
|
|
235
264
|
|
|
@@ -665,9 +694,6 @@ path: `component.meta[name]`
|
|
|
665
694
|
> | `proceedWithNextStep` | string | Please proceed with the next step. | |
|
|
666
695
|
> | `aggregatorsLabel` | string | Swap source | |
|
|
667
696
|
> | `aggregatorsTooltip` | string | Choose which aggregators to use for your trades. | |
|
|
668
|
-
> | `batchTransactionsLabel` | string | Batch transactions | |
|
|
669
|
-
> | `batchTransactionsSwitchLabel` | string | Batch | |
|
|
670
|
-
> | `batchTransactionsTooltip` | string | Group approve and trade calls into a single batch transaction. Disable if you prefer separate prompts. | |
|
|
671
697
|
> | `openLimitOrderAfterBuySwitchLabel` | string | Add Stop Order | |
|
|
672
698
|
> | `openNotificationsSettingsLabel` | string | Enable alerts | |
|
|
673
699
|
> | `addToWallet` | string | add to wallet | |
|
package/const.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("./
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("./gmx-Bmop5mtI.cjs"),A=require("./storage-DHoO5PX_.cjs"),E=require("wagmi/chains");exports.ALCHEMY_RPC_URL_MAP=_.ALCHEMY_RPC_URL_MAP;exports.AUTO_TRANSACTION_PUSH_DELAY=_.AUTO_TRANSACTION_PUSH_DELAY;exports.AddressZero=_.AddressZero;exports.BRIDGED_TOKENS_SYMBOLS=_.BRIDGED_TOKENS_SYMBOLS;exports.CHAIN_MAP=_.CHAIN_MAP;exports.CHAIN_NATIVE_TOKENS=_.CHAIN_NATIVE_TOKENS;exports.COMPLETE_WITHDRAW_ACTIONS=_.COMPLETE_WITHDRAW_ACTIONS;exports.CURRENCY_DECIMALS_MAP=_.CURRENCY_DECIMALS_MAP;exports.CURRENCY_SYMBOL_MAP=_.CURRENCY_SYMBOL_MAP;exports.DEFAULT_DEBOUNCE_TIME=_.DEFAULT_DEBOUNCE_TIME;exports.DEFAULT_DEPOSIT_METHOD=_.DEFAULT_DEPOSIT_METHOD;exports.DEFAULT_DEPOSIT_SLIPPAGE=_.DEFAULT_DEPOSIT_SLIPPAGE;exports.DEFAULT_DEPOSIT_SLIPPAGE_SCALE=_.DEFAULT_DEPOSIT_SLIPPAGE_SCALE;exports.DEFAULT_ERROR_MESSAGE=_.DEFAULT_ERROR_MESSAGE;exports.DEFAULT_LOCK_TIME=_.DEFAULT_LOCK_TIME;exports.DEFAULT_MAX_GAS_LIMIT=_.DEFAULT_MAX_GAS_LIMIT;exports.DEFAULT_MULTI_ASSET_WITHDRAW_METHOD=_.DEFAULT_MULTI_ASSET_WITHDRAW_METHOD;exports.DEFAULT_NOTIFICATION_DURATION_MS=_.DEFAULT_NOTIFICATION_DURATION_MS;exports.DEFAULT_NO_SWAP_MIN_DEPOSIT_AMOUNT_GAP=_.DEFAULT_NO_SWAP_MIN_DEPOSIT_AMOUNT_GAP;exports.DEFAULT_POLLING_INTERVAL=_.DEFAULT_POLLING_INTERVAL;exports.DEFAULT_PRECISION=_.DEFAULT_PRECISION;exports.DEFAULT_PROMISE_TIMEOUT_MS=_.DEFAULT_PROMISE_TIMEOUT_MS;exports.DEFAULT_RECEIVED_VALUE_GAP=_.DEFAULT_RECEIVED_VALUE_GAP;exports.DEFAULT_SIMULATION_ERROR=_.DEFAULT_SIMULATION_ERROR;exports.DEFAULT_SWAP_TRANSACTION_SLIPPAGE=_.DEFAULT_SWAP_TRANSACTION_SLIPPAGE;exports.DEFAULT_VAULT_TOKEN_PRICE=_.DEFAULT_VAULT_TOKEN_PRICE;exports.DEFAULT_VISIBLE_ASSETS_LIMIT=_.DEFAULT_VISIBLE_ASSETS_LIMIT;exports.DEFAULT_WITHDRAW_SLIPPAGE=_.DEFAULT_WITHDRAW_SLIPPAGE;exports.DEPOSIT_SWAP_DATA_ERROR=_.DEPOSIT_SWAP_DATA_ERROR;exports.EASY_SWAPPER_V2_COMPLETE_WITHDRAW_METHOD=_.EASY_SWAPPER_V2_COMPLETE_WITHDRAW_METHOD;exports.EASY_SWAPPER_V2_DEPOSIT_METHODS=_.EASY_SWAPPER_V2_DEPOSIT_METHODS;exports.EASY_SWAPPER_V2_INITIATE_WITHDRAW_METHOD=_.EASY_SWAPPER_V2_INITIATE_WITHDRAW_METHOD;exports.EASY_SWAPPER_V2_UNROLL_AND_CLAIM_METHOD=_.EASY_SWAPPER_V2_UNROLL_AND_CLAIM_METHOD;exports.EMPTY_POOL_CONFIG=_.EMPTY_POOL_CONFIG;exports.EXTENDED_DEBOUNCE_TIME=_.EXTENDED_DEBOUNCE_TIME;exports.EXTENDED_POLLING_INTERVAL=_.EXTENDED_POLLING_INTERVAL;exports.EXTREMELY_SHORT_POLLING_INTERVAL=_.EXTREMELY_SHORT_POLLING_INTERVAL;exports.FALLBACK_ASSETS_MAP=_.FALLBACK_ASSETS_MAP;exports.FLAT_MONEY_COLLATERAL_MAP=_.FLAT_MONEY_COLLATERAL_MAP;exports.FLAT_MONEY_LEVERAGED_ASSET_ADDRESSES=_.FLAT_MONEY_LEVERAGED_ASSET_ADDRESSES;exports.FLAT_MONEY_UNIT_ADDRESSES=_.FLAT_MONEY_UNIT_ADDRESSES;exports.FLAT_MONEY_UNIT_LINK=_.FLAT_MONEY_UNIT_LINK;exports.FLAT_MONEY_V1_UNIT_ADDRESS=_.FLAT_MONEY_V1_UNIT_ADDRESS;exports.FLAT_MONEY_V1_UNIT_LINK=_.FLAT_MONEY_V1_UNIT_LINK;exports.GAS_ESTIMATION_ERROR=_.GAS_ESTIMATION_ERROR;exports.GAS_LIMIT_BUFFER_COEFF=_.GAS_LIMIT_BUFFER_COEFF;exports.GMX_MARKET_ASSETS=_.GMX_MARKET_ASSETS;exports.GMX_MARKET_ASSETS_MAP=_.GMX_MARKET_ASSETS_MAP;exports.GMX_WITHDRAW_ASSET_MAP=_.GMX_WITHDRAW_ASSET_MAP;exports.GMX_WITHDRAW_ASSET_MAP_BY_VAULT_ADDRESS=_.GMX_WITHDRAW_ASSET_MAP_BY_VAULT_ADDRESS;exports.INVALID_PRICES_LIMIT_ORDER_TITLE=_.INVALID_PRICES_LIMIT_ORDER_TITLE;exports.LIMIT_ORDER_TRANSACTION_ERRORS=_.LIMIT_ORDER_TRANSACTION_ERRORS;exports.LOG_EVENT_BY_TRANSACTION_ACTION_MAP=_.LOG_EVENT_BY_TRANSACTION_ACTION_MAP;exports.MANAGER_FEE_DENOMINATOR=_.MANAGER_FEE_DENOMINATOR;exports.MAX_GAS_LIMIT_MAP=_.MAX_GAS_LIMIT_MAP;exports.MULTI_ASSET_TOKEN=_.MULTI_ASSET_TOKEN;exports.MaxUint256=_.MaxUint256;exports.NATIVE_TOKEN_DEPOSIT_GAS_LIMIT=_.NATIVE_TOKEN_DEPOSIT_GAS_LIMIT;exports.PYTH_API_LINK=_.PYTH_API_LINK;exports.SHORTEN_POLLING_INTERVAL=_.SHORTEN_POLLING_INTERVAL;exports.SIMULATION_TIMEOUT_ERROR=_.SIMULATION_TIMEOUT_ERROR;exports.SLIPPAGE_AUTO_SIMULATION_CANDIDATES=_.SLIPPAGE_AUTO_SIMULATION_CANDIDATES;exports.STABLE_TOKEN_SYMBOLS=_.STABLE_TOKEN_SYMBOLS;exports.SWAP_FAILED_ERROR=_.SWAP_FAILED_ERROR;exports.SWAP_QUOTE_REFRESH_INTERVAL_MS=_.SWAP_QUOTE_REFRESH_INTERVAL_MS;exports.TRADING_LOG_EVENT_PARAM=_.TRADING_LOG_EVENT_PARAM;exports.TRADING_PANEL_LOG_EVENT=_.TRADING_PANEL_LOG_EVENT;exports.TRANSACTION_ERRORS=_.TRANSACTION_ERRORS;exports.TRANSACTION_ERROR_KEYS=_.TRANSACTION_ERROR_KEYS;exports.WBTC_BY_CHAIN_ID=_.WBTC_BY_CHAIN_ID;exports.WETH_BY_CHAIN_ID=_.WETH_BY_CHAIN_ID;exports.WITHDRAW_SWAP_DATA_ERROR=_.WITHDRAW_SWAP_DATA_ERROR;exports.contractsAbisMap=_.contractsAbisMap;exports.contractsAddressesMap=_.contractsAddressesMap;exports.COVERED_CALL_VAULT_ADDRESSES=A.COVERED_CALL_VAULT_ADDRESSES;exports.LOCAL_STORAGE_KEYS=A.LOCAL_STORAGE_KEYS;Object.defineProperty(exports,"arbitrum",{enumerable:!0,get:()=>E.arbitrum});Object.defineProperty(exports,"base",{enumerable:!0,get:()=>E.base});Object.defineProperty(exports,"hyperEvm",{enumerable:!0,get:()=>E.hyperEvm});Object.defineProperty(exports,"mainnet",{enumerable:!0,get:()=>E.mainnet});Object.defineProperty(exports,"optimism",{enumerable:!0,get:()=>E.optimism});Object.defineProperty(exports,"polygon",{enumerable:!0,get:()=>E.polygon});
|
package/const.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { A, a as T, b as I, B as
|
|
2
|
-
import { C as B_ } from "./
|
|
3
|
-
import { arbitrum as
|
|
1
|
+
import { A, a as T, b as I, B as S, C as a, c as L, d as R, e as O, f as s, D as N, g as D, h as M, i as P, j as U, k as C, l as F, m as G, n as W, o as Y, p as H, q as V, r as B, s as K, t as r, u as o, v as e, w as t, x as X, y as m, E as p, z as i, F as n, G as c, H as d, I as b, J as f, K as x, L as g, M as h, N as y, O as j, P as l, Q as u, R as v, S as Q, T as Z, U as k, V as q, W as w, X as z, Y as J, Z as $, _ as __, $ as E_, a0 as A_, a1 as T_, a2 as I_, a3 as S_, a4 as a_, a5 as L_, a6 as R_, a7 as O_, a8 as s_, a9 as N_, aa as D_, ab as M_, ac as P_, ad as U_, ae as C_, af as F_, ag as G_, ah as W_, ai as Y_, aj as H_ } from "./gmx-3UudxpaT.js";
|
|
2
|
+
import { C as B_, L as K_ } from "./storage-CSc9iE5L.js";
|
|
3
|
+
import { arbitrum as o_, base as e_, hyperEvm as t_, mainnet as X_, optimism as m_, polygon as p_ } from "wagmi/chains";
|
|
4
4
|
export {
|
|
5
5
|
A as ALCHEMY_RPC_URL_MAP,
|
|
6
6
|
T as AUTO_TRANSACTION_PUSH_DELAY,
|
|
7
7
|
I as AddressZero,
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
S as BRIDGED_TOKENS_SYMBOLS,
|
|
9
|
+
a as CHAIN_MAP,
|
|
10
10
|
L as CHAIN_NATIVE_TOKENS,
|
|
11
11
|
R as COMPLETE_WITHDRAW_ACTIONS,
|
|
12
12
|
B_ as COVERED_CALL_VAULT_ADDRESSES,
|
|
@@ -55,16 +55,17 @@ export {
|
|
|
55
55
|
z as GMX_WITHDRAW_ASSET_MAP_BY_VAULT_ADDRESS,
|
|
56
56
|
J as INVALID_PRICES_LIMIT_ORDER_TITLE,
|
|
57
57
|
$ as LIMIT_ORDER_TRANSACTION_ERRORS,
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
K_ as LOCAL_STORAGE_KEYS,
|
|
59
|
+
__ as LOG_EVENT_BY_TRANSACTION_ACTION_MAP,
|
|
60
|
+
E_ as MANAGER_FEE_DENOMINATOR,
|
|
61
|
+
A_ as MAX_GAS_LIMIT_MAP,
|
|
62
|
+
T_ as MULTI_ASSET_TOKEN,
|
|
63
|
+
I_ as MaxUint256,
|
|
64
64
|
S_ as NATIVE_TOKEN_DEPOSIT_GAS_LIMIT,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
65
|
+
a_ as PYTH_API_LINK,
|
|
66
|
+
L_ as SHORTEN_POLLING_INTERVAL,
|
|
67
|
+
R_ as SIMULATION_TIMEOUT_ERROR,
|
|
68
|
+
O_ as SLIPPAGE_AUTO_SIMULATION_CANDIDATES,
|
|
68
69
|
s_ as STABLE_TOKEN_SYMBOLS,
|
|
69
70
|
N_ as SWAP_FAILED_ERROR,
|
|
70
71
|
D_ as SWAP_QUOTE_REFRESH_INTERVAL_MS,
|
|
@@ -75,12 +76,12 @@ export {
|
|
|
75
76
|
F_ as WBTC_BY_CHAIN_ID,
|
|
76
77
|
G_ as WETH_BY_CHAIN_ID,
|
|
77
78
|
W_ as WITHDRAW_SWAP_DATA_ERROR,
|
|
78
|
-
|
|
79
|
-
|
|
79
|
+
o_ as arbitrum,
|
|
80
|
+
e_ as base,
|
|
80
81
|
Y_ as contractsAbisMap,
|
|
81
82
|
H_ as contractsAddressesMap,
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
83
|
+
t_ as hyperEvm,
|
|
84
|
+
X_ as mainnet,
|
|
85
|
+
m_ as optimism,
|
|
86
|
+
p_ as polygon
|
|
86
87
|
};
|
|
@@ -17,6 +17,7 @@ export declare const DEFAULT_NO_SWAP_MIN_DEPOSIT_AMOUNT_GAP = 0.5;
|
|
|
17
17
|
export declare const DEFAULT_RECEIVED_VALUE_GAP = 0.02;
|
|
18
18
|
export declare const DEFAULT_SWAP_TRANSACTION_SLIPPAGE = 0.5;
|
|
19
19
|
export declare const DEFAULT_DEPOSIT_SLIPPAGE_SCALE: number[];
|
|
20
|
+
export declare const SLIPPAGE_AUTO_SIMULATION_CANDIDATES: number[];
|
|
20
21
|
export declare const DEFAULT_MULTI_ASSET_WITHDRAW_METHOD = "withdrawSafe";
|
|
21
22
|
export declare const EASY_SWAPPER_V2_INITIATE_WITHDRAW_METHOD = "initWithdrawal";
|
|
22
23
|
export declare const EASY_SWAPPER_V2_UNROLL_AND_CLAIM_METHOD = "unrollAndClaim";
|
|
@@ -11,9 +11,10 @@ export declare const TRADING_PANEL_LOG_EVENT: {
|
|
|
11
11
|
WITHDRAWAL: string;
|
|
12
12
|
TRADING_SETTINGS_OPENED: string;
|
|
13
13
|
INFINITE_ALLOWANCE_CHANGE: string;
|
|
14
|
-
BATCH_TRANSACTIONS_CHANGE: string;
|
|
15
14
|
CREATE_LIMIT_SELL_ORDER: string;
|
|
15
|
+
CREATE_LIMIT_BUY_ORDER: string;
|
|
16
16
|
OPEN_LIMIT_SELL_VIEW: string;
|
|
17
|
+
OPEN_LIMIT_BUY_VIEW: string;
|
|
17
18
|
LIMIT_ORDER_WITHDRAW: string;
|
|
18
19
|
LIMIT_ORDER_WITHDRAW_DELETE: string;
|
|
19
20
|
};
|
|
@@ -41,10 +42,6 @@ export declare const TRADING_LOG_EVENT_PARAM: {
|
|
|
41
42
|
NAME: string;
|
|
42
43
|
TYPE: string;
|
|
43
44
|
};
|
|
44
|
-
IS_BATCH_TRANSACTIONS_ENABLED: {
|
|
45
|
-
NAME: string;
|
|
46
|
-
TYPE: string;
|
|
47
|
-
};
|
|
48
45
|
SOURCE: {
|
|
49
46
|
NAME: string;
|
|
50
47
|
TYPE: string;
|
|
@@ -12,7 +12,6 @@ export declare const useUpdateTradingSettings: () => (payload: Partial<{
|
|
|
12
12
|
availableAggregators: string[];
|
|
13
13
|
selectedAggregators: string[];
|
|
14
14
|
aggregatorLimitPerChain?: Partial<Record<number, string[]>> | undefined;
|
|
15
|
-
isBatchTransactionsEnabled: boolean;
|
|
16
15
|
isForceSendEnabled?: boolean | undefined;
|
|
17
16
|
forceSendGas?: number | undefined;
|
|
18
17
|
}>) => void;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare const useDepositCommon: () => {
|
|
2
2
|
chainId: number;
|
|
3
3
|
depositMethod: import("../../../../types").DepositMethodName;
|
|
4
|
-
buildDepositTransactionArgs: (estimate
|
|
4
|
+
buildDepositTransactionArgs: (estimate: import("../../../../types").EstimateCall) => Promise<import("../../../../utils/deposit").DepositArguments>;
|
|
5
5
|
addPendingTransaction: () => void;
|
|
6
6
|
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { EstimateCall, VaultDepositParams } from '../../../types';
|
|
2
2
|
import type { DepositArguments } from '../../../utils/deposit';
|
|
3
|
-
export declare const useGetVaultDepositTransactionArguments: ({ depositMethod, vaultDepositTokenAddress, }: VaultDepositParams) => (estimate
|
|
3
|
+
export declare const useGetVaultDepositTransactionArguments: ({ depositMethod, vaultDepositTokenAddress, }: VaultDepositParams) => (estimate: EstimateCall) => Promise<DepositArguments>;
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
import type { TradingToken } from '@shared/types';
|
|
2
|
-
|
|
2
|
+
interface UseVaultDepositTokensOptions {
|
|
3
|
+
excludeNativeToken?: boolean;
|
|
4
|
+
}
|
|
5
|
+
export declare const useVaultDepositTokens: ({ excludeNativeToken, }?: UseVaultDepositTokensOptions) => TradingToken[];
|
|
6
|
+
export {};
|
|
@@ -12,4 +12,3 @@ export { useSwapQuotesQuery } from '../../hooks/trading/swaps/use-swap-quotes-qu
|
|
|
12
12
|
export { useSwapsQuotesQuery, fetchSwapsQuotesForAave, } from '../../hooks/trading/swaps/use-swaps-quotes-query';
|
|
13
13
|
export { useSendTokenDebouncedValue } from '../../hooks/trading/use-send-token-debounced-value';
|
|
14
14
|
export { useEasySwapperTrackedAssets } from '../../hooks/trading/use-easy-swapper-tracked-assets';
|
|
15
|
-
export { useIsBatchContractWritesTrading } from '../../hooks/trading/use-is-batch-contract-writes-trading';
|
package/core-kit/hooks/trading/withdraw-v2/init-step/use-fetch-init-withdraw-complex-asset-data.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ export type CommonWithdrawTransactionArgs = [bigint] | [Address, bigint];
|
|
|
4
4
|
type FetchInitWithdrawComplexAssetDataParams = FetchAaveSwapParamsProps & {
|
|
5
5
|
estimate: EstimateCall;
|
|
6
6
|
transactionArgs: CommonWithdrawTransactionArgs;
|
|
7
|
+
isAutoSlippage: boolean;
|
|
7
8
|
};
|
|
8
|
-
export declare const useFetchInitWithdrawComplexAssetData: ({ address, chainId, }: Pick<PoolConfig, 'address' | 'chainId'>) => ({ withdrawAmountD18, slippage, estimate, transactionArgs, }: FetchInitWithdrawComplexAssetDataParams) => Promise<ComplexWithdrawAssetData[]>;
|
|
9
|
+
export declare const useFetchInitWithdrawComplexAssetData: ({ address, chainId, }: Pick<PoolConfig, 'address' | 'chainId'>) => ({ withdrawAmountD18, slippage, isAutoSlippage, estimate, transactionArgs, }: FetchInitWithdrawComplexAssetDataParams) => Promise<ComplexWithdrawAssetData[]>;
|
|
9
10
|
export {};
|
|
@@ -11,4 +11,3 @@ export { useContractReadErrorLogging } from '../../hooks/web3/use-contract-read-
|
|
|
11
11
|
export { useStaticCallQuery } from '../../hooks/web3/use-static-call-query';
|
|
12
12
|
export { useInvalidateOnBlock } from '../../hooks/web3/use-invalidate-on-block';
|
|
13
13
|
export { useInvalidateTradingQueries } from '../../hooks/web3/use-invalidate-trading-queries';
|
|
14
|
-
export { useIsBatchContractWritesSupported } from '../../hooks/web3/use-is-batch-contract-writes-supported';
|
|
@@ -34,7 +34,6 @@ export interface TradingPanelState {
|
|
|
34
34
|
availableAggregators: string[];
|
|
35
35
|
selectedAggregators: string[];
|
|
36
36
|
aggregatorLimitPerChain?: Partial<Record<ChainId, string[]>>;
|
|
37
|
-
isBatchTransactionsEnabled: boolean;
|
|
38
37
|
isForceSendEnabled?: boolean;
|
|
39
38
|
forceSendGas?: number;
|
|
40
39
|
};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { TradingToken } from '@shared/types';
|
|
2
|
-
import type { Address, ChainId
|
|
2
|
+
import type { Address, ChainId } from '../types/web3.types';
|
|
3
3
|
export interface DynamicTradingToken extends TradingToken {
|
|
4
4
|
isLoading?: boolean;
|
|
5
5
|
}
|
|
@@ -9,7 +9,6 @@ export interface PendingTransaction {
|
|
|
9
9
|
symbol: string;
|
|
10
10
|
chainId: ChainId;
|
|
11
11
|
txHash?: Address;
|
|
12
|
-
batchId?: Hex;
|
|
13
12
|
}
|
|
14
13
|
type AddTransaction = {
|
|
15
14
|
type: 'add';
|
|
@@ -23,7 +22,7 @@ type RemoveTransaction = {
|
|
|
23
22
|
} & Partial<PendingTransaction>;
|
|
24
23
|
export type UpdateTransactionsArguments = AddTransaction | UpdateTransaction | RemoveTransaction;
|
|
25
24
|
export type TradingPanelType = 'deposit' | 'withdraw';
|
|
26
|
-
export type TransactionAction = 'deposit' | 'multi_withdraw' | 'single_withdraw' | 'approve' | 'swap' | 'claim' | 'single_withdraw_and_claim' | 'create_limit_sell_order' | 'limit_order_withdraw' | 'delete_limit_order_withdraw';
|
|
25
|
+
export type TransactionAction = 'deposit' | 'multi_withdraw' | 'single_withdraw' | 'approve' | 'swap' | 'claim' | 'single_withdraw_and_claim' | 'create_limit_sell_order' | 'create_limit_buy_order' | 'limit_order_withdraw' | 'delete_limit_order_withdraw';
|
|
27
26
|
export type SwapEntity = 'token' | 'pool';
|
|
28
27
|
export interface TokenSelectorPayload {
|
|
29
28
|
isOpen: boolean;
|
|
@@ -18,5 +18,11 @@ export declare const extractAvailableRouterKeys: (vaultAssetsWithSwapQuotes: Vau
|
|
|
18
18
|
export declare const buildComplexAssetDataForRouter: (vaultAssetsWithSwapQuotes: VaultAssetWithSwapQuotes[], routerKey: SwapDataResponse['routerKey'], slippageTolerance: bigint) => ComplexWithdrawAssetData[];
|
|
19
19
|
export declare const tryEstimateWithRouters: (availableRouterKeys: Array<SwapDataResponse['routerKey']>, vaultAssetsWithSwapQuotes: VaultAssetWithSwapQuotes[], slippageTolerance: bigint, estimate: EstimateCall, transactionArgs: unknown[]) => Promise<ComplexWithdrawAssetData[] | null>;
|
|
20
20
|
export declare const createDefaultComplexAssetData: (supportedVaultAssets: Address[] | undefined, slippageTolerance: bigint) => ComplexWithdrawAssetData[];
|
|
21
|
+
/**
|
|
22
|
+
* Tries slippage candidates from lowest to highest.
|
|
23
|
+
* For each candidate, re-fetches swap quotes at that slippage, then tries all routers.
|
|
24
|
+
* Returns the first complexAssetData that passes estimation, or null if all candidates fail.
|
|
25
|
+
*/
|
|
26
|
+
export declare const tryEstimateWithSlippageValues: (slippageCandidates: number[], fetchQuotesForSlippage: (candidateSlippage: number) => Promise<VaultAssetWithSwapQuotes[]>, estimate: EstimateCall, transactionArgs: unknown[]) => Promise<ComplexWithdrawAssetData[] | null>;
|
|
21
27
|
export declare const enrichAssetsWithSwapQuotes: (supportedVaultAssets: Address[] | undefined, aaveLendingPoolV3Address: Address, { fetchAaveSwapParams, fetchAaveSwapQuotes, withdrawAmountD18, slippage, }: EnrichAssetParams) => Promise<VaultAssetWithSwapQuotes[]>;
|
|
22
28
|
export {};
|
|
@@ -15,12 +15,14 @@ export interface BuildZapDepositArgsParams {
|
|
|
15
15
|
sendTokenAmount: string;
|
|
16
16
|
};
|
|
17
17
|
swapQuotes: SwapDataResponse[] | undefined;
|
|
18
|
-
estimate
|
|
18
|
+
estimate: EstimateCall;
|
|
19
19
|
depositSlippage: number;
|
|
20
|
+
isAutoSlippage?: boolean;
|
|
21
|
+
autoSlippageCandidates?: number[];
|
|
20
22
|
sendTokenAddress: Address;
|
|
21
23
|
depositMethod: VaultDepositParams['depositMethod'];
|
|
22
24
|
referralData?: Hex;
|
|
23
25
|
}
|
|
24
26
|
export declare const buildDepositTransactionArgumentsForMethod: (depositMethod: VaultDepositParams['depositMethod'], baseArgs: BuildZapDepositArgsParams['baseArgs'], zapArguments?: unknown[], referralData?: Hex) => DepositArguments;
|
|
25
|
-
export declare const buildZapDepositArguments: ({ baseArgs, swapQuotes, estimate, depositSlippage, sendTokenAddress, depositMethod, referralData, }: BuildZapDepositArgsParams) => Promise<DepositArguments>;
|
|
27
|
+
export declare const buildZapDepositArguments: ({ baseArgs, swapQuotes, estimate, depositSlippage, isAutoSlippage, autoSlippageCandidates, sendTokenAddress, depositMethod, referralData, }: BuildZapDepositArgsParams) => Promise<DepositArguments>;
|
|
26
28
|
export declare const isZapDepositMethod: (depositMethod: DepositMethodName) => boolean;
|
|
@@ -10,5 +10,5 @@ export * from '../utils/ua';
|
|
|
10
10
|
export * from '../utils/flat-money';
|
|
11
11
|
export * from '../utils/logger';
|
|
12
12
|
export * from '../utils/gmx';
|
|
13
|
-
export * from '../utils/batch-transactions';
|
|
14
13
|
export * from '../utils/complex-withdraw-asset-data';
|
|
14
|
+
export * from '../utils/slippage-auto-simulation';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns slippage candidates (low → high) clamped by a maximum (resolved) slippage.
|
|
3
|
+
* Ensures the max value itself is always included (rounded to 2 decimals) when > 0.
|
|
4
|
+
*/
|
|
5
|
+
export declare const getAutoSlippageSimulationCandidates: ({ maxSlippage, candidates, }: {
|
|
6
|
+
maxSlippage: number;
|
|
7
|
+
candidates?: number[] | undefined;
|
|
8
|
+
}) => number[];
|
|
@@ -22,10 +22,11 @@ export declare const buildZapDepositTransactionArguments: ({ vaultAddress, swapD
|
|
|
22
22
|
swapDestinationAmount: string;
|
|
23
23
|
swapSlippage: number;
|
|
24
24
|
}) => (string | (string | `0x${string}`[])[][])[];
|
|
25
|
-
export declare const buildSwapWithdrawTransactionData: ({ receiveAssetAddress, assets, swapData, }: {
|
|
25
|
+
export declare const buildSwapWithdrawTransactionData: ({ receiveAssetAddress, assets, swapData, slippage, }: {
|
|
26
26
|
receiveAssetAddress: Address;
|
|
27
27
|
assets: ReturnType<typeof useCompleteWithdrawTrackedAssets>['data'];
|
|
28
28
|
swapData: SwapDataMap;
|
|
29
|
+
slippage: number;
|
|
29
30
|
}) => unknown[][];
|
|
30
31
|
export declare const buildAaveWithdrawAssetTransactionData: ({ assetAddress, swapQuotes, swapParams, slippageToleranceForContractTransaction, routerKey, }: {
|
|
31
32
|
assetAddress: Address;
|