@dhedge/trading-widget 3.0.4 → 3.1.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 +30 -1
- package/core-kit/const/contracts/base.d.ts +1 -0
- package/core-kit/const/default-data.d.ts +2 -0
- package/core-kit/const/error.d.ts +6 -0
- package/core-kit/const/logger.d.ts +6 -5
- package/core-kit/hooks/pool/index.d.ts +1 -1
- package/core-kit/hooks/pool/{use-fmed-vested-points.d.ts → use-vault-vested-points.d.ts} +3 -1
- package/core-kit/utils/flat-money.d.ts +1 -1
- package/core-kit/utils/index.d.ts +1 -0
- package/core-kit/utils/logger.d.ts +17 -0
- package/index-01347663.cjs +217 -0
- package/{index-9cb35e91.js → index-0fbeafc7.js} +12458 -12186
- package/index.cjs +1 -1
- package/index.d.ts +2 -2
- package/index.js +145 -143
- package/package.json +1 -1
- package/{pyth-adapter-0e675a02.cjs → pyth-adapter-23431569.cjs} +1 -1
- package/{pyth-adapter-c77fed23.js → pyth-adapter-a934350b.js} +1 -1
- package/style.css +1 -1
- package/trading-widget/components/common/button/icon-button/icon-button.d.ts +1 -0
- package/trading-widget/components/common/button/reload-button/reload-button.d.ts +3 -0
- package/trading-widget/components/common/button/reload-button/reload-button.hooks.d.ts +10 -0
- package/trading-widget/components/common/layout/index.d.ts +2 -0
- package/trading-widget/components/common/layout/notification/notification.d.ts +6 -0
- package/trading-widget/components/widget/widget-buttons/index.d.ts +1 -0
- package/trading-widget/components/widget/widget-buttons/reload-swap-quote-button/reload-deposit-swap-quote-button/reload-deposit-swap-quote-button.d.ts +2 -0
- package/trading-widget/components/widget/widget-buttons/reload-swap-quote-button/reload-deposit-swap-quote-button/reload-deposit-swap-quote-button.hooks.d.ts +8 -0
- package/trading-widget/components/widget/widget-buttons/reload-swap-quote-button/reload-swap-quote-button.d.ts +2 -0
- package/trading-widget/components/widget/widget-buttons/reload-swap-quote-button/reload-withdraw-swap-quote-button/reload-withdraw-swap-quote-button.d.ts +2 -0
- package/trading-widget/components/widget/widget-buttons/reload-swap-quote-button/reload-withdraw-swap-quote-button/reload-withdraw-swap-quote-button.hooks.d.ts +8 -0
- package/trading-widget/components/widget/widget-overlay/{fmed-withdrawal-overlay/fmed-withdrawal-overlay.d.ts → fmp-withdrawal-overlay/fmp-withdrawal-overlay.d.ts} +1 -1
- package/trading-widget/components/widget/widget-overlay/fmp-withdrawal-overlay/fmp-withdrawal-overlay.hooks.d.ts +10 -0
- package/trading-widget/components/widget/widget-overlay/index.d.ts +2 -1
- package/trading-widget/components/widget/widget-overlay/notification-overlay/notification-overlay.d.ts +3 -0
- package/trading-widget/components/widget/widget-overlay/notification-overlay/notification-overlay.hooks.d.ts +8 -0
- package/trading-widget/components/withdraw/complete-step/button/swap-button/swap-button.hooks.d.ts +1 -1
- package/trading-widget/providers/config-provider/config-provider.types.d.ts +1 -0
- package/trading-widget/providers/overlay-provider/overlay-provider.hooks.d.ts +3 -0
- package/trading-widget/providers/overlay-provider/overlay-provider.types.d.ts +4 -1
- package/trading-widget/providers/translation-provider/translation-provider.types.d.ts +2 -0
- package/trading-widget/types/overlay.types.d.ts +2 -1
- package/index-389bb96e.cjs +0 -217
package/README.md
CHANGED
|
@@ -120,6 +120,7 @@ UI configuration provider. Manages params to configure custom styling, component
|
|
|
120
120
|
> | `defaultWithdrawSlippage` | `number` | `[0.1, 0.3, 0.5, 1, 1.5, 3]` | Initial withdraw slippage absolute percent. Further adjustments are available in panel settings |
|
|
121
121
|
> | `defaultSwapTransactionSlippage` | `number` | `0.3` | Default slippage (%) applied to swap transaction. |
|
|
122
122
|
> | `defaultNoSwapMinDepositAmountGap` | `number` | `0.1` | Default gap (%) for min received vault tokens during no swap deposits. |
|
|
123
|
+
> | `defaultNotificationDuration` | `number` | `10000` | Notification duration in ms |
|
|
123
124
|
> | `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) |
|
|
124
125
|
> | `customLockTime` | `string` | `'15 minutes'` | Formatted custom deposit lock time alternative to be displayed in panel |
|
|
125
126
|
> | `stablePrecision` | `number` | `3` | Number of decimals to be displayed in stables (e.g USDC balance) |
|
|
@@ -429,7 +430,7 @@ path: `component.meta[name]`
|
|
|
429
430
|
</summary>|
|
|
430
431
|
|
|
431
432
|
> | name | type | default value | description |
|
|
432
|
-
> | -------------------------------- | ------
|
|
433
|
+
> | -------------------------------- | ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------- |
|
|
433
434
|
> | `depositSlippageWarning` | string | Excludes entry fee. Slippage may be amplified by the leverage. See the docs for more info. | |
|
|
434
435
|
> | `withdrawSlippageWarning` | string | Slippage only applies to single asset withdrawals and withdrawals from vaults with debt positions in Aave. | |
|
|
435
436
|
> | `minSlippageWarning` | string | Flexible min slippage value that is likely enough to process the transaction. | |
|
|
@@ -498,6 +499,7 @@ path: `component.meta[name]`
|
|
|
498
499
|
> | `selectToken` | string | Select Token | |
|
|
499
500
|
> | `sendingOrderToWallet` | string | Sending order to your wallet | |
|
|
500
501
|
> | `settingUpTx` | string | Setting up transaction | |
|
|
502
|
+
> | `miningTx` | string | Processing | |
|
|
501
503
|
> | `updateSynthetixOracles` | string | Updating Synthetix Oracles | |
|
|
502
504
|
> | `approveSpending` | string | Approve {symbol} spending | |
|
|
503
505
|
> | `pay` | string | Pay | |
|
|
@@ -522,9 +524,36 @@ path: `component.meta[name]`
|
|
|
522
524
|
> | `total` | string | Total: | |
|
|
523
525
|
> | `showAll` | string | Show All | |
|
|
524
526
|
> | `hide` | string | Hide | |
|
|
527
|
+
> | `refreshSwapQuoteTooltip` | string | Refresh swap quote | |
|
|
525
528
|
|
|
526
529
|
###### Source: `packages/trading-widget/src/trading-widget/providers/translation-provider/translation-provider.tsx`
|
|
527
530
|
|
|
528
531
|
###### Default values: `packages/trading-widget/src/trading-widget/providers/translation-provider/translation-provider.defaults.ts`
|
|
529
532
|
|
|
530
533
|
</details>
|
|
534
|
+
|
|
535
|
+
## Local Development
|
|
536
|
+
|
|
537
|
+
Follow the steps below to set up the project for local development:
|
|
538
|
+
|
|
539
|
+
1. **Install Dependencies**:
|
|
540
|
+
Use `pnpm` to install all required dependencies:
|
|
541
|
+
|
|
542
|
+
```bash
|
|
543
|
+
pnpm install
|
|
544
|
+
```
|
|
545
|
+
|
|
546
|
+
2. **Update Alchemy API Key**: Replace the placeholder Alchemy API key in the file:
|
|
547
|
+
|
|
548
|
+
```bash
|
|
549
|
+
packages/trading-widget/src/core-kit/providers/wagmi-provider.tsx
|
|
550
|
+
```
|
|
551
|
+
|
|
552
|
+
3. **Implement** getSwapData in:
|
|
553
|
+
```bash
|
|
554
|
+
packages/trading-widget/src/core-kit/providers/wagmi-provider.tsx
|
|
555
|
+
```
|
|
556
|
+
4. **Run Storybook**
|
|
557
|
+
```bash
|
|
558
|
+
pnpm storybook
|
|
559
|
+
```
|
|
@@ -3,3 +3,4 @@ export declare const SYNTHETIX_V3_CORE_ADDRESS_BASE = "0x32C222A9A159782aFD7529c
|
|
|
3
3
|
export declare const EASY_SWAPPER_V2_ADDRESS_BASE = "0xf067575Eb60c7587C11e867907AA7284833704d1";
|
|
4
4
|
export declare const FLATCOIN_POINTS_MODULE_ADDRESS_BASE = "0x59525b9b23adc475ef91d98dae06b568ba574ce5";
|
|
5
5
|
export declare const FLATMONEY_EARLY_DEPOSITOR_VAULT_ADDRESS_BASE = "0xa907504d7a4c415b4e6e1d0866d96afe8202f0e5";
|
|
6
|
+
export declare const FLATMONEY_DHT_STAKING_VAULT_ADDRESS_BASE = "0x1849324228d852a67eb7443e42d967e480ffe95d";
|
|
@@ -24,3 +24,5 @@ export declare const GAS_LIMIT_BUFFER_COEFF = 1.25;
|
|
|
24
24
|
export declare const MANAGER_FEE_DENOMINATOR = 10000;
|
|
25
25
|
export declare const DEFAULT_PROMISE_TIMEOUT_MS = 13000;
|
|
26
26
|
export declare const DEFAULT_VISIBLE_ASSETS_LIMIT = 3;
|
|
27
|
+
export declare const SWAP_QUOTE_REFRESH_INTERVAL_MS = 20000;
|
|
28
|
+
export declare const DEFAULT_NOTIFICATION_DURATION_MS = 10000;
|
|
@@ -2,3 +2,9 @@ export declare const GAS_ESTIMATION_ERROR = "Gas estimate error occurred";
|
|
|
2
2
|
export declare const DEFAULT_ERROR_MESSAGE = "See console logs to report error details.";
|
|
3
3
|
export declare const DEFAULT_SIMULATION_ERROR = "Missing simulation params";
|
|
4
4
|
export declare const SIMULATION_TIMEOUT_ERROR = "Simulation timeout";
|
|
5
|
+
export declare const DEPOSIT_SWAP_DATA_ERROR = "swap_data_deposit_error";
|
|
6
|
+
export declare const WITHDRAW_SWAP_DATA_ERROR = "swap_data_withdraw_error";
|
|
7
|
+
export declare const TRANSACTION_ERRORS: Record<string, {
|
|
8
|
+
title: string;
|
|
9
|
+
hint?: string;
|
|
10
|
+
}>;
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
export declare const TRADING_PANEL_LOG_EVENT: {
|
|
2
2
|
INVEST_INPUT_FOCUS: string;
|
|
3
3
|
APPROVED_TOKEN: string;
|
|
4
|
+
UPDATE_ORACLES: string;
|
|
4
5
|
DEPOSIT: string;
|
|
6
|
+
MULTI_ASSET_WITHDRAW: string;
|
|
7
|
+
SINGLE_ASSET_WITHDRAW: string;
|
|
8
|
+
SINGLE_ASSET_WITHDRAW_AND_CLAIM: string;
|
|
9
|
+
CLAIM: string;
|
|
10
|
+
SWAP: string;
|
|
5
11
|
WITHDRAWAL: string;
|
|
6
12
|
TRADING_SETTINGS_OPENED: string;
|
|
7
13
|
INFINITE_ALLOWANCE_CHANGE: string;
|
|
8
|
-
MULTI_ASSET_WITHDRAWAL_CHANGE: string;
|
|
9
14
|
};
|
|
10
15
|
/**
|
|
11
16
|
* Limits: Up to 50 custom event parameters per project;
|
|
@@ -18,10 +23,6 @@ export declare const TRADING_LOG_EVENT_PARAM: {
|
|
|
18
23
|
NAME: string;
|
|
19
24
|
TYPE: string;
|
|
20
25
|
};
|
|
21
|
-
IS_MULTI_ASSET: {
|
|
22
|
-
NAME: string;
|
|
23
|
-
TYPE: string;
|
|
24
|
-
};
|
|
25
26
|
SYMBOL: {
|
|
26
27
|
NAME: string;
|
|
27
28
|
TYPE: string;
|
|
@@ -12,4 +12,4 @@ export { useSynthetixV3AssetBalance } from './synthetixV3/use-synthetix-v3-asset
|
|
|
12
12
|
export { useTotalFundValueMutable } from './synthetixV3/use-total-funds-value-mutable';
|
|
13
13
|
export { useInvalidatePoolContractData } from './use-invalidate-pool-contract-data';
|
|
14
14
|
export { usePoolsDynamic } from './multicall';
|
|
15
|
-
export {
|
|
15
|
+
export { useVaultVestedPoints } from './use-vault-vested-points';
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { Address } from 'core-kit/types';
|
|
1
2
|
interface UseFmedVestedPointsProps {
|
|
2
3
|
enabled?: boolean;
|
|
4
|
+
address: Address;
|
|
3
5
|
}
|
|
4
|
-
export declare const
|
|
6
|
+
export declare const useVaultVestedPoints: ({ enabled, address, }: UseFmedVestedPointsProps) => import("wagmi").UseReadContractsReturnType<{
|
|
5
7
|
address: `0x${string}`;
|
|
6
8
|
chainId: 8453;
|
|
7
9
|
abi: readonly [{
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Address } from 'viem';
|
|
2
|
-
export declare const
|
|
2
|
+
export declare const isFmpAirdropVaultAddress: (address: Address) => boolean;
|
|
3
3
|
export declare const isFlatMoneyLeveragedRethAsset: (address: Address) => boolean;
|
|
4
4
|
export declare const getFlatMonetUnitSymbol: (chainId: number) => string;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { TradingPanelActionsState, TransactionAction } from 'core-kit/types';
|
|
2
|
+
import type { Address } from 'core-kit/types/web3.types';
|
|
3
|
+
/**
|
|
4
|
+
* Transforms an Ethereum address to ensure it's treated as a string in Firebase Analytics.
|
|
5
|
+
* Adds a prefix to avoid scientific notation or numeric interpretation.
|
|
6
|
+
*
|
|
7
|
+
* @param {string} ethereumAddress - The Ethereum address to transform.
|
|
8
|
+
* @returns {string} - The transformed Ethereum address.
|
|
9
|
+
*/
|
|
10
|
+
export declare const transformAddressForAnalytics: (ethereumAddress: Address) => string;
|
|
11
|
+
export declare const logTransactionByActionType: ({ action, log, symbol, vaultAddress, chainId, }: {
|
|
12
|
+
action: TransactionAction;
|
|
13
|
+
symbol: string;
|
|
14
|
+
log: TradingPanelActionsState['onLog'];
|
|
15
|
+
chainId: number;
|
|
16
|
+
vaultAddress: Address;
|
|
17
|
+
}) => void;
|