@clober/v2-sdk 0.0.4 → 0.0.6
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/abis/core/book-viewer-abi.js +189 -0
- package/dist/cjs/abis/core/book-viewer-abi.js.map +1 -0
- package/dist/cjs/apis/market.js +40 -31
- package/dist/cjs/apis/market.js.map +1 -1
- package/dist/cjs/apis/open-order.js +5 -2
- package/dist/cjs/apis/open-order.js.map +1 -1
- package/dist/cjs/apis/subgraph.js.map +1 -1
- package/dist/cjs/approval.js.map +1 -1
- package/dist/cjs/call.js +136 -123
- package/dist/cjs/call.js.map +1 -1
- package/dist/cjs/constants/client.js.map +1 -1
- package/dist/cjs/index.js +19 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/model/book.js +8 -1
- package/dist/cjs/model/book.js.map +1 -1
- package/dist/cjs/model/market.js +44 -171
- package/dist/cjs/model/market.js.map +1 -1
- package/dist/cjs/signature.js +1 -1
- package/dist/cjs/signature.js.map +1 -1
- package/dist/cjs/utils/build-transaction.js.map +1 -1
- package/dist/cjs/utils/currency.js.map +1 -0
- package/dist/cjs/utils/decorator.js +1 -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/view.js +10 -26
- package/dist/cjs/view.js.map +1 -1
- package/dist/esm/abis/core/book-viewer-abi.js +186 -0
- package/dist/esm/abis/core/book-viewer-abi.js.map +1 -0
- package/dist/esm/apis/market.js +41 -32
- package/dist/esm/apis/market.js.map +1 -1
- package/dist/esm/apis/open-order.js +5 -2
- package/dist/esm/apis/open-order.js.map +1 -1
- package/dist/esm/apis/subgraph.js.map +1 -1
- package/dist/esm/approval.js +1 -1
- package/dist/esm/approval.js.map +1 -1
- package/dist/esm/call.js +151 -133
- package/dist/esm/call.js.map +1 -1
- package/dist/esm/constants/client.js.map +1 -1
- package/dist/esm/model/book.js +8 -1
- package/dist/esm/model/book.js.map +1 -1
- package/dist/esm/model/market.js +45 -176
- package/dist/esm/model/market.js.map +1 -1
- package/dist/esm/signature.js +1 -1
- package/dist/esm/signature.js.map +1 -1
- package/dist/esm/utils/build-transaction.js.map +1 -1
- package/dist/esm/utils/currency.js.map +1 -0
- package/dist/esm/utils/decorator.js +1 -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/view.js +11 -26
- package/dist/esm/view.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/abis/core/book-viewer-abi.d.ts +141 -0
- package/dist/types/abis/core/book-viewer-abi.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 +1 -1
- package/dist/types/apis/open-order.d.ts.map +1 -1
- package/dist/types/approval.d.ts +2 -2
- package/dist/types/approval.d.ts.map +1 -1
- package/dist/types/call.d.ts +36 -13
- package/dist/types/call.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/model/book.d.ts +3 -1
- package/dist/types/model/book.d.ts.map +1 -1
- package/dist/types/model/depth.d.ts +0 -2
- package/dist/types/model/depth.d.ts.map +1 -1
- package/dist/types/model/market.d.ts +11 -13
- package/dist/types/model/market.d.ts.map +1 -1
- package/dist/types/model/open-order.d.ts +5 -2
- package/dist/types/model/open-order.d.ts.map +1 -1
- package/dist/types/type.d.ts +11 -6
- package/dist/types/type.d.ts.map +1 -1
- package/dist/types/utils/build-transaction.d.ts +2 -2
- package/dist/types/utils/build-transaction.d.ts.map +1 -1
- 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/unit.d.ts +1 -1
- package/dist/types/utils/unit.d.ts.map +1 -1
- package/dist/types/view.d.ts +8 -13
- package/dist/types/view.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/apis/currency.js.map +0 -1
- package/dist/esm/apis/currency.js.map +0 -1
- package/dist/types/apis/currency.d.ts.map +0 -1
- /package/dist/cjs/{apis → utils}/currency.js +0 -0
- /package/dist/esm/{apis → utils}/currency.js +0 -0
- /package/dist/types/{apis → utils}/currency.d.ts +0 -0
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
export declare const BOOK_VIEWER_ABI: readonly [{
|
|
2
|
+
readonly inputs: readonly [{
|
|
3
|
+
readonly internalType: "contract IBookManager";
|
|
4
|
+
readonly name: "bookManager_";
|
|
5
|
+
readonly type: "address";
|
|
6
|
+
}];
|
|
7
|
+
readonly stateMutability: "nonpayable";
|
|
8
|
+
readonly type: "constructor";
|
|
9
|
+
}, {
|
|
10
|
+
readonly inputs: readonly [];
|
|
11
|
+
readonly name: "InvalidTick";
|
|
12
|
+
readonly type: "error";
|
|
13
|
+
}, {
|
|
14
|
+
readonly inputs: readonly [{
|
|
15
|
+
readonly internalType: "uint256";
|
|
16
|
+
readonly name: "value";
|
|
17
|
+
readonly type: "uint256";
|
|
18
|
+
}];
|
|
19
|
+
readonly name: "SafeCastOverflowedUintToInt";
|
|
20
|
+
readonly type: "error";
|
|
21
|
+
}, {
|
|
22
|
+
readonly inputs: readonly [];
|
|
23
|
+
readonly name: "bookManager";
|
|
24
|
+
readonly outputs: readonly [{
|
|
25
|
+
readonly internalType: "contract IBookManager";
|
|
26
|
+
readonly name: "";
|
|
27
|
+
readonly type: "address";
|
|
28
|
+
}];
|
|
29
|
+
readonly stateMutability: "view";
|
|
30
|
+
readonly type: "function";
|
|
31
|
+
}, {
|
|
32
|
+
readonly inputs: readonly [{
|
|
33
|
+
readonly components: readonly [{
|
|
34
|
+
readonly internalType: "BookId";
|
|
35
|
+
readonly name: "id";
|
|
36
|
+
readonly type: "uint192";
|
|
37
|
+
}, {
|
|
38
|
+
readonly internalType: "uint256";
|
|
39
|
+
readonly name: "limitPrice";
|
|
40
|
+
readonly type: "uint256";
|
|
41
|
+
}, {
|
|
42
|
+
readonly internalType: "uint256";
|
|
43
|
+
readonly name: "quoteAmount";
|
|
44
|
+
readonly type: "uint256";
|
|
45
|
+
}, {
|
|
46
|
+
readonly internalType: "uint256";
|
|
47
|
+
readonly name: "maxBaseAmount";
|
|
48
|
+
readonly type: "uint256";
|
|
49
|
+
}, {
|
|
50
|
+
readonly internalType: "bytes";
|
|
51
|
+
readonly name: "hookData";
|
|
52
|
+
readonly type: "bytes";
|
|
53
|
+
}];
|
|
54
|
+
readonly internalType: "struct IController.TakeOrderParams";
|
|
55
|
+
readonly name: "params";
|
|
56
|
+
readonly type: "tuple";
|
|
57
|
+
}];
|
|
58
|
+
readonly name: "getExpectedInput";
|
|
59
|
+
readonly outputs: readonly [{
|
|
60
|
+
readonly internalType: "uint256";
|
|
61
|
+
readonly name: "takenQuoteAmount";
|
|
62
|
+
readonly type: "uint256";
|
|
63
|
+
}, {
|
|
64
|
+
readonly internalType: "uint256";
|
|
65
|
+
readonly name: "spendBaseAmount";
|
|
66
|
+
readonly type: "uint256";
|
|
67
|
+
}];
|
|
68
|
+
readonly stateMutability: "view";
|
|
69
|
+
readonly type: "function";
|
|
70
|
+
}, {
|
|
71
|
+
readonly inputs: readonly [{
|
|
72
|
+
readonly components: readonly [{
|
|
73
|
+
readonly internalType: "BookId";
|
|
74
|
+
readonly name: "id";
|
|
75
|
+
readonly type: "uint192";
|
|
76
|
+
}, {
|
|
77
|
+
readonly internalType: "uint256";
|
|
78
|
+
readonly name: "limitPrice";
|
|
79
|
+
readonly type: "uint256";
|
|
80
|
+
}, {
|
|
81
|
+
readonly internalType: "uint256";
|
|
82
|
+
readonly name: "baseAmount";
|
|
83
|
+
readonly type: "uint256";
|
|
84
|
+
}, {
|
|
85
|
+
readonly internalType: "uint256";
|
|
86
|
+
readonly name: "minQuoteAmount";
|
|
87
|
+
readonly type: "uint256";
|
|
88
|
+
}, {
|
|
89
|
+
readonly internalType: "bytes";
|
|
90
|
+
readonly name: "hookData";
|
|
91
|
+
readonly type: "bytes";
|
|
92
|
+
}];
|
|
93
|
+
readonly internalType: "struct IController.SpendOrderParams";
|
|
94
|
+
readonly name: "params";
|
|
95
|
+
readonly type: "tuple";
|
|
96
|
+
}];
|
|
97
|
+
readonly name: "getExpectedOutput";
|
|
98
|
+
readonly outputs: readonly [{
|
|
99
|
+
readonly internalType: "uint256";
|
|
100
|
+
readonly name: "takenQuoteAmount";
|
|
101
|
+
readonly type: "uint256";
|
|
102
|
+
}, {
|
|
103
|
+
readonly internalType: "uint256";
|
|
104
|
+
readonly name: "spendBaseAmount";
|
|
105
|
+
readonly type: "uint256";
|
|
106
|
+
}];
|
|
107
|
+
readonly stateMutability: "view";
|
|
108
|
+
readonly type: "function";
|
|
109
|
+
}, {
|
|
110
|
+
readonly inputs: readonly [{
|
|
111
|
+
readonly internalType: "BookId";
|
|
112
|
+
readonly name: "id";
|
|
113
|
+
readonly type: "uint192";
|
|
114
|
+
}, {
|
|
115
|
+
readonly internalType: "Tick";
|
|
116
|
+
readonly name: "tick";
|
|
117
|
+
readonly type: "int24";
|
|
118
|
+
}, {
|
|
119
|
+
readonly internalType: "uint256";
|
|
120
|
+
readonly name: "n";
|
|
121
|
+
readonly type: "uint256";
|
|
122
|
+
}];
|
|
123
|
+
readonly name: "getLiquidity";
|
|
124
|
+
readonly outputs: readonly [{
|
|
125
|
+
readonly components: readonly [{
|
|
126
|
+
readonly internalType: "Tick";
|
|
127
|
+
readonly name: "tick";
|
|
128
|
+
readonly type: "int24";
|
|
129
|
+
}, {
|
|
130
|
+
readonly internalType: "uint64";
|
|
131
|
+
readonly name: "depth";
|
|
132
|
+
readonly type: "uint64";
|
|
133
|
+
}];
|
|
134
|
+
readonly internalType: "struct IBookViewer.Liquidity[]";
|
|
135
|
+
readonly name: "liquidity";
|
|
136
|
+
readonly type: "tuple[]";
|
|
137
|
+
}];
|
|
138
|
+
readonly stateMutability: "view";
|
|
139
|
+
readonly type: "function";
|
|
140
|
+
}];
|
|
141
|
+
//# sourceMappingURL=book-viewer-abi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"book-viewer-abi.d.ts","sourceRoot":"","sources":["../../../../src/abis/core/book-viewer-abi.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwLlB,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { CHAIN_IDS } from '../constants/chain';
|
|
2
2
|
import { Market } from '../model/market';
|
|
3
|
-
export declare function fetchMarket(chainId: CHAIN_IDS, tokenAddresses: `0x${string}`[]): Promise<Market>;
|
|
3
|
+
export declare function fetchMarket(chainId: CHAIN_IDS, tokenAddresses: `0x${string}`[], n?: number): Promise<Market>;
|
|
4
4
|
//# sourceMappingURL=market.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"market.d.ts","sourceRoot":"","sources":["../../../src/apis/market.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"market.d.ts","sourceRoot":"","sources":["../../../src/apis/market.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AAgDxC,wBAAsB,WAAW,CAC/B,OAAO,EAAE,SAAS,EAClB,cAAc,EAAE,KAAK,MAAM,EAAE,EAAE,EAC/B,CAAC,SAAM,GACN,OAAO,CAAC,MAAM,CAAC,CAyBjB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CHAIN_IDS } from '../constants/chain';
|
|
2
|
-
import { OpenOrder } from '../model/open-order';
|
|
2
|
+
import type { OpenOrder } from '../model/open-order';
|
|
3
3
|
export declare function fetchOpenOrders(chainId: CHAIN_IDS, userAddress: `0x${string}`): Promise<OpenOrder[]>;
|
|
4
4
|
export declare function fetchOpenOrder(chainId: CHAIN_IDS, id: string): Promise<OpenOrder>;
|
|
5
5
|
//# sourceMappingURL=open-order.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open-order.d.ts","sourceRoot":"","sources":["../../../src/apis/open-order.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAM9C,OAAO,EAAE,SAAS,EAAgB,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"open-order.d.ts","sourceRoot":"","sources":["../../../src/apis/open-order.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAM9C,OAAO,KAAK,EAAE,SAAS,EAAgB,MAAM,qBAAqB,CAAA;AAsClE,wBAAsB,eAAe,CACnC,OAAO,EAAE,SAAS,EAClB,WAAW,EAAE,KAAK,MAAM,EAAE,GACzB,OAAO,CAAC,SAAS,EAAE,CAAC,CAoBtB;AAED,wBAAsB,cAAc,CAClC,OAAO,EAAE,SAAS,EAClB,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,SAAS,CAAC,CAYpB"}
|
package/dist/types/approval.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { HDAccount, PrivateKeyAccount } from 'viem';
|
|
1
|
+
import { type HDAccount, type PrivateKeyAccount } from 'viem';
|
|
2
2
|
import { CHAIN_IDS } from './constants/chain';
|
|
3
|
-
import { DefaultOptions } from './type';
|
|
3
|
+
import type { DefaultOptions } from './type';
|
|
4
4
|
/**
|
|
5
5
|
* Sets approval of all open orders for the specified account on the given chain.
|
|
6
6
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approval.d.ts","sourceRoot":"","sources":["../../src/approval.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"approval.d.ts","sourceRoot":"","sources":["../../src/approval.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,iBAAiB,EACvB,MAAM,MAAM,CAAA;AAEb,OAAO,EAAE,SAAS,EAAa,MAAM,mBAAmB,CAAA;AAIxD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAuB5C;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,6BAA6B;aAM7B,SAAS;aACT,SAAS,GAAG,iBAAiB;cAC5B,cAAc;wCAuB3B,CAAA"}
|
package/dist/types/call.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CHAIN_IDS } from './constants/chain';
|
|
2
|
-
import { DefaultOptions, PermitSignature, Transaction } from './type';
|
|
2
|
+
import type { CurrencyFlow, DefaultOptions, PermitSignature, Transaction } from './type';
|
|
3
3
|
/**
|
|
4
4
|
* Build a transaction to open a market.
|
|
5
5
|
*
|
|
@@ -37,7 +37,8 @@ export declare const openMarket: (args: {
|
|
|
37
37
|
* @param {PermitSignature} [options.signature] The permit signature for token approval.
|
|
38
38
|
* @param {boolean} [options.postOnly] A boolean indicating whether the order is only to be made not taken.
|
|
39
39
|
* @param {string} [options.rpcUrl] The RPC URL of the blockchain.
|
|
40
|
-
* @returns {Promise<
|
|
40
|
+
* @returns {Promise<{ transaction: Transaction, result: { make: CurrencyFlow, take: CurrencyFlow } }>}
|
|
41
|
+
* Promise resolving to the transaction object representing the limit order with the result of the order.
|
|
41
42
|
* @example
|
|
42
43
|
* import { signERC20Permit, limitOrder } from '@clober/v2-sdk'
|
|
43
44
|
* import { privateKeyToAccount } from 'viem/accounts'
|
|
@@ -49,7 +50,7 @@ export declare const openMarket: (args: {
|
|
|
49
50
|
* '100.123'
|
|
50
51
|
* )
|
|
51
52
|
*
|
|
52
|
-
* const transaction = await limitOrder(
|
|
53
|
+
* const { transaction } = await limitOrder(
|
|
53
54
|
* 421614,
|
|
54
55
|
* '0xF8c1869Ecd4df136693C45EcE1b67f85B6bDaE69
|
|
55
56
|
* '0x00bfd44e79fb7f6dd5887a9426c8ef85a0cd23e0',
|
|
@@ -62,7 +63,7 @@ export declare const openMarket: (args: {
|
|
|
62
63
|
* @example
|
|
63
64
|
* import { limitOrder } from '@clober/v2-sdk'
|
|
64
65
|
*
|
|
65
|
-
* const transaction = await limitOrder(
|
|
66
|
+
* const { transaction } = await limitOrder(
|
|
66
67
|
* 421614,
|
|
67
68
|
* '0xF8c1869Ecd4df136693C45EcE1b67f85B6bDaE69
|
|
68
69
|
* '0x0000000000000000000000000000000000000000',
|
|
@@ -82,7 +83,13 @@ export declare const limitOrder: (args: {
|
|
|
82
83
|
signature?: PermitSignature;
|
|
83
84
|
postOnly?: boolean;
|
|
84
85
|
} & DefaultOptions;
|
|
85
|
-
}) => Promise<
|
|
86
|
+
}) => Promise<{
|
|
87
|
+
transaction: Transaction;
|
|
88
|
+
result: {
|
|
89
|
+
make: CurrencyFlow;
|
|
90
|
+
take: CurrencyFlow;
|
|
91
|
+
};
|
|
92
|
+
}>;
|
|
86
93
|
/**
|
|
87
94
|
* Executes a market order on the specified chain for trading tokens.
|
|
88
95
|
*
|
|
@@ -148,7 +155,8 @@ export declare const marketOrder: (args: {
|
|
|
148
155
|
* @param {string} id An ID representing the open order to be claimed.
|
|
149
156
|
* @param {Object} [options] Optional parameters for claiming orders.
|
|
150
157
|
* @param {string} [options.rpcUrl] The RPC URL to use for executing the transaction.
|
|
151
|
-
* @returns {Promise<
|
|
158
|
+
* @returns {Promise<{ transaction: Transaction, result: CurrencyFlow }>}
|
|
159
|
+
* Promise resolving to the transaction object representing the claim action with the result of the order.
|
|
152
160
|
* @throws {Error} Throws an error if no open orders are found for the specified user.
|
|
153
161
|
* @example
|
|
154
162
|
* import { getOpenOrders, claimOrders } from '@clober/v2-sdk'
|
|
@@ -168,7 +176,10 @@ export declare const claimOrder: (args: {
|
|
|
168
176
|
userAddress: `0x${string}`;
|
|
169
177
|
id: string;
|
|
170
178
|
options?: DefaultOptions;
|
|
171
|
-
}) => Promise<
|
|
179
|
+
}) => Promise<{
|
|
180
|
+
transaction: Transaction;
|
|
181
|
+
result: CurrencyFlow;
|
|
182
|
+
}>;
|
|
172
183
|
/**
|
|
173
184
|
* Claims specified open orders for settlement.
|
|
174
185
|
* [IMPORTANT] Set ApprovalForAll before calling this function.
|
|
@@ -178,7 +189,8 @@ export declare const claimOrder: (args: {
|
|
|
178
189
|
* @param {string[]} ids An array of IDs representing the open orders to be claimed.
|
|
179
190
|
* @param {Object} [options] Optional parameters for claiming orders.
|
|
180
191
|
* @param {string} [options.rpcUrl] The RPC URL to use for executing the transaction.
|
|
181
|
-
* @returns {Promise<
|
|
192
|
+
* @returns {Promise<{ transaction: Transaction, result: CurrencyFlow[] }>}
|
|
193
|
+
* Promise resolving to the transaction object representing the claim action with the result of the orders.
|
|
182
194
|
* @throws {Error} Throws an error if no open orders are found for the specified user.
|
|
183
195
|
* @example
|
|
184
196
|
* import { getOpenOrders, claimOrders } from '@clober/v2-sdk'
|
|
@@ -198,7 +210,10 @@ export declare const claimOrders: (args: {
|
|
|
198
210
|
userAddress: `0x${string}`;
|
|
199
211
|
ids: string[];
|
|
200
212
|
options?: DefaultOptions;
|
|
201
|
-
}) => Promise<
|
|
213
|
+
}) => Promise<{
|
|
214
|
+
transaction: Transaction;
|
|
215
|
+
result: CurrencyFlow[];
|
|
216
|
+
}>;
|
|
202
217
|
/**
|
|
203
218
|
* Cancels specified open order if the order is not fully filled.
|
|
204
219
|
* [IMPORTANT] Set ApprovalForAll before calling this function.
|
|
@@ -208,7 +223,8 @@ export declare const claimOrders: (args: {
|
|
|
208
223
|
* @param {string} id An ID representing the open order to be canceled
|
|
209
224
|
* @param {Object} [options] Optional parameters for canceling orders.
|
|
210
225
|
* @param {string} [options.rpcUrl] The RPC URL to use for executing the transaction.
|
|
211
|
-
* @returns {Promise<
|
|
226
|
+
* @returns {Promise<{ transaction: Transaction, result: CurrencyFlow }>}
|
|
227
|
+
* Promise resolving to the transaction object representing the cancel action with the result of the order.
|
|
212
228
|
* @throws {Error} Throws an error if no open orders are found for the specified user.
|
|
213
229
|
* @example
|
|
214
230
|
* import { getOpenOrders, cancelOrders } from '@clober/v2-sdk'
|
|
@@ -228,7 +244,10 @@ export declare const cancelOrder: (args: {
|
|
|
228
244
|
userAddress: `0x${string}`;
|
|
229
245
|
id: string;
|
|
230
246
|
options?: DefaultOptions;
|
|
231
|
-
}) => Promise<
|
|
247
|
+
}) => Promise<{
|
|
248
|
+
transaction: Transaction;
|
|
249
|
+
result: CurrencyFlow;
|
|
250
|
+
}>;
|
|
232
251
|
/**
|
|
233
252
|
* Cancels specified open orders if orders are not fully filled.
|
|
234
253
|
* [IMPORTANT] Set ApprovalForAll before calling this function.
|
|
@@ -238,7 +257,8 @@ export declare const cancelOrder: (args: {
|
|
|
238
257
|
* @param {string[]} ids An array of IDs representing the open orders to be canceled.
|
|
239
258
|
* @param {Object} [options] Optional parameters for canceling orders.
|
|
240
259
|
* @param {string} [options.rpcUrl] The RPC URL to use for executing the transaction.
|
|
241
|
-
* @returns {Promise<
|
|
260
|
+
* @returns {Promise<{ transaction: Transaction, result: CurrencyFlow[] }>
|
|
261
|
+
* Promise resolving to the transaction object representing the cancel action with the result of the orders.
|
|
242
262
|
* @throws {Error} Throws an error if no open orders are found for the specified user.
|
|
243
263
|
* @example
|
|
244
264
|
* import { getOpenOrders, cancelOrders } from '@clober/v2-sdk'
|
|
@@ -258,5 +278,8 @@ export declare const cancelOrders: (args: {
|
|
|
258
278
|
userAddress: `0x${string}`;
|
|
259
279
|
ids: string[];
|
|
260
280
|
options?: DefaultOptions;
|
|
261
|
-
}) => Promise<
|
|
281
|
+
}) => Promise<{
|
|
282
|
+
transaction: Transaction;
|
|
283
|
+
result: CurrencyFlow[];
|
|
284
|
+
}>;
|
|
262
285
|
//# 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,eAAe,EACf,WAAW,EACZ,MAAM,QAAQ,CAAA;AAef;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,UAAU;aAMV,SAAS;gBACN,KAAK,MAAM,EAAE;iBACZ,KAAK,MAAM,EAAE;cAChB,cAAc;sCAiC3B,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+CG;AACH,eAAO,MAAM,UAAU;aAUV,SAAS;iBACL,KAAK,MAAM,EAAE;gBACd,KAAK,MAAM,EAAE;iBACZ,KAAK,MAAM,EAAE;YAClB,MAAM;WACP,MAAM;cACH;QACR,SAAS,CAAC,EAAE,eAAe,CAAA;QAC3B,QAAQ,CAAC,EAAE,OAAO,CAAA;KACnB,GAAG,cAAc;;iBAEL,WAAW;YAChB;QACN,IAAI,EAAE,YAAY,CAAA;QAClB,IAAI,EAAE,YAAY,CAAA;KACnB;EA0IJ,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4CG;AACH,eAAO,MAAM,WAAW;aASX,SAAS;iBACL,KAAK,MAAM,EAAE;gBACd,KAAK,MAAM,EAAE;iBACZ,KAAK,MAAM,EAAE;YAClB,MAAM;cACJ;QACR,SAAS,CAAC,EAAE,eAAe,CAAA;QAC3B,UAAU,CAAC,EAAE,MAAM,CAAA;KACpB,GAAG,cAAc;0BAyErB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,UAAU;aAOV,SAAS;iBACL,KAAK,MAAM,EAAE;QACtB,MAAM;cACA,cAAc;;iBACC,WAAW;YAAU,YAAY;EAY7D,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,WAAW;aAOX,SAAS;iBACL,KAAK,MAAM,EAAE;SACrB,MAAM,EAAE;cACH,cAAc;;iBACC,WAAW;YAAU,YAAY,EAAE;EAwD/D,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,WAAW;aAOX,SAAS;iBACL,KAAK,MAAM,EAAE;QACtB,MAAM;cACA,cAAc;;iBACC,WAAW;YAAU,YAAY;EAY7D,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,YAAY;aAOZ,SAAS;iBACL,KAAK,MAAM,EAAE;SACrB,MAAM,EAAE;cACH,cAAc;;iBACC,WAAW;YAAU,YAAY,EAAE;EAyD/D,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PublicClient } from 'viem';
|
|
1
|
+
import { type PublicClient } from 'viem';
|
|
2
2
|
import { CHAIN_IDS } from './chain';
|
|
3
3
|
export declare const cachedPublicClients: Record<CHAIN_IDS, PublicClient>;
|
|
4
4
|
export declare const buildPublicClient: (chainId: CHAIN_IDS, rpcUrl?: string) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/constants/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA4B,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/constants/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAA4B,MAAM,MAAM,CAAA;AAElE,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,SAKpE,CAAA"}
|
|
@@ -27,12 +27,14 @@ export declare class Book {
|
|
|
27
27
|
unit: bigint;
|
|
28
28
|
quote: Currency;
|
|
29
29
|
depths: RawDepth[];
|
|
30
|
-
|
|
30
|
+
isOpened: boolean;
|
|
31
|
+
constructor({ id, base, quote, unit, depths, isOpened, }: {
|
|
31
32
|
id: bigint;
|
|
32
33
|
base: Currency;
|
|
33
34
|
quote: Currency;
|
|
34
35
|
unit: bigint;
|
|
35
36
|
depths: RawDepth[];
|
|
37
|
+
isOpened: boolean;
|
|
36
38
|
});
|
|
37
39
|
take: ({ limitPrice, amountOut, }: {
|
|
38
40
|
limitPrice: bigint;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"book.d.ts","sourceRoot":"","sources":["../../../src/model/book.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC,MAAM,MAAM,OAAO,GAAG;IACpB,EAAE,EAAE,MAAM,CAAA;IACV,IAAI,EAAE;QACJ,EAAE,EAAE,MAAM,CAAA;QACV,IAAI,EAAE,MAAM,CAAA;QACZ,MAAM,EAAE,MAAM,CAAA;QACd,QAAQ,EAAE,MAAM,CAAA;KACjB,CAAA;IACD,KAAK,EAAE;QACL,EAAE,EAAE,MAAM,CAAA;QACV,IAAI,EAAE,MAAM,CAAA;QACZ,MAAM,EAAE,MAAM,CAAA;QACd,QAAQ,EAAE,MAAM,CAAA;KACjB,CAAA;IACD,IAAI,EAAE,M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AA;gBAEL,EACV,EAAE,EACF,IAAI,EACJ,KAAK,EACL,IAAI,EACJ,MAAM,EACN,QAAQ,GACT,EAAE;QACD,EAAE,EAAE,MAAM,CAAA;QACV,IAAI,EAAE,QAAQ,CAAA;QACd,KAAK,EAAE,QAAQ,CAAA;QACf,IAAI,EAAE,MAAM,CAAA;QACZ,MAAM,EAAE,QAAQ,EAAE,CAAA;QAClB,QAAQ,EAAE,OAAO,CAAA;KAClB;IASD,IAAI,+BAGD;QACD,UAAU,EAAE,MAAM,CAAA;QAClB,SAAS,EAAE,MAAM,CAAA;KAClB;;;MA2DA;IAED,KAAK,8BAGF;QACD,UAAU,EAAE,MAAM,CAAA;QAClB,QAAQ,EAAE,MAAM,CAAA;KACjB;;;MAwDA;CACF"}
|
|
@@ -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,SAAS,EAAE,MAAM,CAAA;CAClB,CAAA;AAED,MAAM,MAAM,KAAK,GAAG;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA"}
|
|
@@ -12,33 +12,31 @@ export declare class Market {
|
|
|
12
12
|
bidBookOpen: boolean;
|
|
13
13
|
asks: Depth[];
|
|
14
14
|
askBookOpen: boolean;
|
|
15
|
-
private
|
|
16
|
-
|
|
15
|
+
private bidBook;
|
|
16
|
+
private askBook;
|
|
17
|
+
constructor({ chainId, tokens, bidBook, askBook, }: {
|
|
17
18
|
chainId: CHAIN_IDS;
|
|
18
19
|
tokens: [Currency, Currency];
|
|
19
|
-
|
|
20
|
+
bidBook: Book;
|
|
21
|
+
askBook: Book;
|
|
20
22
|
});
|
|
21
23
|
take: ({ takeQuote, limitPrice, amountOut, }: {
|
|
22
24
|
takeQuote: boolean;
|
|
23
25
|
limitPrice: bigint;
|
|
24
26
|
amountOut: bigint;
|
|
25
27
|
}) => {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
};
|
|
28
|
+
takenQuoteAmount: bigint;
|
|
29
|
+
spendBaseAmount: bigint;
|
|
30
|
+
bookId: bigint;
|
|
30
31
|
};
|
|
31
32
|
spend: ({ spendBase, limitPrice, amountIn, }: {
|
|
32
33
|
spendBase: boolean;
|
|
33
34
|
limitPrice: bigint;
|
|
34
35
|
amountIn: bigint;
|
|
35
36
|
}) => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
};
|
|
37
|
+
takenQuoteAmount: bigint;
|
|
38
|
+
spendBaseAmount: bigint;
|
|
39
|
+
bookId: bigint;
|
|
40
40
|
};
|
|
41
|
-
private takeInner;
|
|
42
|
-
private spendInner;
|
|
43
41
|
}
|
|
44
42
|
//# sourceMappingURL=market.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"market.d.ts","sourceRoot":"","sources":["../../../src/model/market.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;
|
|
1
|
+
{"version":3,"file":"market.d.ts","sourceRoot":"","sources":["../../../src/model/market.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAM9C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAA;AAC7B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAA;AAC1C,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,SAAS,CAAA;AAEpC,qBAAa,MAAM;IACjB,QAAQ,CAAC,QAAQ,SAAkD;IACnE,QAAQ,CAAC,QAAQ,SAAkD;IAEnE,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,QAAQ,CAAA;IACf,IAAI,EAAE,QAAQ,CAAA;IACd,IAAI,EAAE,KAAK,EAAE,CAAA;IACb,WAAW,EAAE,OAAO,CAAA;IACpB,IAAI,EAAE,KAAK,EAAE,CAAA;IACb,WAAW,EAAE,OAAO,CAAA;IACpB,OAAO,CAAC,OAAO,CAAM;IACrB,OAAO,CAAC,OAAO,CAAM;gBAET,EACV,OAAO,EACP,MAAM,EACN,OAAO,EACP,OAAO,GACR,EAAE;QACD,OAAO,EAAE,SAAS,CAAA;QAClB,MAAM,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAA;QAC5B,OAAO,EAAE,IAAI,CAAA;QACb,OAAO,EAAE,IAAI,CAAA;KACd;IAiDD,IAAI,0CAID;QACD,SAAS,EAAE,OAAO,CAAA;QAClB,UAAU,EAAE,MAAM,CAAA;QAClB,SAAS,EAAE,MAAM,CAAA;KAClB;;;;MAkBA;IAED,KAAK,yCAIF;QACD,SAAS,EAAE,OAAO,CAAA;QAClB,UAAU,EAAE,MAAM,CAAA;QAClB,QAAQ,EAAE,MAAM,CAAA;KACjB;;;;MAkBA;CACF"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Currency } from './currency';
|
|
1
|
+
import type { Currency } from './currency';
|
|
2
2
|
export type OpenOrderDto = {
|
|
3
3
|
id: string;
|
|
4
4
|
book: {
|
|
@@ -49,6 +49,9 @@ export type OpenOrder = {
|
|
|
49
49
|
currency: Currency;
|
|
50
50
|
value: string;
|
|
51
51
|
};
|
|
52
|
-
cancelable:
|
|
52
|
+
cancelable: {
|
|
53
|
+
currency: Currency;
|
|
54
|
+
value: string;
|
|
55
|
+
};
|
|
53
56
|
};
|
|
54
57
|
//# sourceMappingURL=open-order.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open-order.d.ts","sourceRoot":"","sources":["../../../src/model/open-order.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ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C,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;IAC7C,OAAO,EAAE;QAAE,QAAQ,EAAE,QAAQ,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;IAC9C,SAAS,EAAE;QAAE,QAAQ,EAAE,QAAQ,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;IAChD,UAAU,EAAE;QAAE,QAAQ,EAAE,QAAQ,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAA;CAClD,CAAA"}
|
package/dist/types/type.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { Account } from 'viem';
|
|
1
|
+
import type { Account } from 'viem';
|
|
2
2
|
import { CHAIN_IDS } from './constants/chain';
|
|
3
|
-
import { Currency } from './model/currency';
|
|
4
|
-
import { Depth } from './model/depth';
|
|
3
|
+
import type { Currency } from './model/currency';
|
|
4
|
+
import type { Depth } from './model/depth';
|
|
5
5
|
export { CHAIN_IDS } from './constants/chain';
|
|
6
|
-
export { Currency } from './model/currency';
|
|
7
|
-
export { Depth } from './model/depth';
|
|
8
|
-
export { OpenOrder } from './model/open-order';
|
|
6
|
+
export type { Currency } from './model/currency';
|
|
7
|
+
export type { Depth } from './model/depth';
|
|
8
|
+
export type { OpenOrder } from './model/open-order';
|
|
9
9
|
export type Market = {
|
|
10
10
|
chainId: CHAIN_IDS;
|
|
11
11
|
quote: Currency;
|
|
@@ -34,4 +34,9 @@ export type PermitSignature = {
|
|
|
34
34
|
export type DefaultOptions = {
|
|
35
35
|
rpcUrl?: string;
|
|
36
36
|
};
|
|
37
|
+
export type CurrencyFlow = {
|
|
38
|
+
currency: Currency;
|
|
39
|
+
amount: string;
|
|
40
|
+
direction: 'in' | 'out';
|
|
41
|
+
};
|
|
37
42
|
//# sourceMappingURL=type.d.ts.map
|
package/dist/types/type.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"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E,MAAM,CAAA;IAChB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,KAAK,MAAM,EAAE,CAAA;IAChB,CAAC,EAAE,KAAK,MAAM,EAAE,CAAA;CACjB,CAAA;AAED,MAAM,MAAM,cAAc,GAAG;IAC3B,MAAM,CAAC,EAAE,MAAM,CAAA;CAChB,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,EAAE,QAAQ,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;IACd,SAAS,EAAE,IAAI,GAAG,KAAK,CAAA;CACxB,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SimulateContractParameters, WriteContractParameters } from 'viem';
|
|
2
|
-
import { CHAIN_IDS, Transaction } from '../type';
|
|
1
|
+
import { type SimulateContractParameters, type WriteContractParameters } from 'viem';
|
|
2
|
+
import { CHAIN_IDS, type Transaction } from '../type';
|
|
3
3
|
export declare const buildTransaction: (chainId: CHAIN_IDS, args: WriteContractParameters | SimulateContractParameters) => Promise<Transaction>;
|
|
4
4
|
//# sourceMappingURL=build-transaction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-transaction.d.ts","sourceRoot":"","sources":["../../../src/utils/build-transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,0BAA0B,
|
|
1
|
+
{"version":3,"file":"build-transaction.d.ts","sourceRoot":"","sources":["../../../src/utils/build-transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,0BAA0B,EAC/B,KAAK,uBAAuB,EAC7B,MAAM,MAAM,CAAA;AAEb,OAAO,EAAE,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAA;AAGrD,eAAO,MAAM,gBAAgB,YAClB,SAAS,QACZ,uBAAuB,GAAG,0BAA0B,KACzD,QAAQ,WAAW,CAmBrB,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"currency.d.ts","sourceRoot":"","sources":["../../../src/utils/currency.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AA6C9C,eAAO,MAAM,aAAa,YACf,SAAS,WACT,KAAK,MAAM,EAAE,KACrB,QAAQ,QAAQ,CAoClB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"decorator.d.ts","sourceRoot":"","sources":["../../../src/utils/decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"decorator.d.ts","sourceRoot":"","sources":["../../../src/utils/decorator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,cAAc,EAAE,MAAM,SAAS,CAAA;AAGxD,wBAAgB,SAAS,CACvB,IAAI,SAAS;IACX,OAAO,EAAE,SAAS,CAAA;IAClB,OAAO,EAAE,cAAc,CAAA;CACxB,GAAG,GAAG,EACP,CAAC,EACD,EAAE,EAAE,CAAC,IAAI,EAAE,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,UACV,IAAI,gBAQzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"open.d.ts","sourceRoot":"","sources":["../../../src/utils/open.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AA0B9C,wBAAsB,aAAa,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,oBAOrE"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Currency } from '../model/currency';
|
|
1
|
+
import { type Currency } from '../model/currency';
|
|
2
2
|
import { CHAIN_IDS } from '../constants/chain';
|
|
3
3
|
export declare const calculateUnit: (chainId: CHAIN_IDS, quote: Currency) => Promise<bigint>;
|
|
4
4
|
//# sourceMappingURL=unit.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"unit.d.ts","sourceRoot":"","sources":["../../../src/utils/unit.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"unit.d.ts","sourceRoot":"","sources":["../../../src/utils/unit.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAmB9C,eAAO,MAAM,aAAa,YAAmB,SAAS,SAAS,QAAQ,oBAatE,CAAA"}
|
package/dist/types/view.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { CHAIN_IDS } from './constants/chain';
|
|
2
|
-
import { DefaultOptions, Market } from './type';
|
|
3
|
-
import { OpenOrder } from './model/open-order';
|
|
2
|
+
import type { DefaultOptions, Market } from './type';
|
|
3
|
+
import { type OpenOrder } from './model/open-order';
|
|
4
4
|
/**
|
|
5
5
|
* Get market information by chain id and token addresses
|
|
6
6
|
* @param chainId - chain id from {@link CHAIN_IDS}
|
|
7
7
|
* @param token0 - token0 address
|
|
8
8
|
* @param token1 - token1 address
|
|
9
9
|
* @param options
|
|
10
|
+
* @param options.n - number of depth levels to fetch
|
|
10
11
|
* @param options.rpcUrl - RPC URL of the blockchain
|
|
11
12
|
* @returns A market {@link Market}
|
|
12
13
|
*
|
|
@@ -23,7 +24,9 @@ export declare const getMarket: (args: {
|
|
|
23
24
|
chainId: CHAIN_IDS;
|
|
24
25
|
token0: `0x${string}`;
|
|
25
26
|
token1: `0x${string}`;
|
|
26
|
-
options?:
|
|
27
|
+
options?: {
|
|
28
|
+
n?: number;
|
|
29
|
+
} & DefaultOptions;
|
|
27
30
|
}) => Promise<Market>;
|
|
28
31
|
/**
|
|
29
32
|
* Calculates the expected output for a given input amount, based on the provided market data.
|
|
@@ -57,11 +60,7 @@ export declare const getExpectedOutput: (args: {
|
|
|
57
60
|
}) => Promise<{
|
|
58
61
|
takenAmount: string;
|
|
59
62
|
spendAmount: string;
|
|
60
|
-
|
|
61
|
-
bookId: bigint;
|
|
62
|
-
takenAmount: bigint;
|
|
63
|
-
spendAmount: bigint;
|
|
64
|
-
}[];
|
|
63
|
+
bookId: bigint;
|
|
65
64
|
}>;
|
|
66
65
|
/**
|
|
67
66
|
* Calculates the expected input for a given output amount, based on the provided market data.
|
|
@@ -95,11 +94,7 @@ export declare const getExpectedInput: (args: {
|
|
|
95
94
|
}) => Promise<{
|
|
96
95
|
takenAmount: string;
|
|
97
96
|
spendAmount: string;
|
|
98
|
-
|
|
99
|
-
bookId: bigint;
|
|
100
|
-
takenAmount: bigint;
|
|
101
|
-
spendAmount: bigint;
|
|
102
|
-
}[];
|
|
97
|
+
bookId: bigint;
|
|
103
98
|
}>;
|
|
104
99
|
/**
|
|
105
100
|
* Retrieves the open order with the specified ID on the given chain.
|
package/dist/types/view.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/view.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"view.d.ts","sourceRoot":"","sources":["../../src/view.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AAIpD,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAGnD;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,SAAS;aAOT,SAAS;YACV,KAAK,MAAM,EAAE;YACb,KAAK,MAAM,EAAE;cACX;QACR,CAAC,CAAC,EAAE,MAAM,CAAA;KACX,GAAG,cAAc;qBAkBrB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,iBAAiB;aAQjB,SAAS;gBACN,KAAK,MAAM,EAAE;iBACZ,KAAK,MAAM,EAAE;cAChB,MAAM;cACN;QAAE,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,cAAc;;iBAErC,MAAM;iBACN,MAAM;YACX,MAAM;EAgCjB,CAAA;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,gBAAgB;aAQhB,SAAS;gBACN,KAAK,MAAM,EAAE;iBACZ,KAAK,MAAM,EAAE;eACf,MAAM;cACP;QAAE,UAAU,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,cAAc;;iBAErC,MAAM;iBACN,MAAM;YACX,MAAM;EAgCjB,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,YAAY;aAKZ,SAAS;QACd,MAAM;cACA,cAAc;wBAI3B,CAAA;AAED;;;;;;;;;;;;;;;GAeG;AACH,eAAO,MAAM,aAAa;aAKb,SAAS;iBACL,KAAK,MAAM,EAAE;cAChB,cAAc;0BAI3B,CAAA"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"currency.js","sourceRoot":"","sources":["../../../src/apis/currency.ts"],"names":[],"mappings":";;;AAAA,+BAAkD;AAIlD,gDAAyD;AAEzD,MAAM,IAAI,GAAG;IACX;QACE,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,MAAM;QACZ,OAAO,EAAE;YACP;gBACE,YAAY,EAAE,QAAQ;gBACtB,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,QAAQ;aACf;SACF;QACD,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;IACD;QACE,MAAM,EAAE,EAAE;QACV,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE;YACP;gBACE,YAAY,EAAE,Q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