@dhedge/trading-widget 1.1.0 → 1.1.2

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
@@ -62,6 +62,7 @@ Top level provider component. Headless part of trading logic. API handles params
62
62
  > | `onUpdateTradingModal` | (payload: Partial\<{ isOpen: `boolean`; status: `'Success' \| 'None' \| 'Mining' \| 'Wallet'` }\>) => void | undefined | triggers on trading modal change |
63
63
  > | `onUpdateTransactions` | (payload: AddTransaction \| UpdateTransaction \| RemoveTransaction) => void | undefined | triggers on transaction action change |
64
64
  > | `onUpdateEntryFee` | (payload: Partial\<Record<DepositMethodName, number>\>) => void | undefined | triggers on transaction action change |
65
+ > | `onTradingSettleError` | (error: `Error`) => void | undefined | triggers on trading settle error |
65
66
  > | `onTransactionError` | (error: `Error`, action: `TransactionAction` \| `undefined`, chainId?: `ChainId`, txHash?: `Address`) => void | undefined | triggers on transaction error |
66
67
  > | `onTransactionSuccess` | (data: `WaitForTransactionReceiptReturnType`, action: `TransactionAction` \| `undefined`, link?: `string`) => void | undefined | triggers on transaction success |
67
68
  > | `onTransactionEstimationError` | (error: `EstimationError`, address: `Address`, chainId?: `ChainId`, account?: `Address`) => void | undefined | triggers on transaction estimation error |
@@ -413,82 +414,83 @@ path: `component.meta[name]`
413
414
  <code>Translation keys</code>
414
415
  </summary>
415
416
 
