@dhedge/trading-widget 2.0.2 → 2.0.3

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 CHANGED
@@ -414,84 +414,85 @@ path: `component.meta[name]`
414
414
  <code>translation</code>
415
415
  <code><b>/</b></code>
416
416
  <code>Translation keys</code>
417
- </summary>
418
-
419
- > | name | type | default value | description |
420
- > |----------------------------------|--------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|
421
- > | `depositSlippageWarning` | string | Excludes entry fee. Slippage may be amplified by the leverage. See the docs for more info. | |
422
- > | `withdrawSlippageWarning` | string | Slippage only applies to single asset withdrawals and withdrawals from vaults with debt positions in Aave. | |
423
- > | `minSlippageWarning` | string | Flexible min slippage value that is likely enough to process the transaction. | |
424
- > | `highSlippageWarning` | string | We recommend using another asset to trade with lower slippage. | |
425
- > | `recommendedMinSlippage` | string | Recommended Min Slippage | |
426
- > | `projectedDailyEarningsTooltip` | string | Projected daily earnings are based on the current APY and may differ from actual earnings. | |
427
- > | `dailyEarnings` | string | Daily Earnings | |
428
- > | `projectedYearlyEarningsTooltip` | string | Projected yearly earnings are based on the current APY and may differ from actual earnings. | |
429
- > | `yearlyEarnings` | string | Yearly Earnings | |
430
- > | `fullReceiveDetails` | string | See full details influencing what you will receive. | |
431
- > | `tradeDetails` | string | Trade details | |
432
- > | `maxSlippage` | string | Max slippage | |
433
- > | `minReceiveAmount` | string | You will receive no less than this amount. | |
434
- > | `minReceived` | string | Minimum Received | |
435
- > | `estimatedMultiAssetFractions` | string | Estimated multi asset fractions | |
436
- > | `infinite` | string | Infinite | |
437
- > | `tokenAllowance` | string | Token Allowance | |
438
- > | `entryFee` | string | Entry Fee | |
439
- > | `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. | |
440
- > | `amountToBeApproved` | string | Amount of {symbol} tokens to be approved. Can be customized in settings. | |
441
- > | `minDepositUsd` | string | Minimum deposit in USD. | |
442
- > | `minDeposit` | string | Minimum Deposit | |
443
- > | `tokensLockTime` | string | Purchased tokens will have a {lockTime} lock. | |
444
- > | `slippageTolerance` | string | Slippage tolerance | |
445
- > | `bypassEntryFee` | string | Bypass Entry Fee | |
446
- > | `tokenAmountToApprove` | string | Amount of tokens to be approved. | |
447
- > | `auto` | string | Auto | |
448
- > | `autoSlippageDescription` | string | App is testing different slippage ranges, starting low and increasing until it's likely to pass | |
449
- > | `lengthenLockup` | string | Lengthen lockup to remove entry fee | |
450
- > | `deposit` | string | Buy | |
451
- > | `withdraw` | string | Sell | |
452
- > | `yourBalance` | string | Your Balance | |
453
- > | `max` | string | Max | |
454
- > | `allAssets` | string | All Assets | |
455
- > | `all` | string | All | |
456
- > | `payWith` | string | Pay with | |
457
- > | `buyEstimated` | string | Buy (estimated) | |
458
- > | `sell` | string | Sell | |
459
- > | `receiveEstimated` | string | Receive (estimated) | |
460
- > | `confirmInWallet` | string | Please confirm in wallet | |
461
- > | `pending` | string | Pending... | |
462
- > | `approve` | string | Approve | |
463
- > | `connectWallet` | string | Connect Wallet | |
464
- > | `minimumPurchase` | string | Minimum purchase is ${value} | |
465
- > | `poolIsInactive` | string | {poolSymbol} token is no longer active. Please withdraw from them. | |
466
- > | `poolIsPrivate` | string | This vault is currently private | |
467
- > | `updateOracles` | string | Update Oracles | |
468
- > | `checkingOracles` | string | Checking Oracles | |
469
- > | `confirmMaxSlippage` | string | Confirm {slippagePercentage}% max slippage | |
470
- > | `withdrawalWindowDisabled` | string | You can sell your {tokenSymbol} tokens during withdrawal window period starting from {startTime} | |
471
- > | `withdrawCooldown` | string | You can sell your {tokenSymbol} tokens in {cooldownEndTime} | |
472
- > | `termsOfUse` | string | Terms Of Use | |
473
- > | `termOfUseDepositListTitle` | string | Please know the following before depositing | |
474
- > | `termOfUseDepositAssetSlippage` | string | When exiting, investors receive single asset or the underlying vault assets. Withdraw slippage can be customized in withdraw settings | |
475
- > | `termOfUseDepositBugs` | string | There may be interface bugs on the platform | |
476
- > | `termOfUseDepositDowntime` | string | There may be interface downtime (planned and unplanned) | |
477
- > | `termOfUseDepositAuditRisk` | string | Smart contracts are audited but a risk is still present | |
478
- > | `termOfUseDepositAccept` | string | Accept & Deposit | |
479
- > | `back` | string | Back | |
480
- > | `highSlippage` | string | High Slippage Alert | |
481
- > | `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. | |
482
- > | `highSlippageListTitle` | string | Please consider the following before confirming | |
483
- > | `highSlippageQuoteDiff` | string | Be aware that the final amount of assets you receive may be different from the initially quoted value. | |
484
- > | `highSlippageRisk` | string | Ensure that you understand the risks associated with high slippage and are comfortable proceeding with the trade. | |
485
- > | `confirm` | string | Confirm | |
486
- > | `selectToken` | string | Select Token | |
487
- > | `sendingOrderToWallet` | string | Sending order to your wallet | |
488
- > | `settingUpTx` | string | Setting up transaction | |
489
- > | `updateSynthetixOracles` | string | Updating Synthetix Oracles | |
490
- > | `approveSpending` | string | Approve {symbol} spending | |
491
- > | `pay` | string | Pay | |
492
- > | `multiAssetFractions` | string | multi asset fractions | |
493
- > | `explorer` | string | Explorer | |
494
- > | `as` | string | As | |
417
+ </summary>|
418
+
419
+ > | name | type | default value | description |
420
+ > |-----------------------------------|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------|
421
+ > | `depositSlippageWarning` | string | Excludes entry fee. Slippage may be amplified by the leverage. See the docs for more info. | |
422
+ > | `withdrawSlippageWarning` | string | Slippage only applies to single asset withdrawals and withdrawals from vaults with debt positions in Aave. | |
423
+ > | `minSlippageWarning` | string | Flexible min slippage value that is likely enough to process the transaction. | |
424
+ > | `highSlippageWarning` | string | We recommend using another asset to trade with lower slippage. | |
425
+ > | `recommendedMinSlippage` | string | Recommended Min Slippage | |
426
+ > | `projectedDailyEarningsTooltip` | string | Projected daily earnings are based on the current APY and may differ from actual earnings. | |
427
+ > | `dailyEarnings` | string | Daily Earnings | |
428
+ > | `projectedYearlyEarningsTooltip` | string | Projected yearly earnings are based on the current APY and may differ from actual earnings. | |
429
+ > | `yearlyEarnings` | string | Yearly Earnings | |
430
+ > | `fullReceiveDetails` | string | See full details influencing what you will receive. | |
431
+ > | `tradeDetails` | string | Trade details | |
432
+ > | `maxSlippage` | string | Max slippage | |
433
+ > | `minReceiveAmount` | string | You will receive no less than this amount. | |
434
+ > | `minReceived` | string | Minimum Received | |
435
+ > | `estimatedMultiAssetFractions` | string | Estimated multi asset fractions | |
436
+ > | `infinite` | string | Infinite | |
437
+ > | `tokenAllowance` | string | Token Allowance | |
438
+ > | `entryFee` | string | Entry Fee | |
439
+ > | `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. | |
440
+ > | `amountToBeApproved` | string | Amount of {symbol} tokens to be approved. Can be customized in settings. | |
441
+ > | `minDepositUsd` | string | Minimum deposit in USD. | |
442
+ > | `minDeposit` | string | Minimum Deposit | |
443
+ > | `tokensLockTime` | string | Purchased tokens will have a {lockTime} lock. | |
444
+ > | `slippageTolerance` | string | Slippage tolerance | |
445
+ > | `bypassEntryFee` | string | Bypass Entry Fee | |
446
+ > | `tokenAmountToApprove` | string | Amount of tokens to be approved. | |
447
+ > | `auto` | string | Auto | |
448
+ > | `autoSlippageDescription` | string | App is testing different slippage ranges, starting low and increasing until it's likely to pass | |
449
+ > | `lengthenLockup` | string | Lengthen lockup to remove entry fee | |
450
+ > | `deposit` | string | Buy | |
451
+ > | `withdraw` | string | Sell | |
452
+ > | `yourBalance` | string | Your Balance | |
453
+ > | `max` | string | Max | |
454
+ > | `allAssets` | string | All Assets | |
455
+ > | `all` | string | All | |
456
+ > | `payWith` | string | Pay with | |
457
+ > | `buyEstimated` | string | Buy (estimated) | |
458
+ > | `sell` | string | Sell | |
459
+ > | `receiveEstimated` | string | Receive (estimated) | |
460
+ > | `confirmInWallet` | string | Please confirm in wallet | |
461
+ > | `pending` | string | Pending... | |
462
+ > | `approve` | string | Approve | |
463
+ > | `connectWallet` | string | Connect Wallet | |
464
+ > | `minimumPurchase` | string | Minimum purchase is ${value} | |
465
+ > | `poolIsInactive` | string | {poolSymbol} token is no longer active. Please withdraw from them. | |
466
+ > | `poolIsPrivate` | string | This vault is currently private | |
467
+ > | `updateOracles` | string | Update Oracles | |
468
+ > | `checkingOracles` | string | Checking Oracles | |
469
+ > | `confirmMaxSlippage` | string | Confirm {slippagePercentage}% max slippage | |
470
+ > | `withdrawalWindowDisabled` | string | You can sell your {tokenSymbol} tokens during withdrawal window period starting from {startTime} | |
471
+ > | `withdrawalLiquidityDisabled` | string | Intended withdraw value is greater than available liquidity ({symbol} {value}) | |
472
+ > | `withdrawCooldown` | string | You can sell your {tokenSymbol} tokens in {cooldownEndTime} | |
473
+ > | `termsOfUse` | string | Terms Of Use | |
474
+ > | `termOfUseDepositListTitle` | string | Please know the following before depositing | |
475
+ > | `termOfUseDepositAssetSlippage` | string | When exiting, investors receive single asset or the underlying vault assets. Withdraw slippage can be customized in withdraw settings | |
476
+ > | `termOfUseDepositBugs` | string | There may be interface bugs on the platform | |
477
+ > | `termOfUseDepositDowntime` | string | There may be interface downtime (planned and unplanned) | |
478
+ > | `termOfUseDepositAuditRisk` | string | Smart contracts are audited but a risk is still present | |
479
+ > | `termOfUseDepositAccept` | string | Accept & Deposit | |
480
+ > | `back` | string | Back | |
481
+ > | `highSlippage` | string | High Slippage Alert | |
482
+ > | `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. | |
483
+ > | `highSlippageListTitle` | string | Please consider the following before confirming | |
484
+ > | `highSlippageQuoteDiff` | string | Be aware that the final amount of assets you receive may be different from the initially quoted value. | |
485
+ > | `highSlippageRisk` | string | Ensure that you understand the risks associated with high slippage and are comfortable proceeding with the trade. | |
486
+ > | `confirm` | string | Confirm | |
487
+ > | `selectToken` | string | Select Token | |
488
+ > | `sendingOrderToWallet` | string | Sending order to your wallet | |
489
+ > | `settingUpTx` | string | Setting up transaction | |
490
+ > | `updateSynthetixOracles` | string | Updating Synthetix Oracles | |
491
+ > | `approveSpending` | string | Approve {symbol} spending | |
492
+ > | `pay` | string | Pay | |
493
+ > | `multiAssetFractions` | string | multi asset fractions | |
494
+ > | `explorer` | string | Explorer | |
495
+ > | `as` | string | As | |
495
496
 
