@dhedge/trading-widget 5.2.0 → 5.3.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 +116 -115
- package/core-kit/const/trading.d.ts +2 -1
- package/core-kit/hooks/trading/deposit-v2/deposit-transaction/use-approve-and-deposit.d.ts +6 -0
- package/core-kit/hooks/trading/deposit-v2/deposit-transaction/use-deposit.d.ts +6 -1
- package/core-kit/hooks/trading/deposit-v2/index.d.ts +1 -0
- package/core-kit/hooks/trading/trade-handlers/use-trading-settle-handler.d.ts +3 -1
- package/core-kit/utils/deposit.d.ts +2 -2
- package/index.cjs +1 -1
- package/index.js +2798 -2745
- package/package.json +1 -1
- package/trading-widget/components/deposit/button/approve-and-deposit-button.d.ts +2 -0
- package/trading-widget/components/deposit/button/approve-and-deposit-button.hooks.d.ts +6 -0
- 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 +0 -2
- package/trading-widget/providers/translation-provider/translation-provider.types.d.ts +2 -0
- package/trading-widget/components/deposit/button/single-trade-button.d.ts +0 -2
- package/trading-widget/components/widget/widget-buttons/approve-button/approve-button.d.ts +0 -3
- package/trading-widget/components/widget/widget-buttons/approve-button/approve-button.hooks.d.ts +0 -8
package/README.md
CHANGED
|
@@ -494,121 +494,122 @@ path: `component.meta[name]`
|
|
|
494
494
|
<code>Translation keys</code>
|
|
495
495
|
</summary>|
|
|
496
496
|
|
|
497
|
-
> | name | type | default value | description
|
|
498
|
-
> | ----------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
499
|
-
> | `depositSlippageWarning` | string | Excludes entry fee. |
|
|
500
|
-
> | `withdrawSlippageWarning` | string | Slippage only applies to single asset withdrawals and withdrawals from vaults with debt positions in Aave. |
|
|
501
|
-
> | `minSlippageWarning` | string | Flexible min slippage value that is likely enough to process the transaction. |
|
|
502
|
-
> | `highSlippageWarning` | string | We recommend using another asset to trade with lower slippage. |
|
|
503
|
-
> | `recommendedMinSlippage` | string | Recommended Min Slippage |
|
|
504
|
-
> | `projectedDailyEarningsTooltip` | string | Projected daily earnings are based on the current APY and may differ from actual earnings. |
|
|
505
|
-
> | `dailyEarnings` | string | Daily Earnings |
|
|
506
|
-
> | `projectedYearlyEarningsTooltip` | string | Projected yearly earnings are based on the current APY and may differ from actual earnings. |
|
|
507
|
-
> | `yearlyEarnings` | string | Yearly Earnings |
|
|
508
|
-
> | `fullReceiveDetails` | string | See full details influencing what you will receive. |
|
|
509
|
-
> | `tradeDetails` | string | Trade details |
|
|
510
|
-
> | `maxSlippage` | string | Max slippage |
|
|
511
|
-
> | `minReceiveAmount` | string | You will receive no less than this amount. |
|
|
512
|
-
> | `minReceived` | string | Minimum Received |
|
|
513
|
-
> | `estimatedMultiAssetFractions` | string | Estimated multi asset fractions |
|
|
514
|
-
> | `infinite` | string | Infinite |
|
|
515
|
-
> | `tokenAllowance` | string | Token Allowance |
|
|
516
|
-
> | `entryFee` | string | Entry Fee |
|
|
517
|
-
> | `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. |
|
|
518
|
-
> | `minDepositUsd` | string | Minimum deposit in USD. |
|
|
519
|
-
> | `minDeposit` | string | Minimum Deposit |
|
|
520
|
-
> | `tokensLockTime` | string | Purchased tokens will have a {lockTime} lock. |
|
|
521
|
-
> | `slippageTolerance` | string | Slippage tolerance |
|
|
522
|
-
> | `bypassEntryFee` | string | Bypass Entry Fee |
|
|
523
|
-
> | `tokenAmountToApprove` | string | Amount of tokens to be approved. |
|
|
524
|
-
> | `auto` | string | Auto |
|
|
525
|
-
> | `lengthenLockup` | string | Lengthen lockup to remove entry fee |
|
|
526
|
-
> | `deposit` | string | Buy |
|
|
527
|
-
> | `withdraw` | string | Sell |
|
|
528
|
-
> | `max` | string | Max |
|
|
529
|
-
> | `allAssets` | string | All Assets |
|
|
530
|
-
> | `all` | string | All |
|
|
531
|
-
> | `sell` | string | Sell |
|
|
532
|
-
> | `sellNow` | string | Sell now |
|
|
533
|
-
> | `
|
|
534
|
-
> | `
|
|
535
|
-
> | `
|
|
536
|
-
> | `
|
|
537
|
-
> | `
|
|
538
|
-
> | `
|
|
539
|
-
> | `
|
|
540
|
-
> | `
|
|
541
|
-
> | `
|
|
542
|
-
> | `
|
|
543
|
-
> | `
|
|
544
|
-
> | `
|
|
545
|
-
> | `
|
|
546
|
-
> | `
|
|
547
|
-
> | `
|
|
548
|
-
> | `
|
|
549
|
-
> | `
|
|
550
|
-
> | `
|
|
551
|
-
> | `
|
|
552
|
-
> | `
|
|
553
|
-
> | `
|
|
554
|
-
> | `
|
|
555
|
-
> | `
|
|
556
|
-
> | `
|
|
557
|
-
> | `
|
|
558
|
-
> | `
|
|
559
|
-
> | `
|
|
560
|
-
> | `
|
|
561
|
-
> | `
|
|
562
|
-
> | `
|
|
563
|
-
> | `
|
|
564
|
-
> | `
|
|
565
|
-
> | `
|
|
566
|
-
> | `
|
|
567
|
-
> | `
|
|
568
|
-
> | `
|
|
569
|
-
> | `
|
|
570
|
-
> | `
|
|
571
|
-
> | `
|
|
572
|
-
> | `
|
|
573
|
-
> | `
|
|
574
|
-
> | `
|
|
575
|
-
> | `
|
|
576
|
-
> | `
|
|
577
|
-
> | `
|
|
578
|
-
> | `
|
|
579
|
-
> | `
|
|
580
|
-
> | `
|
|
581
|
-
> | `
|
|
582
|
-
> | `
|
|
583
|
-
> | `
|
|
584
|
-
> | `
|
|
585
|
-
> | `
|
|
586
|
-
> | `
|
|
587
|
-
> | `
|
|
588
|
-
> | `
|
|
589
|
-
> | `
|
|
590
|
-
> | `
|
|
591
|
-
> | `
|
|
592
|
-
> | `
|
|
593
|
-
> | `
|
|
594
|
-
> | `
|
|
595
|
-
> | `
|
|
596
|
-
> | `
|
|
597
|
-
> | `
|
|
598
|
-
> | `
|
|
599
|
-
> | `
|
|
600
|
-
> | `
|
|
601
|
-
> | `
|
|
602
|
-
> | `
|
|
603
|
-
> | `
|
|
604
|
-
> | `
|
|
605
|
-
> | `
|
|
606
|
-
> | `
|
|
607
|
-
> | `
|
|
608
|
-
> | `
|
|
609
|
-
> | `
|
|
610
|
-
> | `
|
|
611
|
-
> | `
|
|
497
|
+
> | name | type | default value | description |
|
|
498
|
+
> | ----------------------------------- | ------ | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- |
|
|
499
|
+
> | `depositSlippageWarning` | string | Excludes entry fee. | |
|
|
500
|
+
> | `withdrawSlippageWarning` | string | Slippage only applies to single asset withdrawals and withdrawals from vaults with debt positions in Aave. | |
|
|
501
|
+
> | `minSlippageWarning` | string | Flexible min slippage value that is likely enough to process the transaction. | |
|
|
502
|
+
> | `highSlippageWarning` | string | We recommend using another asset to trade with lower slippage. | |
|
|
503
|
+
> | `recommendedMinSlippage` | string | Recommended Min Slippage | |
|
|
504
|
+
> | `projectedDailyEarningsTooltip` | string | Projected daily earnings are based on the current APY and may differ from actual earnings. | |
|
|
505
|
+
> | `dailyEarnings` | string | Daily Earnings | |
|
|
506
|
+
> | `projectedYearlyEarningsTooltip` | string | Projected yearly earnings are based on the current APY and may differ from actual earnings. | |
|
|
507
|
+
> | `yearlyEarnings` | string | Yearly Earnings | |
|
|
508
|
+
> | `fullReceiveDetails` | string | See full details influencing what you will receive. | |
|
|
509
|
+
> | `tradeDetails` | string | Trade details | |
|
|
510
|
+
> | `maxSlippage` | string | Max slippage | |
|
|
511
|
+
> | `minReceiveAmount` | string | You will receive no less than this amount. | |
|
|
512
|
+
> | `minReceived` | string | Minimum Received | |
|
|
513
|
+
> | `estimatedMultiAssetFractions` | string | Estimated multi asset fractions | |
|
|
514
|
+
> | `infinite` | string | Infinite | |
|
|
515
|
+
> | `tokenAllowance` | string | Token Allowance | |
|
|
516
|
+
> | `entryFee` | string | Entry Fee | |
|
|
517
|
+
> | `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. | |
|
|
518
|
+
> | `minDepositUsd` | string | Minimum deposit in USD. | |
|
|
519
|
+
> | `minDeposit` | string | Minimum Deposit | |
|
|
520
|
+
> | `tokensLockTime` | string | Purchased tokens will have a {lockTime} lock. | |
|
|
521
|
+
> | `slippageTolerance` | string | Slippage tolerance | |
|
|
522
|
+
> | `bypassEntryFee` | string | Bypass Entry Fee | |
|
|
523
|
+
> | `tokenAmountToApprove` | string | Amount of tokens to be approved. | |
|
|
524
|
+
> | `auto` | string | Auto | |
|
|
525
|
+
> | `lengthenLockup` | string | Lengthen lockup to remove entry fee | |
|
|
526
|
+
> | `deposit` | string | Buy | |
|
|
527
|
+
> | `withdraw` | string | Sell | |
|
|
528
|
+
> | `max` | string | Max | |
|
|
529
|
+
> | `allAssets` | string | All Assets | |
|
|
530
|
+
> | `all` | string | All | |
|
|
531
|
+
> | `sell` | string | Sell | |
|
|
532
|
+
> | `sellNow` | string | Sell now | |
|
|
533
|
+
> | `confirmInWallet` | string | Please confirm in wallet | |
|
|
534
|
+
> | `pending` | string | Pending... | |
|
|
535
|
+
> | `approve` | string | Approve | |
|
|
536
|
+
> | `connectWallet` | string | Connect Wallet | |
|
|
537
|
+
> | `minimumPurchase` | string | Minimum purchase is {value} | |
|
|
538
|
+
> | `poolIsInactive` | string | {poolSymbol} token is no longer active. Please withdraw from them. | |
|
|
539
|
+
> | `poolDepositsAreMaintenance` | string | {poolSymbol} token is under maintenance. Deposits are temporarily blocked. | |
|
|
540
|
+
> | `exceedsDepositCapacity` | string | Deposit amount exceeds available {poolSymbol} deposit capacity. | |
|
|
541
|
+
> | `poolWithdrawalsAreMaintenance` | string | {poolSymbol} token is under maintenance. Withdrawals are temporarily blocked. | |
|
|
542
|
+
> | `poolIsPrivate` | string | This vault is currently private | |
|
|
543
|
+
> | `confirmMaxSlippage` | string | Confirm {slippagePercentage}% max slippage | |
|
|
544
|
+
> | `withdrawalLiquidityDisabled` | string | Intended withdraw value is greater than available liquidity ({value}) | |
|
|
545
|
+
> | `withdrawCooldown` | string | You can sell your {tokenSymbol} tokens in {cooldownEndTime} | |
|
|
546
|
+
> | `termsOfUse` | string | Terms Of Use | |
|
|
547
|
+
> | `termOfUseDepositListTitle` | string | Please know the following before depositing | |
|
|
548
|
+
> | `termOfUseDepositAssetSlippage` | string | When exiting, investors receive single asset or the underlying vault assets. Withdraw slippage can be customized in withdraw settings | |
|
|
549
|
+
> | `termOfUseDepositBugs` | string | There may be interface bugs on the platform | |
|
|
550
|
+
> | `termOfUseDepositDowntime` | string | There may be interface downtime (planned and unplanned) | |
|
|
551
|
+
> | `termOfUseDepositAuditRisk` | string | Smart contracts are audited but a risk is still present | |
|
|
552
|
+
> | `termOfUseDepositAccept` | string | Accept & Deposit | |
|
|
553
|
+
> | `back` | string | Back | |
|
|
554
|
+
> | `done` | string | Done | |
|
|
555
|
+
> | `termOfUseWithdrawAcceptLabel` | string | I understand and accept the withdraw terms | |
|
|
556
|
+
> | `termOfUseWithdrawPoint1` | string | Withdrawal requests are intended to settle in USDC. In rare cases where market conditions or high slippage prevent a USDC swap, the order may be settled in the underlying tokens of the respective vault. | |
|
|
557
|
+
> | `termOfUseWithdrawPoint2` | string | Revoking token approval after placing an order will prevent the order from being executed. | |
|
|
558
|
+
> | `highSlippage` | string | High Slippage Alert | |
|
|
559
|
+
> | `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. | |
|
|
560
|
+
> | `highSlippageListTitle` | string | Please consider the following before confirming | |
|
|
561
|
+
> | `highSlippageQuoteDiff` | string | Be aware that the final amount of assets you receive may be different from the initially quoted value. | |
|
|
562
|
+
> | `highSlippageRisk` | string | Ensure that you understand the risks associated with high slippage and are comfortable proceeding with the trade. | |
|
|
563
|
+
> | `confirm` | string | Confirm | |
|
|
564
|
+
> | `selectToken` | string | Select Token | |
|
|
565
|
+
> | `sendingOrderToWallet` | string | Sending order to your wallet | |
|
|
566
|
+
> | `settingUpTx` | string | Setting up transaction | |
|
|
567
|
+
> | `miningTx` | string | Processing | |
|
|
568
|
+
> | `approveSpending` | string | Approve {symbol} spending | |
|
|
569
|
+
> | `pay` | string | Pay | |
|
|
570
|
+
> | `multiAssetFractions` | string | multi asset fractions | |
|
|
571
|
+
> | `swappableAssets` | string | swappable assets | |
|
|
572
|
+
> | `explorer` | string | Explorer | |
|
|
573
|
+
> | `as` | string | As | |
|
|
574
|
+
> | `switchNetwork` | string | Switch Network | |
|
|
575
|
+
> | `depositAction` | string | Buy | |
|
|
576
|
+
> | `withdrawAction` | string | Sell | |
|
|
577
|
+
> | `swapAction` | string | Swap | |
|
|
578
|
+
> | `unrollAction` | string | Unroll | |
|
|
579
|
+
> | `unrollAndClaimAction` | string | Claim | |
|
|
580
|
+
> | `claimAction` | string | Claim Without Swap | |
|
|
581
|
+
> | `claimLabel` | string | Claim Assets | |
|
|
582
|
+
> | `createLimitSellOrder` | string | Stop order set | |
|
|
583
|
+
> | `swapAndClaimTo` | string | Swap and claim assets to | |
|
|
584
|
+
> | `limitOrderWithdrawDescription` | string | You are about to create a withdrawal request. Your vault tokens will be withdrawn within a few minutes. | |
|
|
585
|
+
> | `total` | string | Total: | |
|
|
586
|
+
> | `showAll` | string | Show All | |
|
|
587
|
+
> | `hide` | string | Hide | |
|
|
588
|
+
> | `refreshSwapQuoteTooltip` | string | Refresh swap quote | |
|
|
589
|
+
> | `proceedWithNextStep` | string | Please proceed with the next step. | |
|
|
590
|
+
> | `aggregatorsLabel` | string | Swap source | |
|
|
591
|
+
> | `aggregatorsTooltip` | string | Choose which aggregators to use for your trades. | |
|
|
592
|
+
> | `batchTransactionsLabel` | string | Batch transactions | |
|
|
593
|
+
> | `batchTransactionsSwitchLabel` | string | Batch | |
|
|
594
|
+
> | `batchTransactionsTooltip` | string | Group approve and trade calls into a single batch transaction. Disable if you prefer separate prompts. | |
|
|
595
|
+
> | `openLimitOrderAfterBuySwitchLabel` | string | Add Stop Order | |
|
|
596
|
+
> | `openNotificationsSettingsLabel` | string | Enable alerts | |
|
|
597
|
+
> | `addToWallet` | string | add to wallet | |
|
|
598
|
+
> | `orderingLabel` | string | Ordering | |
|
|
599
|
+
> | `paidLabel` | string | Paid | |
|
|
600
|
+
> | `priceLabel` | string | Price | |
|
|
601
|
+
> | `transactionLabel` | string | Transaction | |
|
|
602
|
+
> | `stopOrder` | string | Stop Order | |
|
|
603
|
+
> | `send` | string | Send | |
|
|
604
|
+
> | `cooldown` | string | Cooldown | |
|
|
605
|
+
> | `delete` | string | Delete | |
|
|
606
|
+
> | `withdrawalRequest` | string | Withdrawal request | |
|
|
607
|
+
> | `deleteWithdrawalRequest` | string | Delete withdrawal request | |
|
|
608
|
+
> | `insufficientBalance` | string | Insufficient Balance | |
|
|
609
|
+
> | `expectToReceiveUsdcSoon` | string | Expect to receive your USDC over the next few minutes | |
|
|
610
|
+
> | `cancel` | string | Cancel | |
|
|
611
|
+
> | `approveDepositStep` | string | 1/2 Approve Buy | Button text during approve step of deposit flow |
|
|
612
|
+
> | `depositNowStep` | string | 2/2 Buy Now | Button text during final deposit step |
|
|
612
613
|
|
|
613
614
|
###### Source: `packages/trading-widget/src/trading-widget/providers/translation-provider/translation-provider.tsx`
|
|
614
615
|
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { TransactionAction } from '../types';
|
|
1
|
+
import type { ChainId, TransactionAction } from '../types';
|
|
2
|
+
export declare const AUTO_TRANSACTION_PUSH_DELAY: Record<ChainId, number>;
|
|
2
3
|
export declare const EASY_SWAPPER_V2_DEPOSIT_METHODS: {
|
|
3
4
|
DEPOSIT: "deposit";
|
|
4
5
|
DEPOSIT_CUSTOM: "depositWithCustomCooldown";
|
|
@@ -1,2 +1,7 @@
|
|
|
1
|
+
import type { OnTradingSettleSuccessCallback } from '../../../../hooks/trading/trade-handlers/use-trading-settle-handler';
|
|
1
2
|
import type { ContractActionFunc } from '../../../../types/web3.types';
|
|
2
|
-
|
|
3
|
+
interface UseDepositParams {
|
|
4
|
+
onDepositSettled?: OnTradingSettleSuccessCallback;
|
|
5
|
+
}
|
|
6
|
+
export declare const useDeposit: ({ onDepositSettled, }: UseDepositParams) => ContractActionFunc;
|
|
7
|
+
export {};
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
export { useDeposit } from '../../../hooks/trading/deposit-v2/deposit-transaction/use-deposit';
|
|
2
|
+
export { useApproveAndDeposit } from '../../../hooks/trading/deposit-v2/deposit-transaction/use-approve-and-deposit';
|
|
2
3
|
export { useDepositAllowance } from '../../../hooks/trading/deposit-v2/use-deposit-allowance';
|
|
3
4
|
export { useDepositQuote } from '../../../hooks/trading/deposit-v2/use-deposit-quote';
|
|
4
5
|
export { useDepositQuoteContractRead } from '../../../hooks/trading/deposit-v2/use-deposit-quote-contract-read';
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import type { PendingTransaction } from '../../../types/trading-panel.types';
|
|
2
2
|
import type { UseWriteContractParameters } from '../../../types/web3.types';
|
|
3
3
|
export type OnTradingSettleErrorCallback = (error: Error) => void;
|
|
4
|
+
export type OnTradingSettleSuccessCallback = () => void;
|
|
4
5
|
interface UseTradingSettleHandlerParams {
|
|
5
6
|
action: PendingTransaction['action'];
|
|
6
7
|
onErrorCallback?: OnTradingSettleErrorCallback;
|
|
8
|
+
onSuccessCallback?: OnTradingSettleSuccessCallback;
|
|
7
9
|
}
|
|
8
|
-
export declare const useTradingSettleHandler: ({ action, onErrorCallback, }: UseTradingSettleHandlerParams) => Required<Required<UseWriteContractParameters>['mutation']>['onSettled'];
|
|
10
|
+
export declare const useTradingSettleHandler: ({ action, onErrorCallback, onSuccessCallback, }: UseTradingSettleHandlerParams) => Required<Required<UseWriteContractParameters>['mutation']>['onSettled'];
|
|
9
11
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { SwapDataResponse } from '@shared/types';
|
|
2
2
|
import type { DepositMethodName, EstimateCall, VaultDepositParams } from '../types';
|
|
3
3
|
import type { Address } from '../types/web3.types';
|
|
4
4
|
export type DepositArguments = [Address, string, {
|
|
@@ -14,7 +14,7 @@ export interface BuildZapDepositArgsParams {
|
|
|
14
14
|
minVaultTokensReceivedAmount: string;
|
|
15
15
|
sendTokenAmount: string;
|
|
16
16
|
};
|
|
17
|
-
swapQuotes:
|
|
17
|
+
swapQuotes: SwapDataResponse[] | undefined;
|
|
18
18
|
estimate?: EstimateCall;
|
|
19
19
|
depositSlippage: number;
|
|
20
20
|
sendTokenAddress: Address;
|