@dhedge/trading-widget 5.8.1 → 5.11.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 +64 -31
- package/complex-withdraw-asset-data-DKDPznHy.cjs +1 -0
- package/{complex-withdraw-asset-data-Cf9Ea0VI.js → complex-withdraw-asset-data-DzhKTztw.js} +119 -144
- package/const.cjs +1 -1
- package/const.js +32 -32
- package/core-kit/const/gmx.d.ts +1 -1
- package/core-kit/const/logger.d.ts +2 -5
- package/core-kit/const/storage.d.ts +0 -1
- package/core-kit/hooks/state/action.d.ts +1 -1
- package/core-kit/hooks/state/aggregators.d.ts +11 -0
- package/core-kit/hooks/state/index.d.ts +1 -0
- package/core-kit/hooks/trading/deposit-v2/deposit-transaction/use-deposit-common.d.ts +1 -1
- package/core-kit/hooks/trading/deposit-v2/use-get-vault-deposit-transaction-arguments.d.ts +1 -1
- package/core-kit/hooks/trading/deposit-v2/use-vault-deposit-tokens.d.ts +5 -1
- package/core-kit/hooks/trading/index.d.ts +0 -1
- package/core-kit/hooks/web3/index.d.ts +0 -1
- package/core-kit/types/state.types.d.ts +1 -1
- package/core-kit/types/trading-panel.types.d.ts +2 -3
- package/core-kit/utils/deposit.d.ts +1 -1
- package/core-kit/utils/index.d.ts +0 -1
- package/{storage-DhvdxqW3.js → gmx-BroDb_q_.js} +157 -161
- package/gmx-CLiWBUH_.cjs +1 -0
- package/index.cjs +1 -1
- package/index.d.ts +5 -3
- package/index.js +6335 -5493
- package/limit-orders/common/network-check-button.d.ts +7 -0
- package/limit-orders/common/network-check-button.hooks.d.ts +4 -0
- package/limit-orders/common/utils.d.ts +2 -0
- package/limit-orders/index.d.ts +9 -5
- package/limit-orders/limit-buys/component/input-group/input-amount-field.d.ts +2 -0
- package/limit-orders/limit-buys/component/input-group/input-amount-field.hooks.d.ts +11 -0
- package/limit-orders/limit-buys/component/input-group/input-group.d.ts +2 -0
- package/limit-orders/limit-buys/component/input-group/input-group.hooks.d.ts +15 -0
- package/limit-orders/limit-buys/component/input-group/slippage-deadline-fields.d.ts +2 -0
- package/limit-orders/limit-buys/component/input-group/slippage-deadline-fields.hooks.d.ts +5 -0
- package/limit-orders/limit-buys/component/input-group/token-select-overlay.d.ts +10 -0
- package/limit-orders/limit-buys/component/limit-buy-button/sign-limit-buy-button.d.ts +6 -0
- package/limit-orders/limit-buys/component/limit-buy-button/sign-limit-buy-button.hooks.d.ts +6 -0
- package/limit-orders/limit-buys/component/limit-buy-content.d.ts +6 -0
- package/limit-orders/limit-buys/component/limit-buy-order-modal.d.ts +14 -0
- package/limit-orders/limit-buys/component/limit-buy-overlay.d.ts +11 -0
- package/limit-orders/limit-buys/component/terms-confirmation.d.ts +8 -0
- package/limit-orders/limit-buys/constants.d.ts +55 -0
- package/limit-orders/limit-buys/hooks/state.d.ts +2 -0
- package/limit-orders/limit-buys/hooks/use-approve-and-sign-limit-buy.d.ts +7 -0
- package/limit-orders/limit-buys/hooks/use-is-permit2-approved.d.ts +1 -0
- package/limit-orders/limit-buys/hooks/use-permit2-approve-transaction.d.ts +5 -0
- package/limit-orders/limit-buys/hooks/use-sign-limit-buy-order.d.ts +3 -0
- package/limit-orders/limit-buys/providers/state-provider/reducer.d.ts +3 -0
- package/limit-orders/limit-buys/providers/state-provider/state-provider.d.ts +6 -0
- package/limit-orders/limit-buys/providers/state-provider/state-provider.types.d.ts +69 -0
- package/limit-orders/limit-buys/providers/translation-provider/index.d.ts +3 -0
- package/limit-orders/limit-buys/providers/translation-provider/translation-provider.d.ts +4 -0
- package/limit-orders/limit-buys/providers/translation-provider/translation-provider.defaults.d.ts +2 -0
- package/limit-orders/limit-buys/providers/translation-provider/translation-provider.hooks.d.ts +1 -0
- package/limit-orders/limit-buys/providers/translation-provider/translation-provider.types.d.ts +29 -0
- package/limit-orders/limit-buys/types.d.ts +27 -0
- package/limit-orders/limit-buys/utils.d.ts +4 -0
- package/limit-orders/{component → limit-sells/component}/input-group/input-group.hooks.d.ts +0 -2
- package/limit-orders/{component → limit-sells/component}/limit-order-button/approve-and-create-limit-order-button.d.ts +1 -0
- package/limit-orders/{component → limit-sells/component}/limit-order-content.d.ts +1 -1
- package/limit-orders/{component → limit-sells/component}/limit-order-overlay.d.ts +3 -3
- package/limit-orders/{component/limit-order-modal.d.ts → limit-sells/component/limit-sell-order-modal.d.ts} +5 -5
- package/limit-orders/limit-sells/component/terms-confirmation.d.ts +8 -0
- package/limit-orders/{constants.d.ts → limit-sells/constants.d.ts} +2 -2
- package/limit-orders/limit-sells/hooks/use-invalidate-limit-sell-order-query.d.ts +1 -0
- package/limit-orders/{hooks → limit-sells/hooks}/use-on-limit-order-settled.d.ts +1 -1
- package/limit-orders/{hooks/use-user-limit-order.d.ts → limit-sells/hooks/use-user-limit-sell-order.d.ts} +3 -3
- package/limit-orders/{providers → limit-sells/providers}/state-provider/reducer.d.ts +1 -1
- package/limit-orders/{providers → limit-sells/providers}/state-provider/state-provider.d.ts +1 -1
- package/limit-orders/{providers → limit-sells/providers}/state-provider/state-provider.types.d.ts +1 -1
- package/limit-orders/{utils.d.ts → limit-sells/utils.d.ts} +3 -3
- package/limit-orders/providers/translation-provider/translation-provider.types.d.ts +1 -0
- package/package.json +1 -1
- package/{derive-BmKPodpX.js → storage-CSc9iE5L.js} +6 -2
- package/storage-DHoO5PX_.cjs +1 -0
- package/style.css +1 -1
- 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 +1 -0
- package/trading-widget/components/widget/widget-buttons/limit-buy-button/limit-buy-button.d.ts +3 -0
- package/trading-widget/components/widget/widget-overlay/hyper-evm-warning-overlay/hyper-evm-warning-overlay.d.ts +3 -0
- package/trading-widget/components/widget/widget-overlay/index.d.ts +2 -0
- package/trading-widget/components/widget/widget-overlay/limit-buys-overlay/limit-buys-overlay.d.ts +3 -0
- package/trading-widget/components/widget/widget-overlay/limit-buys-overlay/limit-buys-overlay.hooks.d.ts +17 -0
- package/trading-widget/components/widget/widget-settings/index.d.ts +0 -1
- package/trading-widget/components/widget/widget-settings/slippage-selector/slippage-selector.hooks.d.ts +1 -1
- package/trading-widget/hooks/index.d.ts +3 -1
- package/trading-widget/hooks/use-display-limit-buy-overlay.d.ts +1 -0
- package/trading-widget/hooks/use-open-limit-buys-overlay.d.ts +4 -0
- package/trading-widget/hooks/use-show-hyper-evm-deposit-warning.d.ts +1 -0
- package/trading-widget/providers/config-provider/config-provider.types.d.ts +3 -0
- package/trading-widget/providers/translation-provider/translation-provider.types.d.ts +7 -5
- package/trading-widget/types/overlay.types.d.ts +2 -0
- package/utils.cjs +1 -1
- package/utils.js +32 -34
- package/complex-withdraw-asset-data-Cmnlgieq.cjs +0 -1
- package/core-kit/hooks/trading/deposit-v2/deposit-transaction/use-batch-approve-transaction.d.ts +0 -141
- package/core-kit/hooks/trading/deposit-v2/deposit-transaction/use-batch-deposit.d.ts +0 -1
- package/core-kit/hooks/trading/trade-handlers/use-batch-trading-settle-handler.d.ts +0 -5
- package/core-kit/hooks/trading/use-is-batch-contract-writes-trading.d.ts +0 -1
- package/core-kit/hooks/web3/use-custom-send-calls.d.ts +0 -14
- package/core-kit/hooks/web3/use-is-batch-contract-writes-supported.d.ts +0 -1
- package/core-kit/utils/batch-transactions.d.ts +0 -2
- package/derive-CsdqSZEg.cjs +0 -1
- package/limit-orders/component/input-group/terms-content.d.ts +0 -6
- package/limit-orders/component/limit-order-button/network-check-button.d.ts +0 -2
- package/limit-orders/component/limit-order-button/network-check-button.hooks.d.ts +0 -4
- package/limit-orders/hooks/use-invalidate-limit-order-query.d.ts +0 -1
- package/storage-Bbr6G6F3.cjs +0 -1
- package/trading-widget/components/deposit/button/batch-trade-button.d.ts +0 -2
- package/trading-widget/components/widget/widget-settings/batch-transactions-switch/batch-transactions-switch.d.ts +0 -2
- package/trading-widget/components/widget/widget-settings/batch-transactions-switch/batch-transactions-switch.hooks.d.ts +0 -1
- package/trading-widget/hooks/use-trading-type-name.d.ts +0 -2
- /package/limit-orders/{component/common → common}/action-button.d.ts +0 -0
- /package/limit-orders/{component/common → common}/asset-price-panel.d.ts +0 -0
- /package/limit-orders/{component/common → common}/modal-content.d.ts +0 -0
- /package/limit-orders/{component/common → common}/modal-dialog.d.ts +0 -0
- /package/limit-orders/{component/common → common}/percentage-input.d.ts +0 -0
- /package/limit-orders/{component/common → common}/price-input.d.ts +0 -0
- /package/limit-orders/{component/common → common}/switch-panel.d.ts +0 -0
- /package/limit-orders/{component → limit-sells/component}/input-group/input-group.d.ts +0 -0
- /package/limit-orders/{component → limit-sells/component}/limit-order-button/approve-and-create-limit-order-button.hooks.d.ts +0 -0
- /package/limit-orders/{component → limit-sells/component}/limit-order-button/limit-order-delete-button.d.ts +0 -0
- /package/limit-orders/{component → limit-sells/component}/limit-order-button/limit-order-delete-button.hooks.d.ts +0 -0
- /package/limit-orders/{component → limit-sells/component}/limit-order-content.hooks.d.ts +0 -0
- /package/limit-orders/{component → limit-sells/component}/limit-order-modal.hooks.d.ts +0 -0
- /package/limit-orders/{hooks → limit-sells/hooks}/state.d.ts +0 -0
- /package/limit-orders/{hooks → limit-sells/hooks}/use-approve-and-create-limit-order.d.ts +0 -0
- /package/limit-orders/{hooks → limit-sells/hooks}/use-create-limit-order-transaction.d.ts +0 -0
- /package/limit-orders/{hooks → limit-sells/hooks}/use-existing-limit-order-default-prices.d.ts +0 -0
- /package/limit-orders/{hooks → limit-sells/hooks}/use-is-limit-order-approved.d.ts +0 -0
- /package/limit-orders/{hooks → limit-sells/hooks}/use-limit-order-approve-transaction.d.ts +0 -0
- /package/limit-orders/{hooks → limit-sells/hooks}/use-limit-order-covered-vault-amount.d.ts +0 -0
- /package/limit-orders/{hooks → limit-sells/hooks}/use-listen-limit-order-execution.d.ts +0 -0
package/limit-orders/index.d.ts
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
1
|
+
export { LimitSellOrderModal } from './limit-sells/component/limit-sell-order-modal';
|
|
2
|
+
export { useUserLimitSellOrder } from './limit-sells/hooks/use-user-limit-sell-order';
|
|
3
|
+
export { useInvalidateLimitSellOrderQuery } from './limit-sells/hooks/use-invalidate-limit-sell-order-query';
|
|
4
|
+
export { LIMIT_SELL_ORDER_READ_FUNCTION_NAME, GET_ALL_LIMIT_SELL_ORDER_IDS_FUNCTION_NAME, } from './limit-sells/constants';
|
|
5
|
+
export { getLimitSellOrderId } from './limit-sells/utils';
|
|
6
|
+
export { LimitBuyOrderModal } from './limit-buys/component/limit-buy-order-modal';
|
|
7
|
+
export { LimitBuyOverlay } from './limit-buys/component/limit-buy-overlay';
|
|
8
|
+
export type { LimitBuyOverlayProps } from './limit-buys/component/limit-buy-overlay';
|
|
9
|
+
export type { SignedLimitBuyOrder, LimitBuyCallbacks, } from './limit-buys/types';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { LimitBuyInputToken } from '../../../limit-buys/providers/state-provider/state-provider.types';
|
|
2
|
+
export declare const useInputAmountField: () => {
|
|
3
|
+
inputAmount: string;
|
|
4
|
+
handleInputAmountChange: (value: string) => void;
|
|
5
|
+
inputToken: LimitBuyInputToken;
|
|
6
|
+
depositTokens: LimitBuyInputToken[];
|
|
7
|
+
handleInputTokenChange: (token: LimitBuyInputToken) => void;
|
|
8
|
+
tokenBalance: string;
|
|
9
|
+
inputAmountLabel: string;
|
|
10
|
+
balanceLabel: string;
|
|
11
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const useLimitBuyInputGroup: () => {
|
|
2
|
+
upperLimitPrice: string;
|
|
3
|
+
lowerLimitPrice: string;
|
|
4
|
+
setUpperLimitPrice: (payload: string) => void;
|
|
5
|
+
setLowerLimitPrice: (payload: string) => void;
|
|
6
|
+
onDisableUpperLimitPrice: () => void;
|
|
7
|
+
onDisableLowerLimitPrice: () => void;
|
|
8
|
+
pricingAssetPrice: string | null;
|
|
9
|
+
pricingAssetSymbol: string;
|
|
10
|
+
inputSuffix: string;
|
|
11
|
+
upperLimitLabel: string;
|
|
12
|
+
upperLimitSubtitle: string;
|
|
13
|
+
lowerLimitLabel: string;
|
|
14
|
+
lowerLimitSubtitle: string;
|
|
15
|
+
};
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import type { LimitBuyInputToken } from '../../../limit-buys/providers/state-provider/state-provider.types';
|
|
3
|
+
interface TokenSelectOverlayProps {
|
|
4
|
+
depositTokens: LimitBuyInputToken[];
|
|
5
|
+
activeAddress: string;
|
|
6
|
+
onSelect: (token: LimitBuyInputToken) => void;
|
|
7
|
+
onClose: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare const TokenSelectOverlay: FC<TokenSelectOverlayProps>;
|
|
10
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { FC, ReactNode } from 'react';
|
|
2
|
+
import type { LimitBuyState } from '../../limit-buys/providers/state-provider/state-provider.types';
|
|
3
|
+
import type { LimitBuyTranslationProviderProps } from '../../limit-buys/providers/translation-provider';
|
|
4
|
+
import type { LimitBuyCallbacks } from '../../limit-buys/types';
|
|
5
|
+
import type { ThemeProviderConfigProps } from '../../providers/theme-provider';
|
|
6
|
+
export type LimitBuyOrderModalProps = {
|
|
7
|
+
translation?: LimitBuyTranslationProviderProps['config'];
|
|
8
|
+
children: (args: {
|
|
9
|
+
onClick: () => void;
|
|
10
|
+
}) => ReactNode;
|
|
11
|
+
actions: LimitBuyCallbacks;
|
|
12
|
+
themeConfig?: ThemeProviderConfigProps;
|
|
13
|
+
} & Pick<LimitBuyState, 'vaultAddress' | 'vaultChainId' | 'pricingAsset' | 'limitBuyManagerAddress'>;
|
|
14
|
+
export declare const LimitBuyOrderModal: FC<LimitBuyOrderModalProps>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { FC } from 'react';
|
|
2
|
+
import type { LimitBuyState } from '../../limit-buys/providers/state-provider/state-provider.types';
|
|
3
|
+
import type { LimitBuyTranslationProviderProps } from '../../limit-buys/providers/translation-provider';
|
|
4
|
+
import type { LimitBuyCallbacks } from '../../limit-buys/types';
|
|
5
|
+
import type { ThemeProviderConfigProps } from '../../providers/theme-provider';
|
|
6
|
+
export type LimitBuyOverlayProps = {
|
|
7
|
+
translation?: LimitBuyTranslationProviderProps['config'];
|
|
8
|
+
actions: LimitBuyCallbacks;
|
|
9
|
+
themeConfig?: ThemeProviderConfigProps;
|
|
10
|
+
} & Pick<LimitBuyState, 'vaultAddress' | 'vaultChainId' | 'pricingAsset' | 'depositTokens' | 'limitBuyManagerAddress'>;
|
|
11
|
+
export declare const LimitBuyOverlay: FC<LimitBuyOverlayProps>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import type { Address, ChainId } from '../../core-kit/types';
|
|
2
|
+
export declare const PERMIT2_ADDRESS: "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
3
|
+
export declare const DEFAULT_LIMIT_BUY_SLIPPAGE_BPS = 100;
|
|
4
|
+
export declare const DEFAULT_LIMIT_BUY_DEADLINE_DAYS = 28;
|
|
5
|
+
export declare const MIN_SLIPPAGE_BPS = 1;
|
|
6
|
+
export declare const MAX_SLIPPAGE_BPS = 500;
|
|
7
|
+
export declare const LIMIT_BUY_SLIPPAGE_PERCENT_DECIMALS = 2;
|
|
8
|
+
export declare const PRICE_SMALL_THRESHOLD = 1;
|
|
9
|
+
export declare const PRICE_SMALL_MAX_FRACTION_DIGITS = 5;
|
|
10
|
+
export declare const PRICE_DEFAULT_MAX_FRACTION_DIGITS = 2;
|
|
11
|
+
export declare const LIMIT_BUY_MANAGER_ADDRESS_MAP: Partial<Record<ChainId, Address>>;
|
|
12
|
+
export declare const EIP712_TYPES: {
|
|
13
|
+
readonly PermitWitnessTransferFrom: readonly [{
|
|
14
|
+
readonly name: "permitted";
|
|
15
|
+
readonly type: "TokenPermissions";
|
|
16
|
+
}, {
|
|
17
|
+
readonly name: "spender";
|
|
18
|
+
readonly type: "address";
|
|
19
|
+
}, {
|
|
20
|
+
readonly name: "nonce";
|
|
21
|
+
readonly type: "uint256";
|
|
22
|
+
}, {
|
|
23
|
+
readonly name: "deadline";
|
|
24
|
+
readonly type: "uint256";
|
|
25
|
+
}, {
|
|
26
|
+
readonly name: "witness";
|
|
27
|
+
readonly type: "LimitBuyOrder";
|
|
28
|
+
}];
|
|
29
|
+
readonly TokenPermissions: readonly [{
|
|
30
|
+
readonly name: "token";
|
|
31
|
+
readonly type: "address";
|
|
32
|
+
}, {
|
|
33
|
+
readonly name: "amount";
|
|
34
|
+
readonly type: "uint256";
|
|
35
|
+
}];
|
|
36
|
+
readonly LimitBuyOrder: readonly [{
|
|
37
|
+
readonly name: "owner";
|
|
38
|
+
readonly type: "address";
|
|
39
|
+
}, {
|
|
40
|
+
readonly name: "targetVault";
|
|
41
|
+
readonly type: "address";
|
|
42
|
+
}, {
|
|
43
|
+
readonly name: "pricingAsset";
|
|
44
|
+
readonly type: "address";
|
|
45
|
+
}, {
|
|
46
|
+
readonly name: "minTriggerPriceD18";
|
|
47
|
+
readonly type: "uint256";
|
|
48
|
+
}, {
|
|
49
|
+
readonly name: "maxTriggerPriceD18";
|
|
50
|
+
readonly type: "uint256";
|
|
51
|
+
}, {
|
|
52
|
+
readonly name: "slippageToleranceBps";
|
|
53
|
+
readonly type: "uint16";
|
|
54
|
+
}];
|
|
55
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type ApproveAndSignState = 'idle' | 'approving' | 'waiting-confirmation' | 'signing';
|
|
2
|
+
export declare const useApproveAndSignLimitBuy: () => {
|
|
3
|
+
approveAndSign: () => Promise<void>;
|
|
4
|
+
isLoading: boolean;
|
|
5
|
+
flowState: ApproveAndSignState;
|
|
6
|
+
needsApproval: boolean;
|
|
7
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useIsPermit2Approved: () => boolean;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { LimitBuyAction, LimitBuyState } from '../../../limit-buys/providers/state-provider/state-provider.types';
|
|
2
|
+
export declare const DEFAULT_FORM_DATA: LimitBuyState['form'];
|
|
3
|
+
export declare const reducer: (state: LimitBuyState, action: LimitBuyAction) => LimitBuyState;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { FC, PropsWithChildren } from 'react';
|
|
2
|
+
import type { LimitBuyActionsState, LimitBuyContextConfig, LimitBuyState } from '../../../limit-buys/providers/state-provider/state-provider.types';
|
|
3
|
+
export declare const getDefaultLimitBuyState: (config: LimitBuyContextConfig['initialState']) => LimitBuyState;
|
|
4
|
+
export declare const LimitBuyStateContext: import("react").Context<LimitBuyState>;
|
|
5
|
+
export declare const LimitBuyActionsContext: import("react").Context<LimitBuyActionsState>;
|
|
6
|
+
export declare const LimitBuyStateProvider: FC<PropsWithChildren<LimitBuyContextConfig>>;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import type { Address } from 'viem';
|
|
2
|
+
import type { LimitBuyCallbacks } from '../../../limit-buys/types';
|
|
3
|
+
export interface LimitBuyInputToken {
|
|
4
|
+
address: Address;
|
|
5
|
+
symbol: string;
|
|
6
|
+
decimals: number;
|
|
7
|
+
}
|
|
8
|
+
export interface LimitBuyState {
|
|
9
|
+
vaultAddress: Address;
|
|
10
|
+
vaultChainId: number;
|
|
11
|
+
limitBuyManagerAddress: Address;
|
|
12
|
+
pricingAsset: {
|
|
13
|
+
address: Address;
|
|
14
|
+
symbol: string;
|
|
15
|
+
};
|
|
16
|
+
form: {
|
|
17
|
+
upperLimitPrice: string;
|
|
18
|
+
lowerLimitPrice: string;
|
|
19
|
+
inputAmount: string;
|
|
20
|
+
slippageBps: string;
|
|
21
|
+
deadlineDays: string;
|
|
22
|
+
termsAccepted: boolean;
|
|
23
|
+
};
|
|
24
|
+
depositTokens: LimitBuyInputToken[];
|
|
25
|
+
inputToken: LimitBuyInputToken;
|
|
26
|
+
isSubmitting: boolean;
|
|
27
|
+
}
|
|
28
|
+
export type LimitBuyActionsState = LimitBuyCallbacks & {
|
|
29
|
+
setUpperLimitPrice: (payload: string) => void;
|
|
30
|
+
setLowerLimitPrice: (payload: string) => void;
|
|
31
|
+
setInputAmount: (payload: string) => void;
|
|
32
|
+
setSlippageBps: (payload: string) => void;
|
|
33
|
+
setDeadlineDays: (payload: string) => void;
|
|
34
|
+
setTermsAccepted: (payload: boolean) => void;
|
|
35
|
+
setInputToken: (payload: LimitBuyState['inputToken']) => void;
|
|
36
|
+
setIsSubmitting: (payload: boolean) => void;
|
|
37
|
+
reset: () => void;
|
|
38
|
+
};
|
|
39
|
+
export type LimitBuyAction = {
|
|
40
|
+
type: 'SET_UPPER_LIMIT_PRICE';
|
|
41
|
+
payload: string;
|
|
42
|
+
} | {
|
|
43
|
+
type: 'SET_LOWER_LIMIT_PRICE';
|
|
44
|
+
payload: string;
|
|
45
|
+
} | {
|
|
46
|
+
type: 'SET_INPUT_AMOUNT';
|
|
47
|
+
payload: string;
|
|
48
|
+
} | {
|
|
49
|
+
type: 'SET_SLIPPAGE_BPS';
|
|
50
|
+
payload: string;
|
|
51
|
+
} | {
|
|
52
|
+
type: 'SET_DEADLINE_DAYS';
|
|
53
|
+
payload: string;
|
|
54
|
+
} | {
|
|
55
|
+
type: 'SET_TERMS_ACCEPTED';
|
|
56
|
+
payload: boolean;
|
|
57
|
+
} | {
|
|
58
|
+
type: 'SET_INPUT_TOKEN';
|
|
59
|
+
payload: LimitBuyState['inputToken'];
|
|
60
|
+
} | {
|
|
61
|
+
type: 'SET_IS_SUBMITTING';
|
|
62
|
+
payload: boolean;
|
|
63
|
+
} | {
|
|
64
|
+
type: 'RESET';
|
|
65
|
+
};
|
|
66
|
+
export interface LimitBuyContextConfig {
|
|
67
|
+
initialState: Pick<LimitBuyState, 'vaultAddress' | 'vaultChainId' | 'pricingAsset' | 'depositTokens' | 'limitBuyManagerAddress'>;
|
|
68
|
+
actions: LimitBuyCallbacks;
|
|
69
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { useLimitBuyTranslationContext } from '../../../limit-buys/providers/translation-provider/translation-provider.hooks';
|
|
2
|
+
export { LimitBuyTranslationProvider } from '../../../limit-buys/providers/translation-provider/translation-provider';
|
|
3
|
+
export * from '../../../limit-buys/providers/translation-provider/translation-provider.types';
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { FC, PropsWithChildren } from 'react';
|
|
2
|
+
import type { LimitBuyTranslationProviderProps } from '../../../limit-buys/providers/translation-provider/translation-provider.types';
|
|
3
|
+
export declare const LimitBuyTranslationProviderContext: import("react").Context<Required<Partial<import('../../../limit-buys/providers/translation-provider/translation-provider.types').LimitBuyTranslationMap> | undefined>>;
|
|
4
|
+
export declare const LimitBuyTranslationProvider: FC<PropsWithChildren<LimitBuyTranslationProviderProps>>;
|
package/limit-orders/limit-buys/providers/translation-provider/translation-provider.hooks.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useLimitBuyTranslationContext: () => Required<Partial<import("./translation-provider.types").LimitBuyTranslationMap>>;
|
package/limit-orders/limit-buys/providers/translation-provider/translation-provider.types.d.ts
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export type LimitBuyTermsKey = 'termsPoint1' | 'termsPoint2' | 'termsPoint3';
|
|
2
|
+
type LimitBuyTermsMap = {
|
|
3
|
+
[key in LimitBuyTermsKey]: string;
|
|
4
|
+
};
|
|
5
|
+
export type LimitBuyTranslationMap = {
|
|
6
|
+
switchNetwork: string;
|
|
7
|
+
limitBuyTitle: string;
|
|
8
|
+
upperLimitLabel: string;
|
|
9
|
+
upperLimitSubtitle: string;
|
|
10
|
+
lowerLimitLabel: string;
|
|
11
|
+
lowerLimitSubtitle: string;
|
|
12
|
+
inputAmountLabel: string;
|
|
13
|
+
slippageLabel: string;
|
|
14
|
+
deadlineLabel: string;
|
|
15
|
+
deadlineDaysSuffix: string;
|
|
16
|
+
price: string;
|
|
17
|
+
limitBuyTerms: string;
|
|
18
|
+
acceptTerms: string;
|
|
19
|
+
signAndSubmit: string;
|
|
20
|
+
approvePermit2Step: string;
|
|
21
|
+
signOrderStep: string;
|
|
22
|
+
balanceLabel: string;
|
|
23
|
+
cancel: string;
|
|
24
|
+
[key: string]: string;
|
|
25
|
+
} & LimitBuyTermsMap;
|
|
26
|
+
export interface LimitBuyTranslationProviderProps {
|
|
27
|
+
config?: Partial<LimitBuyTranslationMap>;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Address } from '../../core-kit/types';
|
|
2
|
+
export interface LimitBuyOrder {
|
|
3
|
+
owner: Address;
|
|
4
|
+
targetVault: Address;
|
|
5
|
+
pricingAsset: Address;
|
|
6
|
+
minTriggerPriceD18: bigint;
|
|
7
|
+
maxTriggerPriceD18: bigint;
|
|
8
|
+
slippageToleranceBps: number;
|
|
9
|
+
}
|
|
10
|
+
export interface SignedLimitBuyOrder {
|
|
11
|
+
order: LimitBuyOrder;
|
|
12
|
+
permit: {
|
|
13
|
+
token: Address;
|
|
14
|
+
amount: string;
|
|
15
|
+
nonce: string;
|
|
16
|
+
deadline: number;
|
|
17
|
+
};
|
|
18
|
+
owner: Address;
|
|
19
|
+
signature: string;
|
|
20
|
+
chainId: number;
|
|
21
|
+
}
|
|
22
|
+
export interface LimitBuyCallbacks {
|
|
23
|
+
onSubmitOrder: (signedOrder: SignedLimitBuyOrder) => Promise<void>;
|
|
24
|
+
onOrderCreated?: () => void;
|
|
25
|
+
onOrderError?: (error: Error) => void;
|
|
26
|
+
onLog?: (eventName: string, payload?: Record<string, unknown>) => void;
|
|
27
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
/** Generate a random nonce for Permit2 (fits in uint48). */
|
|
2
|
+
export declare const generatePermit2Nonce: () => bigint;
|
|
3
|
+
/** Convert a number of days from now to a Unix timestamp (seconds). */
|
|
4
|
+
export declare const daysFromNowToTimestamp: (days: number | string) => number;
|
|
@@ -8,8 +8,6 @@ export declare const useInputGroup: () => {
|
|
|
8
8
|
onDisableUpperLimitPrice: () => void;
|
|
9
9
|
onDisableLowerLimitPrice: () => void;
|
|
10
10
|
onDisableSellPercentage: () => void;
|
|
11
|
-
termsAccepted: boolean;
|
|
12
|
-
setTermsAccepted: (payload: boolean) => void;
|
|
13
11
|
pricingAssetPrice: string | null;
|
|
14
12
|
upperLimitPriceDifference: string;
|
|
15
13
|
lowerLimitPriceDifference: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { FC } from 'react';
|
|
2
|
-
import type { LimitOrderCallbacks, LimitOrderState } from '
|
|
3
|
-
import type { ThemeProviderConfigProps } from '
|
|
4
|
-
import type { TranslationProviderProps } from '
|
|
2
|
+
import type { LimitOrderCallbacks, LimitOrderState } from '../../limit-sells/providers/state-provider/state-provider.types';
|
|
3
|
+
import type { ThemeProviderConfigProps } from '../../providers/theme-provider';
|
|
4
|
+
import type { TranslationProviderProps } from '../../providers/translation-provider';
|
|
5
5
|
export type LimitOrderOverlayProps = {
|
|
6
6
|
translation?: TranslationProviderProps['config'];
|
|
7
7
|
actions?: LimitOrderCallbacks;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import type { FC, ReactNode } from 'react';
|
|
2
|
-
import type { LimitOrderCallbacks, LimitOrderState } from '
|
|
3
|
-
import type { ThemeProviderConfigProps } from '
|
|
4
|
-
import type { TranslationProviderProps } from '
|
|
5
|
-
export type
|
|
2
|
+
import type { LimitOrderCallbacks, LimitOrderState } from '../../limit-sells/providers/state-provider/state-provider.types';
|
|
3
|
+
import type { ThemeProviderConfigProps } from '../../providers/theme-provider';
|
|
4
|
+
import type { TranslationProviderProps } from '../../providers/translation-provider';
|
|
5
|
+
export type LimitSellOrderModalProps = {
|
|
6
6
|
translation?: TranslationProviderProps['config'];
|
|
7
7
|
children: (args: {
|
|
8
8
|
onClick: () => void;
|
|
@@ -11,4 +11,4 @@ export type LimitOrderModalProps = {
|
|
|
11
11
|
actions?: LimitOrderCallbacks;
|
|
12
12
|
themeConfig?: ThemeProviderConfigProps;
|
|
13
13
|
} & Pick<LimitOrderState, 'vaultAddress' | 'vaultChainId' | 'pricingAsset'> & Partial<Pick<LimitOrderState, 'minAmountInUsd' | 'isModalOpen'>>;
|
|
14
|
-
export declare const
|
|
14
|
+
export declare const LimitSellOrderModal: FC<LimitSellOrderModalProps>;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export declare const
|
|
2
|
-
export declare const
|
|
1
|
+
export declare const LIMIT_SELL_ORDER_READ_FUNCTION_NAME = "limitOrders";
|
|
2
|
+
export declare const GET_ALL_LIMIT_SELL_ORDER_IDS_FUNCTION_NAME = "getAllLimitOrderIds";
|
|
3
3
|
export declare const DEFAULT_MIN_ORDER_AMOUNT = 0;
|
|
4
4
|
export declare const DEFAULT_SELL_PERCENTAGE = "100";
|
|
5
5
|
export declare const PRICE_SMALL_THRESHOLD = 1;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const useInvalidateLimitSellOrderQuery: () => () => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import type { OnLimitOrderSettled, PendingTransaction } from '
|
|
1
|
+
import type { OnLimitOrderSettled, PendingTransaction } from '../../limit-sells/providers/state-provider/state-provider.types';
|
|
2
2
|
export declare const useOnLimitOrderSettled: (action: PendingTransaction['action']) => OnLimitOrderSettled;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import type { UseReadContractReturnType } from 'wagmi';
|
|
2
|
-
import type { Address } from '
|
|
3
|
-
interface
|
|
2
|
+
import type { Address } from '../../../core-kit/types';
|
|
3
|
+
interface UseUserLimitSellOrderParams {
|
|
4
4
|
vaultAddress: Address;
|
|
5
5
|
userAddress: Address;
|
|
6
6
|
chainId: number;
|
|
7
7
|
}
|
|
8
|
-
export declare const
|
|
8
|
+
export declare const useUserLimitSellOrder: ({ chainId, userAddress, vaultAddress, }: UseUserLimitSellOrderParams) => UseReadContractReturnType<readonly [{
|
|
9
9
|
readonly inputs: readonly [];
|
|
10
10
|
readonly name: "ExternalCallerNotAllowed";
|
|
11
11
|
readonly type: "error";
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { LimitOrderAction, LimitOrderState } from '
|
|
1
|
+
import type { LimitOrderAction, LimitOrderState } from '../../../limit-sells/providers/state-provider/state-provider.types';
|
|
2
2
|
export declare const DEFAULT_FORM_DATA: {
|
|
3
3
|
upperLimitPrice: string;
|
|
4
4
|
lowerLimitPrice: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { FC, PropsWithChildren } from 'react';
|
|
2
|
-
import type { LimitOrderActionsState, LimitOrderContextConfig, LimitOrderState } from '
|
|
2
|
+
import type { LimitOrderActionsState, LimitOrderContextConfig, LimitOrderState } from '../../../limit-sells/providers/state-provider/state-provider.types';
|
|
3
3
|
export declare const getDefaultLimitOrderState: (config: LimitOrderContextConfig['initialState']) => LimitOrderState;
|
|
4
4
|
export declare const LimitOrderStateContext: import("react").Context<LimitOrderState>;
|
|
5
5
|
export declare const LimitOrderActionsContext: import("react").Context<LimitOrderActionsState>;
|
package/limit-orders/{providers → limit-sells/providers}/state-provider/state-provider.types.d.ts
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Address, Hash } from 'viem';
|
|
2
|
-
import type { UseWriteContractParameters } from '
|
|
2
|
+
import type { UseWriteContractParameters } from '../../../../core-kit/types/web3.types';
|
|
3
3
|
export type PendingTransaction = {
|
|
4
4
|
hash: Hash;
|
|
5
5
|
action: 'approve' | 'create' | 'remove';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Address } from '
|
|
2
|
-
import type { TranslationMap } from '
|
|
3
|
-
export declare const
|
|
1
|
+
import type { Address } from '../../core-kit/types';
|
|
2
|
+
import type { TranslationMap } from '../providers/translation-provider';
|
|
3
|
+
export declare const getLimitSellOrderId: ({ userAddress, vaultAddress, }: {
|
|
4
4
|
userAddress: Address;
|
|
5
5
|
vaultAddress: Address;
|
|
6
6
|
}) => `0x${string}`;
|
package/package.json
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const E=new Set(["0x2fbadd08ade2e8a24cf1fe3a58fe918336b39a72"]),_={REFERRER:"referrer",REF_POOL:"ref_pool"};exports.COVERED_CALL_VAULT_ADDRESSES=E;exports.LOCAL_STORAGE_KEYS=_;
|