496
497
  ###### Source: `packages/trading-widget/src/trading-widget/providers/translation-provider/translation-provider.tsx`
497
498
  ###### Default values: `packages/trading-widget/src/trading-widget/providers/translation-provider/translation-provider.defaults.ts`
@@ -12,7 +12,7 @@ export declare const EMPTY_POOL_CONFIG: PoolConfig;
12
12
  export declare const DEFAULT_DEPOSIT_METHOD: DepositMethodName;
13
13
  export declare const DEFAULT_WITHDRAW_SLIPPAGE = 3;
14
14
  export declare const DEFAULT_DEPOSIT_SLIPPAGE = 0;
15
- export declare const DEFAULT_NO_SWAP_MIN_DEPOSIT_AMOUNT_GAP = 0.1;
15
+ export declare const DEFAULT_NO_SWAP_MIN_DEPOSIT_AMOUNT_GAP = 0.2;
16
16
  export declare const DEFAULT_SWAP_TRANSACTION_SLIPPAGE = 0.3;
17
17
  export declare const DEFAULT_WITHDRAW_SLIPPAGE_SCALE: number[];
18
18
  export declare const DEFAULT_DEPOSIT_SLIPPAGE_SCALE: number[];
@@ -12,3 +12,4 @@ export { useDepositProjectedEarnings } from './projected-earnings/use-deposit-pr
12
12
  export { useProjectedEarningsCore } from './projected-earnings/use-projected-earnings-core';
