@dhedge/trading-widget 3.18.0 → 3.19.0-canary.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.
Files changed (25) hide show
  1. package/README.md +100 -102
  2. package/core-kit/const/links.d.ts +0 -1
  3. package/core-kit/const/logger.d.ts +5 -0
  4. package/core-kit/hooks/state/action.d.ts +1 -0
  5. package/core-kit/hooks/trading/index.d.ts +1 -0
  6. package/core-kit/hooks/trading/use-is-batch-contract-writes-trading.d.ts +1 -0
  7. package/core-kit/types/config.types.d.ts +5 -0
  8. package/core-kit/types/state.types.d.ts +1 -0
  9. package/index.cjs +46 -46
  10. package/index.d.ts +1 -1
  11. package/index.js +37970 -37937
  12. package/package.json +1 -1
  13. package/style.css +1 -1
  14. package/trading-widget/components/deposit/button/valid-deposit-button/valid-deposit-button.hooks.d.ts +1 -1
  15. package/trading-widget/components/deposit/meta/open-limit-order-after-buy-switch/open-limit-order-after-buy-switch.d.ts +2 -0
  16. package/trading-widget/components/deposit/meta/open-limit-order-after-buy-switch/open-limit-order-after-buy-switch.hooks.d.ts +5 -0
  17. package/trading-widget/components/widget/widget-overlay/pool-select-overlay/pool-select-overlay.hooks.d.ts +1 -0
  18. package/trading-widget/components/widget/widget-settings/batch-transactions-switch/batch-transactions-switch.d.ts +1 -5
  19. package/trading-widget/components/widget/widget-settings/slippage-selector/slippage-selector.hooks.d.ts +1 -0
  20. package/trading-widget/providers/config-provider/config-provider.types.d.ts +1 -0
  21. package/trading-widget/providers/index.d.ts +2 -0
  22. package/trading-widget/providers/limit-order-provider/limit-order-provider.d.ts +8 -0
  23. package/trading-widget/providers/translation-provider/translation-provider.types.d.ts +1 -3
  24. package/trading-widget/components/deposit/meta/batched-transaction-tip.d.ts +0 -2
  25. package/trading-widget/components/deposit/meta/batched-transaction-tip.hooks.d.ts +0 -3
package/README.md CHANGED
@@ -451,108 +451,106 @@ path: `component.meta[name]`
451
451
  <code>Translation keys</code>
452
452
  </summary>|
453
453
 
