@clober/v2-sdk 0.0.3-b → 0.0.4-6.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 +63 -34
- package/dist/cjs/apis/market.js.map +1 -1
- package/dist/cjs/apis/open-order.js +60 -25
- package/dist/cjs/apis/open-order.js.map +1 -1
- package/dist/cjs/approval.js +79 -32
- package/dist/cjs/approval.js.map +1 -1
- package/dist/cjs/call.js +346 -245
- 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 +18 -0
- package/dist/cjs/constants/client.js.map +1 -0
- 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 +43 -182
- package/dist/cjs/model/market.js.map +1 -1
- package/dist/cjs/signature.js +25 -25
- 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/approval.js +3 -8
- package/dist/cjs/utils/approval.js.map +1 -1
- package/dist/cjs/utils/bigint.js +9 -0
- package/dist/cjs/utils/bigint.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 +10 -13
- 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 +15 -0
- package/dist/cjs/utils/decorator.js.map +1 -0
- 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 +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 +14 -0
- package/dist/cjs/utils.js.map +1 -0
- package/dist/cjs/view.js +64 -49
- 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 +63 -34
- package/dist/esm/apis/market.js.map +1 -1
- package/dist/esm/apis/open-order.js +61 -25
- package/dist/esm/apis/open-order.js.map +1 -1
- package/dist/esm/approval.js +118 -45
- package/dist/esm/approval.js.map +1 -1
- package/dist/esm/call.js +464 -342
- 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 +14 -0
- package/dist/esm/constants/client.js.map +1 -0
- 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 +44 -187
- package/dist/esm/model/market.js.map +1 -1
- package/dist/esm/signature.js +40 -45
- 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/approval.js +3 -8
- package/dist/esm/utils/approval.js.map +1 -1
- package/dist/esm/utils/bigint.js +5 -0
- package/dist/esm/utils/bigint.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 +11 -14
- 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 +11 -0
- package/dist/esm/utils/decorator.js.map +1 -0
- 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 +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 +164 -71
- 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 +4 -3
- package/dist/types/apis/open-order.d.ts.map +1 -1
- package/dist/types/approval.d.ts +50 -15
- package/dist/types/approval.d.ts.map +1 -1
- package/dist/types/call.d.ts +191 -123
- 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 +5 -0
- package/dist/types/constants/client.d.ts.map +1 -0
- 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 +3 -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 +23 -25
- package/dist/types/signature.d.ts.map +1 -1
- package/dist/types/type.d.ts +54 -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/approval.d.ts +1 -1
- package/dist/types/utils/approval.d.ts.map +1 -1
- package/dist/types/utils/bigint.d.ts +2 -0
- package/dist/types/utils/bigint.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 -4
- package/dist/types/utils/build-transaction.d.ts.map +1 -1
- package/dist/types/utils/currency.d.ts +7 -0
- package/dist/types/utils/currency.d.ts.map +1 -0
- package/dist/types/utils/decorator.d.ts +6 -0
- package/dist/types/utils/decorator.d.ts.map +1 -0
- 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 +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 +164 -52
- 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 -87
- 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 -38
- 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 -83
- 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 -34
- 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 +0 -4
- 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/types/call.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { CHAIN_IDS } from './constants/chain';
|
|
2
|
-
import {
|
|
2
|
+
import type { CurrencyFlow, DefaultOptions, ERC20PermitParam, Transaction } from './type';
|
|
3
3
|
/**
|
|
4
4
|
* Build a transaction to open a market.
|
|
5
5
|
*
|
|
6
6
|
* @param chainId The chain ID of the blockchain.
|
|
7
|
+
* @param userAddress The address of the user.
|
|
7
8
|
* @param inputToken The address of the input token.
|
|
8
9
|
* @param outputToken The address of the output token.
|
|
9
10
|
* @param options
|
|
@@ -12,14 +13,19 @@ import { PermitSignature, Transaction } from './type';
|
|
|
12
13
|
* @example
|
|
13
14
|
* import { openMarket } from '@clober/v2-sdk'
|
|
14
15
|
*
|
|
15
|
-
* const transaction = await openMarket(
|
|
16
|
-
* 421614,
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
16
|
+
* const transaction = await openMarket({
|
|
17
|
+
* chainId: 421614,
|
|
18
|
+
* userAddress: '0xF8c1869Ecd4df136693C45EcE1b67f85B6bDaE69',
|
|
19
|
+
* inputToken: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
|
|
20
|
+
* outputToken: '0x0000000000000000000000000000000000000000'
|
|
21
|
+
* })
|
|
20
22
|
*/
|
|
21
|
-
export declare const openMarket: (
|
|
22
|
-
|
|
23
|
+
export declare const openMarket: (args: {
|
|
24
|
+
chainId: CHAIN_IDS;
|
|
25
|
+
userAddress: `0x${string}`;
|
|
26
|
+
inputToken: `0x${string}`;
|
|
27
|
+
outputToken: `0x${string}`;
|
|
28
|
+
options?: DefaultOptions;
|
|
23
29
|
}) => Promise<Transaction | undefined>;
|
|
24
30
|
/**
|
|
25
31
|
* Places a limit order on the specified chain for trading tokens.
|
|
@@ -31,98 +37,124 @@ export declare const openMarket: (chainId: CHAIN_IDS, inputToken: `0x${string}`,
|
|
|
31
37
|
* @param {string} amount The amount of input tokens for the order.
|
|
32
38
|
* @param {string} price The price at which the order should be executed.
|
|
33
39
|
* @param {Object} [options] Optional parameters for the limit order.
|
|
34
|
-
* @param {
|
|
40
|
+
* @param {erc20PermitParam} [options.erc20PermitParam] The permit signature for token approval.
|
|
35
41
|
* @param {boolean} [options.postOnly] A boolean indicating whether the order is only to be made not taken.
|
|
36
42
|
* @param {string} [options.rpcUrl] The RPC URL of the blockchain.
|
|
37
|
-
* @
|
|
43
|
+
* @param {number} [options.gasLimit] The gas limit to use for the transaction.
|
|
44
|
+
* @param {boolean} [options.useSubgraph] A boolean indicating whether to use the subgraph for fetching orders.
|
|
45
|
+
* @returns {Promise<{ transaction: Transaction, result: { make: CurrencyFlow, take: CurrencyFlow, spent: CurrencyFlow }>}
|
|
46
|
+
* Promise resolving to the transaction object representing the limit order with the result of the order.
|
|
38
47
|
* @example
|
|
39
48
|
* import { signERC20Permit, limitOrder } from '@clober/v2-sdk'
|
|
40
49
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
41
50
|
*
|
|
42
|
-
* const
|
|
43
|
-
* 421614,
|
|
44
|
-
*
|
|
45
|
-
* '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
|
|
46
|
-
* '100.123'
|
|
47
|
-
* )
|
|
51
|
+
* const erc20PermitParam = await signERC20Permit({
|
|
52
|
+
* chainId: 421614,
|
|
53
|
+
* walletClient,
|
|
54
|
+
* token: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
|
|
55
|
+
* amount: '100.123'
|
|
56
|
+
* })
|
|
48
57
|
*
|
|
49
|
-
* const transaction = await limitOrder(
|
|
50
|
-
* 421614,
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* )
|
|
58
|
+
* const { transaction } = await limitOrder({
|
|
59
|
+
* chainId: 421614,
|
|
60
|
+
* userAddress: '0xF8c1869Ecd4df136693C45EcE1b67f85B6bDaE69
|
|
61
|
+
* inputToken: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
|
|
62
|
+
* outputToken: '0x0000000000000000000000000000000000000000',
|
|
63
|
+
* amount: '100.123', // 100.123 USDC
|
|
64
|
+
* price: '4000.01', // price at 4000.01 (ETH/USDC)
|
|
65
|
+
* options: { erc20PermitParam }
|
|
66
|
+
* })
|
|
58
67
|
*
|
|
59
68
|
* @example
|
|
60
69
|
* import { limitOrder } from '@clober/v2-sdk'
|
|
61
70
|
*
|
|
62
|
-
* const transaction = await limitOrder(
|
|
63
|
-
* 421614,
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
67
|
-
*
|
|
68
|
-
*
|
|
69
|
-
* )
|
|
71
|
+
* const { transaction } = await limitOrder({
|
|
72
|
+
* chainId: 421614,
|
|
73
|
+
* userAddress: '0xF8c1869Ecd4df136693C45EcE1b67f85B6bDaE69
|
|
74
|
+
* inputToken: '0x0000000000000000000000000000000000000000',
|
|
75
|
+
* outputToken: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
|
|
76
|
+
* amount: '0.13', // 0.13 ETH
|
|
77
|
+
* price: '4000.01', // price at 4000.01 (ETH/USDC)
|
|
78
|
+
* })
|
|
70
79
|
*/
|
|
71
|
-
export declare const limitOrder: (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
}
|
|
80
|
+
export declare const limitOrder: (args: {
|
|
81
|
+
chainId: CHAIN_IDS;
|
|
82
|
+
userAddress: `0x${string}`;
|
|
83
|
+
inputToken: `0x${string}`;
|
|
84
|
+
outputToken: `0x${string}`;
|
|
85
|
+
amount: string;
|
|
86
|
+
price: string;
|
|
87
|
+
options?: {
|
|
88
|
+
erc20PermitParam?: ERC20PermitParam;
|
|
89
|
+
postOnly?: boolean;
|
|
90
|
+
} & DefaultOptions;
|
|
91
|
+
}) => Promise<{
|
|
92
|
+
transaction: Transaction;
|
|
93
|
+
result: {
|
|
94
|
+
make: CurrencyFlow;
|
|
95
|
+
taken: CurrencyFlow;
|
|
96
|
+
spent: CurrencyFlow;
|
|
97
|
+
};
|
|
98
|
+
}>;
|
|
76
99
|
/**
|
|
77
100
|
* Executes a market order on the specified chain for trading tokens.
|
|
101
|
+
* If only `amountIn` is provided, spend the specified amount of input tokens.
|
|
102
|
+
* If only `amountOut` is provided, take the specified amount of output tokens.
|
|
78
103
|
*
|
|
79
104
|
* @param {CHAIN_IDS} chainId The chain ID.
|
|
80
105
|
* @param {`0x${string}`} userAddress The Ethereum address of the user placing the order.
|
|
81
106
|
* @param {`0x${string}`} inputToken The address of the token to be used as input.
|
|
82
107
|
* @param {`0x${string}`} outputToken The address of the token to be received as output.
|
|
83
|
-
* @param {string}
|
|
84
|
-
* @param {
|
|
85
|
-
* @param {
|
|
108
|
+
* @param {string} amountIn The amount of input tokens for the order to spend.
|
|
109
|
+
* @param {string} amountOut The amount of output tokens for the order to take.
|
|
110
|
+
* @param {Object} [options] Optional parameters for the market order.
|
|
111
|
+
* @param {erc20PermitParam} [options.erc20PermitParam] The permit signature for token approval.
|
|
86
112
|
* @param {string} [options.rpcUrl] The RPC URL of the blockchain.
|
|
87
|
-
* @param {
|
|
88
|
-
*
|
|
89
|
-
* @
|
|
113
|
+
* @param {number} [options.gasLimit] The gas limit to use for the transaction.
|
|
114
|
+
* @param {boolean} [options.useSubgraph] A boolean indicating whether to use the subgraph for fetching orders.
|
|
115
|
+
* @param {number} [options.slippage] The maximum slippage percentage allowed for the order.
|
|
116
|
+
* if the slippage is not provided, unlimited slippage is allowed.
|
|
117
|
+
* @returns {Promise<{ transaction: Transaction, result: { spent: CurrencyFlow, taken: CurrencyFlow } }>}
|
|
118
|
+
* Promise resolving to the transaction object representing the market order with the result of the order.
|
|
90
119
|
* @example
|
|
91
120
|
* import { signERC20Permit, marketOrder } from '@clober/v2-sdk'
|
|
92
121
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
93
122
|
*
|
|
94
|
-
* const
|
|
95
|
-
* 421614,
|
|
96
|
-
*
|
|
97
|
-
* '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
|
|
98
|
-
* '100.123'
|
|
99
|
-
* )
|
|
123
|
+
* const erc20PermitParam = await signERC20Permit({
|
|
124
|
+
* chainId: 421614,
|
|
125
|
+
* walletClient,
|
|
126
|
+
* token: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
|
|
127
|
+
* amount: '100.123'
|
|
128
|
+
* })
|
|
100
129
|
*
|
|
101
|
-
* const transaction = await marketOrder(
|
|
102
|
-
* 421614,
|
|
103
|
-
*
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
* )
|
|
130
|
+
* const transaction = await marketOrder({
|
|
131
|
+
* chainId: 421614,
|
|
132
|
+
* userAddress: '0xF8c1869Ecd4df136693C45EcE1b67f85B6bDaE69
|
|
133
|
+
* inputToken: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
|
|
134
|
+
* outputToken: '0x0000000000000000000000000000000000000000',
|
|
135
|
+
* amount: '100.123', // 100.123 USDC
|
|
136
|
+
* options: { erc20PermitParam }
|
|
137
|
+
* })
|
|
109
138
|
*
|
|
110
|
-
* @example
|
|
111
|
-
* import { marketOrder } from '@clober/v2-sdk'
|
|
112
|
-
*
|
|
113
|
-
* const transaction = await limitOrder(
|
|
114
|
-
* 421614,
|
|
115
|
-
* '0xF8c1869Ecd4df136693C45EcE1b67f85B6bDaE69
|
|
116
|
-
* '0x0000000000000000000000000000000000000000',
|
|
117
|
-
* '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
|
|
118
|
-
* '0.13', // 0.13 ETH
|
|
119
|
-
* )
|
|
120
139
|
*/
|
|
121
|
-
export declare const marketOrder: (
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
}
|
|
140
|
+
export declare const marketOrder: (args: {
|
|
141
|
+
chainId: CHAIN_IDS;
|
|
142
|
+
userAddress: `0x${string}`;
|
|
143
|
+
inputToken: `0x${string}`;
|
|
144
|
+
outputToken: `0x${string}`;
|
|
145
|
+
amountIn?: string;
|
|
146
|
+
amountOut?: string;
|
|
147
|
+
options?: {
|
|
148
|
+
erc20PermitParam?: ERC20PermitParam;
|
|
149
|
+
slippage?: number;
|
|
150
|
+
} & DefaultOptions;
|
|
151
|
+
}) => Promise<{
|
|
152
|
+
transaction: Transaction;
|
|
153
|
+
result: {
|
|
154
|
+
taken: CurrencyFlow;
|
|
155
|
+
spent: CurrencyFlow;
|
|
156
|
+
};
|
|
157
|
+
}>;
|
|
126
158
|
/**
|
|
127
159
|
* Claims specified open order for settlement.
|
|
128
160
|
* [IMPORTANT] Set ApprovalForAll before calling this function.
|
|
@@ -132,24 +164,33 @@ export declare const marketOrder: (chainId: CHAIN_IDS, userAddress: `0x${string}
|
|
|
132
164
|
* @param {string} id An ID representing the open order to be claimed.
|
|
133
165
|
* @param {Object} [options] Optional parameters for claiming orders.
|
|
134
166
|
* @param {string} [options.rpcUrl] The RPC URL to use for executing the transaction.
|
|
135
|
-
* @
|
|
167
|
+
* @param {number} [options.gasLimit] The gas limit to use for the transaction.
|
|
168
|
+
* @param {boolean} [options.useSubgraph] A boolean indicating whether to use the subgraph for fetching orders.
|
|
169
|
+
* @returns {Promise<{ transaction: Transaction, result: CurrencyFlow }>}
|
|
170
|
+
* Promise resolving to the transaction object representing the claim action with the result of the order.
|
|
136
171
|
* @throws {Error} Throws an error if no open orders are found for the specified user.
|
|
137
172
|
* @example
|
|
138
173
|
* import { getOpenOrders, claimOrders } from '@clober/v2-sdk'
|
|
139
174
|
*
|
|
140
|
-
* const openOrders = await getOpenOrders(
|
|
141
|
-
* 421614,
|
|
142
|
-
*
|
|
143
|
-
* )
|
|
144
|
-
* const transaction = await claimOrders(
|
|
145
|
-
* 421614,
|
|
146
|
-
* '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
|
|
147
|
-
* openOrders.map((order) => order.id)
|
|
148
|
-
* )
|
|
175
|
+
* const openOrders = await getOpenOrders({
|
|
176
|
+
* chainId: 421614,
|
|
177
|
+
* userAddress: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0'
|
|
178
|
+
* })
|
|
179
|
+
* const transaction = await claimOrders({
|
|
180
|
+
* chainId: 421614,
|
|
181
|
+
* userAddress: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
|
|
182
|
+
* id: openOrders.map((order) => order.id)
|
|
183
|
+
* })
|
|
149
184
|
*/
|
|
150
|
-
export declare const claimOrder: (
|
|
151
|
-
|
|
152
|
-
}
|
|
185
|
+
export declare const claimOrder: (args: {
|
|
186
|
+
chainId: CHAIN_IDS;
|
|
187
|
+
userAddress: `0x${string}`;
|
|
188
|
+
id: string;
|
|
189
|
+
options?: DefaultOptions;
|
|
190
|
+
}) => Promise<{
|
|
191
|
+
transaction: Transaction;
|
|
192
|
+
result: CurrencyFlow;
|
|
193
|
+
}>;
|
|
153
194
|
/**
|
|
154
195
|
* Claims specified open orders for settlement.
|
|
155
196
|
* [IMPORTANT] Set ApprovalForAll before calling this function.
|
|
@@ -159,24 +200,33 @@ export declare const claimOrder: (chainId: CHAIN_IDS, userAddress: `0x${string}`
|
|
|
159
200
|
* @param {string[]} ids An array of IDs representing the open orders to be claimed.
|
|
160
201
|
* @param {Object} [options] Optional parameters for claiming orders.
|
|
161
202
|
* @param {string} [options.rpcUrl] The RPC URL to use for executing the transaction.
|
|
162
|
-
* @
|
|
203
|
+
* @param {number} [options.gasLimit] The gas limit to use for the transaction.
|
|
204
|
+
* @param {boolean} [options.useSubgraph] A boolean indicating whether to use the subgraph for fetching orders.
|
|
205
|
+
* @returns {Promise<{ transaction: Transaction, result: CurrencyFlow[] }>}
|
|
206
|
+
* Promise resolving to the transaction object representing the claim action with the result of the orders.
|
|
163
207
|
* @throws {Error} Throws an error if no open orders are found for the specified user.
|
|
164
208
|
* @example
|
|
165
209
|
* import { getOpenOrders, claimOrders } from '@clober/v2-sdk'
|
|
166
210
|
*
|
|
167
|
-
* const openOrders = await getOpenOrders(
|
|
168
|
-
* 421614,
|
|
169
|
-
*
|
|
170
|
-
* )
|
|
211
|
+
* const openOrders = await getOpenOrders({
|
|
212
|
+
* chainId: 421614,
|
|
213
|
+
* userAddress: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0'
|
|
214
|
+
* })
|
|
171
215
|
* const transaction = await claimOrders(
|
|
172
|
-
* 421614,
|
|
173
|
-
* '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
|
|
174
|
-
* openOrders.map((order) => order.id)
|
|
216
|
+
* chainId: 421614,
|
|
217
|
+
* userAddress: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
|
|
218
|
+
* ids: openOrders.map((order) => order.id)
|
|
175
219
|
* )
|
|
176
220
|
*/
|
|
177
|
-
export declare const claimOrders: (
|
|
178
|
-
|
|
179
|
-
}
|
|
221
|
+
export declare const claimOrders: (args: {
|
|
222
|
+
chainId: CHAIN_IDS;
|
|
223
|
+
userAddress: `0x${string}`;
|
|
224
|
+
ids: string[];
|
|
225
|
+
options?: DefaultOptions;
|
|
226
|
+
}) => Promise<{
|
|
227
|
+
transaction: Transaction;
|
|
228
|
+
result: CurrencyFlow[];
|
|
229
|
+
}>;
|
|
180
230
|
/**
|
|
181
231
|
* Cancels specified open order if the order is not fully filled.
|
|
182
232
|
* [IMPORTANT] Set ApprovalForAll before calling this function.
|
|
@@ -186,24 +236,33 @@ export declare const claimOrders: (chainId: CHAIN_IDS, userAddress: `0x${string}
|
|
|
186
236
|
* @param {string} id An ID representing the open order to be canceled
|
|
187
237
|
* @param {Object} [options] Optional parameters for canceling orders.
|
|
188
238
|
* @param {string} [options.rpcUrl] The RPC URL to use for executing the transaction.
|
|
189
|
-
* @
|
|
239
|
+
* @param {number} [options.gasLimit] The gas limit to use for the transaction.
|
|
240
|
+
* @param {boolean} [options.useSubgraph] A boolean indicating whether to use the subgraph for fetching orders.
|
|
241
|
+
* @returns {Promise<{ transaction: Transaction, result: CurrencyFlow }>}
|
|
242
|
+
* Promise resolving to the transaction object representing the cancel action with the result of the order.
|
|
190
243
|
* @throws {Error} Throws an error if no open orders are found for the specified user.
|
|
191
244
|
* @example
|
|
192
245
|
* import { getOpenOrders, cancelOrders } from '@clober/v2-sdk'
|
|
193
246
|
*
|
|
194
|
-
* const openOrders = await getOpenOrders(
|
|
195
|
-
* 421614,
|
|
196
|
-
*
|
|
197
|
-
* )
|
|
198
|
-
* const transaction = await cancelOrders(
|
|
199
|
-
* 421614,
|
|
200
|
-
* '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
|
|
201
|
-
* openOrders.map((order) => order.id)
|
|
202
|
-
* )
|
|
247
|
+
* const openOrders = await getOpenOrders({
|
|
248
|
+
* chainId: 421614,
|
|
249
|
+
* userAddress:'0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0'
|
|
250
|
+
* })
|
|
251
|
+
* const transaction = await cancelOrders({
|
|
252
|
+
* chainId: 421614,
|
|
253
|
+
* userAddress: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
|
|
254
|
+
* id: openOrders.map((order) => order.id)
|
|
255
|
+
* })
|
|
203
256
|
*/
|
|
204
|
-
export declare const cancelOrder: (
|
|
205
|
-
|
|
206
|
-
}
|
|
257
|
+
export declare const cancelOrder: (args: {
|
|
258
|
+
chainId: CHAIN_IDS;
|
|
259
|
+
userAddress: `0x${string}`;
|
|
260
|
+
id: string;
|
|
261
|
+
options?: DefaultOptions;
|
|
262
|
+
}) => Promise<{
|
|
263
|
+
transaction: Transaction;
|
|
264
|
+
result: CurrencyFlow;
|
|
265
|
+
}>;
|
|
207
266
|
/**
|
|
208
267
|
* Cancels specified open orders if orders are not fully filled.
|
|
209
268
|
* [IMPORTANT] Set ApprovalForAll before calling this function.
|
|
@@ -213,22 +272,31 @@ export declare const cancelOrder: (chainId: CHAIN_IDS, userAddress: `0x${string}
|
|
|
213
272
|
* @param {string[]} ids An array of IDs representing the open orders to be canceled.
|
|
214
273
|
* @param {Object} [options] Optional parameters for canceling orders.
|
|
215
274
|
* @param {string} [options.rpcUrl] The RPC URL to use for executing the transaction.
|
|
216
|
-
* @
|
|
275
|
+
* @param {number} [options.gasLimit] The gas limit to use for the transaction.
|
|
276
|
+
* @param {boolean} [options.useSubgraph] A boolean indicating whether to use the subgraph for fetching orders.
|
|
277
|
+
* @returns {Promise<{ transaction: Transaction, result: CurrencyFlow[] }>
|
|
278
|
+
* Promise resolving to the transaction object representing the cancel action with the result of the orders.
|
|
217
279
|
* @throws {Error} Throws an error if no open orders are found for the specified user.
|
|
218
280
|
* @example
|
|
219
281
|
* import { getOpenOrders, cancelOrders } from '@clober/v2-sdk'
|
|
220
282
|
*
|
|
221
|
-
* const openOrders = await getOpenOrders(
|
|
222
|
-
* 421614,
|
|
223
|
-
*
|
|
224
|
-
* )
|
|
225
|
-
* const transaction = await cancelOrders(
|
|
226
|
-
* 421614,
|
|
227
|
-
* '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
|
|
228
|
-
* openOrders.map((order) => order.id)
|
|
229
|
-
* )
|
|
283
|
+
* const openOrders = await getOpenOrders({
|
|
284
|
+
* chainId: 421614,
|
|
285
|
+
* userAddress: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0'
|
|
286
|
+
* })
|
|
287
|
+
* const transaction = await cancelOrders({
|
|
288
|
+
* chainId: 421614,
|
|
289
|
+
* userAddress: '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
|
|
290
|
+
* ids: openOrders.map((order) => order.id)
|
|
291
|
+
* })
|
|
230
292
|
*/
|
|
231
|
-
export declare const cancelOrders: (
|
|
232
|
-
|
|
233
|
-
}
|
|
293
|
+
export declare const cancelOrders: (args: {
|
|
294
|
+
chainId: CHAIN_IDS;
|
|
295
|
+
userAddress: `0x${string}`;
|
|
296
|
+
ids: string[];
|
|
297
|
+
options?: DefaultOptions;
|
|
298
|
+
}) => Promise<{
|
|
299
|
+
transaction: Transaction;
|
|
300
|
+
result: CurrencyFlow[];
|
|
301
|
+
}>;
|
|
234
302
|
//# sourceMappingURL=call.d.ts.map
|
package/dist/types/call.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"call.d.ts","sourceRoot":"","sources":["../../src/call.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAa,MAAM,mBAAmB,CAAA;AACxD,OAAO,
|
|
1
|
+
{"version":3,"file":"call.d.ts","sourceRoot":"","sources":["../../src/call.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAa,MAAM,mBAAmB,CAAA;AACxD,OAAO,KAAK,EACV,YAAY,EACZ,cAAc,EACd,gBAAgB,EAChB,WAAW,EACZ,MAAM,QAAQ,CAAA;AAiBf;;;;;;;;;;;;;;;;;;;GAmBG;AACH,eAAO,MAAM,UAAU;aAQV,SAAS;iBACL,KAAK,MAAM,EAAE;gBACd,KAAK,MAAM,EAAE;iBACZ,KAAK,MAAM,EAAE;cAChB,cAAc;sCA0C3B,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiDG;AACH,eAAO,MAAM,UAAU;aAUV,SAAS;iBACL,KAAK,MAAM,EAAE;gBACd,KAAK,MAAM,EAAE;iBACZ,KAAK,MAAM,EAAE;YAClB,MAAM;WACP,MAAM;cACH;QACR,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;QACnC,QAAQ,CAAC,EAAE,OAAO,CAAA;KACnB,GAAG,cAAc;;iBAEL,WAAW;YAChB;QACN,IAAI,EAAE,YAAY,CAAA;QAClB,KAAK,EAAE,YAAY,CAAA;QACnB,KAAK,EAAE,YAAY,CAAA;KACpB;EAiJJ,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,eAAO,MAAM,WAAW;aAUX,SAAS;iBACL,KAAK,MAAM,EAAE;gBACd,KAAK,MAAM,EAAE;iBACZ,KAAK,MAAM,EAAE;eACf,MAAM;gBACL,MAAM;cACR;QACR,gBAAgB,CAAC,EAAE,gBAAgB,CAAA;QACnC,QAAQ,CAAC,EAAE,MAAM,CAAA;KAClB,GAAG,cAAc;;iBAEL,WAAW;YAChB;QACN,KAAK,EAAE,YAAY,CAAA;QACnB,KAAK,EAAE,YAAY,CAAA;KACpB;EA0JJ,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,UAAU;aAOV,SAAS;iBACL,KAAK,MAAM,EAAE;QACtB,MAAM;cACA,cAAc;;iBACC,WAAW;YAAU,YAAY;EAY7D,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,WAAW;aAOX,SAAS;iBACL,KAAK,MAAM,EAAE;SACrB,MAAM,EAAE;cACH,cAAc;;iBACC,WAAW;YAAU,YAAY,EAAE;EAuE/D,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,WAAW;aAOX,SAAS;iBACL,KAAK,MAAM,EAAE;QACtB,MAAM;cACA,cAAc;;iBACC,WAAW;YAAU,YAAY;EAY7D,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,eAAO,MAAM,YAAY;aAOZ,SAAS;iBACL,KAAK,MAAM,EAAE;SACrB,MAAM,EAAE;cACH,cAAc;;iBACC,WAAW;YAAU,YAAY,EAAE;EAwE/D,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"addresses.d.ts","sourceRoot":"","sources":["../../../src/constants/addresses.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEnC,eAAO,MAAM,kBAAkB,EAAE;KAC9B,KAAK,IAAI,SAAS,GAAG;QACpB,UAAU,EAAE,KAAK,MAAM,EAAE,CAAA;QACzB,WAAW,EAAE,KAAK,MAAM,EAAE,CAAA;QAC1B,UAAU,EAAE,KAAK,MAAM,EAAE,CAAA;KAC1B;
|
|
1
|
+
{"version":3,"file":"addresses.d.ts","sourceRoot":"","sources":["../../../src/constants/addresses.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEnC,eAAO,MAAM,kBAAkB,EAAE;KAC9B,KAAK,IAAI,SAAS,GAAG;QACpB,UAAU,EAAE,KAAK,MAAM,EAAE,CAAA;QACzB,WAAW,EAAE,KAAK,MAAM,EAAE,CAAA;QAC1B,UAAU,EAAE,KAAK,MAAM,EAAE,CAAA;KAC1B;CAgCF,CAAA"}
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { type Chain } from 'viem/chains';
|
|
2
2
|
export declare enum CHAIN_IDS {
|
|
3
|
-
|
|
4
|
-
ARBITRUM_SEPOLIA
|
|
3
|
+
CLOBER_TESTNET,
|
|
4
|
+
ARBITRUM_SEPOLIA,
|
|
5
|
+
BASE,
|
|
6
|
+
BERACHAIN_TESTNET,
|
|
7
|
+
ZKSYNC,
|
|
8
|
+
ZKSYNC_SEPOLIA
|
|
5
9
|
}
|
|
6
10
|
export declare const CHAIN_MAP: {
|
|
7
11
|
[chain in CHAIN_IDS]: Chain;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../../src/constants/chain.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"chain.d.ts","sourceRoot":"","sources":["../../../src/constants/chain.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,KAAK,KAAK,EAGX,MAAM,aAAa,CAAA;AAIpB,oBAAY,SAAS;IACnB,cAAmC;IACnC,gBAAqC;IACrC,IAAc;IACd,iBAAuC;IACvC,MAAkB;IAClB,cAAwC;CACzC;AAED,eAAO,MAAM,SAAS,EAAE;KACrB,KAAK,IAAI,SAAS,GAAG,KAAK;CAgB5B,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type PublicClient } from 'viem';
|
|
2
|
+
import { CHAIN_IDS } from './chain';
|
|
3
|
+
export declare const cachedPublicClients: Record<CHAIN_IDS, PublicClient>;
|
|
4
|
+
export declare const buildPublicClient: (chainId: CHAIN_IDS, rpcUrl?: string) => void;
|
|
5
|
+
//# sourceMappingURL=client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/constants/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAA4B,KAAK,YAAY,EAAE,MAAM,MAAM,CAAA;AAGlE,OAAO,EAAE,SAAS,EAAa,MAAM,SAAS,CAAA;AAE9C,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,SAAS,EAAE,YAAY,CAAe,CAAA;AAC/E,eAAO,MAAM,iBAAiB,YAAa,SAAS,WAAW,MAAM,SAWpE,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"currency.d.ts","sourceRoot":"","sources":["../../../src/constants/currency.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEnC,eAAO,MAAM,cAAc,EAAE;KAC1B,KAAK,IAAI,SAAS,GAAG,KAAK,MAAM,EAAE,EAAE;
|
|
1
|
+
{"version":3,"file":"currency.d.ts","sourceRoot":"","sources":["../../../src/constants/currency.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEnC,eAAO,MAAM,cAAc,EAAE;KAC1B,KAAK,IAAI,SAAS,GAAG,KAAK,MAAM,EAAE,EAAE;CAYtC,CAAA;AAED,eAAO,MAAM,qBAAqB,EAAE;KACjC,KAAK,IAAI,SAAS,GAAG,KAAK,MAAM,EAAE,EAAE;CAoBtC,CAAA"}
|
|
@@ -1,4 +1,9 @@
|
|
|
1
1
|
import { FeePolicy } from '../model/fee-policy';
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
2
|
+
import { CHAIN_IDS } from './chain';
|
|
3
|
+
export declare const MAKER_DEFAULT_POLICY: {
|
|
4
|
+
[chain in CHAIN_IDS]: FeePolicy;
|
|
5
|
+
};
|
|
6
|
+
export declare const TAKER_DEFAULT_POLICY: {
|
|
7
|
+
[chain in CHAIN_IDS]: FeePolicy;
|
|
8
|
+
};
|
|
4
9
|
//# sourceMappingURL=fee.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"fee.d.ts","sourceRoot":"","sources":["../../../src/constants/fee.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAE/C,eAAO,MAAM,oBAAoB,
|
|
1
|
+
{"version":3,"file":"fee.d.ts","sourceRoot":"","sources":["../../../src/constants/fee.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAA;AAE/C,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAEnC,eAAO,MAAM,oBAAoB,EAAE;KAChC,KAAK,IAAI,SAAS,GAAG,SAAS;CAQhC,CAAA;AAED,eAAO,MAAM,oBAAoB,EAAE;KAChC,KAAK,IAAI,SAAS,GAAG,SAAS;CAQhC,CAAA"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { CHAIN_IDS } from './chain';
|
|
2
|
+
declare class Subgraph {
|
|
3
|
+
private subgraphURL;
|
|
4
|
+
constructor(chainId: CHAIN_IDS);
|
|
5
|
+
get<T>(operationName: string, query: string, variables: {}): Promise<T>;
|
|
6
|
+
}
|
|
7
|
+
export declare const cachedSubgraph: Record<CHAIN_IDS, Subgraph | undefined>;
|
|
8
|
+
export declare const buildSubgraph: (chainId: CHAIN_IDS, useSubgraph?: boolean) => void;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=subgraph.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"subgraph.d.ts","sourceRoot":"","sources":["../../../src/constants/subgraph.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAmBnC,cAAM,QAAQ;IACZ,OAAO,CAAC,WAAW,CAAQ;gBAEf,OAAO,EAAE,SAAS;IAOjB,GAAG,CAAC,CAAC,EAChB,aAAa,EAAE,MAAM,EACrB,KAAK,EAAE,MAAM,EACb,SAAS,EAAE,EAAE,GACZ,OAAO,CAAC,CAAC,CAAC;CAqBd;AAED,eAAO,MAAM,cAAc,EAAE,MAAM,CAAC,SAAS,EAAE,QAAQ,GAAG,SAAS,CACtD,CAAA;AACb,eAAO,MAAM,aAAa,YACf,SAAS,gBACL,OAAO,SAOrB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"test-chain.d.ts","sourceRoot":"","sources":["../../../src/constants/test-chain.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,MAAM,CAAA;AAE5B,eAAO,MAAM,eAAe,EAAE,KAsB7B,CAAA"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA;AACtB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA;AACtB,cAAc,QAAQ,CAAA;AACtB,cAAc,aAAa,CAAA;AAC3B,cAAc,YAAY,CAAA;AAC1B,cAAc,SAAS,CAAA"}
|
|
@@ -1,52 +1,36 @@
|
|
|
1
|
+
import { CHAIN_IDS } from '../constants/chain';
|
|
1
2
|
import type { Currency } from './currency';
|
|
2
|
-
import type {
|
|
3
|
-
export type BookDto = {
|
|
4
|
-
id: string;
|
|
5
|
-
base: {
|
|
6
|
-
id: string;
|
|
7
|
-
name: string;
|
|
8
|
-
symbol: string;
|
|
9
|
-
decimals: string;
|
|
10
|
-
};
|
|
11
|
-
quote: {
|
|
12
|
-
id: string;
|
|
13
|
-
name: string;
|
|
14
|
-
symbol: string;
|
|
15
|
-
decimals: string;
|
|
16
|
-
};
|
|
17
|
-
unit: string;
|
|
18
|
-
depths: {
|
|
19
|
-
tick: string;
|
|
20
|
-
price: string;
|
|
21
|
-
rawAmount: string;
|
|
22
|
-
}[];
|
|
23
|
-
};
|
|
3
|
+
import type { DepthDto } from './depth';
|
|
24
4
|
export declare class Book {
|
|
5
|
+
chainId: CHAIN_IDS;
|
|
25
6
|
id: bigint;
|
|
26
7
|
base: Currency;
|
|
27
|
-
|
|
8
|
+
unitSize: bigint;
|
|
28
9
|
quote: Currency;
|
|
29
|
-
depths:
|
|
30
|
-
|
|
10
|
+
depths: DepthDto[];
|
|
11
|
+
isOpened: boolean;
|
|
12
|
+
constructor({ chainId, id, base, quote, unitSize, depths, isOpened, }: {
|
|
13
|
+
chainId: CHAIN_IDS;
|
|
31
14
|
id: bigint;
|
|
32
15
|
base: Currency;
|
|
33
16
|
quote: Currency;
|
|
34
|
-
|
|
35
|
-
depths:
|
|
17
|
+
unitSize: bigint;
|
|
18
|
+
depths: DepthDto[];
|
|
19
|
+
isOpened: boolean;
|
|
36
20
|
});
|
|
37
21
|
take: ({ limitPrice, amountOut, }: {
|
|
38
22
|
limitPrice: bigint;
|
|
39
23
|
amountOut: bigint;
|
|
40
24
|
}) => {
|
|
41
25
|
takenQuoteAmount: bigint;
|
|
42
|
-
|
|
26
|
+
spentBaseAmount: bigint;
|
|
43
27
|
};
|
|
44
28
|
spend: ({ limitPrice, amountIn, }: {
|
|
45
29
|
limitPrice: bigint;
|
|
46
30
|
amountIn: bigint;
|
|
47
31
|
}) => {
|
|
48
32
|
takenQuoteAmount: bigint;
|
|
49
|
-
|
|
33
|
+
spentBaseAmount: bigint;
|
|
50
34
|
};
|
|
51
35
|
}
|
|
52
36
|
//# sourceMappingURL=book.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"book.d.ts","sourceRoot":"","sources":["../../../src/model/book.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"book.d.ts","sourceRoot":"","sources":["../../../src/model/book.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAE9C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,qBAAa,IAAI;IACf,OAAO,EAAE,SAAS,CAAA;IAClB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE,QAAQ,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,QAAQ,CAAA;IACf,MAAM,EAAE,QAAQ,EAAE,CAAA;IAClB,QAAQ,EAAE,OAAO,CAAA;gBAEL,EACV,OAAO,EACP,EAAE,EACF,IAAI,EACJ,KAAK,EACL,QAAQ,EACR,MAAM,EACN,QAAQ,GACT,EAAE;QACD,OAAO,EAAE,SAAS,CAAA;QAClB,EAAE,EAAE,MAAM,CAAA;QACV,IAAI,EAAE,QAAQ,CAAA;QACd,KAAK,EAAE,QAAQ,CAAA;QACf,QAAQ,EAAE,MAAM,CAAA;QAChB,MAAM,EAAE,QAAQ,EAAE,CAAA;QAClB,QAAQ,EAAE,OAAO,CAAA;KAClB;IAUD,IAAI,+BAGD;QACD,UAAU,EAAE,MAAM,CAAA;QAClB,SAAS,EAAE,MAAM,CAAA;KAClB;;;MA6DA;IAED,KAAK,8BAGF;QACD,UAAU,EAAE,MAAM,CAAA;QAClB,QAAQ,EAAE,MAAM,CAAA;KACjB;;;MA0DA;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"chart-log.d.ts","sourceRoot":"","sources":["../../../src/model/chart-log.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GAAG;IACxB,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
export type
|
|
2
|
-
bookId: string;
|
|
3
|
-
unit: bigint;
|
|
1
|
+
export type DepthDto = {
|
|
4
2
|
tick: bigint;
|
|
5
|
-
|
|
3
|
+
unitAmount: bigint;
|
|
6
4
|
};
|
|
7
5
|
export type Depth = {
|
|
8
|
-
price:
|
|
6
|
+
price: string;
|
|
9
7
|
baseAmount: bigint;
|
|
10
8
|
};
|
|
11
9
|
//# sourceMappingURL=depth.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"depth.d.ts","sourceRoot":"","sources":["../../../src/model/depth.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG;IACrB,
|
|
1
|
+
{"version":3,"file":"depth.d.ts","sourceRoot":"","sources":["../../../src/model/depth.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,QAAQ,GAAG;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,MAAM,MAAM,KAAK,GAAG;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA"}
|