13
13
  export { useSwapDataQuery } from './use-swap-data-query';
14
14
  export { useSendTokenDebouncedValue } from './use-send-token-debounced-value';
15
+ export { useAvailableWithdrawLiquidity } from './synthetix-v3/use-available-withdraw-liquidity';
@@ -0,0 +1,47 @@
1
+ export declare const useAvailableWithdrawLiquidity: (params?: {
2
+ enabled?: boolean;
3
+ }) => import("wagmi").UseReadContractReturnType<readonly [{
4
+ readonly inputs: readonly [{
5
+ readonly internalType: "uint128";
6
+ readonly name: "accountId";
7
+ readonly type: "uint128";
8
+ }, {
9
+ readonly internalType: "uint128";
10
+ readonly name: "poolId";
11
+ readonly type: "uint128";
12
+ }, {
13
+ readonly internalType: "address";
14
+ readonly name: "collateralType";
15
+ readonly type: "address";
16
+ }];
17
+ readonly name: "getPositionDebt";
18
+ readonly outputs: readonly [{
19
+ readonly internalType: "int256";
20
+ readonly name: "debtD18";
21
+ readonly type: "int256";
22
+ }];
23
+ readonly stateMutability: "nonpayable";
24
+ readonly type: "function";
25
+ }, {
26
+ readonly inputs: readonly [{
27
+ readonly internalType: "uint128";
28
+ readonly name: "accountId";
29
+ readonly type: "uint128";
30
+ }, {
31
+ readonly internalType: "address";
32
+ readonly name: "collateralType";
33
+ readonly type: "address";
34
+ }];
35
+ readonly name: "getAccountAvailableCollateral";
36
+ readonly outputs: readonly [{
37
+ readonly internalType: "uint256";
38
+ readonly name: "";
39
+ readonly type: "uint256";
40
+ }];
41
+ readonly stateMutability: "view";
42
+ readonly type: "function";
43
+ }], "getAccountAvailableCollateral", [bigint, `0x${string}`], {
44
+ address: `0x${string}`;
45
+ value: number;
46
+ formatted: string;
47
+ }>;
@@ -0,0 +1,5 @@
1
+ export declare const useWithdrawLiquidity: () => {
2
+ noLiquidity: boolean;
3
+ symbol: string | undefined;
4
+ availableLiquidity: string | undefined;
5
+ };
@@ -13,4 +13,5 @@ export interface PoolComposition {
13
13
  export interface PoolCompositionWithFraction extends PoolComposition {
14
14
  fraction: string;
15
15
  fractionUsd: string;
16
+ fractionUsdNumber: number;
16
17
  }