@clober/v2-sdk 0.0.3 → 0.0.4
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/apis/currency.js +3 -7
- package/dist/cjs/apis/currency.js.map +1 -1
- package/dist/cjs/apis/market.js +3 -3
- package/dist/cjs/apis/market.js.map +1 -1
- package/dist/cjs/apis/open-order.js +5 -5
- package/dist/cjs/apis/open-order.js.map +1 -1
- package/dist/cjs/approval.js +4 -4
- package/dist/cjs/approval.js.map +1 -1
- package/dist/cjs/call.js +75 -76
- package/dist/cjs/call.js.map +1 -1
- package/dist/cjs/constants/client.js +14 -0
- package/dist/cjs/constants/client.js.map +1 -0
- package/dist/cjs/signature.js +6 -10
- package/dist/cjs/signature.js.map +1 -1
- package/dist/cjs/utils/approval.js +3 -8
- package/dist/cjs/utils/approval.js.map +1 -1
- package/dist/cjs/utils/build-transaction.js +4 -8
- package/dist/cjs/utils/build-transaction.js.map +1 -1
- package/dist/cjs/utils/decorator.js +13 -0
- package/dist/cjs/utils/decorator.js.map +1 -0
- package/dist/cjs/utils/unit.js +3 -7
- package/dist/cjs/utils/unit.js.map +1 -1
- package/dist/cjs/view.js +16 -20
- package/dist/cjs/view.js.map +1 -1
- package/dist/esm/apis/currency.js +4 -8
- package/dist/esm/apis/currency.js.map +1 -1
- package/dist/esm/apis/market.js +3 -3
- package/dist/esm/apis/market.js.map +1 -1
- package/dist/esm/apis/open-order.js +5 -5
- package/dist/esm/apis/open-order.js.map +1 -1
- package/dist/esm/approval.js +4 -3
- package/dist/esm/approval.js.map +1 -1
- package/dist/esm/call.js +75 -69
- package/dist/esm/call.js.map +1 -1
- package/dist/esm/constants/client.js +10 -0
- package/dist/esm/constants/client.js.map +1 -0
- package/dist/esm/signature.js +7 -10
- package/dist/esm/signature.js.map +1 -1
- package/dist/esm/utils/approval.js +3 -8
- package/dist/esm/utils/approval.js.map +1 -1
- package/dist/esm/utils/build-transaction.js +5 -9
- package/dist/esm/utils/build-transaction.js.map +1 -1
- package/dist/esm/utils/decorator.js +9 -0
- package/dist/esm/utils/decorator.js.map +1 -0
- package/dist/esm/utils/unit.js +4 -8
- package/dist/esm/utils/unit.js.map +1 -1
- package/dist/esm/view.js +16 -15
- package/dist/esm/view.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/apis/currency.d.ts +1 -1
- package/dist/types/apis/currency.d.ts.map +1 -1
- 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 +2 -2
- package/dist/types/apis/open-order.d.ts.map +1 -1
- package/dist/types/approval.d.ts +5 -2
- package/dist/types/approval.d.ts.map +1 -1
- package/dist/types/call.d.ts +47 -19
- package/dist/types/call.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/signature.d.ts +7 -3
- package/dist/types/signature.d.ts.map +1 -1
- package/dist/types/type.d.ts +3 -0
- package/dist/types/type.d.ts.map +1 -1
- package/dist/types/utils/approval.d.ts +1 -1
- package/dist/types/utils/approval.d.ts.map +1 -1
- package/dist/types/utils/build-transaction.d.ts +2 -3
- package/dist/types/utils/build-transaction.d.ts.map +1 -1
- package/dist/types/utils/decorator.d.ts +6 -0
- package/dist/types/utils/decorator.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 +30 -13
- package/dist/types/view.d.ts.map +1 -1
- package/package.json +1 -8
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { Currency } from '../model/currency';
|
|
2
2
|
import { CHAIN_IDS } from '../constants/chain';
|
|
3
|
-
export declare const fetchCurrency: (chainId: CHAIN_IDS, address: `0x${string}
|
|
3
|
+
export declare const fetchCurrency: (chainId: CHAIN_IDS, address: `0x${string}`) => Promise<Currency>;
|
|
4
4
|
//# sourceMappingURL=currency.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"currency.d.ts","sourceRoot":"","sources":["../../../src/apis/currency.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AACjD,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"currency.d.ts","sourceRoot":"","sources":["../../../src/apis/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,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}`[]
|
|
3
|
+
export declare function fetchMarket(chainId: CHAIN_IDS, tokenAddresses: `0x${string}`[]): 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":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AA4BxC,wBAAsB,WAAW,CAC/B,OAAO,EAAE,SAAS,EAClB,cAAc,EAAE,KAAK,MAAM,EAAE,EAAE,
|
|
1
|
+
{"version":3,"file":"market.d.ts","sourceRoot":"","sources":["../../../src/apis/market.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAC9C,OAAO,EAAE,MAAM,EAAE,MAAM,iBAAiB,CAAA;AA4BxC,wBAAsB,WAAW,CAC/B,OAAO,EAAE,SAAS,EAClB,cAAc,EAAE,KAAK,MAAM,EAAE,EAAE,GAC9B,OAAO,CAAC,MAAM,CAAC,CAsDjB"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CHAIN_IDS } from '../constants/chain';
|
|
2
2
|
import { OpenOrder } from '../model/open-order';
|
|
3
|
-
export declare function fetchOpenOrders(chainId: CHAIN_IDS, userAddress: `0x${string}
|
|
4
|
-
export declare function fetchOpenOrder(chainId: CHAIN_IDS, id: string
|
|
3
|
+
export declare function fetchOpenOrders(chainId: CHAIN_IDS, userAddress: `0x${string}`): Promise<OpenOrder[]>;
|
|
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;AAsC7D,wBAAsB,eAAe,CACnC,OAAO,EAAE,SAAS,EAClB,WAAW,EAAE,KAAK,MAAM,EAAE,
|
|
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;AAsC7D,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,5 +1,6 @@
|
|
|
1
1
|
import { HDAccount, PrivateKeyAccount } from 'viem';
|
|
2
2
|
import { CHAIN_IDS } from './constants/chain';
|
|
3
|
+
import { DefaultOptions } from './type';
|
|
3
4
|
/**
|
|
4
5
|
* Sets approval of all open orders for the specified account on the given chain.
|
|
5
6
|
*
|
|
@@ -26,7 +27,9 @@ import { CHAIN_IDS } from './constants/chain';
|
|
|
26
27
|
* mnemonicToAccount('legal ...')
|
|
27
28
|
* )
|
|
28
29
|
*/
|
|
29
|
-
export declare const setApprovalOfOpenOrdersForAll: (
|
|
30
|
-
|
|
30
|
+
export declare const setApprovalOfOpenOrdersForAll: (args: {
|
|
31
|
+
chainId: CHAIN_IDS;
|
|
32
|
+
account: HDAccount | PrivateKeyAccount;
|
|
33
|
+
options?: DefaultOptions;
|
|
31
34
|
}) => Promise<`0x${string}` | undefined>;
|
|
32
35
|
//# sourceMappingURL=approval.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approval.d.ts","sourceRoot":"","sources":["../../src/approval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,SAAS,EAAQ,iBAAiB,EAAE,MAAM,MAAM,CAAA;AAE7E,OAAO,EAAE,SAAS,EAAa,MAAM,mBAAmB,CAAA;
|
|
1
|
+
{"version":3,"file":"approval.d.ts","sourceRoot":"","sources":["../../src/approval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,SAAS,EAAQ,iBAAiB,EAAE,MAAM,MAAM,CAAA;AAE7E,OAAO,EAAE,SAAS,EAAa,MAAM,mBAAmB,CAAA;AAIxD,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAA;AAuBvC;;;;;;;;;;;;;;;;;;;;;;;;;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 { PermitSignature, Transaction } from './type';
|
|
2
|
+
import { DefaultOptions, PermitSignature, Transaction } from './type';
|
|
3
3
|
/**
|
|
4
4
|
* Build a transaction to open a market.
|
|
5
5
|
*
|
|
@@ -18,8 +18,11 @@ import { PermitSignature, Transaction } from './type';
|
|
|
18
18
|
* '0x0000000000000000000000000000000000000000'
|
|
19
19
|
* )
|
|
20
20
|
*/
|
|
21
|
-
export declare const openMarket: (
|
|
22
|
-
|
|
21
|
+
export declare const openMarket: (args: {
|
|
22
|
+
chainId: CHAIN_IDS;
|
|
23
|
+
inputToken: `0x${string}`;
|
|
24
|
+
outputToken: `0x${string}`;
|
|
25
|
+
options?: DefaultOptions;
|
|
23
26
|
}) => Promise<Transaction | undefined>;
|
|
24
27
|
/**
|
|
25
28
|
* Places a limit order on the specified chain for trading tokens.
|
|
@@ -68,10 +71,17 @@ export declare const openMarket: (chainId: CHAIN_IDS, inputToken: `0x${string}`,
|
|
|
68
71
|
* '4000.01', // price at 4000.01 (ETH/USDC)
|
|
69
72
|
* )
|
|
70
73
|
*/
|
|
71
|
-
export declare const limitOrder: (
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
74
|
+
export declare const limitOrder: (args: {
|
|
75
|
+
chainId: CHAIN_IDS;
|
|
76
|
+
userAddress: `0x${string}`;
|
|
77
|
+
inputToken: `0x${string}`;
|
|
78
|
+
outputToken: `0x${string}`;
|
|
79
|
+
amount: string;
|
|
80
|
+
price: string;
|
|
81
|
+
options?: {
|
|
82
|
+
signature?: PermitSignature;
|
|
83
|
+
postOnly?: boolean;
|
|
84
|
+
} & DefaultOptions;
|
|
75
85
|
}) => Promise<Transaction>;
|
|
76
86
|
/**
|
|
77
87
|
* Executes a market order on the specified chain for trading tokens.
|
|
@@ -118,10 +128,16 @@ export declare const limitOrder: (chainId: CHAIN_IDS, userAddress: `0x${string}`
|
|
|
118
128
|
* '0.13', // 0.13 ETH
|
|
119
129
|
* )
|
|
120
130
|
*/
|
|
121
|
-
export declare const marketOrder: (
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
131
|
+
export declare const marketOrder: (args: {
|
|
132
|
+
chainId: CHAIN_IDS;
|
|
133
|
+
userAddress: `0x${string}`;
|
|
134
|
+
inputToken: `0x${string}`;
|
|
135
|
+
outputToken: `0x${string}`;
|
|
136
|
+
amount: string;
|
|
137
|
+
options?: {
|
|
138
|
+
signature?: PermitSignature;
|
|
139
|
+
limitPrice?: string;
|
|
140
|
+
} & DefaultOptions;
|
|
125
141
|
}) => Promise<Transaction>;
|
|
126
142
|
/**
|
|
127
143
|
* Claims specified open order for settlement.
|
|
@@ -147,8 +163,11 @@ export declare const marketOrder: (chainId: CHAIN_IDS, userAddress: `0x${string}
|
|
|
147
163
|
* openOrders.map((order) => order.id)
|
|
148
164
|
* )
|
|
149
165
|
*/
|
|
150
|
-
export declare const claimOrder: (
|
|
151
|
-
|
|
166
|
+
export declare const claimOrder: (args: {
|
|
167
|
+
chainId: CHAIN_IDS;
|
|
168
|
+
userAddress: `0x${string}`;
|
|
169
|
+
id: string;
|
|
170
|
+
options?: DefaultOptions;
|
|
152
171
|
}) => Promise<Transaction>;
|
|
153
172
|
/**
|
|
154
173
|
* Claims specified open orders for settlement.
|
|
@@ -174,8 +193,11 @@ export declare const claimOrder: (chainId: CHAIN_IDS, userAddress: `0x${string}`
|
|
|
174
193
|
* openOrders.map((order) => order.id)
|
|
175
194
|
* )
|
|
176
195
|
*/
|
|
177
|
-
export declare const claimOrders: (
|
|
178
|
-
|
|
196
|
+
export declare const claimOrders: (args: {
|
|
197
|
+
chainId: CHAIN_IDS;
|
|
198
|
+
userAddress: `0x${string}`;
|
|
199
|
+
ids: string[];
|
|
200
|
+
options?: DefaultOptions;
|
|
179
201
|
}) => Promise<Transaction>;
|
|
180
202
|
/**
|
|
181
203
|
* Cancels specified open order if the order is not fully filled.
|
|
@@ -201,8 +223,11 @@ export declare const claimOrders: (chainId: CHAIN_IDS, userAddress: `0x${string}
|
|
|
201
223
|
* openOrders.map((order) => order.id)
|
|
202
224
|
* )
|
|
203
225
|
*/
|
|
204
|
-
export declare const cancelOrder: (
|
|
205
|
-
|
|
226
|
+
export declare const cancelOrder: (args: {
|
|
227
|
+
chainId: CHAIN_IDS;
|
|
228
|
+
userAddress: `0x${string}`;
|
|
229
|
+
id: string;
|
|
230
|
+
options?: DefaultOptions;
|
|
206
231
|
}) => Promise<Transaction>;
|
|
207
232
|
/**
|
|
208
233
|
* Cancels specified open orders if orders are not fully filled.
|
|
@@ -228,7 +253,10 @@ export declare const cancelOrder: (chainId: CHAIN_IDS, userAddress: `0x${string}
|
|
|
228
253
|
* openOrders.map((order) => order.id)
|
|
229
254
|
* )
|
|
230
255
|
*/
|
|
231
|
-
export declare const cancelOrders: (
|
|
232
|
-
|
|
256
|
+
export declare const cancelOrders: (args: {
|
|
257
|
+
chainId: CHAIN_IDS;
|
|
258
|
+
userAddress: `0x${string}`;
|
|
259
|
+
ids: string[];
|
|
260
|
+
options?: DefaultOptions;
|
|
233
261
|
}) => Promise<Transaction>;
|
|
234
262
|
//# 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,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"call.d.ts","sourceRoot":"","sources":["../../src/call.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,SAAS,EAAa,MAAM,mBAAmB,CAAA;AACxD,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,QAAQ,CAAA;AAoBrE;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAA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,cAAc;0BAkD3B,CAAA"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { 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,EAAE,YAAY,EAA4B,MAAM,MAAM,CAAA;AAE7D,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"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HDAccount, PrivateKeyAccount } from 'viem';
|
|
2
2
|
import { CHAIN_IDS } from './constants/chain';
|
|
3
|
-
import { PermitSignature } from './type';
|
|
3
|
+
import { DefaultOptions, PermitSignature } from './type';
|
|
4
4
|
/**
|
|
5
5
|
* Signs an ERC20 permit using EIP-712 encoding.
|
|
6
6
|
*
|
|
@@ -34,7 +34,11 @@ import { PermitSignature } from './type';
|
|
|
34
34
|
* '1000.123', // spend 1000.123 USDC
|
|
35
35
|
* )
|
|
36
36
|
*/
|
|
37
|
-
export declare const signERC20Permit: (
|
|
38
|
-
|
|
37
|
+
export declare const signERC20Permit: (args: {
|
|
38
|
+
chainId: CHAIN_IDS;
|
|
39
|
+
account: HDAccount | PrivateKeyAccount;
|
|
40
|
+
token: `0x${string}`;
|
|
41
|
+
amount: string;
|
|
42
|
+
options?: DefaultOptions;
|
|
39
43
|
}) => Promise<PermitSignature>;
|
|
40
44
|
//# sourceMappingURL=signature.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../src/signature.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../src/signature.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EAGT,iBAAiB,EAGlB,MAAM,MAAM,CAAA;AAEb,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAI7C,OAAO,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,QAAQ,CAAA;AAoDxD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,eAAO,MAAM,eAAe;aAOf,SAAS;aACT,SAAS,GAAG,iBAAiB;WAC/B,KAAK,MAAM,EAAE;YACZ,MAAM;cACJ,cAAc;8BAuF3B,CAAA"}
|
package/dist/types/type.d.ts
CHANGED
package/dist/types/type.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../../src/type.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAA;AAE9B,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AAErC,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC7C,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAE9C,MAAM,MAAM,MAAM,GAAG;IACnB,OAAO,EAAE,SAAS,CAAA;IAClB,KAAK,EAAE,QAAQ,CAAA;IACf,IAAI,EAAE,QAAQ,CAAA;IAC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AQ,CAAA;IACf,IAAI,EAAE,QAAQ,CAAA;IACd,QAAQ,EAAE,MAAM,CAAA;IAChB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,KAAK,EAAE,CAAA;IACb,WAAW,EAAE,OAAO,CAAA;IACpB,IAAI,EAAE,KAAK,EAAE,CAAA;IACb,WAAW,EAAE,OAAO,CAAA;CACrB,CAAA;AAED,MAAM,MAAM,WAAW,GAAG;IACxB,IAAI,EAAE,KAAK,MAAM,EAAE,CAAA;IACnB,GAAG,EAAE,MAAM,CAAA;IACX,QAAQ,EAAE,MAAM,CAAA;IAChB,KAAK,EAAE,MAAM,CAAA;IACb,EAAE,EAAE,KAAK,MAAM,EAAE,CAAA;IACjB,IAAI,EAAE,KAAK,MAAM,EAAE,GAAG,OAAO,GAAG,SAAS,CAAA;CAC1C,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,QAAQ,EAAE,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"}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { CHAIN_IDS } from '../constants/chain';
|
|
2
|
-
export declare function fetchIsApprovedForAll(chainId: CHAIN_IDS, owner: `0x${string}
|
|
2
|
+
export declare function fetchIsApprovedForAll(chainId: CHAIN_IDS, owner: `0x${string}`): Promise<boolean>;
|
|
3
3
|
//# sourceMappingURL=approval.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"approval.d.ts","sourceRoot":"","sources":["../../../src/utils/approval.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"approval.d.ts","sourceRoot":"","sources":["../../../src/utils/approval.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AA+B9C,wBAAsB,qBAAqB,CACzC,OAAO,EAAE,SAAS,EAClB,KAAK,EAAE,KAAK,MAAM,EAAE,GACnB,OAAO,CAAC,OAAO,CAAC,CAOlB"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { SimulateContractParameters, WriteContractParameters } from 'viem';
|
|
2
|
-
import { CHAIN_IDS } from '../
|
|
3
|
-
|
|
4
|
-
export declare const buildTransaction: (chainId: CHAIN_IDS, args: WriteContractParameters | SimulateContractParameters, rpcUrl?: string) => Promise<Transaction>;
|
|
2
|
+
import { CHAIN_IDS, Transaction } from '../type';
|
|
3
|
+
export declare const buildTransaction: (chainId: CHAIN_IDS, args: WriteContractParameters | SimulateContractParameters) => Promise<Transaction>;
|
|
5
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,
|
|
1
|
+
{"version":3,"file":"build-transaction.d.ts","sourceRoot":"","sources":["../../../src/utils/build-transaction.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,0BAA0B,EAC1B,uBAAuB,EACxB,MAAM,MAAM,CAAA;AAEb,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAGhD,eAAO,MAAM,gBAAgB,YAClB,SAAS,QACZ,uBAAuB,GAAG,0BAA0B,KACzD,QAAQ,WAAW,CAmBrB,CAAA"}
|
|
@@ -0,0 +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;AAGnD,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"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { Currency } from '../model/currency';
|
|
2
2
|
import { CHAIN_IDS } from '../constants/chain';
|
|
3
|
-
export declare const calculateUnit: (chainId: CHAIN_IDS, quote: Currency
|
|
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;AAC5C,OAAO,EAAE,SAAS,
|
|
1
|
+
{"version":3,"file":"unit.d.ts","sourceRoot":"","sources":["../../../src/utils/unit.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAA;AAC5C,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,5 +1,5 @@
|
|
|
1
1
|
import { CHAIN_IDS } from './constants/chain';
|
|
2
|
-
import { Market } from './type';
|
|
2
|
+
import { DefaultOptions, Market } from './type';
|
|
3
3
|
import { OpenOrder } from './model/open-order';
|
|
4
4
|
/**
|
|
5
5
|
* Get market information by chain id and token addresses
|
|
@@ -19,8 +19,11 @@ import { OpenOrder } from './model/open-order';
|
|
|
19
19
|
* '0x0000000000000000000000000000000000000000',
|
|
20
20
|
* )
|
|
21
21
|
*/
|
|
22
|
-
export declare const getMarket: (
|
|
23
|
-
|
|
22
|
+
export declare const getMarket: (args: {
|
|
23
|
+
chainId: CHAIN_IDS;
|
|
24
|
+
token0: `0x${string}`;
|
|
25
|
+
token1: `0x${string}`;
|
|
26
|
+
options?: DefaultOptions;
|
|
24
27
|
}) => Promise<Market>;
|
|
25
28
|
/**
|
|
26
29
|
* Calculates the expected output for a given input amount, based on the provided market data.
|
|
@@ -43,9 +46,14 @@ export declare const getMarket: (chainId: CHAIN_IDS, token0: `0x${string}`, toke
|
|
|
43
46
|
* '1000.123', // spend 1000.123 USDC
|
|
44
47
|
* )
|
|
45
48
|
*/
|
|
46
|
-
export declare const getExpectedOutput: (
|
|
47
|
-
|
|
48
|
-
|
|
49
|
+
export declare const getExpectedOutput: (args: {
|
|
50
|
+
chainId: CHAIN_IDS;
|
|
51
|
+
inputToken: `0x${string}`;
|
|
52
|
+
outputToken: `0x${string}`;
|
|
53
|
+
amountIn: string;
|
|
54
|
+
options?: {
|
|
55
|
+
limitPrice?: string;
|
|
56
|
+
} & DefaultOptions;
|
|
49
57
|
}) => Promise<{
|
|
50
58
|
takenAmount: string;
|
|
51
59
|
spendAmount: string;
|
|
@@ -76,9 +84,14 @@ export declare const getExpectedOutput: (chainId: CHAIN_IDS, inputToken: `0x${st
|
|
|
76
84
|
* '0.1', // take 0.1 ETH
|
|
77
85
|
* )
|
|
78
86
|
*/
|
|
79
|
-
export declare const getExpectedInput: (
|
|
80
|
-
|
|
81
|
-
|
|
87
|
+
export declare const getExpectedInput: (args: {
|
|
88
|
+
chainId: CHAIN_IDS;
|
|
89
|
+
inputToken: `0x${string}`;
|
|
90
|
+
outputToken: `0x${string}`;
|
|
91
|
+
amountOut: string;
|
|
92
|
+
options?: {
|
|
93
|
+
limitPrice?: string;
|
|
94
|
+
} & DefaultOptions;
|
|
82
95
|
}) => Promise<{
|
|
83
96
|
takenAmount: string;
|
|
84
97
|
spendAmount: string;
|
|
@@ -104,8 +117,10 @@ export declare const getExpectedInput: (chainId: CHAIN_IDS, inputToken: `0x${str
|
|
|
104
117
|
* '46223845323662364279893361453861711542636620039907198451770258805035840307200'
|
|
105
118
|
* )
|
|
106
119
|
*/
|
|
107
|
-
export declare const getOpenOrder: (
|
|
108
|
-
|
|
120
|
+
export declare const getOpenOrder: (args: {
|
|
121
|
+
chainId: CHAIN_IDS;
|
|
122
|
+
id: string;
|
|
123
|
+
options?: DefaultOptions;
|
|
109
124
|
}) => Promise<OpenOrder>;
|
|
110
125
|
/**
|
|
111
126
|
* Retrieves open orders for the specified user on the given chain.
|
|
@@ -123,7 +138,9 @@ export declare const getOpenOrder: (chainId: CHAIN_IDS, id: string, options?: {
|
|
|
123
138
|
* '0x5F79EE8f8fA862E98201120d83c4eC39D9468D49'
|
|
124
139
|
* )
|
|
125
140
|
*/
|
|
126
|
-
export declare const getOpenOrders: (
|
|
127
|
-
|
|
141
|
+
export declare const getOpenOrders: (args: {
|
|
142
|
+
chainId: CHAIN_IDS;
|
|
143
|
+
userAddress: `0x${string}`;
|
|
144
|
+
options?: DefaultOptions;
|
|
128
145
|
}) => Promise<OpenOrder[]>;
|
|
129
146
|
//# sourceMappingURL=view.d.ts.map
|
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,MAAM,EAAE,MAAM,QAAQ,CAAA;AAI/
|
|
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;AAI/C,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAA;AAG9C;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,SAAS;aAMT,SAAS;YACV,KAAK,MAAM,EAAE;YACb,KAAK,MAAM,EAAE;cACX,cAAc;qBAkB3B,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;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,EAAE;EA6CzE,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;QAAE,MAAM,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAA;KAAE,EAAE;EA6CzE,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,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clober/v2-sdk",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"description": "🛠 An SDK for building applications on top of Clober V2",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -9,13 +9,6 @@
|
|
|
9
9
|
"module": "./dist/esm/index.js",
|
|
10
10
|
"types": "./dist/types/index.d.ts",
|
|
11
11
|
"typings": "./dist/types/index.d.ts",
|
|
12
|
-
"exports": {
|
|
13
|
-
".": {
|
|
14
|
-
"types": "./dist/types/index.d.ts",
|
|
15
|
-
"import": "./dist/esm/index.js",
|
|
16
|
-
"default": "./dist/cjs/index.js"
|
|
17
|
-
}
|
|
18
|
-
},
|
|
19
12
|
"repository": {
|
|
20
13
|
"type": "git",
|
|
21
14
|
"url": "git+https://github.com/clober-dex/v2-sdk.git"
|