@1stdex/first-sdk 1.0.92-beta.2 → 1.0.92-beta.3
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 +2 -2
- package/dist/cjs/entities/book/apis/index.js.map +1 -1
- package/dist/cjs/entities/book/apis/position.js +7 -24
- package/dist/cjs/entities/book/apis/position.js.map +1 -1
- package/dist/cjs/views/book.js +4 -4
- package/dist/cjs/views/book.js.map +1 -1
- package/dist/cjs/views/index.js +2 -2
- package/dist/cjs/views/index.js.map +1 -1
- package/dist/esm/entities/book/apis/index.js +1 -1
- package/dist/esm/entities/book/apis/index.js.map +1 -1
- package/dist/esm/entities/book/apis/position.js +7 -36
- package/dist/esm/entities/book/apis/position.js.map +1 -1
- package/dist/esm/views/book.js +13 -13
- 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 +1 -1
- package/dist/types/entities/book/apis/index.d.ts.map +1 -1
- package/dist/types/entities/book/apis/position.d.ts +3 -3
- package/dist/types/entities/book/apis/position.d.ts.map +1 -1
- package/dist/types/views/book.d.ts +13 -13
- 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,7 +2,7 @@ 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,
|
|
5
|
+
export { fetchBookPositionValue, fetchBaseFromQuoteAmount } from './position';
|
|
6
6
|
export declare const fetchBookTokens: ({ chainId, bookId, }: {
|
|
7
7
|
chainId: CHAIN_IDS;
|
|
8
8
|
bookId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/entities/book/apis/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,MAAM,CAAC;AAEhD,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,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/entities/book/apis/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAE,MAAM,MAAM,CAAC;AAEhD,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,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAI9E,eAAO,MAAM,eAAe,yBAGzB;IACD,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,KAAG,QAAQ;IAAE,KAAK,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,CAiD9C,CAAC;AAEF,eAAO,MAAM,SAAS,iBACN,YAAY,WACjB,SAAS,iBACH,QAAQ,gBACT,QAAQ,eACT,OAAO,KACnB,QAAQ,SAAS,CAuGnB,CAAC"}
|
|
@@ -8,13 +8,13 @@ export declare const fetchBookPositionValue: ({ chainId, bookId, tick, units, }:
|
|
|
8
8
|
bookType: 'bids' | 'asks';
|
|
9
9
|
usdValue: string;
|
|
10
10
|
}>;
|
|
11
|
-
export declare const
|
|
11
|
+
export declare const fetchBaseFromQuoteAmount: ({ chainId, bookId, tick, quoteAmount, }: {
|
|
12
12
|
chainId: CHAIN_IDS;
|
|
13
13
|
bookId: string;
|
|
14
14
|
tick: bigint;
|
|
15
|
-
|
|
15
|
+
quoteAmount: string;
|
|
16
16
|
}) => Promise<{
|
|
17
17
|
bookType: 'bids' | 'asks';
|
|
18
|
-
|
|
18
|
+
baseAmount: bigint;
|
|
19
19
|
}>;
|
|
20
20
|
//# sourceMappingURL=position.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../../../../src/entities/book/apis/position.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AASnE,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;AAEF,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../../../../src/entities/book/apis/position.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,SAAS,EAAE,MAAM,wCAAwC,CAAC;AASnE,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;AAEF,eAAO,MAAM,wBAAwB,4CAKlC;IACD,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB,KAAG,QAAQ;IACV,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,UAAU,EAAE,MAAM,CAAC;CACpB,CA6DA,CAAC"}
|
|
@@ -33,36 +33,36 @@ export declare const getBookPositionValue: ({ chainId, bookId, tick, units, }: {
|
|
|
33
33
|
usdValue: string;
|
|
34
34
|
}>;
|
|
35
35
|
/**
|
|
36
|
-
*
|
|
36
|
+
* Converts base token amount to quote token amount at a specific tick price.
|
|
37
37
|
*
|
|
38
38
|
* @param {CHAIN_IDS} chainId - chain id from {@link CHAIN_IDS}
|
|
39
39
|
* @param {string} bookId - The book ID as a string
|
|
40
|
-
* @param {bigint} tick - The tick for the
|
|
41
|
-
* @param {string}
|
|
40
|
+
* @param {bigint} tick - The tick for the conversion
|
|
41
|
+
* @param {string} baseAmount - The base token amount (raw) as a string
|
|
42
42
|
*
|
|
43
|
-
* @returns {Promise<{ bookType: 'bids' | 'asks';
|
|
43
|
+
* @returns {Promise<{ bookType: 'bids' | 'asks'; quoteAmount: bigint }>} An object containing:
|
|
44
44
|
* - bookType: 'bids' for bid books, 'asks' for ask books
|
|
45
|
-
* -
|
|
45
|
+
* - quoteAmount: The quote token amount at the given tick price
|
|
46
46
|
*
|
|
47
47
|
* @example
|
|
48
|
-
* import {
|
|
48
|
+
* import { getQuoteFromBaseAmount } from '@1stdex/first-sdk'
|
|
49
49
|
*
|
|
50
|
-
* const result = await
|
|
50
|
+
* const result = await getQuoteFromBaseAmount({
|
|
51
51
|
* chainId: 421614,
|
|
52
52
|
* bookId: '123456789',
|
|
53
|
-
* tick:
|
|
54
|
-
*
|
|
53
|
+
* tick: -283255n,
|
|
54
|
+
* baseAmount: '970871980108393703474280',
|
|
55
55
|
* })
|
|
56
|
-
* // returns { bookType: 'bids',
|
|
56
|
+
* // returns { bookType: 'bids', quoteAmount: 485477000000n }
|
|
57
57
|
*/
|
|
58
|
-
export declare const
|
|
58
|
+
export declare const getBaseFromQuoteAmount: ({ chainId, bookId, tick, quoteAmount, }: {
|
|
59
59
|
chainId: CHAIN_IDS;
|
|
60
60
|
bookId: string;
|
|
61
61
|
tick: bigint;
|
|
62
|
-
|
|
62
|
+
quoteAmount: string;
|
|
63
63
|
}) => Promise<{
|
|
64
64
|
bookType: 'bids' | 'asks';
|
|
65
|
-
|
|
65
|
+
baseAmount: bigint;
|
|
66
66
|
}>;
|
|
67
67
|
/**
|
|
68
68
|
* Gets the quote and base tokens for a book.
|
|
@@ -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;AAM7D,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,oBAAoB,sCAK9B;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,CAE1D,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"book.d.ts","sourceRoot":"","sources":["../../../src/views/book.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kCAAkC,CAAC;AAM7D,OAAO,EAAE,QAAQ,EAAE,MAAM,4BAA4B,CAAC;AAEtD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,oBAAoB,sCAK9B;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,CAE1D,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,sBAAsB,4CAKhC;IACD,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACrB,KAAG,QAAQ;IAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAA;CAAE,CAE5D,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,aAAa,yBAGvB;IACD,OAAO,EAAE,SAAS,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;CAChB,KAAG,QAAQ;IAAE,KAAK,EAAE,QAAQ,CAAC;IAAC,IAAI,EAAE,QAAQ,CAAA;CAAE,CAE9C,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 { getBookPositionValue,
|
|
11
|
+
export { getBookPositionValue, getBaseFromQuoteAmount, getBookTokens, } 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,EACL,oBAAoB,EACpB,
|
|
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,EACL,oBAAoB,EACpB,sBAAsB,EACtB,aAAa,GACd,MAAM,QAAQ,CAAC;AAChB,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"}
|