416
- > | name | type | default value | description |
417
- > |---------------------------------------|--------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------|
418
- > | `depositSlippageWarning` | string | Includes entry fee. We recommend 2-3%, but usually it will be < 1%. Slippage may be amplified by the leverage. See the docs for more info. | |
419
- > | `withdrawSlippageWarning` | string | Slippage only applies to single asset withdrawals and withdrawals from vaults with debt positions in Aave. | |
420
- > | `minSlippageWarning` | string | Flexible min slippage value that is likely enough to process the transaction. | |
421
- > | `highSlippageWarning` | string | We recommend using another asset to trade with lower slippage. | |
422
- > | `recommendedMinSlippage` | string | Recommended Min Slippage | |
423
- > | `projectedDailyEarningsTooltip` | string | Projected daily earnings are based on the current APY and may differ from actual earnings. | |
424
- > | `dailyEarnings` | string | Daily Earnings | |
425
- > | `projectedYearlyEarningsTooltip` | string | Projected yearly earnings are based on the current APY and may differ from actual earnings. | |
426
- > | `yearlyEarnings` | string | Yearly Earnings | |
427
- > | `fullReceiveDetails` | string | See full details influencing what you will receive. | |
428
- > | `tradeDetails` | string | Trade details | |
429
- > | `maxSlippage` | string | Max slippage | |
430
- > | `minReceiveAmount` | string | You will receive no less than this amount. | |
431
- > | `minReceived` | string | Minimum Received | |
432
- > | `estimatedMultiAssetFractions` | string | Estimated multi asset fractions | |
433
- > | `infinite` | string | Infinite | |
434
- > | `tokenAllowance` | string | Token Allowance | |
435
- > | `entryFee` | string | Entry Fee | |
436
- > | `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. | |
437
- > | `easySwapperEntryFee` | string | Entry fee is charged when a cooldown of {time} is selected. Bypass Entry Fee at trading settings. | |
438
- > | `amountToBeApproved` | string | Amount of {symbol} tokens to be approved. Can be customized in settings. | |
439
- > | `minDepositUsd` | string | Minimum deposit in USD. | |
440
- > | `minDeposit` | string | Minimum Deposit | |
441
- > | `tokensLockTime` | string | Purchased tokens will have a {lockTime} lock. | |
442
- > | `slippageTolerance` | string | Slippage tolerance | |
443
- > | `bypassEntryFee` | string | Bypass Entry Fee | |
444
- > | `entryFeeSwitchWarning` | string | By removing the entry fee, your position is locked for up to {defaultLockTime} instead of the normal {customLockTime}. | |
445
- > | `tokenAmountToApprove` | string | Amount of tokens to be approved. | |
446
- > | `auto` | string | Auto | |
447
- > | `autoSlippageDescription` | string | App is testing different slippage ranges, starting low and increasing until it's likely to pass | |
448
- > | `lengthenLockup` | string | Lengthen lockup to remove entry fee | |
449
- > | `deposit` | string | Buy | |
450
- > | `withdraw` | string | Sell | |
451
- > | `yourBalance` | string | Your Balance | |
452
- > | `max` | string | Max | |
453
- > | `allAssets` | string | All Assets | |
454
- > | `all` | string | All | |
455
- > | `payWith` | string | Pay with | |
456
- > | `buyEstimated` | string | Buy (estimated) | |
457
- > | `sell` | string | Sell | |
458
- > | `receiveEstimated` | string | Receive (estimated) | |
459
- > | `confirmInWallet` | string | Please confirm in wallet | |
460
- > | `pending` | string | Pending... | |
461
- > | `approve` | string | Approve | |
462
- > | `connectWallet` | string | Connect Wallet | |
463
- > | `minimumPurchase` | string | Minimum purchase is ${value} | |
464
- > | `poolIsInactive` | string | {poolSymbol} token is no longer active. Please withdraw from them. | |
465
- > | `poolIsPrivate` | string | This vault is currently private | |
466
- > | `updateOracles` | string | Update Oracles | |
467
- > | `confirmMaxSlippage` | string | Confirm {slippagePercentage}% max slippage | |
468
- > | `withdrawalWindowDisabled` | string | You can sell your {tokenSymbol} tokens during withdrawal window period starting from {startTime} | |
469
- > | `withdrawCooldown` | string | You can sell your {tokenSymbol} tokens in {cooldownEndTime} | |
470
- > | `termsOfUse` | string | Terms Of Use | |
471
- > | `termOfUseDepositListTitle` | string | Please know the following before depositing | |
472
- > | `termOfUseDepositAssetSlippage` | string | When exiting, investors receive single asset or the underlying vault assets. Withdraw slippage can be customized in withdraw settings | |
473
- > | `termOfUseDepositBugs` | string | There may be interface bugs on the platform | |
474
- > | `termOfUseDepositDowntime` | string | There may be interface downtime (planned and unplanned) | |
475
- > | `termOfUseDepositAuditRisk` | string | Smart contracts are audited but a risk is still present | |
476
- > | `termOfUseDepositAccept` | string | Accept & Deposit | |
477
- > | `back` | string | Back | |
478
- > | `highSlippage` | string | High Slippage Alert | |
479
- > | `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. | |
480
- > | `highSlippageListTitle` | string | Please consider the following before confirming | |
481
- > | `highSlippageQuoteDiff` | string | Be aware that the final amount of assets you receive may be different from the initially quoted value. | |
482
- > | `highSlippageRisk` | string | Ensure that you understand the risks associated with high slippage and are comfortable proceeding with the trade. | |
483
- > | `confirm` | string | Confirm | |
484
- > | `selectToken` | string | Select Token | |
485
- > | `sendingOrderToWallet` | string | Sending order to your wallet | |
486
- > | `settingUpTx` | string | Setting up transaction | |
487
- > | `updateSynthetixOracles` | string | Updating Synthetix Oracles | |
488
- > | `approveSpending` | string | Approve {symbol} spending | |
489
- > | `pay` | string | Pay | |
490
- > | `multiAssetFractions` | string | multi asset fractions | |
491
- > | `explorer` | string | Explorer | |
417
+ > | name | type | default value | description |
418
+ > |----------------------------------|--------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------|
419
+ > | `depositSlippageWarning` | string | Includes entry fee. We recommend 2-3%, but usually it will be < 1%. Slippage may be amplified by the leverage. See the docs for more info. | |
420
+ > | `withdrawSlippageWarning` | string | Slippage only applies to single asset withdrawals and withdrawals from vaults with debt positions in Aave. | |
421
+ > | `minSlippageWarning` | string | Flexible min slippage value that is likely enough to process the transaction. | |
422
+ > | `highSlippageWarning` | string | We recommend using another asset to trade with lower slippage. | |
423
+ > | `recommendedMinSlippage` | string | Recommended Min Slippage | |
424
+ > | `projectedDailyEarningsTooltip` | string | Projected daily earnings are based on the current APY and may differ from actual earnings. | |
425
+ > | `dailyEarnings` | string | Daily Earnings | |
426
+ > | `projectedYearlyEarningsTooltip` | string | Projected yearly earnings are based on the current APY and may differ from actual earnings. | |
427
+ > | `yearlyEarnings` | string | Yearly Earnings | |
428
+ > | `fullReceiveDetails` | string | See full details influencing what you will receive. | |
429
+ > | `tradeDetails` | string | Trade details | |
430
+ > | `maxSlippage` | string | Max slippage | |
431
+ > | `minReceiveAmount` | string | You will receive no less than this amount. | |
432
+ > | `minReceived` | string | Minimum Received | |
433
+ > | `estimatedMultiAssetFractions` | string | Estimated multi asset fractions | |
434
+ > | `infinite` | string | Infinite | |
435
+ > | `tokenAllowance` | string | Token Allowance | |
436
+ > | `entryFee` | string | Entry Fee | |
437
+ > | `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. | |
438
+ > | `easySwapperEntryFee` | string | Entry fee is charged when a cooldown of {time} is selected. Bypass Entry Fee at trading settings. | |
439
+ > | `amountToBeApproved` | string | Amount of {symbol} tokens to be approved. Can be customized in settings. | |
440
+ > | `minDepositUsd` | string | Minimum deposit in USD. | |
441
+ > | `minDeposit` | string | Minimum Deposit | |
442
+ > | `tokensLockTime` | string | Purchased tokens will have a {lockTime} lock. | |
443
+ > | `slippageTolerance` | string | Slippage tolerance | |
444
+ > | `bypassEntryFee` | string | Bypass Entry Fee | |
445
+ > | `entryFeeSwitchWarning` | string | By removing the entry fee, your position is locked for up to {defaultLockTime} instead of the normal {customLockTime}. | |
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
+ > | `confirmMaxSlippage` | string | Confirm {slippagePercentage}% max slippage | |
469
+ > | `withdrawalWindowDisabled` | string | You can sell your {tokenSymbol} tokens during withdrawal window period starting from {startTime} | |
470
+ > | `withdrawCooldown` | string | You can sell your {tokenSymbol} tokens in {cooldownEndTime} | |
471
+ > | `termsOfUse` | string | Terms Of Use | |
472
+ > | `termOfUseDepositListTitle` | string | Please know the following before depositing | |
473
+ > | `termOfUseDepositAssetSlippage` | string | When exiting, investors receive single asset or the underlying vault assets. Withdraw slippage can be customized in withdraw settings | |
474
+ > | `termOfUseDepositBugs` | string | There may be interface bugs on the platform | |
475
+ > | `termOfUseDepositDowntime` | string | There may be interface downtime (planned and unplanned) | |
476
+ > | `termOfUseDepositAuditRisk` | string | Smart contracts are audited but a risk is still present | |
477
+ > | `termOfUseDepositAccept` | string | Accept & Deposit | |
478
+ > | `back` | string | Back | |
479
+ > | `highSlippage` | string | High Slippage Alert | |
480
+ > | `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. | |
481
+ > | `highSlippageListTitle` | string | Please consider the following before confirming | |
482
+ > | `highSlippageQuoteDiff` | string | Be aware that the final amount of assets you receive may be different from the initially quoted value. | |
483
+ > | `highSlippageRisk` | string | Ensure that you understand the risks associated with high slippage and are comfortable proceeding with the trade. | |
484
+ > | `confirm` | string | Confirm | |
485
+ > | `selectToken` | string | Select Token | |
486
+ > | `sendingOrderToWallet` | string | Sending order to your wallet | |
487
+ > | `settingUpTx` | string | Setting up transaction | |
488
+ > | `updateSynthetixOracles` | string | Updating Synthetix Oracles | |
489
+ > | `approveSpending` | string | Approve {symbol} spending | |
490
+ > | `pay` | string | Pay | |
491
+ > | `multiAssetFractions` | string | multi asset fractions | |
492
+ > | `explorer` | string | Explorer | |
493
+ > | `as` | string | As | |
492
494
 