454
- > | name | type | default value | description |
455
- > | -------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
456
- > | `depositSlippageWarning` | string | Excludes entry fee. | |
457
- > | `withdrawSlippageWarning` | string | Slippage only applies to single asset withdrawals and withdrawals from vaults with debt positions in Aave. | |
458
- > | `minSlippageWarning` | string | Flexible min slippage value that is likely enough to process the transaction. | |
459
- > | `highSlippageWarning` | string | We recommend using another asset to trade with lower slippage. | |
460
- > | `recommendedMinSlippage` | string | Recommended Min Slippage | |
461
- > | `projectedDailyEarningsTooltip` | string | Projected daily earnings are based on the current APY and may differ from actual earnings. | |
462
- > | `dailyEarnings` | string | Daily Earnings | |
463
- > | `projectedYearlyEarningsTooltip` | string | Projected yearly earnings are based on the current APY and may differ from actual earnings. | |
464
- > | `yearlyEarnings` | string | Yearly Earnings | |
465
- > | `fullReceiveDetails` | string | See full details influencing what you will receive. | |
466
- > | `tradeDetails` | string | Trade details | |
467
- > | `maxSlippage` | string | Max slippage | |
468
- > | `minReceiveAmount` | string | You will receive no less than this amount. | |
469
- > | `minReceived` | string | Minimum Received | |
470
- > | `estimatedMultiAssetFractions` | string | Estimated multi asset fractions | |
471
- > | `infinite` | string | Infinite | |
472
- > | `tokenAllowance` | string | Token Allowance | |
473
- > | `entryFee` | string | Entry Fee | |
474
- > | `entryFeeExplanation` | string | When you deposit, the token takes a small entry fee. This fee helps cover the costs when we rebalance the underlying funds, and it's shared among all token holders. | |
475
- > | `minDepositUsd` | string | Minimum deposit in USD. | |
476
- > | `minDeposit` | string | Minimum Deposit | |
477
- > | `tokensLockTime` | string | Purchased tokens will have a {lockTime} lock. | |
478
- > | `slippageTolerance` | string | Slippage tolerance | |
479
- > | `bypassEntryFee` | string | Bypass Entry Fee | |
480
- > | `tokenAmountToApprove` | string | Amount of tokens to be approved. | |
481
- > | `auto` | string | Auto | |
482
- > | `lengthenLockup` | string | Lengthen lockup to remove entry fee | |
483
- > | `deposit` | string | Buy | |
484
- > | `withdraw` | string | Sell | |
485
- > | `yourBalance` | string | Your Balance | |
486
- > | `max` | string | Max | |
487
- > | `allAssets` | string | All Assets | |
488
- > | `all` | string | All | |
489
- > | `payWith` | string | Pay with | |
490
- > | `buyEstimated` | string | Buy (estimated) | |
491
- > | `sell` | string | Sell | |
492
- > | `receiveEstimated` | string | Receive (estimated) | |
493
- > | `confirmInWallet` | string | Please confirm in wallet | |
494
- > | `pending` | string | Pending... | |
495
- > | `approve` | string | Approve | |
496
- > | `connectWallet` | string | Connect Wallet | |
497
- > | `minimumPurchase` | string | Minimum purchase is {value} | |
498
- > | `poolIsInactive` | string | {poolSymbol} token is no longer active. Please withdraw from them. | |
499
- > | `poolDepositsAreMaintenance` | string | {poolSymbol} token is under maintenance. Deposits are temporarily blocked. | |
500
- > | `poolWithdrawalsAreMaintenance` | string | {poolSymbol} token is under maintenance. Withdrawals are temporarily blocked. | |
501
- > | `poolIsPrivate` | string | This vault is currently private | |
502
- > | `confirmMaxSlippage` | string | Confirm {slippagePercentage}% max slippage | |
503
- > | `withdrawalLiquidityDisabled` | string | Intended withdraw value is greater than available liquidity ({value}) | |
504
- > | `withdrawCooldown` | string | You can sell your {tokenSymbol} tokens in {cooldownEndTime} | |
505
- > | `termsOfUse` | string | Terms Of Use | |
506
- > | `termOfUseDepositListTitle` | string | Please know the following before depositing | |
507
- > | `termOfUseDepositAssetSlippage` | string | When exiting, investors receive single asset or the underlying vault assets. Withdraw slippage can be customized in withdraw settings | |
508
- > | `termOfUseDepositBugs` | string | There may be interface bugs on the platform | |
509
- > | `termOfUseDepositDowntime` | string | There may be interface downtime (planned and unplanned) | |
510
- > | `termOfUseDepositAuditRisk` | string | Smart contracts are audited but a risk is still present | |
511
- > | `termOfUseDepositAccept` | string | Accept & Deposit | |
512
- > | `back` | string | Back | |
513
- > | `highSlippage` | string | High Slippage Alert | |
514
- > | `responsibleHighSlippage` | string | By proceeding with this trade, you acknowledge and accept the possibility of experiencing high slippage, resulting in a potential difference between the expected and executed price. | |
515
- > | `highSlippageListTitle` | string | Please consider the following before confirming | |
516
- > | `highSlippageQuoteDiff` | string | Be aware that the final amount of assets you receive may be different from the initially quoted value. | |
517
- > | `highSlippageRisk` | string | Ensure that you understand the risks associated with high slippage and are comfortable proceeding with the trade. | |
518
- > | `confirm` | string | Confirm | |
519
- > | `selectToken` | string | Select Token | |
520
- > | `sendingOrderToWallet` | string | Sending order to your wallet | |
521
- > | `settingUpTx` | string | Setting up transaction | |
522
- > | `miningTx` | string | Processing | |
523
- > | `approveSpending` | string | Approve {symbol} spending | |
524
- > | `pay` | string | Pay | |
525
- > | `multiAssetFractions` | string | multi asset fractions | |
526
- > | `swappableAssets` | string | swappable assets | |
527
- > | `explorer` | string | Explorer | |
528
- > | `as` | string | As | |
529
- > | `switchNetwork` | string | Switch Network | |
530
- > | `depositAction` | string | Buy | |
531
- > | `withdrawAction` | string | Sell | |
532
- > | `swapAction` | string | Swap | |
533
- > | `unrollAction` | string | Unroll | |
534
- > | `unrollAndClaimAction` | string | Claim | |
535
- > | `claimAction` | string | Claim Without Swap | |
536
- > | `claimLabel` | string | Claim Assets | |
537
- > | `swapAndClaimTo` | string | Swap and claim assets to | |
538
- > | `initWithdrawDescription` | string | Unroll | |
539
- > | `initWithdrawTooltip` | string | Unroll prepares assets for single asset withdrawal | |
540
- > | `completeWithdrawDescription` | string | Claim | |
541
- > | `completeWithdrawTooltip` | string | This final step swaps all assets to a single asset and sends it to your wallet | |
542
- > | `unrollAndClaimDescription` | string | Claim | |
543
- > | `total` | string | Total: | |
544
- > | `showAll` | string | Show All | |
545
- > | `hide` | string | Hide | |
546
- > | `refreshSwapQuoteTooltip` | string | Refresh swap quote | |
547
- > | `proceedWithNextStep` | string | Please proceed with the next step. | |
548
- > | `aggregatorsLabel` | string | Swap source | |
549
- > | `aggregatorsTooltip` | string | Choose which aggregators to use for your trades. | |
550
- > | `batchTransactionsLabel` | string | Batch transactions | |
551
- > | `batchTransactionsSwitchLabel` | string | Batch | |
552
- > | `batchTransactionsTooltip` | string | Group approve and trade calls into a single batch transaction. Disable if you prefer separate prompts. | |
553
- > | `seamlessOneClickTrading` | string | Seamless one-click trading | |
554
- > | `approveDepositPrefix` | string | Approve & deposit in a | |
555
- > | `singleTransaction` | string | single transaction | |
454
+ > | name | type | default value | description |
455
+ > | ----------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
456
+ > | `depositSlippageWarning` | string | Excludes entry fee. | |
457
+ > | `withdrawSlippageWarning` | string | Slippage only applies to single asset withdrawals and withdrawals from vaults with debt positions in Aave. | |
458
+ > | `minSlippageWarning` | string | Flexible min slippage value that is likely enough to process the transaction. | |
459
+ > | `highSlippageWarning` | string | We recommend using another asset to trade with lower slippage. | |
460
+ > | `recommendedMinSlippage` | string | Recommended Min Slippage | |
461
+ > | `projectedDailyEarningsTooltip` | string | Projected daily earnings are based on the current APY and may differ from actual earnings. | |
462
+ > | `dailyEarnings` | string | Daily Earnings | |
463
+ > | `projectedYearlyEarningsTooltip` | string | Projected yearly earnings are based on the current APY and may differ from actual earnings. | |
464
+ > | `yearlyEarnings` | string | Yearly Earnings | |
465
+ > | `fullReceiveDetails` | string | See full details influencing what you will receive. | |
466
+ > | `tradeDetails` | string | Trade details | |
467
+ > | `maxSlippage` | string | Max slippage | |
468
+ > | `minReceiveAmount` | string | You will receive no less than this amount. | |
469
+ > | `minReceived` | string | Minimum Received | |
470
+ > | `estimatedMultiAssetFractions` | string | Estimated multi asset fractions | |
471
+ > | `infinite` | string | Infinite | |
472
+ > | `tokenAllowance` | string | Token Allowance | |
473
+ > | `entryFee` | string | Entry Fee | |
474
+ > | `entryFeeExplanation` | string | When you deposit, the token takes a small entry fee. This fee helps cover the costs when we rebalance the underlying funds, and it's shared among all token holders. | |
475
+ > | `minDepositUsd` | string | Minimum deposit in USD. | |
476
+ > | `minDeposit` | string | Minimum Deposit | |
477
+ > | `tokensLockTime` | string | Purchased tokens will have a {lockTime} lock. | |
478
+ > | `slippageTolerance` | string | Slippage tolerance | |
479
+ > | `bypassEntryFee` | string | Bypass Entry Fee | |
480
+ > | `tokenAmountToApprove` | string | Amount of tokens to be approved. | |
481
+ > | `auto` | string | Auto | |
482
+ > | `lengthenLockup` | string | Lengthen lockup to remove entry fee | |
483
+ > | `deposit` | string | Buy | |
484
+ > | `withdraw` | string | Sell | |
485
+ > | `yourBalance` | string | Your Balance | |
486
+ > | `max` | string | Max | |
487
+ > | `allAssets` | string | All Assets | |
488
+ > | `all` | string | All | |
489
+ > | `payWith` | string | Pay with | |
490
+ > | `buyEstimated` | string | Buy (estimated) | |
491
+ > | `sell` | string | Sell | |
492
+ > | `receiveEstimated` | string | Receive (estimated) | |
493
+ > | `confirmInWallet` | string | Please confirm in wallet | |
494
+ > | `pending` | string | Pending... | |
495
+ > | `approve` | string | Approve | |
496
+ > | `connectWallet` | string | Connect Wallet | |
497
+ > | `minimumPurchase` | string | Minimum purchase is {value} | |
498
+ > | `poolIsInactive` | string | {poolSymbol} token is no longer active. Please withdraw from them. | |
499
+ > | `poolDepositsAreMaintenance` | string | {poolSymbol} token is under maintenance. Deposits are temporarily blocked. | |
500
+ > | `poolWithdrawalsAreMaintenance` | string | {poolSymbol} token is under maintenance. Withdrawals are temporarily blocked. | |
501
+ > | `poolIsPrivate` | string | This vault is currently private | |
502
+ > | `confirmMaxSlippage` | string | Confirm {slippagePercentage}% max slippage | |
503
+ > | `withdrawalLiquidityDisabled` | string | Intended withdraw value is greater than available liquidity ({value}) | |
504
+ > | `withdrawCooldown` | string | You can sell your {tokenSymbol} tokens in {cooldownEndTime} | |
505
+ > | `termsOfUse` | string | Terms Of Use | |
506
+ > | `termOfUseDepositListTitle` | string | Please know the following before depositing | |
507
+ > | `termOfUseDepositAssetSlippage` | string | When exiting, investors receive single asset or the underlying vault assets. Withdraw slippage can be customized in withdraw settings | |
508
+ > | `termOfUseDepositBugs` | string | There may be interface bugs on the platform | |
509
+ > | `termOfUseDepositDowntime` | string | There may be interface downtime (planned and unplanned) | |
510
+ > | `termOfUseDepositAuditRisk` | string | Smart contracts are audited but a risk is still present | |
511
+ > | `termOfUseDepositAccept` | string | Accept & Deposit | |
512
+ > | `back` | string | Back | |
513
+ > | `highSlippage` | string | High Slippage Alert | |
514
+ > | `responsibleHighSlippage` | string | By proceeding with this trade, you acknowledge and accept the possibility of experiencing high slippage, resulting in a potential difference between the expected and executed price. | |
515
+ > | `highSlippageListTitle` | string | Please consider the following before confirming | |
516
+ > | `highSlippageQuoteDiff` | string | Be aware that the final amount of assets you receive may be different from the initially quoted value. | |
517
+ > | `highSlippageRisk` | string | Ensure that you understand the risks associated with high slippage and are comfortable proceeding with the trade. | |
518
+ > | `confirm` | string | Confirm | |
519
+ > | `selectToken` | string | Select Token | |
520
+ > | `sendingOrderToWallet` | string | Sending order to your wallet | |
521
+ > | `settingUpTx` | string | Setting up transaction | |
522
+ > | `miningTx` | string | Processing | |
523
+ > | `approveSpending` | string | Approve {symbol} spending | |
524
+ > | `pay` | string | Pay | |
525
+ > | `multiAssetFractions` | string | multi asset fractions | |
526
+ > | `swappableAssets` | string | swappable assets | |
527
+ > | `explorer` | string | Explorer | |
528
+ > | `as` | string | As | |
529
+ > | `switchNetwork` | string | Switch Network | |
530
+ > | `depositAction` | string | Buy | |
531
+ > | `withdrawAction` | string | Sell | |
532
+ > | `swapAction` | string | Swap | |
533
+ > | `unrollAction` | string | Unroll | |
534
+ > | `unrollAndClaimAction` | string | Claim | |
535
+ > | `claimAction` | string | Claim Without Swap | |
536
+ > | `claimLabel` | string | Claim Assets | |
537
+ > | `swapAndClaimTo` | string | Swap and claim assets to | |
538
+ > | `initWithdrawDescription` | string | Unroll | |
539
+ > | `initWithdrawTooltip` | string | Unroll prepares assets for single asset withdrawal | |
540
+ > | `completeWithdrawDescription` | string | Claim | |
541
+ > | `completeWithdrawTooltip` | string | This final step swaps all assets to a single asset and sends it to your wallet | |
542
+ > | `unrollAndClaimDescription` | string | Claim | |
543
+ > | `total` | string | Total: | |
544
+ > | `showAll` | string | Show All | |
545
+ > | `hide` | string | Hide | |
546
+ > | `refreshSwapQuoteTooltip` | string | Refresh swap quote | |
547
+ > | `proceedWithNextStep` | string | Please proceed with the next step. | |
548
+ > | `aggregatorsLabel` | string | Swap source | |
549
+ > | `aggregatorsTooltip` | string | Choose which aggregators to use for your trades. | |
550
+ > | `batchTransactionsLabel` | string | Batch transactions | |
551
+ > | `batchTransactionsSwitchLabel` | string | Batch | |
552
+ > | `batchTransactionsTooltip` | string | Group approve and trade calls into a single batch transaction. Disable if you prefer separate prompts. | |
553
+ > | `openLimitOrderAfterBuySwitchLabel` | string | Add limit sell | |
556
554
 
