@clober/v2-sdk 0.0.4 → 0.0.5-0.dev
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 +12 -4
- package/dist/cjs/abis/core/book-manager-abi.js +112 -0
- package/dist/cjs/abis/core/book-manager-abi.js.map +1 -0
- package/dist/cjs/abis/core/book-viewer-abi.js +321 -0
- package/dist/cjs/abis/core/book-viewer-abi.js.map +1 -0
- package/dist/cjs/abis/core/controller-abi.js +29 -24
- package/dist/cjs/abis/core/controller-abi.js.map +1 -1
- package/dist/cjs/apis/chart-logs.js +154 -0
- package/dist/cjs/apis/chart-logs.js.map +1 -0
- package/dist/cjs/apis/market.js +61 -32
- package/dist/cjs/apis/market.js.map +1 -1
- package/dist/cjs/apis/open-order.js +56 -21
- package/dist/cjs/apis/open-order.js.map +1 -1
- package/dist/cjs/approval.js +77 -30
- package/dist/cjs/approval.js.map +1 -1
- package/dist/cjs/call.js +313 -206
- package/dist/cjs/call.js.map +1 -1
- package/dist/cjs/constants/addresses.js +26 -1
- package/dist/cjs/constants/addresses.js.map +1 -1
- package/dist/cjs/constants/chain.js +19 -1
- package/dist/cjs/constants/chain.js.map +1 -1
- package/dist/cjs/constants/client.js +4 -0
- package/dist/cjs/constants/client.js.map +1 -1
- package/dist/cjs/constants/currency.js +28 -2
- package/dist/cjs/constants/currency.js.map +1 -1
- package/dist/cjs/constants/fee.js +17 -2
- package/dist/cjs/constants/fee.js.map +1 -1
- package/dist/cjs/constants/subgraph.js +57 -0
- package/dist/cjs/constants/subgraph.js.map +1 -0
- package/dist/cjs/constants/test-chain.js +27 -0
- package/dist/cjs/constants/test-chain.js.map +1 -0
- package/dist/cjs/index.js +20 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/model/book.js +47 -29
- package/dist/cjs/model/book.js.map +1 -1
- package/dist/cjs/model/chart-log.js +3 -0
- package/dist/cjs/model/chart-log.js.map +1 -0
- package/dist/cjs/model/market.js +45 -182
- package/dist/cjs/model/market.js.map +1 -1
- package/dist/cjs/signature.js +20 -16
- package/dist/cjs/signature.js.map +1 -1
- package/dist/cjs/type.js +16 -1
- package/dist/cjs/type.js.map +1 -1
- package/dist/cjs/utils/allowance.js +40 -0
- package/dist/cjs/utils/allowance.js.map +1 -0
- package/dist/cjs/utils/bigint.js +9 -0
- package/dist/cjs/utils/bigint.js.map +1 -0
- package/dist/cjs/utils/bignumber.js +9 -0
- package/dist/cjs/utils/bignumber.js.map +1 -0
- package/dist/cjs/utils/book-id.js +7 -7
- package/dist/cjs/utils/book-id.js.map +1 -1
- package/dist/cjs/utils/build-transaction.js +8 -7
- package/dist/cjs/utils/build-transaction.js.map +1 -1
- package/dist/cjs/utils/currency.js +166 -0
- package/dist/cjs/utils/currency.js.map +1 -0
- package/dist/cjs/utils/decorator.js +3 -1
- package/dist/cjs/utils/decorator.js.map +1 -1
- package/dist/cjs/utils/open.js +36 -0
- package/dist/cjs/utils/open.js.map +1 -0
- package/dist/cjs/utils/order.js +102 -0
- package/dist/cjs/utils/order.js.map +1 -0
- package/dist/cjs/utils/prices.js +25 -3
- package/dist/cjs/utils/prices.js.map +1 -1
- package/dist/cjs/utils/unit-size.js +49 -0
- package/dist/cjs/utils/unit-size.js.map +1 -0
- package/dist/cjs/utils.js +15 -0
- package/dist/cjs/utils.js.map +1 -0
- package/dist/cjs/view.js +102 -33
- package/dist/cjs/view.js.map +1 -1
- package/dist/esm/abis/core/book-manager-abi.js +109 -0
- package/dist/esm/abis/core/book-manager-abi.js.map +1 -0
- package/dist/esm/abis/core/book-viewer-abi.js +318 -0
- package/dist/esm/abis/core/book-viewer-abi.js.map +1 -0
- package/dist/esm/abis/core/controller-abi.js +29 -24
- package/dist/esm/abis/core/controller-abi.js.map +1 -1
- package/dist/esm/apis/chart-logs.js +150 -0
- package/dist/esm/apis/chart-logs.js.map +1 -0
- package/dist/esm/apis/market.js +61 -32
- package/dist/esm/apis/market.js.map +1 -1
- package/dist/esm/apis/open-order.js +57 -21
- package/dist/esm/apis/open-order.js.map +1 -1
- package/dist/esm/approval.js +116 -44
- package/dist/esm/approval.js.map +1 -1
- package/dist/esm/call.js +430 -309
- package/dist/esm/call.js.map +1 -1
- package/dist/esm/constants/addresses.js +26 -1
- package/dist/esm/constants/addresses.js.map +1 -1
- package/dist/esm/constants/chain.js +20 -2
- package/dist/esm/constants/chain.js.map +1 -1
- package/dist/esm/constants/client.js +5 -1
- package/dist/esm/constants/client.js.map +1 -1
- package/dist/esm/constants/currency.js +28 -2
- package/dist/esm/constants/currency.js.map +1 -1
- package/dist/esm/constants/fee.js +17 -2
- package/dist/esm/constants/fee.js.map +1 -1
- package/dist/esm/constants/subgraph.js +53 -0
- package/dist/esm/constants/subgraph.js.map +1 -0
- package/dist/esm/constants/test-chain.js +24 -0
- package/dist/esm/constants/test-chain.js.map +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/model/book.js +47 -29
- package/dist/esm/model/book.js.map +1 -1
- package/dist/esm/model/chart-log.js +2 -0
- package/dist/esm/model/chart-log.js.map +1 -0
- package/dist/esm/model/market.js +46 -187
- package/dist/esm/model/market.js.map +1 -1
- package/dist/esm/signature.js +35 -37
- package/dist/esm/signature.js.map +1 -1
- package/dist/esm/type.js +15 -0
- package/dist/esm/type.js.map +1 -1
- package/dist/esm/utils/allowance.js +36 -0
- package/dist/esm/utils/allowance.js.map +1 -0
- package/dist/esm/utils/bigint.js +5 -0
- package/dist/esm/utils/bigint.js.map +1 -0
- package/dist/esm/utils/bignumber.js +6 -0
- package/dist/esm/utils/bignumber.js.map +1 -0
- package/dist/esm/utils/book-id.js +7 -7
- package/dist/esm/utils/book-id.js.map +1 -1
- package/dist/esm/utils/build-transaction.js +8 -7
- package/dist/esm/utils/build-transaction.js.map +1 -1
- package/dist/esm/utils/currency.js +161 -0
- package/dist/esm/utils/currency.js.map +1 -0
- package/dist/esm/utils/decorator.js +3 -1
- package/dist/esm/utils/decorator.js.map +1 -1
- package/dist/esm/utils/open.js +32 -0
- package/dist/esm/utils/open.js.map +1 -0
- package/dist/esm/utils/order.js +98 -0
- package/dist/esm/utils/order.js.map +1 -0
- package/dist/esm/utils/prices.js +24 -2
- package/dist/esm/utils/prices.js.map +1 -1
- package/dist/esm/utils/unit-size.js +45 -0
- package/dist/esm/utils/unit-size.js.map +1 -0
- package/dist/esm/utils.js +4 -0
- package/dist/esm/utils.js.map +1 -0
- package/dist/esm/view.js +215 -61
- package/dist/esm/view.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/abis/core/book-manager-abi.d.ts +82 -0
- package/dist/types/abis/core/book-manager-abi.d.ts.map +1 -0
- package/dist/types/abis/core/book-viewer-abi.d.ts +243 -0
- package/dist/types/abis/core/book-viewer-abi.d.ts.map +1 -0
- package/dist/types/abis/core/controller-abi.d.ts +23 -19
- package/dist/types/abis/core/controller-abi.d.ts.map +1 -1
- package/dist/types/apis/chart-logs.d.ts +5 -0
- package/dist/types/apis/chart-logs.d.ts.map +1 -0
- package/dist/types/apis/market.d.ts +1 -1
- package/dist/types/apis/market.d.ts.map +1 -1
- package/dist/types/apis/open-order.d.ts +3 -2
- package/dist/types/apis/open-order.d.ts.map +1 -1
- package/dist/types/approval.d.ts +48 -16
- package/dist/types/approval.d.ts.map +1 -1
- package/dist/types/call.d.ts +151 -109
- package/dist/types/call.d.ts.map +1 -1
- package/dist/types/constants/addresses.d.ts.map +1 -1
- package/dist/types/constants/chain.d.ts +6 -2
- package/dist/types/constants/chain.d.ts.map +1 -1
- package/dist/types/constants/client.d.ts +1 -1
- package/dist/types/constants/client.d.ts.map +1 -1
- package/dist/types/constants/currency.d.ts.map +1 -1
- package/dist/types/constants/fee.d.ts +7 -2
- package/dist/types/constants/fee.d.ts.map +1 -1
- package/dist/types/constants/subgraph.d.ts +10 -0
- package/dist/types/constants/subgraph.d.ts.map +1 -0
- package/dist/types/constants/test-chain.d.ts +3 -0
- package/dist/types/constants/test-chain.d.ts.map +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/model/book.d.ts +13 -29
- package/dist/types/model/book.d.ts.map +1 -1
- package/dist/types/model/chart-log.d.ts +9 -0
- package/dist/types/model/chart-log.d.ts.map +1 -0
- package/dist/types/model/depth.d.ts +4 -5
- package/dist/types/model/depth.d.ts.map +1 -1
- package/dist/types/model/market.d.ts +15 -19
- package/dist/types/model/market.d.ts.map +1 -1
- package/dist/types/model/open-order.d.ts +16 -8
- package/dist/types/model/open-order.d.ts.map +1 -1
- package/dist/types/signature.d.ts +18 -24
- package/dist/types/signature.d.ts.map +1 -1
- package/dist/types/type.d.ts +52 -8
- package/dist/types/type.d.ts.map +1 -1
- package/dist/types/utils/allowance.d.ts +3 -0
- package/dist/types/utils/allowance.d.ts.map +1 -0
- package/dist/types/utils/bigint.d.ts +2 -0
- package/dist/types/utils/bigint.d.ts.map +1 -0
- package/dist/types/utils/bignumber.d.ts +3 -0
- package/dist/types/utils/bignumber.d.ts.map +1 -0
- package/dist/types/utils/book-id.d.ts +2 -1
- package/dist/types/utils/book-id.d.ts.map +1 -1
- package/dist/types/utils/build-transaction.d.ts +3 -3
- package/dist/types/utils/build-transaction.d.ts.map +1 -1
- package/dist/types/{apis → utils}/currency.d.ts +3 -0
- package/dist/types/utils/currency.d.ts.map +1 -0
- package/dist/types/utils/decorator.d.ts +1 -1
- package/dist/types/utils/decorator.d.ts.map +1 -1
- package/dist/types/utils/open.d.ts +3 -0
- package/dist/types/utils/open.d.ts.map +1 -0
- package/dist/types/utils/order.d.ts +8 -0
- package/dist/types/utils/order.d.ts.map +1 -0
- package/dist/types/utils/prices.d.ts +8 -1
- package/dist/types/utils/prices.d.ts.map +1 -1
- package/dist/types/utils/unit-size.d.ts +4 -0
- package/dist/types/utils/unit-size.d.ts.map +1 -0
- package/dist/types/utils.d.ts +4 -0
- package/dist/types/utils.d.ts.map +1 -0
- package/dist/types/view.d.ts +184 -41
- package/dist/types/view.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/abis/core/params-abi.js +0 -62
- package/dist/cjs/abis/core/params-abi.js.map +0 -1
- package/dist/cjs/apis/currency.js +0 -83
- package/dist/cjs/apis/currency.js.map +0 -1
- package/dist/cjs/apis/subgraph.js +0 -26
- package/dist/cjs/apis/subgraph.js.map +0 -1
- package/dist/cjs/constants/subgraph-url.js +0 -8
- package/dist/cjs/constants/subgraph-url.js.map +0 -1
- package/dist/cjs/utils/unit.js +0 -34
- package/dist/cjs/utils/unit.js.map +0 -1
- package/dist/esm/abis/core/params-abi.js +0 -59
- package/dist/esm/abis/core/params-abi.js.map +0 -1
- package/dist/esm/apis/currency.js +0 -79
- package/dist/esm/apis/currency.js.map +0 -1
- package/dist/esm/apis/subgraph.js +0 -22
- package/dist/esm/apis/subgraph.js.map +0 -1
- package/dist/esm/constants/subgraph-url.js +0 -5
- package/dist/esm/constants/subgraph-url.js.map +0 -1
- package/dist/esm/utils/unit.js +0 -30
- package/dist/esm/utils/unit.js.map +0 -1
- package/dist/types/abis/core/params-abi.d.ts +0 -21
- package/dist/types/abis/core/params-abi.d.ts.map +0 -1
- package/dist/types/apis/currency.d.ts.map +0 -1
- package/dist/types/apis/subgraph.d.ts +0 -3
- package/dist/types/apis/subgraph.d.ts.map +0 -1
- package/dist/types/constants/subgraph-url.d.ts +0 -5
- package/dist/types/constants/subgraph-url.d.ts.map +0 -1
- package/dist/types/utils/unit.d.ts +0 -4
- package/dist/types/utils/unit.d.ts.map +0 -1
package/dist/esm/view.js
CHANGED
|
@@ -1,44 +1,144 @@
|
|
|
1
|
-
import { formatUnits, isAddressEqual, parseUnits } from 'viem';
|
|
1
|
+
import { formatUnits, getAddress, isAddressEqual, parseUnits } from 'viem';
|
|
2
2
|
import { fetchMarket } from './apis/market';
|
|
3
|
-
import { parsePrice } from './utils/prices';
|
|
3
|
+
import { formatPrice, parsePrice } from './utils/prices';
|
|
4
4
|
import { MAX_PRICE } from './constants/price';
|
|
5
|
-
import { fetchOpenOrder,
|
|
5
|
+
import { fetchOpenOrder, fetchOpenOrdersByUserAddress } from './apis/open-order';
|
|
6
6
|
import { decorator } from './utils/decorator';
|
|
7
|
+
import { fetchChartLogs, fetchLatestChartLog } from './apis/chart-logs';
|
|
8
|
+
import { getMarketId } from './utils/market';
|
|
9
|
+
import { CONTRACT_ADDRESSES } from './constants/addresses';
|
|
10
|
+
import { fromPrice, invertPrice, toPrice } from './utils/tick';
|
|
11
|
+
/**
|
|
12
|
+
* Get contract addresses by chain id
|
|
13
|
+
* @param chainId - chain id from {@link CHAIN_IDS}
|
|
14
|
+
* @returns Contract addresses
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* import { getContractAddresses } from '@clober/v2-sdk'
|
|
18
|
+
*
|
|
19
|
+
* const addresses = await getContractAddresses({
|
|
20
|
+
* chainId: 421614,
|
|
21
|
+
* })
|
|
22
|
+
*/
|
|
23
|
+
export const getContractAddresses = ({ chainId }) => {
|
|
24
|
+
return CONTRACT_ADDRESSES[chainId];
|
|
25
|
+
};
|
|
7
26
|
/**
|
|
8
27
|
* Get market information by chain id and token addresses
|
|
9
28
|
* @param chainId - chain id from {@link CHAIN_IDS}
|
|
10
29
|
* @param token0 - token0 address
|
|
11
30
|
* @param token1 - token1 address
|
|
12
31
|
* @param options
|
|
32
|
+
* @param options.n - number of depth levels to fetch
|
|
13
33
|
* @param options.rpcUrl - RPC URL of the blockchain
|
|
34
|
+
* @param options.useSubgraph Whether to use the subgraph to fetch the market data.
|
|
14
35
|
* @returns A market {@link Market}
|
|
15
36
|
*
|
|
16
37
|
* @example
|
|
17
38
|
* import { getMarket } from '@clober/v2-sdk'
|
|
18
39
|
*
|
|
19
|
-
* const market = await getMarket(
|
|
20
|
-
* 421614,
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
* )
|
|
40
|
+
* const market = await getMarket({
|
|
41
|
+
* chainId: 421614,
|
|
42
|
+
* token0: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
|
|
43
|
+
* token1: '0x0000000000000000000000000000000000000000',
|
|
44
|
+
* })
|
|
24
45
|
*/
|
|
25
|
-
export const getMarket = decorator(async ({ chainId, token0, token1, }) => {
|
|
46
|
+
export const getMarket = decorator(async ({ chainId, token0, token1, options, }) => {
|
|
26
47
|
if (isAddressEqual(token0, token1)) {
|
|
27
48
|
throw new Error('Token0 and token1 must be different');
|
|
28
49
|
}
|
|
29
|
-
const market = await fetchMarket(chainId, [token0, token1]);
|
|
50
|
+
const market = await fetchMarket(chainId, [token0, token1], options?.n);
|
|
30
51
|
return {
|
|
31
52
|
chainId,
|
|
32
53
|
quote: market.quote,
|
|
33
54
|
base: market.base,
|
|
34
55
|
makerFee: market.makerFee,
|
|
35
56
|
takerFee: market.takerFee,
|
|
36
|
-
bids: market.bids,
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
57
|
+
bids: market.bids.map(({ price, tick, baseAmount }) => ({
|
|
58
|
+
price,
|
|
59
|
+
tick: Number(tick),
|
|
60
|
+
baseAmount: formatUnits(baseAmount, market.base.decimals),
|
|
61
|
+
})),
|
|
62
|
+
bidBook: {
|
|
63
|
+
id: market.bidBook.id.toString(),
|
|
64
|
+
base: market.bidBook.base,
|
|
65
|
+
unitSize: market.bidBook.unitSize.toString(),
|
|
66
|
+
quote: market.bidBook.quote,
|
|
67
|
+
isOpened: market.bidBook.isOpened,
|
|
68
|
+
},
|
|
69
|
+
asks: market.asks.map(({ price, tick, baseAmount }) => ({
|
|
70
|
+
price,
|
|
71
|
+
tick: Number(tick),
|
|
72
|
+
baseAmount: formatUnits(baseAmount, market.base.decimals),
|
|
73
|
+
})),
|
|
74
|
+
askBook: {
|
|
75
|
+
id: market.askBook.id.toString(),
|
|
76
|
+
base: market.askBook.base,
|
|
77
|
+
unitSize: market.askBook.unitSize.toString(),
|
|
78
|
+
quote: market.askBook.quote,
|
|
79
|
+
isOpened: market.askBook.isOpened,
|
|
80
|
+
},
|
|
40
81
|
};
|
|
41
82
|
});
|
|
83
|
+
/**
|
|
84
|
+
* Calculates and returns the neighboring price ticks and their corresponding prices for a given input price.
|
|
85
|
+
*
|
|
86
|
+
* @param {CHAIN_IDS} chainId - chain id from {@link CHAIN_IDS}
|
|
87
|
+
* @param {string} price - The input price to calculate the neighborhood for, as a string.
|
|
88
|
+
* @param {Currency} currency0 - token0 currency {@link Currency}.
|
|
89
|
+
* @param {Currency} currency1 - token1 currency {@link Currency}.
|
|
90
|
+
*
|
|
91
|
+
* @returns {Object} An object containing the normal and inverted price neighborhoods. Each neighborhood includes:
|
|
92
|
+
* - up: The tick and price for one tick above the current price.
|
|
93
|
+
* - now: The tick and price for the current price.
|
|
94
|
+
* - down: The tick and price for one tick below the current price.
|
|
95
|
+
*/
|
|
96
|
+
export const getPriceNeighborhood = ({ chainId, price, currency0, currency1, }) => {
|
|
97
|
+
const quoteTokenAddress = getQuoteToken({
|
|
98
|
+
chainId,
|
|
99
|
+
token0: currency0.address,
|
|
100
|
+
token1: currency1.address,
|
|
101
|
+
});
|
|
102
|
+
const quoteCurrency = isAddressEqual(quoteTokenAddress, currency0.address)
|
|
103
|
+
? currency0
|
|
104
|
+
: currency1;
|
|
105
|
+
const baseCurrency = isAddressEqual(quoteTokenAddress, currency0.address)
|
|
106
|
+
? currency1
|
|
107
|
+
: currency0;
|
|
108
|
+
const rawPrice = parsePrice(Number(price), quoteCurrency.decimals, baseCurrency.decimals);
|
|
109
|
+
const bidBookTick = fromPrice(rawPrice);
|
|
110
|
+
const askBookTick = fromPrice(invertPrice(rawPrice));
|
|
111
|
+
return {
|
|
112
|
+
normal: {
|
|
113
|
+
up: {
|
|
114
|
+
tick: bidBookTick + 1n,
|
|
115
|
+
price: formatPrice(toPrice(bidBookTick + 1n), quoteCurrency.decimals, baseCurrency.decimals),
|
|
116
|
+
},
|
|
117
|
+
now: {
|
|
118
|
+
tick: bidBookTick,
|
|
119
|
+
price: formatPrice(toPrice(bidBookTick), quoteCurrency.decimals, baseCurrency.decimals),
|
|
120
|
+
},
|
|
121
|
+
down: {
|
|
122
|
+
tick: bidBookTick - 1n,
|
|
123
|
+
price: formatPrice(toPrice(bidBookTick - 1n), quoteCurrency.decimals, baseCurrency.decimals),
|
|
124
|
+
},
|
|
125
|
+
},
|
|
126
|
+
inverted: {
|
|
127
|
+
up: {
|
|
128
|
+
tick: askBookTick + 1n,
|
|
129
|
+
price: formatPrice(toPrice(askBookTick + 1n), baseCurrency.decimals, quoteCurrency.decimals),
|
|
130
|
+
},
|
|
131
|
+
now: {
|
|
132
|
+
tick: askBookTick,
|
|
133
|
+
price: formatPrice(toPrice(askBookTick), baseCurrency.decimals, quoteCurrency.decimals),
|
|
134
|
+
},
|
|
135
|
+
down: {
|
|
136
|
+
tick: askBookTick - 1n,
|
|
137
|
+
price: formatPrice(toPrice(askBookTick - 1n), baseCurrency.decimals, quoteCurrency.decimals),
|
|
138
|
+
},
|
|
139
|
+
},
|
|
140
|
+
};
|
|
141
|
+
};
|
|
42
142
|
/**
|
|
43
143
|
* Calculates the expected output for a given input amount, based on the provided market data.
|
|
44
144
|
*
|
|
@@ -49,16 +149,17 @@ export const getMarket = decorator(async ({ chainId, token0, token1, }) => {
|
|
|
49
149
|
* @param options
|
|
50
150
|
* @param options.limitPrice The maximum limit price to spend.
|
|
51
151
|
* @param options.rpcUrl The RPC URL of the blockchain.
|
|
152
|
+
* @param options.useSubgraph Whether to use the subgraph to fetch the market data.
|
|
52
153
|
* @returns A Promise resolving to an object containing the taken amount, spend amount and result of the calculation.
|
|
53
154
|
* @example
|
|
54
155
|
* import { getExpectedOutput } from '@clober/v2-sdk'
|
|
55
156
|
*
|
|
56
|
-
* const { takenAmount,
|
|
57
|
-
* 421614,
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
61
|
-
* )
|
|
157
|
+
* const { takenAmount, spentAmount } = await getExpectedOutput({
|
|
158
|
+
* chainId: 421614,
|
|
159
|
+
* inputToken: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
|
|
160
|
+
* outputToken: '0x0000000000000000000000000000000000000000',
|
|
161
|
+
* amountIn: '1000.123', // spend 1000.123 USDC
|
|
162
|
+
* })
|
|
62
163
|
*/
|
|
63
164
|
export const getExpectedOutput = decorator(async ({ chainId, inputToken, outputToken, amountIn, options, }) => {
|
|
64
165
|
const market = await fetchMarket(chainId, [inputToken, outputToken]);
|
|
@@ -69,23 +170,15 @@ export const getExpectedOutput = decorator(async ({ chainId, inputToken, outputT
|
|
|
69
170
|
? MAX_PRICE
|
|
70
171
|
: 0n;
|
|
71
172
|
const inputCurrency = isBid ? market.quote : market.base;
|
|
72
|
-
const
|
|
73
|
-
|
|
173
|
+
const { takenQuoteAmount, spentBaseAmount, bookId } = market.spend({
|
|
174
|
+
spentBase: !isBid,
|
|
74
175
|
limitPrice: rawLimitPrice,
|
|
75
176
|
amountIn: parseUnits(amountIn, inputCurrency.decimals),
|
|
76
177
|
});
|
|
77
|
-
const { takenAmount, spendAmount } = Object.values(result).reduce((acc, { takenAmount, spendAmount }) => ({
|
|
78
|
-
takenAmount: acc.takenAmount + takenAmount,
|
|
79
|
-
spendAmount: acc.spendAmount + spendAmount,
|
|
80
|
-
}), { takenAmount: 0n, spendAmount: 0n });
|
|
81
178
|
return {
|
|
82
|
-
takenAmount: formatUnits(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
bookId: BigInt(bookId),
|
|
86
|
-
takenAmount,
|
|
87
|
-
spendAmount,
|
|
88
|
-
})),
|
|
179
|
+
takenAmount: formatUnits(takenQuoteAmount, isBid ? market.base.decimals : market.quote.decimals),
|
|
180
|
+
spentAmount: formatUnits(spentBaseAmount, isBid ? market.quote.decimals : market.base.decimals),
|
|
181
|
+
bookId,
|
|
89
182
|
};
|
|
90
183
|
});
|
|
91
184
|
/**
|
|
@@ -98,16 +191,17 @@ export const getExpectedOutput = decorator(async ({ chainId, inputToken, outputT
|
|
|
98
191
|
* @param options
|
|
99
192
|
* @param options.limitPrice The maximum limit price to take.
|
|
100
193
|
* @param options.rpcUrl The RPC URL of the blockchain.
|
|
101
|
-
* @
|
|
194
|
+
* @param options.useSubgraph Whether to use the subgraph to fetch the market data.
|
|
195
|
+
* @returns A Promise resolving to an object containing the taken amount, spent amount and result of the calculation.
|
|
102
196
|
* @example
|
|
103
197
|
* import { getExpectedInput } from '@clober/v2-sdk'
|
|
104
198
|
*
|
|
105
|
-
* const { takenAmount,
|
|
106
|
-
* 421614,
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
* )
|
|
199
|
+
* const { takenAmount, spentAmount } = await getExpectedInput({
|
|
200
|
+
* chainId: 421614,
|
|
201
|
+
* inputToken: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
|
|
202
|
+
* outputToken: '0x0000000000000000000000000000000000000000',
|
|
203
|
+
* amountOut: '0.1', // take 0.1 ETH
|
|
204
|
+
* })
|
|
111
205
|
*/
|
|
112
206
|
export const getExpectedInput = decorator(async ({ chainId, inputToken, outputToken, amountOut, options, }) => {
|
|
113
207
|
const market = await fetchMarket(chainId, [inputToken, outputToken]);
|
|
@@ -118,23 +212,15 @@ export const getExpectedInput = decorator(async ({ chainId, inputToken, outputTo
|
|
|
118
212
|
? MAX_PRICE
|
|
119
213
|
: 0n;
|
|
120
214
|
const outputCurrency = isBid ? market.base : market.quote;
|
|
121
|
-
const
|
|
215
|
+
const { takenQuoteAmount, spentBaseAmount, bookId } = market.take({
|
|
122
216
|
takeQuote: !isBid,
|
|
123
217
|
limitPrice: rawLimitPrice,
|
|
124
218
|
amountOut: parseUnits(amountOut, outputCurrency.decimals),
|
|
125
219
|
});
|
|
126
|
-
const { takenAmount, spendAmount } = Object.values(result).reduce((acc, { takenAmount, spendAmount }) => ({
|
|
127
|
-
takenAmount: acc.takenAmount + takenAmount,
|
|
128
|
-
spendAmount: acc.spendAmount + spendAmount,
|
|
129
|
-
}), { takenAmount: 0n, spendAmount: 0n });
|
|
130
220
|
return {
|
|
131
|
-
takenAmount: formatUnits(
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
bookId: BigInt(bookId),
|
|
135
|
-
takenAmount,
|
|
136
|
-
spendAmount,
|
|
137
|
-
})),
|
|
221
|
+
takenAmount: formatUnits(takenQuoteAmount, isBid ? market.base.decimals : market.quote.decimals),
|
|
222
|
+
spentAmount: formatUnits(spentBaseAmount, isBid ? market.quote.decimals : market.base.decimals),
|
|
223
|
+
bookId,
|
|
138
224
|
};
|
|
139
225
|
});
|
|
140
226
|
/**
|
|
@@ -144,14 +230,15 @@ export const getExpectedInput = decorator(async ({ chainId, inputToken, outputTo
|
|
|
144
230
|
* @param {string} id The ID of the open order.
|
|
145
231
|
* @param options
|
|
146
232
|
* @param options.rpcUrl The RPC URL of the blockchain.
|
|
233
|
+
* @param options.useSubgraph Whether to use the subgraph to fetch the market data.
|
|
147
234
|
* @returns {Promise<OpenOrder>} Promise resolving to the open order object, or undefined if not found.
|
|
148
235
|
* @example
|
|
149
236
|
* import { getOpenOrder } from '@clober/v2-sdk'
|
|
150
237
|
*
|
|
151
|
-
* const openOrder = await getOpenOrder(
|
|
152
|
-
* 421614,
|
|
153
|
-
*
|
|
154
|
-
* )
|
|
238
|
+
* const openOrder = await getOpenOrder({
|
|
239
|
+
* chainId: 421614,
|
|
240
|
+
* id: '46223845323662364279893361453861711542636620039907198451770258805035840307200'
|
|
241
|
+
* })
|
|
155
242
|
*/
|
|
156
243
|
export const getOpenOrder = decorator(async ({ chainId, id, }) => {
|
|
157
244
|
return fetchOpenOrder(chainId, id);
|
|
@@ -163,16 +250,83 @@ export const getOpenOrder = decorator(async ({ chainId, id, }) => {
|
|
|
163
250
|
* @param {`0x${string}`} userAddress The Ethereum address of the user.
|
|
164
251
|
* @param options
|
|
165
252
|
* @param options.rpcUrl The RPC URL of the blockchain.
|
|
253
|
+
* @param options.useSubgraph Whether to use the subgraph to fetch the market data.
|
|
166
254
|
* @returns {Promise<OpenOrder[]>} Promise resolving to an array of open orders.
|
|
167
255
|
* @example
|
|
168
256
|
* import { getOpenOrders } from '@clober/v2-sdk'
|
|
169
257
|
*
|
|
170
|
-
* const openOrders = await getOpenOrders(
|
|
171
|
-
* 421614,
|
|
172
|
-
*
|
|
173
|
-
* )
|
|
258
|
+
* const openOrders = await getOpenOrders({
|
|
259
|
+
* chainId: 421614,
|
|
260
|
+
* userAddress: '0x5F79EE8f8fA862E98201120d83c4eC39D9468D49'
|
|
261
|
+
* })
|
|
174
262
|
*/
|
|
175
263
|
export const getOpenOrders = decorator(async ({ chainId, userAddress, }) => {
|
|
176
|
-
return
|
|
264
|
+
return fetchOpenOrdersByUserAddress(chainId, userAddress);
|
|
265
|
+
});
|
|
266
|
+
/**
|
|
267
|
+
* Retrieves the latest chart log for a specific market.
|
|
268
|
+
*
|
|
269
|
+
* @param {CHAIN_IDS} params.chainId - The ID of the blockchain.
|
|
270
|
+
* @param {`0x${string}`} params.quote - The address of the quote token.
|
|
271
|
+
* @param {`0x${string}`} params.base - The address of the base token.
|
|
272
|
+
* @returns {Promise<ChartLog>} A promise that resolves with the latest chart log.
|
|
273
|
+
*
|
|
274
|
+
* @example
|
|
275
|
+
* import { getLatestChartLog } from '@clober/v2-sdk'
|
|
276
|
+
*
|
|
277
|
+
* const logs = await getLatestChartLog({
|
|
278
|
+
* chainId: 421614,
|
|
279
|
+
* quote: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
|
|
280
|
+
* base: '0x0000000000000000000000000000000000000000',
|
|
281
|
+
* })
|
|
282
|
+
*/
|
|
283
|
+
export const getLatestChartLog = decorator(async ({ chainId, quote, base, }) => {
|
|
284
|
+
return fetchLatestChartLog(chainId, `${base}/${quote}`);
|
|
177
285
|
});
|
|
286
|
+
/**
|
|
287
|
+
* Retrieves chart logs for a specific market within a specified time interval.
|
|
288
|
+
*
|
|
289
|
+
* @param {CHAIN_IDS} params.chainId - The ID of the chain.
|
|
290
|
+
* @param {`0x${string}`} params.quote - The address of the quote token.
|
|
291
|
+
* @param {`0x${string}`} params.base - The address of the base token.
|
|
292
|
+
* @param {CHART_LOG_INTERVALS} params.intervalType - The type of time interval for the chart logs.
|
|
293
|
+
* @param {number} params.from - The start of the time interval (Unix timestamp in seconds).
|
|
294
|
+
* @param {number} params.to - The end of the time interval (Unix timestamp in seconds).
|
|
295
|
+
* @returns {Promise<ChartLog[]>} A promise that resolves with an array of chart logs within the specified interval.
|
|
296
|
+
*
|
|
297
|
+
* @example
|
|
298
|
+
* import { getLatestChartLog, CHART_LOG_INTERVALS } from '@clober/v2-sdk'
|
|
299
|
+
*
|
|
300
|
+
* const logs = await getChartLogs({
|
|
301
|
+
* chainId: 421614,
|
|
302
|
+
* quote: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
|
|
303
|
+
* base: '0x0000000000000000000000000000000000000000',
|
|
304
|
+
* intervalType: CHART_LOG_INTERVALS.oneDay,
|
|
305
|
+
* from: 1687305600,
|
|
306
|
+
* to: 1713312000,
|
|
307
|
+
* })
|
|
308
|
+
*/
|
|
309
|
+
export const getChartLogs = decorator(async ({ chainId, quote, base, intervalType, from, to, }) => {
|
|
310
|
+
return fetchChartLogs(chainId, `${base}/${quote}`, intervalType, from, to);
|
|
311
|
+
});
|
|
312
|
+
/**
|
|
313
|
+
* Retrieves the quote token address for a given chain and a pair of tokens.
|
|
314
|
+
*
|
|
315
|
+
* @param chainId - chain id from {@link CHAIN_IDS}
|
|
316
|
+
* @param token0 - token0 address
|
|
317
|
+
* @param token1 - token1 address
|
|
318
|
+
* @returns {string} The address of the quote token.
|
|
319
|
+
*
|
|
320
|
+
* @example
|
|
321
|
+
* import { getQuoteToken } from '@clober/v2-sdk'
|
|
322
|
+
*
|
|
323
|
+
* const quote = await getQuoteToken({
|
|
324
|
+
* chainId: 421614,
|
|
325
|
+
* token0: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
|
|
326
|
+
* token1: '0x0000000000000000000000000000000000000000',
|
|
327
|
+
* })
|
|
328
|
+
*/
|
|
329
|
+
export const getQuoteToken = ({ chainId, token0, token1, }) => {
|
|
330
|
+
return getAddress(getMarketId(chainId, [token0, token1]).quoteTokenAddress);
|
|
331
|
+
};
|
|
178
332
|
//# sourceMappingURL=view.js.map
|
package/dist/esm/view.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../src/view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"view.js","sourceRoot":"","sources":["../../src/view.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAA;AAE1E,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAA;AAI3C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAA;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,4BAA4B,EAAE,MAAM,mBAAmB,CAAA;AAEhF,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAA;AACvE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,uBAAuB,CAAA;AAC1D,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAE9D;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,EAAE,OAAO,EAA0B,EAAE,EAAE;IAC1E,OAAO,kBAAkB,CAAC,OAAO,CAAC,CAAA;AACpC,CAAC,CAAA;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MA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