493
495
  ###### Source: `packages/trading-widget/src/trading-widget/providers/translation-provider/translation-provider.tsx`
494
496
  ###### Default values: `packages/trading-widget/src/trading-widget/providers/translation-provider/translation-provider.defaults.ts`
@@ -1,3 +1,4 @@
1
1
  export declare const FACTORY_ADDRESS_ARBITRUM = "0xffFb5fB14606EB3a548C113026355020dDF27535";
2
2
  export declare const EASY_SWAPPER_ADDRESS_ARBITRUM = "0x80b9411977C4fF8D618f2aC3f29F1e2D623C4d34";
3
3
  export declare const AAVE_LENDING_POOL_V3_ADDRESS_ARBITRUM = "0x794a61358D6845594F94dc1DB02A252b5b4814aD";
4
+ export declare const SYNTHETIX_V3_CORE_ADDRESS_ARBITRUM = "0xffffffaEff0B96Ea8e4f94b2253f31abdD875847";
@@ -0,0 +1,3 @@
1
+ import type { Address, ChainId } from '../types';
2
+ export declare const FLATMONEY_LEVERAGED_RETH_ASSET_MAP: Record<ChainId, Address>;
3
+ export declare const FLATMONEY_COLLATERAL_SYMBOL_MAP: Record<ChainId, string>;
@@ -9,3 +9,4 @@ export * from './error';
9
9
  export * from './tokens';
10
10
  export * from './synthetix';
11
11
  export * from './links';
12
+ export * from './flat-money';
@@ -3,3 +3,4 @@ export declare const USDC_BASE: TradingToken;
3
3
  export declare const USDCBC_BASE: TradingToken;
