@dodoex/widgets 3.0.2-bartio.1 → 3.0.2-bartio.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/dist/cjs/locales/en-US.js +1 -1
- package/dist/cjs/locales/zh-CN.js +1 -1
- package/dist/{helper-TYi75VBP.js → helper-BhZWILyg.js} +1 -1
- package/dist/{helper-DKeGoo7f.cjs → helper-D6LlnQ1M.cjs} +1 -1
- package/dist/{index-DfAUT_X8.cjs → index-7x0JpwJJ.cjs} +1 -1
- package/dist/index-BduZdyfz.cjs +31 -0
- package/dist/{index-Bl0iIGn3.js → index-CAmXGIvF.js} +1 -1
- package/dist/{index-DAMt9CI-.cjs → index-DDsCP5_a.cjs} +1 -1
- package/dist/index-Dl7FV9-C.js +31 -0
- package/dist/{index-tcJHVTUx.js → index-h5hit_bx.js} +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/locales/en-US.js +1 -1
- package/dist/locales/zh-CN.js +1 -1
- package/dist/types/components/Swap/components/TokenCard/NumberInput.d.ts +1 -0
- package/dist/types/components/Swap/components/TokenCard/index.d.ts +5 -2
- package/dist/types/constants/address.d.ts +1 -0
- package/dist/types/hooks/Submission/types.d.ts +4 -0
- package/dist/types/hooks/usePoolTokenSort.d.ts +24 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/providers/useInitContractRequest.d.ts +2 -1
- package/dist/types/router/types.d.ts +2 -1
- package/dist/types/utils/address.d.ts +35 -0
- package/dist/types/utils/fractions/fraction.d.ts +24 -0
- package/dist/types/utils/fractions/index.d.ts +3 -0
- package/dist/types/utils/fractions/percent.d.ts +14 -0
- package/dist/types/utils/fractions/price.d.ts +29 -0
- package/dist/types/utils/fractions/types.d.ts +7 -0
- package/dist/types/widgets/PoolWidget/AMMV3/sdks/sdk-core/addresses.d.ts +8 -0
- package/dist/types/widgets/PoolWidget/AMMV3/sdks/v3-sdk/constants.d.ts +11 -2
- package/dist/types/widgets/PoolWidget/Algebra/AddLiquidity.d.ts +8 -0
- package/dist/types/widgets/PoolWidget/Algebra/AlgebraPositionManage.d.ts +11 -0
- package/dist/types/widgets/PoolWidget/Algebra/components/Badge/RangeBadge.d.ts +4 -0
- package/dist/types/widgets/PoolWidget/Algebra/components/ClaimButton.d.ts +8 -0
- package/dist/types/widgets/PoolWidget/Algebra/components/InRangeDot.d.ts +4 -0
- package/dist/types/widgets/PoolWidget/Algebra/components/InputStepCounter.d.ts +16 -0
- package/dist/types/widgets/PoolWidget/Algebra/components/LiquidityChartRangeInput/Area.d.ts +10 -0
- package/dist/types/widgets/PoolWidget/Algebra/components/LiquidityChartRangeInput/AxisBottom.d.ts +6 -0
- package/dist/types/widgets/PoolWidget/Algebra/components/LiquidityChartRangeInput/Brush.d.ts +13 -0
- package/dist/types/widgets/PoolWidget/Algebra/components/LiquidityChartRangeInput/Chart.d.ts +2 -0
- package/dist/types/widgets/PoolWidget/Algebra/components/LiquidityChartRangeInput/Line.d.ts +6 -0
- package/dist/types/widgets/PoolWidget/Algebra/components/LiquidityChartRangeInput/Zoom.d.ts +12 -0
- package/dist/types/widgets/PoolWidget/Algebra/components/LiquidityChartRangeInput/hooks.d.ts +12 -0
- package/dist/types/widgets/PoolWidget/Algebra/components/LiquidityChartRangeInput/index.d.ts +17 -0
- package/dist/types/widgets/PoolWidget/Algebra/components/LiquidityChartRangeInput/svg.d.ts +22 -0
- package/dist/types/widgets/PoolWidget/Algebra/components/LiquidityChartRangeInput/types.d.ts +50 -0
- package/dist/types/widgets/PoolWidget/Algebra/components/LiquidityChartRangeInput/usePrevious.d.ts +1 -0
- package/dist/types/widgets/PoolWidget/Algebra/components/LiquidityChartRangeInput/utils.d.ts +14 -0
- package/dist/types/widgets/PoolWidget/Algebra/components/MyLiquidity.d.ts +10 -0
- package/dist/types/widgets/PoolWidget/Algebra/components/PositionPreview.d.ts +14 -0
- package/dist/types/widgets/PoolWidget/Algebra/components/PositionSelectedRangePreview.d.ts +11 -0
- package/dist/types/widgets/PoolWidget/Algebra/components/RangeSelector.d.ts +20 -0
- package/dist/types/widgets/PoolWidget/Algebra/components/RateToggle.d.ts +9 -0
- package/dist/types/widgets/PoolWidget/Algebra/components/RemoveButton.d.ts +10 -0
- package/dist/types/widgets/PoolWidget/Algebra/components/ReviewModal.d.ts +18 -0
- package/dist/types/widgets/PoolWidget/Algebra/components/TokenAndEtherscan.d.ts +4 -0
- package/dist/types/widgets/PoolWidget/Algebra/components/TokenPairSelect.d.ts +7 -0
- package/dist/types/widgets/PoolWidget/Algebra/components/shared.d.ts +4 -0
- package/dist/types/widgets/PoolWidget/Algebra/components/widgets.d.ts +56 -0
- package/dist/types/widgets/PoolWidget/Algebra/constants/misc.d.ts +17 -0
- package/dist/types/widgets/PoolWidget/Algebra/hooks/useAddAlgebraLiquidity.d.ts +15 -0
- package/dist/types/widgets/PoolWidget/Algebra/hooks/useAlgebraAmounts.d.ts +19 -0
- package/dist/types/widgets/PoolWidget/Algebra/hooks/useAlgebraPair.d.ts +59 -0
- package/dist/types/widgets/PoolWidget/Algebra/hooks/useAlgebraPositionFees.d.ts +13 -0
- package/dist/types/widgets/PoolWidget/Algebra/hooks/useClaimAlgebraFees.d.ts +12 -0
- package/dist/types/widgets/PoolWidget/Algebra/hooks/useContract.d.ts +2 -0
- package/dist/types/widgets/PoolWidget/Algebra/hooks/useFetchPositionFromTokenId.d.ts +295 -0
- package/dist/types/widgets/PoolWidget/Algebra/hooks/useFetchPositions.d.ts +23 -0
- package/dist/types/widgets/PoolWidget/Algebra/hooks/usePoolTickData.d.ts +20 -0
- package/dist/types/widgets/PoolWidget/Algebra/hooks/usePools.d.ts +22 -0
- package/dist/types/widgets/PoolWidget/Algebra/hooks/useRemoveAlgebraLiquidity.d.ts +14 -0
- package/dist/types/widgets/PoolWidget/Algebra/hooks/useSetRange.d.ts +32 -0
- package/dist/types/widgets/PoolWidget/Algebra/hooks/useSwapTaxes.d.ts +5 -0
- package/dist/types/widgets/PoolWidget/Algebra/hooks/useV3MintActionHandlers.d.ts +11 -0
- package/dist/types/widgets/PoolWidget/Algebra/hooks/useV3PositionFees.d.ts +8 -0
- package/dist/types/widgets/PoolWidget/Algebra/hooks/useV3Positions.d.ts +13 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/sdk-core/addresses.d.ts +12 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/sdk-core/chains.d.ts +4 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/sdk-core/constants.d.ts +12 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/sdk-core/entities/baseCurrency.d.ts +49 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/sdk-core/entities/currency.d.ts +3 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/sdk-core/entities/fractions/currencyAmount.d.ts +32 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/sdk-core/entities/fractions/fraction.d.ts +24 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/sdk-core/entities/fractions/index.d.ts +4 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/sdk-core/entities/fractions/percent.d.ts +14 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/sdk-core/entities/fractions/price.d.ts +38 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/sdk-core/entities/index.d.ts +4 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/sdk-core/entities/nativeCurrency.d.ts +16 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/sdk-core/entities/nativeCurrencyClass.d.ts +8 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/sdk-core/entities/token.d.ts +48 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/sdk-core/index.d.ts +5 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/sdk-core/utils/computePriceImpact.d.ts +8 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/sdk-core/utils/index.d.ts +4 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/sdk-core/utils/sortedInsert.d.ts +1 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/sdk-core/utils/sqrt.d.ts +7 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/sdk-core/utils/validateAndParseAddress.d.ts +10 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/constants.d.ts +23 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/entities/index.d.ts +7 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/entities/pool.d.ts +81 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/entities/position.d.ts +131 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/entities/route.d.ts +26 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/entities/tick.d.ts +13 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/entities/tickDataProvider.d.ts +31 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/entities/tickListDataProvider.d.ts +15 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/entities/trade.d.ts +220 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/index.d.ts +10 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/internalConstants.d.ts +6 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/multicall.d.ts +10 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/nonfungiblePositionManager.d.ts +159 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/payments.d.ts +24 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/quoter.d.ts +37 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/selfPermit.d.ts +25 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/staker.d.ts +101 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/swapRouter.d.ts +51 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/utils/calldata.d.ts +20 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/utils/computePoolAddress.d.ts +21 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/utils/encodeRouteToPath.d.ts +8 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/utils/encodeSqrtRatioX96.d.ts +9 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/utils/fullMath.d.ts +8 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/utils/index.d.ts +18 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/utils/isSorted.d.ts +7 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/utils/liquidityMath.d.ts +8 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/utils/maxLiquidityForAmounts.d.ts +14 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/utils/mostSignificantBit.d.ts +2 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/utils/nearestUsableTick.d.ts +6 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/utils/position.d.ts +8 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/utils/priceTickConversions.d.ts +15 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/utils/sqrtPriceMath.d.ts +13 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/utils/swapMath.d.ts +9 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/utils/tickLibrary.d.ts +14 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/utils/tickList.d.ts +23 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/utils/tickMath.d.ts +34 -0
- package/dist/types/widgets/PoolWidget/Algebra/sdks/v3-sdk/utils/v3swap.d.ts +8 -0
- package/dist/types/widgets/PoolWidget/Algebra/types/position.d.ts +18 -0
- package/dist/types/widgets/PoolWidget/Algebra/types.d.ts +10 -0
- package/dist/types/widgets/PoolWidget/Algebra/utils/calldata.d.ts +7 -0
- package/dist/types/widgets/PoolWidget/Algebra/utils/computeSurroundingTicks.d.ts +4 -0
- package/dist/types/widgets/PoolWidget/Algebra/utils/constants.d.ts +7 -0
- package/dist/types/widgets/PoolWidget/Algebra/utils/encodeSqrtRatioX96.d.ts +9 -0
- package/dist/types/widgets/PoolWidget/Algebra/utils/formatTickPrice.d.ts +1 -0
- package/dist/types/widgets/PoolWidget/Algebra/utils/fullMath.d.ts +8 -0
- package/dist/types/widgets/PoolWidget/Algebra/utils/getPositionAmount.d.ts +37 -0
- package/dist/types/widgets/PoolWidget/Algebra/utils/getPositionAmountWithSlippage.d.ts +22 -0
- package/dist/types/widgets/PoolWidget/Algebra/utils/getTickToPrice.d.ts +18 -0
- package/dist/types/widgets/PoolWidget/Algebra/utils/maxLiquidityForAmounts.d.ts +22 -0
- package/dist/types/widgets/PoolWidget/Algebra/utils/mostSignificantBit.d.ts +2 -0
- package/dist/types/widgets/PoolWidget/Algebra/utils/nearestUsableTick.d.ts +6 -0
- package/dist/types/widgets/PoolWidget/Algebra/utils/slippage.d.ts +3 -0
- package/dist/types/widgets/PoolWidget/Algebra/utils/sqrt.d.ts +7 -0
- package/dist/types/widgets/PoolWidget/Algebra/utils/sqrtPriceMath.d.ts +13 -0
- package/dist/types/widgets/PoolWidget/Algebra/utils/tickMath.d.ts +34 -0
- package/dist/types/widgets/PoolWidget/Algebra/utils/tryParseTick.d.ts +7 -0
- package/dist/types/widgets/PoolWidget/Algebra/utils.d.ts +9 -0
- package/dist/types/widgets/PoolWidget/PoolList/components/PoolApyTooltip.d.ts +1 -0
- package/dist/types/widgets/PoolWidget/PoolList/hooks/usePoolListFilterTokenAndPool.d.ts +1 -0
- package/package.json +4 -4
- package/dist/index-3pLqfeyF.cjs +0 -31
- package/dist/index-D93HWmmI.js +0 -31
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
export declare function useFetchPositionFromTokenId({ chainId, tokenId, }: {
|
|
2
|
+
chainId: number | undefined;
|
|
3
|
+
tokenId: string | undefined;
|
|
4
|
+
}): {
|
|
5
|
+
position: {
|
|
6
|
+
tokenId: string | undefined;
|
|
7
|
+
pool: string;
|
|
8
|
+
feeGrowthInside0LastX128: bigint;
|
|
9
|
+
feeGrowthInside1LastX128: bigint;
|
|
10
|
+
liquidity: bigint;
|
|
11
|
+
nonce: bigint;
|
|
12
|
+
operator: string;
|
|
13
|
+
tickLower: number;
|
|
14
|
+
tickUpper: number;
|
|
15
|
+
token0: string;
|
|
16
|
+
token1: string;
|
|
17
|
+
tokensOwed0: bigint;
|
|
18
|
+
tokensOwed1: bigint;
|
|
19
|
+
} | undefined;
|
|
20
|
+
data: {
|
|
21
|
+
nonce: bigint;
|
|
22
|
+
operator: string;
|
|
23
|
+
token0: string;
|
|
24
|
+
token1: string;
|
|
25
|
+
deployer: string;
|
|
26
|
+
tickLower: bigint;
|
|
27
|
+
tickUpper: bigint;
|
|
28
|
+
liquidity: bigint;
|
|
29
|
+
feeGrowthInside0LastX128: bigint;
|
|
30
|
+
feeGrowthInside1LastX128: bigint;
|
|
31
|
+
tokensOwed0: bigint;
|
|
32
|
+
tokensOwed1: bigint;
|
|
33
|
+
};
|
|
34
|
+
error: Error;
|
|
35
|
+
isError: true;
|
|
36
|
+
isPending: false;
|
|
37
|
+
isLoading: false;
|
|
38
|
+
isLoadingError: false;
|
|
39
|
+
isRefetchError: true;
|
|
40
|
+
isSuccess: false;
|
|
41
|
+
status: "error";
|
|
42
|
+
dataUpdatedAt: number;
|
|
43
|
+
errorUpdatedAt: number;
|
|
44
|
+
failureCount: number;
|
|
45
|
+
failureReason: Error | null;
|
|
46
|
+
errorUpdateCount: number;
|
|
47
|
+
isFetched: boolean;
|
|
48
|
+
isFetchedAfterMount: boolean;
|
|
49
|
+
isFetching: boolean;
|
|
50
|
+
isInitialLoading: boolean;
|
|
51
|
+
isPaused: boolean;
|
|
52
|
+
isPlaceholderData: boolean;
|
|
53
|
+
isRefetching: boolean;
|
|
54
|
+
isStale: boolean;
|
|
55
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
|
|
56
|
+
nonce: bigint;
|
|
57
|
+
operator: string;
|
|
58
|
+
token0: string;
|
|
59
|
+
token1: string;
|
|
60
|
+
deployer: string;
|
|
61
|
+
tickLower: bigint;
|
|
62
|
+
tickUpper: bigint;
|
|
63
|
+
liquidity: bigint;
|
|
64
|
+
feeGrowthInside0LastX128: bigint;
|
|
65
|
+
feeGrowthInside1LastX128: bigint;
|
|
66
|
+
tokensOwed0: bigint;
|
|
67
|
+
tokensOwed1: bigint;
|
|
68
|
+
}, Error>>;
|
|
69
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
70
|
+
} | {
|
|
71
|
+
position: {
|
|
72
|
+
tokenId: string | undefined;
|
|
73
|
+
pool: string;
|
|
74
|
+
feeGrowthInside0LastX128: bigint;
|
|
75
|
+
feeGrowthInside1LastX128: bigint;
|
|
76
|
+
liquidity: bigint;
|
|
77
|
+
nonce: bigint;
|
|
78
|
+
operator: string;
|
|
79
|
+
tickLower: number;
|
|
80
|
+
tickUpper: number;
|
|
81
|
+
token0: string;
|
|
82
|
+
token1: string;
|
|
83
|
+
tokensOwed0: bigint;
|
|
84
|
+
tokensOwed1: bigint;
|
|
85
|
+
} | undefined;
|
|
86
|
+
data: {
|
|
87
|
+
nonce: bigint;
|
|
88
|
+
operator: string;
|
|
89
|
+
token0: string;
|
|
90
|
+
token1: string;
|
|
91
|
+
deployer: string;
|
|
92
|
+
tickLower: bigint;
|
|
93
|
+
tickUpper: bigint;
|
|
94
|
+
liquidity: bigint;
|
|
95
|
+
feeGrowthInside0LastX128: bigint;
|
|
96
|
+
feeGrowthInside1LastX128: bigint;
|
|
97
|
+
tokensOwed0: bigint;
|
|
98
|
+
tokensOwed1: bigint;
|
|
99
|
+
};
|
|
100
|
+
error: null;
|
|
101
|
+
isError: false;
|
|
102
|
+
isPending: false;
|
|
103
|
+
isLoading: false;
|
|
104
|
+
isLoadingError: false;
|
|
105
|
+
isRefetchError: false;
|
|
106
|
+
isSuccess: true;
|
|
107
|
+
status: "success";
|
|
108
|
+
dataUpdatedAt: number;
|
|
109
|
+
errorUpdatedAt: number;
|
|
110
|
+
failureCount: number;
|
|
111
|
+
failureReason: Error | null;
|
|
112
|
+
errorUpdateCount: number;
|
|
113
|
+
isFetched: boolean;
|
|
114
|
+
isFetchedAfterMount: boolean;
|
|
115
|
+
isFetching: boolean;
|
|
116
|
+
isInitialLoading: boolean;
|
|
117
|
+
isPaused: boolean;
|
|
118
|
+
isPlaceholderData: boolean;
|
|
119
|
+
isRefetching: boolean;
|
|
120
|
+
isStale: boolean;
|
|
121
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
|
|
122
|
+
nonce: bigint;
|
|
123
|
+
operator: string;
|
|
124
|
+
token0: string;
|
|
125
|
+
token1: string;
|
|
126
|
+
deployer: string;
|
|
127
|
+
tickLower: bigint;
|
|
128
|
+
tickUpper: bigint;
|
|
129
|
+
liquidity: bigint;
|
|
130
|
+
feeGrowthInside0LastX128: bigint;
|
|
131
|
+
feeGrowthInside1LastX128: bigint;
|
|
132
|
+
tokensOwed0: bigint;
|
|
133
|
+
tokensOwed1: bigint;
|
|
134
|
+
}, Error>>;
|
|
135
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
136
|
+
} | {
|
|
137
|
+
position: {
|
|
138
|
+
tokenId: string | undefined;
|
|
139
|
+
pool: string;
|
|
140
|
+
feeGrowthInside0LastX128: bigint;
|
|
141
|
+
feeGrowthInside1LastX128: bigint;
|
|
142
|
+
liquidity: bigint;
|
|
143
|
+
nonce: bigint;
|
|
144
|
+
operator: string;
|
|
145
|
+
tickLower: number;
|
|
146
|
+
tickUpper: number;
|
|
147
|
+
token0: string;
|
|
148
|
+
token1: string;
|
|
149
|
+
tokensOwed0: bigint;
|
|
150
|
+
tokensOwed1: bigint;
|
|
151
|
+
} | undefined;
|
|
152
|
+
data: undefined;
|
|
153
|
+
error: Error;
|
|
154
|
+
isError: true;
|
|
155
|
+
isPending: false;
|
|
156
|
+
isLoading: false;
|
|
157
|
+
isLoadingError: true;
|
|
158
|
+
isRefetchError: false;
|
|
159
|
+
isSuccess: false;
|
|
160
|
+
status: "error";
|
|
161
|
+
dataUpdatedAt: number;
|
|
162
|
+
errorUpdatedAt: number;
|
|
163
|
+
failureCount: number;
|
|
164
|
+
failureReason: Error | null;
|
|
165
|
+
errorUpdateCount: number;
|
|
166
|
+
isFetched: boolean;
|
|
167
|
+
isFetchedAfterMount: boolean;
|
|
168
|
+
isFetching: boolean;
|
|
169
|
+
isInitialLoading: boolean;
|
|
170
|
+
isPaused: boolean;
|
|
171
|
+
isPlaceholderData: boolean;
|
|
172
|
+
isRefetching: boolean;
|
|
173
|
+
isStale: boolean;
|
|
174
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
|
|
175
|
+
nonce: bigint;
|
|
176
|
+
operator: string;
|
|
177
|
+
token0: string;
|
|
178
|
+
token1: string;
|
|
179
|
+
deployer: string;
|
|
180
|
+
tickLower: bigint;
|
|
181
|
+
tickUpper: bigint;
|
|
182
|
+
liquidity: bigint;
|
|
183
|
+
feeGrowthInside0LastX128: bigint;
|
|
184
|
+
feeGrowthInside1LastX128: bigint;
|
|
185
|
+
tokensOwed0: bigint;
|
|
186
|
+
tokensOwed1: bigint;
|
|
187
|
+
}, Error>>;
|
|
188
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
189
|
+
} | {
|
|
190
|
+
position: {
|
|
191
|
+
tokenId: string | undefined;
|
|
192
|
+
pool: string;
|
|
193
|
+
feeGrowthInside0LastX128: bigint;
|
|
194
|
+
feeGrowthInside1LastX128: bigint;
|
|
195
|
+
liquidity: bigint;
|
|
196
|
+
nonce: bigint;
|
|
197
|
+
operator: string;
|
|
198
|
+
tickLower: number;
|
|
199
|
+
tickUpper: number;
|
|
200
|
+
token0: string;
|
|
201
|
+
token1: string;
|
|
202
|
+
tokensOwed0: bigint;
|
|
203
|
+
tokensOwed1: bigint;
|
|
204
|
+
} | undefined;
|
|
205
|
+
data: undefined;
|
|
206
|
+
error: null;
|
|
207
|
+
isError: false;
|
|
208
|
+
isPending: true;
|
|
209
|
+
isLoading: true;
|
|
210
|
+
isLoadingError: false;
|
|
211
|
+
isRefetchError: false;
|
|
212
|
+
isSuccess: false;
|
|
213
|
+
status: "pending";
|
|
214
|
+
dataUpdatedAt: number;
|
|
215
|
+
errorUpdatedAt: number;
|
|
216
|
+
failureCount: number;
|
|
217
|
+
failureReason: Error | null;
|
|
218
|
+
errorUpdateCount: number;
|
|
219
|
+
isFetched: boolean;
|
|
220
|
+
isFetchedAfterMount: boolean;
|
|
221
|
+
isFetching: boolean;
|
|
222
|
+
isInitialLoading: boolean;
|
|
223
|
+
isPaused: boolean;
|
|
224
|
+
isPlaceholderData: boolean;
|
|
225
|
+
isRefetching: boolean;
|
|
226
|
+
isStale: boolean;
|
|
227
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
|
|
228
|
+
nonce: bigint;
|
|
229
|
+
operator: string;
|
|
230
|
+
token0: string;
|
|
231
|
+
token1: string;
|
|
232
|
+
deployer: string;
|
|
233
|
+
tickLower: bigint;
|
|
234
|
+
tickUpper: bigint;
|
|
235
|
+
liquidity: bigint;
|
|
236
|
+
feeGrowthInside0LastX128: bigint;
|
|
237
|
+
feeGrowthInside1LastX128: bigint;
|
|
238
|
+
tokensOwed0: bigint;
|
|
239
|
+
tokensOwed1: bigint;
|
|
240
|
+
}, Error>>;
|
|
241
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
242
|
+
} | {
|
|
243
|
+
position: {
|
|
244
|
+
tokenId: string | undefined;
|
|
245
|
+
pool: string;
|
|
246
|
+
feeGrowthInside0LastX128: bigint;
|
|
247
|
+
feeGrowthInside1LastX128: bigint;
|
|
248
|
+
liquidity: bigint;
|
|
249
|
+
nonce: bigint;
|
|
250
|
+
operator: string;
|
|
251
|
+
tickLower: number;
|
|
252
|
+
tickUpper: number;
|
|
253
|
+
token0: string;
|
|
254
|
+
token1: string;
|
|
255
|
+
tokensOwed0: bigint;
|
|
256
|
+
tokensOwed1: bigint;
|
|
257
|
+
} | undefined;
|
|
258
|
+
data: undefined;
|
|
259
|
+
error: null;
|
|
260
|
+
isError: false;
|
|
261
|
+
isPending: true;
|
|
262
|
+
isLoadingError: false;
|
|
263
|
+
isRefetchError: false;
|
|
264
|
+
isSuccess: false;
|
|
265
|
+
status: "pending";
|
|
266
|
+
dataUpdatedAt: number;
|
|
267
|
+
errorUpdatedAt: number;
|
|
268
|
+
failureCount: number;
|
|
269
|
+
failureReason: Error | null;
|
|
270
|
+
errorUpdateCount: number;
|
|
271
|
+
isFetched: boolean;
|
|
272
|
+
isFetchedAfterMount: boolean;
|
|
273
|
+
isFetching: boolean;
|
|
274
|
+
isLoading: boolean;
|
|
275
|
+
isInitialLoading: boolean;
|
|
276
|
+
isPaused: boolean;
|
|
277
|
+
isPlaceholderData: boolean;
|
|
278
|
+
isRefetching: boolean;
|
|
279
|
+
isStale: boolean;
|
|
280
|
+
refetch: (options?: import("@tanstack/react-query").RefetchOptions) => Promise<import("@tanstack/react-query").QueryObserverResult<{
|
|
281
|
+
nonce: bigint;
|
|
282
|
+
operator: string;
|
|
283
|
+
token0: string;
|
|
284
|
+
token1: string;
|
|
285
|
+
deployer: string;
|
|
286
|
+
tickLower: bigint;
|
|
287
|
+
tickUpper: bigint;
|
|
288
|
+
liquidity: bigint;
|
|
289
|
+
feeGrowthInside0LastX128: bigint;
|
|
290
|
+
feeGrowthInside1LastX128: bigint;
|
|
291
|
+
tokensOwed0: bigint;
|
|
292
|
+
tokensOwed1: bigint;
|
|
293
|
+
}, Error>>;
|
|
294
|
+
fetchStatus: import("@tanstack/react-query").FetchStatus;
|
|
295
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare function useFetchPositions({ account, chainId, }: {
|
|
2
|
+
account?: string;
|
|
3
|
+
chainId?: number;
|
|
4
|
+
}): {
|
|
5
|
+
isError: boolean;
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
refetchError: () => void;
|
|
8
|
+
positions: {
|
|
9
|
+
tokenId: number;
|
|
10
|
+
pool: string;
|
|
11
|
+
feeGrowthInside0LastX128: bigint;
|
|
12
|
+
feeGrowthInside1LastX128: bigint;
|
|
13
|
+
liquidity: bigint;
|
|
14
|
+
nonce: bigint;
|
|
15
|
+
operator: string;
|
|
16
|
+
tickLower: bigint;
|
|
17
|
+
tickUpper: bigint;
|
|
18
|
+
token0: string;
|
|
19
|
+
token1: string;
|
|
20
|
+
tokensOwed0: bigint;
|
|
21
|
+
tokensOwed1: bigint;
|
|
22
|
+
}[];
|
|
23
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ChainId } from '@dodoex/api';
|
|
2
|
+
import JSBI from 'jsbi';
|
|
3
|
+
import { Currency, Price, Token } from '../sdks/sdk-core';
|
|
4
|
+
import { FeeAmount } from '../sdks/v3-sdk';
|
|
5
|
+
export interface TickProcessed {
|
|
6
|
+
tick: number;
|
|
7
|
+
liquidityActive: JSBI;
|
|
8
|
+
liquidityNet: JSBI;
|
|
9
|
+
price0: string;
|
|
10
|
+
sdkPrice: Price<Token, Token>;
|
|
11
|
+
}
|
|
12
|
+
export declare function usePoolActiveLiquidity(currencyA: Currency | undefined, currencyB: Currency | undefined, feeAmount: FeeAmount | undefined, chainId?: ChainId): {
|
|
13
|
+
isLoading: boolean;
|
|
14
|
+
error: any;
|
|
15
|
+
currentTick?: number;
|
|
16
|
+
activeTick?: number;
|
|
17
|
+
liquidity?: JSBI;
|
|
18
|
+
sqrtPriceX96?: JSBI;
|
|
19
|
+
data?: TickProcessed[];
|
|
20
|
+
};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ChainId } from '@dodoex/api';
|
|
2
|
+
import { BigintIsh, Currency, Token } from '../sdks/sdk-core';
|
|
3
|
+
import { FeeAmount, Pool } from '../sdks/v3-sdk';
|
|
4
|
+
export declare class PoolCache {
|
|
5
|
+
private static MAX_ENTRIES;
|
|
6
|
+
private static pools;
|
|
7
|
+
private static addresses;
|
|
8
|
+
static getPoolAddress(factoryAddress: string, tokenA: Token, tokenB: Token, fee: FeeAmount, chainId: ChainId): string;
|
|
9
|
+
static getPool(tokenA: Token, tokenB: Token, fee: FeeAmount, sqrtPriceX96: BigintIsh, liquidity: BigintIsh, tick: number): Pool;
|
|
10
|
+
}
|
|
11
|
+
export declare enum PoolState {
|
|
12
|
+
LOADING = 0,
|
|
13
|
+
NOT_EXISTS = 1,
|
|
14
|
+
EXISTS = 2,
|
|
15
|
+
INVALID = 3
|
|
16
|
+
}
|
|
17
|
+
export declare function usePools(poolKeys: [
|
|
18
|
+
Currency | undefined,
|
|
19
|
+
Currency | undefined,
|
|
20
|
+
FeeAmount | undefined
|
|
21
|
+
][]): [PoolState, Pool | null][];
|
|
22
|
+
export declare function usePool(currencyA: Currency | undefined, currencyB: Currency | undefined, feeAmount: FeeAmount | undefined): [PoolState, Pool | null];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import BigNumber from 'bignumber.js';
|
|
2
|
+
export declare function useRemoveAlgebraLiquidity(): import("@tanstack/react-query").UseMutationResult<import("../../../../hooks/Submission/types").ExecutionResult | undefined, Error, {
|
|
3
|
+
chainId?: number;
|
|
4
|
+
tokenId?: number | string;
|
|
5
|
+
amount0Min: string;
|
|
6
|
+
amount1Min: string;
|
|
7
|
+
newLiquidity: string;
|
|
8
|
+
collectOptions: {
|
|
9
|
+
expectedCurrencyOwed0: BigNumber;
|
|
10
|
+
expectedCurrencyOwed1: BigNumber;
|
|
11
|
+
recipient: string;
|
|
12
|
+
};
|
|
13
|
+
successBack?: () => void;
|
|
14
|
+
}, unknown>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { TokenInfo } from '../../../../hooks/Token';
|
|
2
|
+
import React from 'react';
|
|
3
|
+
import { Price } from '../../../../utils/fractions';
|
|
4
|
+
export declare function useSetRange({ tickCurrent, token0, token1, sorted, tickSpacing, price, }: {
|
|
5
|
+
tickCurrent: number | undefined;
|
|
6
|
+
token0: TokenInfo | undefined;
|
|
7
|
+
token1: TokenInfo | undefined;
|
|
8
|
+
sorted: boolean;
|
|
9
|
+
tickSpacing: number;
|
|
10
|
+
price?: Price;
|
|
11
|
+
}): {
|
|
12
|
+
ticksAtLimit: {
|
|
13
|
+
LOWER: boolean;
|
|
14
|
+
UPPER: boolean;
|
|
15
|
+
};
|
|
16
|
+
tickLower: number;
|
|
17
|
+
tickUpper: number;
|
|
18
|
+
priceLower: Price | undefined;
|
|
19
|
+
priceUpper: Price | undefined;
|
|
20
|
+
leftRangeTypedValue: string | boolean;
|
|
21
|
+
rightRangeTypedValue: string | boolean;
|
|
22
|
+
invalidRange: boolean;
|
|
23
|
+
outOfRange: boolean;
|
|
24
|
+
getDecrementLower: () => string;
|
|
25
|
+
getIncrementLower: () => string;
|
|
26
|
+
getDecrementUpper: () => string;
|
|
27
|
+
getIncrementUpper: () => string;
|
|
28
|
+
handleSetFullRange: () => void;
|
|
29
|
+
handleRateToggle: () => void;
|
|
30
|
+
onLeftRangeInput: React.Dispatch<React.SetStateAction<string | boolean>>;
|
|
31
|
+
onRightRangeInput: React.Dispatch<React.SetStateAction<string | boolean>>;
|
|
32
|
+
};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ChainId } from '@dodoex/api';
|
|
2
|
+
export declare function useSwapTaxes(inputTokenAddress?: string, outputTokenAddress?: string, tokenChainId?: ChainId): {
|
|
3
|
+
inputTax: import("../../../../utils/fractions").Percent;
|
|
4
|
+
outputTax: import("../../../../utils/fractions").Percent;
|
|
5
|
+
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Actions } from '../reducer';
|
|
2
|
+
export declare function useV3MintActionHandlers({ noLiquidity, dispatch, }: {
|
|
3
|
+
noLiquidity: boolean | undefined;
|
|
4
|
+
dispatch: React.Dispatch<Actions>;
|
|
5
|
+
}): {
|
|
6
|
+
onFieldAInput: (typedValue: string) => void;
|
|
7
|
+
onFieldBInput: (typedValue: string) => void;
|
|
8
|
+
onLeftRangeInput: (typedValue: string) => void;
|
|
9
|
+
onRightRangeInput: (typedValue: string) => void;
|
|
10
|
+
onStartPriceInput: (typedValue: string) => void;
|
|
11
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ChainId, Currency, CurrencyAmount } from '../sdks/sdk-core';
|
|
2
|
+
import { Pool } from '../sdks/v3-sdk';
|
|
3
|
+
export declare function useV3PositionFees({ chainId, pool, tokenId, asWETH, }: {
|
|
4
|
+
chainId: ChainId;
|
|
5
|
+
pool?: Pool;
|
|
6
|
+
tokenId: string;
|
|
7
|
+
asWETH: boolean;
|
|
8
|
+
}): [CurrencyAmount<Currency>, CurrencyAmount<Currency>] | [undefined, undefined];
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ChainId } from '@dodoex/api';
|
|
2
|
+
import { PositionDetails } from '../types/position';
|
|
3
|
+
interface UseV3PositionsResults {
|
|
4
|
+
loading: boolean;
|
|
5
|
+
positions?: PositionDetails[];
|
|
6
|
+
}
|
|
7
|
+
interface UseV3PositionResults {
|
|
8
|
+
loading: boolean;
|
|
9
|
+
position?: PositionDetails;
|
|
10
|
+
}
|
|
11
|
+
export declare function useV3PositionFromTokenId(tokenId: string | undefined, chainId: ChainId): UseV3PositionResults;
|
|
12
|
+
export declare function useV3Positions(account: string | null | undefined, chainId: ChainId): UseV3PositionsResults;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SupportedChainsType } from './chains';
|
|
2
|
+
type AddressMap = {
|
|
3
|
+
[chainId: number]: string;
|
|
4
|
+
};
|
|
5
|
+
type ChainAddresses = {
|
|
6
|
+
v3CoreFactoryAddress: string;
|
|
7
|
+
nonfungiblePositionManagerAddress?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const CHAIN_TO_ADDRESSES_MAP: Record<SupportedChainsType, ChainAddresses>;
|
|
10
|
+
export declare const V3_CORE_FACTORY_ADDRESSES: AddressMap;
|
|
11
|
+
export declare const NONFUNGIBLE_POSITION_MANAGER_ADDRESSES: AddressMap;
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import JSBI from 'jsbi';
|
|
2
|
+
export type BigintIsh = JSBI | string | number;
|
|
3
|
+
export declare enum TradeType {
|
|
4
|
+
EXACT_INPUT = 0,
|
|
5
|
+
EXACT_OUTPUT = 1
|
|
6
|
+
}
|
|
7
|
+
export declare enum Rounding {
|
|
8
|
+
ROUND_DOWN = 0,
|
|
9
|
+
ROUND_HALF_UP = 1,
|
|
10
|
+
ROUND_UP = 2
|
|
11
|
+
}
|
|
12
|
+
export declare const MaxUint256: JSBI;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Currency } from './currency';
|
|
2
|
+
import { Token } from './token';
|
|
3
|
+
/**
|
|
4
|
+
* A currency is any fungible financial instrument, including Ether, all ERC20 tokens, and other chain-native currencies
|
|
5
|
+
*/
|
|
6
|
+
export declare abstract class BaseCurrency {
|
|
7
|
+
/**
|
|
8
|
+
* Returns whether the currency is native to the chain and must be wrapped (e.g. Ether)
|
|
9
|
+
*/
|
|
10
|
+
abstract readonly isNative: boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Returns whether the currency is a token that is usable in Uniswap without wrapping
|
|
13
|
+
*/
|
|
14
|
+
abstract readonly isToken: boolean;
|
|
15
|
+
/**
|
|
16
|
+
* The chain ID on which this currency resides
|
|
17
|
+
*/
|
|
18
|
+
readonly chainId: number;
|
|
19
|
+
/**
|
|
20
|
+
* The decimals used in representing currency amounts
|
|
21
|
+
*/
|
|
22
|
+
readonly decimals: number;
|
|
23
|
+
/**
|
|
24
|
+
* The symbol of the currency, i.e. a short textual non-unique identifier
|
|
25
|
+
*/
|
|
26
|
+
readonly symbol?: string;
|
|
27
|
+
/**
|
|
28
|
+
* The name of the currency, i.e. a descriptive textual non-unique identifier
|
|
29
|
+
*/
|
|
30
|
+
readonly name?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Constructs an instance of the base class `BaseCurrency`.
|
|
33
|
+
* @param chainId the chain ID on which this currency resides
|
|
34
|
+
* @param decimals decimals of the currency
|
|
35
|
+
* @param symbol symbol of the currency
|
|
36
|
+
* @param name of the currency
|
|
37
|
+
*/
|
|
38
|
+
protected constructor(chainId: number, decimals: number, symbol?: string, name?: string);
|
|
39
|
+
/**
|
|
40
|
+
* Returns whether this currency is functionally equivalent to the other currency
|
|
41
|
+
* @param other the other currency
|
|
42
|
+
*/
|
|
43
|
+
abstract equals(other: Currency): boolean;
|
|
44
|
+
/**
|
|
45
|
+
* Return the wrapped version of this currency that can be used with the Uniswap contracts. Currencies must
|
|
46
|
+
* implement this to be used in Uniswap
|
|
47
|
+
*/
|
|
48
|
+
abstract get wrapped(): Token;
|
|
49
|
+
}
|
package/dist/types/widgets/PoolWidget/Algebra/sdks/sdk-core/entities/fractions/currencyAmount.d.ts
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import JSBI from 'jsbi';
|
|
2
|
+
import { Currency } from '../currency';
|
|
3
|
+
import { Token } from '../token';
|
|
4
|
+
import { Fraction } from './fraction';
|
|
5
|
+
import BigNumber from 'bignumber.js';
|
|
6
|
+
import { BigintIsh, Rounding } from '../../constants';
|
|
7
|
+
export declare class CurrencyAmount<T extends Currency> extends Fraction {
|
|
8
|
+
readonly currency: T;
|
|
9
|
+
readonly decimalScale: JSBI;
|
|
10
|
+
/**
|
|
11
|
+
* Returns a new currency amount instance from the unitless amount of token, i.e. the raw amount
|
|
12
|
+
* @param currency the currency in the amount
|
|
13
|
+
* @param rawAmount the raw token or ether amount
|
|
14
|
+
*/
|
|
15
|
+
static fromRawAmount<T extends Currency>(currency: T, rawAmount: BigintIsh): CurrencyAmount<T>;
|
|
16
|
+
/**
|
|
17
|
+
* Construct a currency amount with a denominator that is not equal to 1
|
|
18
|
+
* @param currency the currency
|
|
19
|
+
* @param numerator the numerator of the fractional token amount
|
|
20
|
+
* @param denominator the denominator of the fractional token amount
|
|
21
|
+
*/
|
|
22
|
+
static fromFractionalAmount<T extends Currency>(currency: T, numerator: BigintIsh, denominator: BigintIsh): CurrencyAmount<T>;
|
|
23
|
+
protected constructor(currency: T, numerator: BigintIsh, denominator?: BigintIsh);
|
|
24
|
+
add(other: CurrencyAmount<T>): CurrencyAmount<T>;
|
|
25
|
+
subtract(other: CurrencyAmount<T>): CurrencyAmount<T>;
|
|
26
|
+
multiply(other: Fraction | BigintIsh): CurrencyAmount<T>;
|
|
27
|
+
divide(other: Fraction | BigintIsh): CurrencyAmount<T>;
|
|
28
|
+
toSignificant(significantDigits?: number, format?: object, rounding?: Rounding): string;
|
|
29
|
+
toFixed(decimalPlaces?: number, format?: object, rounding?: Rounding): string;
|
|
30
|
+
toExact(): BigNumber;
|
|
31
|
+
get wrapped(): CurrencyAmount<Token>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import JSBI from 'jsbi';
|
|
2
|
+
import { BigintIsh, Rounding } from '../../constants';
|
|
3
|
+
export declare class Fraction {
|
|
4
|
+
readonly numerator: JSBI;
|
|
5
|
+
readonly denominator: JSBI;
|
|
6
|
+
constructor(numerator: BigintIsh, denominator?: BigintIsh);
|
|
7
|
+
private static tryParseFraction;
|
|
8
|
+
get quotient(): JSBI;
|
|
9
|
+
get remainder(): Fraction;
|
|
10
|
+
invert(): Fraction;
|
|
11
|
+
add(other: Fraction | BigintIsh): Fraction;
|
|
12
|
+
subtract(other: Fraction | BigintIsh): Fraction;
|
|
13
|
+
lessThan(other: Fraction | BigintIsh): boolean;
|
|
14
|
+
equalTo(other: Fraction | BigintIsh): boolean;
|
|
15
|
+
greaterThan(other: Fraction | BigintIsh): boolean;
|
|
16
|
+
multiply(other: Fraction | BigintIsh): Fraction;
|
|
17
|
+
divide(other: Fraction | BigintIsh): Fraction;
|
|
18
|
+
toSignificant(significantDigits: number, format?: object, rounding?: Rounding): string;
|
|
19
|
+
toFixed(decimalPlaces: number, format?: object, rounding?: Rounding): string;
|
|
20
|
+
/**
|
|
21
|
+
* Helper method for converting any super class back to a fraction
|
|
22
|
+
*/
|
|
23
|
+
get asFraction(): Fraction;
|
|
24
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BigintIsh, Rounding } from '../../constants';
|
|
2
|
+
import { Fraction } from './fraction';
|
|
3
|
+
export declare class Percent extends Fraction {
|
|
4
|
+
/**
|
|
5
|
+
* This boolean prevents a fraction from being interpreted as a Percent
|
|
6
|
+
*/
|
|
7
|
+
readonly isPercent: true;
|
|
8
|
+
add(other: Fraction | BigintIsh): Percent;
|
|
9
|
+
subtract(other: Fraction | BigintIsh): Percent;
|
|
10
|
+
multiply(other: Fraction | BigintIsh): Percent;
|
|
11
|
+
divide(other: Fraction | BigintIsh): Percent;
|
|
12
|
+
toSignificant(significantDigits?: number, format?: object, rounding?: Rounding): string;
|
|
13
|
+
toFixed(decimalPlaces?: number, format?: object, rounding?: Rounding): string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { BigintIsh, Rounding } from '../../constants';
|
|
2
|
+
import { Currency } from '../currency';
|
|
3
|
+
import { Fraction } from './fraction';
|
|
4
|
+
import { CurrencyAmount } from './currencyAmount';
|
|
5
|
+
export declare class Price<TBase extends Currency, TQuote extends Currency> extends Fraction {
|
|
6
|
+
readonly baseCurrency: TBase;
|
|
7
|
+
readonly quoteCurrency: TQuote;
|
|
8
|
+
readonly scalar: Fraction;
|
|
9
|
+
/**
|
|
10
|
+
* Construct a price, either with the base and quote currency amount, or the
|
|
11
|
+
* @param args
|
|
12
|
+
*/
|
|
13
|
+
constructor(...args: [TBase, TQuote, BigintIsh, BigintIsh] | [{
|
|
14
|
+
baseAmount: CurrencyAmount<TBase>;
|
|
15
|
+
quoteAmount: CurrencyAmount<TQuote>;
|
|
16
|
+
}]);
|
|
17
|
+
/**
|
|
18
|
+
* Flip the price, switching the base and quote currency
|
|
19
|
+
*/
|
|
20
|
+
invert(): Price<TQuote, TBase>;
|
|
21
|
+
/**
|
|
22
|
+
* Multiply the price by another price, returning a new price. The other price must have the same base currency as this price's quote currency
|
|
23
|
+
* @param other the other price
|
|
24
|
+
*/
|
|
25
|
+
multiply<TOtherQuote extends Currency>(other: Price<TQuote, TOtherQuote>): Price<TBase, TOtherQuote>;
|
|
26
|
+
/**
|
|
27
|
+
* Return the amount of quote currency corresponding to a given amount of the base currency
|
|
28
|
+
* @param currencyAmount the amount of base currency to quote against the price
|
|
29
|
+
*/
|
|
30
|
+
quote(currencyAmount: CurrencyAmount<TBase>): CurrencyAmount<TQuote>;
|
|
31
|
+
/**
|
|
32
|
+
* Get the value scaled by decimals for formatting
|
|
33
|
+
* @private
|
|
34
|
+
*/
|
|
35
|
+
private get adjustedForDecimals();
|
|
36
|
+
toSignificant(significantDigits?: number, format?: object, rounding?: Rounding): string;
|
|
37
|
+
toFixed(decimalPlaces?: number, format?: object, rounding?: Rounding): string;
|
|
38
|
+
}
|