@1stdex/first-sdk 1.0.92-beta.2 → 1.0.92-beta.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/entities/book/apis/index.js +79 -80
- package/dist/cjs/entities/book/apis/index.js.map +1 -1
- package/dist/cjs/entities/book/apis/position.js +3 -47
- package/dist/cjs/entities/book/apis/position.js.map +1 -1
- package/dist/cjs/entities/market/apis/index.js +2 -2
- package/dist/cjs/entities/market/apis/index.js.map +1 -1
- package/dist/cjs/views/book.js +32 -13
- package/dist/cjs/views/book.js.map +1 -1
- package/dist/cjs/views/index.js +2 -4
- package/dist/cjs/views/index.js.map +1 -1
- package/dist/esm/entities/book/apis/index.js +79 -78
- package/dist/esm/entities/book/apis/index.js.map +1 -1
- package/dist/esm/entities/book/apis/position.js +1 -60
- package/dist/esm/entities/book/apis/position.js.map +1 -1
- package/dist/esm/entities/market/apis/index.js +2 -2
- package/dist/esm/entities/market/apis/index.js.map +1 -1
- package/dist/esm/views/book.js +45 -61
- package/dist/esm/views/book.js.map +1 -1
- package/dist/esm/views/index.js +1 -1
- package/dist/esm/views/index.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/entities/book/apis/index.d.ts +2 -9
- package/dist/types/entities/book/apis/index.d.ts.map +1 -1
- package/dist/types/entities/book/apis/position.d.ts +0 -9
- package/dist/types/entities/book/apis/position.d.ts.map +1 -1
- package/dist/types/entities/market/apis/index.d.ts.map +1 -1
- package/dist/types/views/book.d.ts +18 -72
- package/dist/types/views/book.d.ts.map +1 -1
- package/dist/types/views/index.d.ts +1 -1
- package/dist/types/views/index.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -2,13 +2,6 @@ import { PublicClient } from 'viem';
|
|
|
2
2
|
import { CHAIN_IDS } from '../../../constants/chain-configs/chain';
|
|
3
3
|
import { Currency } from '../../currency/types';
|
|
4
4
|
import { BookModel } from '../model';
|
|
5
|
-
export { fetchBookPositionValue
|
|
6
|
-
export declare const
|
|
7
|
-
chainId: CHAIN_IDS;
|
|
8
|
-
bookId: string;
|
|
9
|
-
}) => Promise<{
|
|
10
|
-
quote: Currency;
|
|
11
|
-
base: Currency;
|
|
12
|
-
}>;
|
|
13
|
-
export declare const fetchBook: (publicClient: PublicClient, chainId: CHAIN_IDS, quoteCurrency: Currency, baseCurrency: Currency, useSubgraph: boolean) => Promise<BookModel>;
|
|
5
|
+
export { fetchBookPositionValue } from './position';
|
|
6
|
+
export declare const fetchBook: (publicClient: PublicClient, chainId: CHAIN_IDS, quoteCurrency: Currency, baseCurrency: Currency, useSubgraph: boolean, includeDepths?: boolean) => Promise<BookModel>;
|
|
14
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/entities/book/apis/index.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/entities/book/apis/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAMhD,OAAO,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAErC,OAAO,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAC;AAIpD,eAAO,MAAM,SAAS,iBACN,YAAY,WACjB,SAAS,iBACH,QAAQ,gBACT,QAAQ,eACT,OAAO,kBACL,OAAO,KACrB,QAAQ,SAAS,CA+InB,CAAC"}
|
|
@@ -8,13 +8,4 @@ export declare const fetchBookPositionValue: ({ chainId, bookId, tick, units, }:
|
|
|
8
8
|
bookType: 'bids' | 'asks';
|
|
9
9
|
usdValue: string;
|
|
10
10
|
}>;
|
|
11
|
-
export declare const fetchBookUnitsFromUsdValue: ({ chainId, bookId, tick, usdValue, }: {
|
|
12
|
-
chainId: CHAIN_IDS;
|
|
13
|
-
bookId: string;
|
|
14
|
-
tick: bigint;
|
|
15
|
-
usdValue: string;
|
|
16
|
-
}) => Promise<{
|
|
17
|
-
bookType: 'bids' | 'asks';
|
|
18
|
-
units: bigint;
|
|
19
|
-
}>;
|
|
20
11
|
//# sourceMappingURL=position.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../../../../src/entities/book/apis/position.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../../../../src/entities/book/apis/position.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AAKnE,eAAO,MAAM,sBAAsB,sCAKhC;IACD,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,KAAG,QAAQ;IAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CA2F1D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/entities/market/apis/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAKvC,wBAAsB,WAAW,CAC/B,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,SAAS,EAClB,cAAc,EAAE,KAAK,MAAM,EAAE,EAAE,EAC/B,WAAW,EAAE,OAAO,GACnB,OAAO,CAAC,WAAW,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/entities/market/apis/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAEpC,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAKvC,wBAAsB,WAAW,CAC/B,YAAY,EAAE,YAAY,EAC1B,OAAO,EAAE,SAAS,EAClB,cAAc,EAAE,KAAK,MAAM,EAAE,EAAE,EAC/B,WAAW,EAAE,OAAO,GACnB,OAAO,CAAC,WAAW,CAAC,CA4CtB"}
|
|
@@ -1,93 +1,39 @@
|
|
|
1
1
|
import { CHAIN_IDS } from '../constants/chain-configs/chain';
|
|
2
2
|
import { Currency } from '../entities/currency/types';
|
|
3
3
|
/**
|
|
4
|
-
* Gets
|
|
4
|
+
* Gets trade information for a specific book, tick and quote units.
|
|
5
5
|
*
|
|
6
6
|
* @param {CHAIN_IDS} chainId - chain id from {@link CHAIN_IDS}
|
|
7
7
|
* @param {string} bookId - The book ID as a string
|
|
8
|
-
* @param {bigint} tick - The tick for the
|
|
9
|
-
* @param {bigint}
|
|
8
|
+
* @param {bigint} tick - The tick for the trade
|
|
9
|
+
* @param {bigint} quoteUnits - The number of quote units
|
|
10
10
|
*
|
|
11
|
-
* @returns {Promise<{
|
|
12
|
-
* -
|
|
13
|
-
* -
|
|
11
|
+
* @returns {Promise<{ quoteCurrency: Currency; quoteAmount: bigint; baseCurrency: Currency; baseAmount: bigint }>} An object containing:
|
|
12
|
+
* - quoteCurrency: The quote currency information
|
|
13
|
+
* - quoteAmount: The raw quote token amount
|
|
14
|
+
* - baseCurrency: The base currency information
|
|
15
|
+
* - baseAmount: The raw base token amount
|
|
14
16
|
*
|
|
15
17
|
* @example
|
|
16
|
-
* import {
|
|
18
|
+
* import { getTradeInfo } from '@1stdex/first-sdk'
|
|
17
19
|
*
|
|
18
|
-
* const result = await
|
|
20
|
+
* const result = await getTradeInfo({
|
|
19
21
|
* chainId: 421614,
|
|
20
22
|
* bookId: '123456789',
|
|
21
23
|
* tick: 1000n,
|
|
22
|
-
*
|
|
24
|
+
* quoteUnits: 5n,
|
|
23
25
|
* })
|
|
24
|
-
* // returns {
|
|
26
|
+
* // returns { quoteCurrency, quoteAmount, baseCurrency, baseAmount }
|
|
25
27
|
*/
|
|
26
|
-
export declare const
|
|
28
|
+
export declare const getTradeInfo: ({ chainId, bookId, tick, quoteUnits, }: {
|
|
27
29
|
chainId: CHAIN_IDS;
|
|
28
30
|
bookId: string;
|
|
29
31
|
tick: bigint;
|
|
30
|
-
|
|
32
|
+
quoteUnits: bigint;
|
|
31
33
|
}) => Promise<{
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
* Gets the token units needed for a book position at a specific tick to achieve a target USD value.
|
|
37
|
-
*
|
|
38
|
-
* @param {CHAIN_IDS} chainId - chain id from {@link CHAIN_IDS}
|
|
39
|
-
* @param {string} bookId - The book ID as a string
|
|
40
|
-
* @param {bigint} tick - The tick for the order
|
|
41
|
-
* @param {string} usdValue - The target USD value as a string
|
|
42
|
-
*
|
|
43
|
-
* @returns {Promise<{ bookType: 'bids' | 'asks'; units: bigint }>} An object containing:
|
|
44
|
-
* - bookType: 'bids' for bid books, 'asks' for ask books
|
|
45
|
-
* - units: The number of units needed to achieve the target USD value
|
|
46
|
-
*
|
|
47
|
-
* @example
|
|
48
|
-
* import { getBookUnitsFromUsdValue } from '@1stdex/first-sdk'
|
|
49
|
-
*
|
|
50
|
-
* const result = await getBookUnitsFromUsdValue({
|
|
51
|
-
* chainId: 421614,
|
|
52
|
-
* bookId: '123456789',
|
|
53
|
-
* tick: 1000n,
|
|
54
|
-
* usdValue: '1234.56',
|
|
55
|
-
* })
|
|
56
|
-
* // returns { bookType: 'bids', units: 5n }
|
|
57
|
-
*/
|
|
58
|
-
export declare const getBookUnitsFromUsdValue: ({ chainId, bookId, tick, usdValue, }: {
|
|
59
|
-
chainId: CHAIN_IDS;
|
|
60
|
-
bookId: string;
|
|
61
|
-
tick: bigint;
|
|
62
|
-
usdValue: string;
|
|
63
|
-
}) => Promise<{
|
|
64
|
-
bookType: 'bids' | 'asks';
|
|
65
|
-
units: bigint;
|
|
66
|
-
}>;
|
|
67
|
-
/**
|
|
68
|
-
* Gets the quote and base tokens for a book.
|
|
69
|
-
*
|
|
70
|
-
* @param {CHAIN_IDS} chainId - chain id from {@link CHAIN_IDS}
|
|
71
|
-
* @param {string} bookId - The book ID as a string
|
|
72
|
-
*
|
|
73
|
-
* @returns {Promise<{ quote: Currency; base: Currency }>} An object containing:
|
|
74
|
-
* - quote: The quote token currency details
|
|
75
|
-
* - base: The base token currency details
|
|
76
|
-
*
|
|
77
|
-
* @example
|
|
78
|
-
* import { getBookTokens } from '@1stdex/first-sdk'
|
|
79
|
-
*
|
|
80
|
-
* const result = await getBookTokens({
|
|
81
|
-
* chainId: 421614,
|
|
82
|
-
* bookId: '123456789',
|
|
83
|
-
* })
|
|
84
|
-
* // returns { quote: { address: '0x...', name: 'USDC', symbol: 'USDC', decimals: 6 }, base: { address: '0x...', name: 'Wrapped Ether', symbol: 'WETH', decimals: 18 } }
|
|
85
|
-
*/
|
|
86
|
-
export declare const getBookTokens: ({ chainId, bookId, }: {
|
|
87
|
-
chainId: CHAIN_IDS;
|
|
88
|
-
bookId: string;
|
|
89
|
-
}) => Promise<{
|
|
90
|
-
quote: Currency;
|
|
91
|
-
base: Currency;
|
|
34
|
+
quoteCurrency: Currency;
|
|
35
|
+
quoteAmount: bigint;
|
|
36
|
+
baseCurrency: Currency;
|
|
37
|
+
baseAmount: bigint;
|
|
92
38
|
}>;
|
|
93
39
|
//# sourceMappingURL=book.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"book.d.ts","sourceRoot":"","sources":["../../../src/views/book.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;
|
|
1
|
+
{"version":3,"file":"book.d.ts","sourceRoot":"","sources":["../../../src/views/book.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAE7D,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAGtD;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,YAAY,2CAKtB;IACD,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;CACpB,KAAG,QAAQ;IACV,aAAa,EAAE,QAAQ,CAAC;IACxB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,QAAQ,CAAC;IACvB,UAAU,EAAE,MAAM,CAAC;CACpB,CA+DA,CAAC"}
|
|
@@ -8,7 +8,7 @@ export { getProtocolAnalytics, getUserDailyVolumes, getTopUsersByNativeVolume, g
|
|
|
8
8
|
export { getVault } from './vault';
|
|
9
9
|
export { getTradingBalance, getPortfolioBalance, getAllBalances, getRealTokenBalance, } from './balance';
|
|
10
10
|
export { checkTokenAllowances, needsVaultDeposit, getOrderSetupStatus, } from './setup';
|
|
11
|
-
export {
|
|
11
|
+
export { getTradeInfo } from './book';
|
|
12
12
|
export { getOrder, getOrderPositionValue } from './order';
|
|
13
13
|
export { getTradeHistory } from './trade-history';
|
|
14
14
|
export { getUserVolumeUSD } from './user-volume';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,4BAA4B,EAC5B,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,mBAAmB,GACpB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,SAAS,CAAC;AACjB,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/views/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,kBAAkB,EAClB,iBAAiB,EACjB,aAAa,EACb,4BAA4B,EAC5B,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,oBAAoB,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EACL,YAAY,EACZ,aAAa,EACb,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,mBAAmB,EACnB,sBAAsB,EACtB,gBAAgB,GACjB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,oBAAoB,EAAE,MAAM,WAAW,CAAC;AACjD,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,iBAAiB,EACjB,qBAAqB,EACrB,cAAc,GACf,MAAM,YAAY,CAAC;AACpB,OAAO,EACL,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EACzB,mBAAmB,EACnB,kBAAkB,GACnB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACnC,OAAO,EACL,iBAAiB,EACjB,mBAAmB,EACnB,cAAc,EACd,mBAAmB,GACpB,MAAM,WAAW,CAAC;AACnB,OAAO,EACL,oBAAoB,EACpB,iBAAiB,EACjB,mBAAmB,GACpB,MAAM,SAAS,CAAC;AACjB,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,QAAQ,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAC1D,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,+BAA+B,EAAE,MAAM,cAAc,CAAC;AAC/D,YAAY,EAAE,sBAAsB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC"}
|