557
555
  ###### Source: `packages/trading-widget/src/trading-widget/providers/translation-provider/translation-provider.tsx`
558
556
 
@@ -1,4 +1,3 @@
1
1
  export declare const PYTH_API_LINK = "https://hermes.pyth.network";
2
2
  export declare const FLAT_MONEY_UNIT_LINK = "https://flat.money/flatcoin";
3
3
  export declare const FLAT_MONEY_V1_UNIT_LINK = "https://v1.flat.money/flatcoin";
4
- export declare const EIP5792_LINK = "https://www.eip5792.xyz";
@@ -11,6 +11,7 @@ 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;
14
15
  };
15
16
  export declare const LOG_EVENT_BY_TRANSACTION_ACTION_MAP: Record<TransactionAction, string[]>;
16
17
  /**
@@ -36,4 +37,8 @@ export declare const TRADING_LOG_EVENT_PARAM: {
36
37
  NAME: string;
37
38
  TYPE: string;
38
39
  };
40
+ IS_BATCH_TRANSACTIONS_ENABLED: {
41
+ NAME: string;
42
+ TYPE: string;
43
+ };
39
44
  };
@@ -12,6 +12,7 @@ export declare const useUpdateTradingSettings: () => (payload: Partial<{
12
12
  availableAggregators: string[];
13
13
  selectedAggregators: string[];
14
14
  isBatchTransactionsEnabled: boolean;
15
+ openLimitOrderModalAfterBuy: boolean;
15
16
  }>) => void;
16
17
  export declare const useSetTradingType: () => (payload: import("core-kit/types").TradingPanelType) => void;
17
18
  export declare const useUpdateTradingModal: () => (payload: Partial<import("core-kit/types").TradingPanelStateModal>) => void;
@@ -10,3 +10,4 @@ export { useProjectedEarningsCore } from './projected-earnings/use-projected-ear
10
10
  export { useSwapDataQuery } from './use-swap-data-query';
11
11
  export { useSendTokenDebouncedValue } from './use-send-token-debounced-value';
12
12
  export { useEasySwapperTrackedAssets } from './use-easy-swapper-tracked-assets';
13
+ export { useIsBatchContractWritesTrading } from './use-is-batch-contract-writes-trading';
@@ -0,0 +1 @@
1
+ export declare const useIsBatchContractWritesTrading: () => boolean;
@@ -1,6 +1,10 @@
1
1
  import type { PoolComposition } from 'core-kit/types/pool.types';
2
2
  import type { ApyCurrency, TradingToken } from 'core-kit/types/trading-panel.types';
3
3
  import type { Address, ChainId } from 'core-kit/types/web3.types';
4
+ export type PricingAsset = {
5
+ address: Address;
6
+ symbol: string;
7
+ };
4
8
  export interface PoolConfig {
5
9
  address: Address;
6
10
  symbol: string;
@@ -16,6 +20,7 @@ export interface PoolConfig {
16
20
  maintenance?: boolean;
17
21
  maintenanceDeposits?: boolean;
18
22
  maintenanceWithdrawals?: boolean;
23
+ pricingAsset?: PricingAsset;
19
24
  }
20
25
  export interface PoolFallbackData {
21
26
  address: Address;
@@ -25,6 +25,7 @@ export interface TradingPanelState {
25
25
  availableAggregators: string[];
26
26
  selectedAggregators: string[];
27
27
  isBatchTransactionsEnabled: boolean;
28
+ openLimitOrderModalAfterBuy: boolean;
28
29
  };
29
30
  type: TradingPanelType;
30
31
  input: {