4
4
  export declare const WETH_BASE: TradingToken;
5
5
  export declare const CBETH_BASE: TradingToken;
6
+ export declare const RETH_BASE: TradingToken;
@@ -16,6 +16,7 @@ export declare const useUpdateEntryFee: () => (payload: Partial<Record<import(".
16
16
  export declare const useUpdateTradingModal: () => (payload: Partial<import("../../types").TradingPanelStateModal>) => void;
17
17
  export declare const useUpdatePoolFallbackData: () => (payload: import("../../types").PoolFallbackData) => void;
18
18
  export declare const useOnTransactionError: () => ((error: Error, action: import("../../types").TransactionAction | undefined, chainId?: number | undefined, txHash?: `0x${string}` | undefined) => void) | undefined;
19
+ export declare const useOnTradingSettleError: () => ((error: Error) => void) | undefined;
19
20
  export declare const useOnTransactionSuccess: () => ((data: import("viem").TransactionReceipt, action: import("../../types").TransactionAction | undefined, link?: string | undefined) => void) | undefined;
20
21
  export declare const useOnTransactionEstimationError: () => ((error: import("../../models").EstimationError, address: `0x${string}`, chainId: number, account?: `0x${string}` | undefined) => void) | undefined;
21
22
  export declare const useOnTokenSelector: () => ((payload: import("../../types").TokenSelectorPayload) => void) | undefined;
@@ -1,4 +1,4 @@
1
- export { useSetTradingType, useUpdateTradingMeta, useUpdateTradingModal, useUpdateSendTokenInput, useSetPoolAddress, useUpdateReceiveTokenInput, useUpdateTradingSettings, useUpdateEntryFee, useOnTransactionError, useOnTransactionSuccess, useOnTransactionEstimationError, useOnTokenSelector, useTradingPanelLogger, useOnSimulateTransaction, useUpdatePoolFallbackData, } from './action';
1
+ export { useSetTradingType, useUpdateTradingMeta, useUpdateTradingModal, useUpdateSendTokenInput, useSetPoolAddress, useUpdateReceiveTokenInput, useUpdateTradingSettings, useUpdateEntryFee, useOnTransactionError, useOnTransactionSuccess, useOnTransactionEstimationError, useOnTokenSelector, useTradingPanelLogger, useOnSimulateTransaction, useUpdatePoolFallbackData, useOnTradingSettleError, } from './action';
2
2
  export { useTradingPanelPoolAddress, useTradingPanelPoolConfig, useTradingPanelDepositMethod, useTradingPanelPoolConfigs, useTradingPanelPoolFallbackData, useIsPoolAddress, } from './pool';
3
3
  export { useSendTokenInput, useReceiveTokenInput } from './input';
4
4
  export { useTradingPanelSettings } from './settings';
@@ -57,6 +57,7 @@ export interface CallbackConfig {
57
57
  onUpdateEntryFee: TradingPanelSetters['updateEntryFee'];
58
58
  onUpdateTradingModal: TradingPanelSetters['updateTradingModal'];
59
59
  onUpdateTransactions: TradingPanelSetters['updateTransactions'];
60
+ onTradingSettleError: (error: Error) => void;
60
61
  onTransactionError: (error: Error, action: TransactionAction | undefined, chainId?: ChainId, txHash?: Address) => void;
61
62
  onTransactionSuccess: (data: WaitForTransactionReceiptReturnType, action: TransactionAction | undefined, link?: string) => void;
62
63
  onTransactionEstimationError: (error: EstimationError, address: Address, chainId: ChainId, account?: Address) => void;
@@ -103,6 +104,7 @@ export interface TradingPanelContextConfig {
103
104
  initialState?: Partial<TradingPanelState>;
104
105
  }
105
106
  export type TradingPanelActionsState = TradingPanelSetters & {
107
+ onTradingSettleError: CallbackConfig['onTradingSettleError'] | undefined;
106
108
  onTransactionError: CallbackConfig['onTransactionError'] | undefined;
107
109
  onTransactionSuccess: CallbackConfig['onTransactionSuccess'] | undefined;
108
110
  onTransactionEstimationError: CallbackConfig['onTransactionEstimationError'] | undefined;
@@ -0,0 +1,3 @@
1
+ import type { Address } from 'viem';
2
+ export declare const isFlatMoneyEarlyDepositorAddress: (address: Address) => boolean;
3
+ export declare const isFlatMoneyLeveragedRethAsset: (address: Address) => boolean;
@@ -7,4 +7,4 @@ export * from './error';
7
7
  export * from './formatter';
8
8
  export * from './synthetix';
9
9
  export * from './ua';
10
- export * from './fmed';
10
+ export * from './flat-money';