@dhedge/trading-widget 1.1.4 → 1.1.5

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
@@ -79,18 +79,19 @@ Top level provider component. Headless part of trading logic. API handles params
79
79
  <details>
80
80
  <summary><code>initialState</code> <code><b>/</b></code> <code>Optional initial state of trading panel</code></summary>
81
81
 
82
- > | name | type | default value | description |
83
- > |--------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------|
84
- > | `poolAddress` | Address | `AddressZero` | Current active pool address |
85
- > | `poolConfigMap` | Record<Address, PoolConfig> | `{}` | Map of pool configs available for trading |
86
- > | `settings` | { slippage: `number \| 'auto'`; minSlippage?: `number`; isInfiniteAllowance: `boolean`; isMultiAssetWithdrawalEnabled: `boolean`; isMaxSlippageLoading: `boolean` } | { slippage: `'auto'`; isInfiniteAllowance: `false`; isMultiAssetWithdrawalEnabled: `true`; isMaxSlippageLoading: `false` } | Panel settings |
87
- > | `type` | 'deposit' \| 'withdraw' | `'deposit'` | Trading type |
88
- > | `input` | { sendToken: { address: `Address`; symbol: `string`; value: `string`; decimals: `number`; isLoading?: `boolean` }; receiveToken: { address: `Address`; symbol: `string`; value: `string`; decimals: `number`; isLoading?: `boolean` } } | `poolConfigMap[poolAddress]` | Send/receive tokens pair |
89
- > | `entryFee` | { deposit: `number`; depositWithCustomCooldown: `number`; } | { deposit: `0`; depositWithCustomCooldown: `0.1` } | Entry fee config map |
90
- > | `meta` | { approvingStatus?: `'pending' \| 'success'` } | `{}` | Trading meta info |
91
- > | `modal` | { isOpen: `boolean`; status: `'Success' \| 'None' \| 'Mining' \| 'Wallet'`; action: `'deposit' \| 'withdraw' \| 'approve \| 'oraclesUpdate'`; link?: `string`; sendToken: TradingToken \| null; receiveToken: TradingToken \| null } | `{ isOpen: `false`,status: `'None'`, receiveToken: `null`, sendToken: `null` }` | Trading modal state |
92
- > | `transactions` | { action: `'deposit' \| 'withdraw' \| 'approve'`; symbol: `string`; chainId: `ChainId`; txHash?: `Address` }[] | `[]` | Pending transactions |
93
- > | `poolFallbackData` | { address: `Address`; managerLogicAddress?: `Address`; poolCompositions: `PoolComposition[]`; tokenPrice?: `string`; apy?: { value: `number`; currency: `'USD' \| 'ETH'` } } | { address: `AddressZero` } | Current active pool fallback data to override or extend contract's response |
82
+ > | name | type | default value | description |
83
+ > |--------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------|
84
+ > | `poolAddress` | Address | `AddressZero` | Current active pool address |
85
+ > | `poolConfigMap` | Record<Address, PoolConfig> | `{}` | Map of pool configs available for trading |
86
+ > | `settings` | { slippage: `number \| 'auto'`; minSlippage?: `number`; isInfiniteAllowance: `boolean`; isMultiAssetWithdrawalEnabled: `boolean`; isMaxSlippageLoading: `boolean` } | { slippage: `'auto'`; isInfiniteAllowance: `false`; isMultiAssetWithdrawalEnabled: `true`; isMaxSlippageLoading: `false` } | Panel settings |
87
+ > | `type` | 'deposit' \| 'withdraw' | `'deposit'` | Trading type |
88
+ > | `input` | { sendToken: { address: `Address`; symbol: `string`; value: `string`; decimals: `number`; isLoading?: `boolean` }; receiveToken: { address: `Address`; symbol: `string`; value: `string`; decimals: `number`; isLoading?: `boolean` } } | `poolConfigMap[poolAddress]` | Send/receive tokens pair |
89
+ > | `entryFee` | { deposit: `number`; depositWithCustomCooldown: `number`; } | { deposit: `0`; depositWithCustomCooldown: `0.1` } | Entry fee config map |
90
+ > | `meta` | { approvingStatus?: `'pending' \| 'success'` } | `{}` | Trading meta info |
91
+ > | `modal` | { isOpen: `boolean`; status: `'Success' \| 'None' \| 'Mining' \| 'Wallet'`; action: `'deposit' \| 'withdraw' \| 'approve \| 'oraclesUpdate'`; link?: `string`; sendToken: TradingToken \| null; receiveToken: TradingToken \| null } | `{ isOpen: `false`,status: `'None'`, receiveToken: `null`, sendToken: `null` }` | Trading modal state |
92
+ > | `transactions` | { action: `'deposit' \| 'withdraw' \| 'approve'`; symbol: `string`; chainId: `ChainId`; txHash?: `Address` }[] | `[]` | Pending transactions |
93
+ > | `poolFallbackData` | { address: `Address`; managerLogicAddress?: `Address`; poolCompositions: `PoolComposition[]`; tokenPrice?: `string`; apy?: { value: `number`; currency: `'USD' \| 'ETH'` } } | { address: `AddressZero` } | Current active pool fallback data to override or extend contract's response |
94
+ > | `defaultChainId` | number (optional) | undefined | Chain id that will be returned from useNetwork wagmi hook when connected to unsupported network |
94
95
 
95
96
  ###### Source: `packages/trading-widget/src/core-kit/providers/index.tsx`
96
97
  ###### Default values: `packages/trading-widget/src/core-kit/providers/index.tsx`
@@ -9,7 +9,6 @@ export declare const DEFAULT_RETRIES_NUMBER = 5;
9
9
  export declare const DEFAULT_LOCK_TIME: string;
10
10
  export declare const CUSTOM_LOCK_TIME: string;
11
11
  export declare const DEFAULT_DEPOSIT_LOCKTIME_MAP: Record<PoolDepositMethodName, string>;
12
- export declare const DEFAULT_CHAIN_ID: 10;
13
12
  export declare const EMPTY_POOL_CONFIG: PoolConfig;
14
13
  export declare const DEFAULT_DEPOSIT_METHOD: DepositMethodName;
15
14
  export declare const DEFAULT_WITHDRAW_SLIPPAGE = 3;
@@ -0,0 +1 @@
1
+ export declare const useTradingPanelDefaultChainId: () => number | undefined;
@@ -7,3 +7,4 @@ export { useTradingPanelModal } from './modal';
7
7
  export { useTradingPanelType, useIsDepositTradingPanelType } from './type';
8
8
  export { useTradingPanelTransactions } from './transaction';
9
9
  export { useTradingPanelActions, useTradingPanelState } from './context';
10
+ export { useTradingPanelDefaultChainId } from './default-data';
@@ -32,6 +32,7 @@ export interface TradingPanelState {
32
32
  poolConfigMap: Record<PoolConfig['address'], PoolConfig>;
33
33
  transactions: PendingTransaction[];
34
34
  poolFallbackData: PoolFallbackData;
35
+ defaultChainId?: ChainId;
35
36
  }
36
37
  export interface TradingPanelSetters {
37
38
  setPoolAddress: (payload: TradingPanelState['poolAddress']) => void;