@nadohq/shared 0.1.0-alpha.4 → 0.1.0-alpha.40
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/abis/index.cjs +12 -12
- package/dist/abis/index.cjs.map +1 -1
- package/dist/abis/index.d.cts +6 -6
- package/dist/abis/index.d.ts +6 -6
- package/dist/abis/index.js +6 -6
- package/dist/abis/index.js.map +1 -1
- package/dist/consts/chainEnvToChain.cjs +2 -2
- package/dist/consts/chainEnvToChain.cjs.map +1 -1
- package/dist/consts/chainEnvToChain.d.cts +308 -39
- package/dist/consts/chainEnvToChain.d.ts +308 -39
- package/dist/consts/chainEnvToChain.js +3 -3
- package/dist/consts/chainEnvToChain.js.map +1 -1
- package/dist/consts/productIds.cjs +1 -1
- package/dist/consts/productIds.cjs.map +1 -1
- package/dist/consts/productIds.d.cts +1 -1
- package/dist/consts/productIds.d.ts +1 -1
- package/dist/consts/productIds.js +1 -1
- package/dist/consts/productIds.js.map +1 -1
- package/dist/deployments/core/deployment.inkMainnet.json +13 -0
- package/dist/deployments/core/deployment.inkSepolia.json +13 -0
- package/dist/deployments/index.cjs +6 -6
- package/dist/deployments/index.cjs.map +1 -1
- package/dist/deployments/index.js +5 -5
- package/dist/deployments/index.js.map +1 -1
- package/dist/eip712/eip712ValueTypes.d.cts +1 -1
- package/dist/eip712/eip712ValueTypes.d.ts +1 -1
- package/dist/eip712/getNadoEIP712Domain.cjs.map +1 -1
- package/dist/eip712/getNadoEIP712Domain.js.map +1 -1
- package/dist/eip712/index.cjs +13 -13
- package/dist/eip712/index.cjs.map +1 -1
- package/dist/eip712/index.d.cts +9 -9
- package/dist/eip712/index.d.ts +9 -9
- package/dist/eip712/index.js +6 -6
- package/dist/eip712/index.js.map +1 -1
- package/dist/index.d.cts +33 -33
- package/dist/index.d.ts +33 -33
- package/dist/types/ChainEnv.cjs +1 -1
- package/dist/types/ChainEnv.cjs.map +1 -1
- package/dist/types/ChainEnv.d.cts +2 -2
- package/dist/types/ChainEnv.d.ts +2 -2
- package/dist/types/ChainEnv.js +1 -1
- package/dist/types/ChainEnv.js.map +1 -1
- package/dist/types/index.cjs +7 -7
- package/dist/types/index.cjs.map +1 -1
- package/dist/types/index.d.cts +4 -4
- package/dist/types/index.d.ts +4 -4
- package/dist/types/index.js +3 -3
- package/dist/types/index.js.map +1 -1
- package/dist/types/orderAppendixTypes.cjs.map +1 -1
- package/dist/types/orderAppendixTypes.d.cts +7 -3
- package/dist/types/orderAppendixTypes.d.ts +7 -3
- package/dist/utils/createDeterministicLinkedSignerPrivateKey.cjs.map +1 -1
- package/dist/utils/createDeterministicLinkedSignerPrivateKey.js.map +1 -1
- package/dist/utils/index.cjs +12 -12
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +21 -21
- package/dist/utils/index.d.ts +21 -21
- package/dist/utils/index.js +6 -6
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/math/index.cjs +8 -8
- package/dist/utils/math/index.cjs.map +1 -1
- package/dist/utils/math/index.d.cts +4 -4
- package/dist/utils/math/index.d.ts +4 -4
- package/dist/utils/math/index.js +4 -4
- package/dist/utils/math/index.js.map +1 -1
- package/dist/utils/orders/appendix/appendixIsolatedValue.cjs +50 -0
- package/dist/utils/orders/appendix/appendixIsolatedValue.cjs.map +1 -0
- package/dist/utils/orders/appendix/appendixIsolatedValue.d.cts +26 -0
- package/dist/utils/orders/appendix/appendixIsolatedValue.d.ts +26 -0
- package/dist/utils/orders/appendix/appendixIsolatedValue.js +31 -0
- package/dist/utils/orders/appendix/appendixIsolatedValue.js.map +1 -0
- package/dist/utils/orders/appendix/{appendixTWAPValue.cjs → appendixTwapValue.cjs} +14 -15
- package/dist/utils/orders/appendix/appendixTwapValue.cjs.map +1 -0
- package/dist/utils/orders/appendix/appendixTwapValue.d.cts +29 -0
- package/dist/utils/orders/appendix/appendixTwapValue.d.ts +29 -0
- package/dist/utils/orders/appendix/appendixTwapValue.js +25 -0
- package/dist/utils/orders/appendix/appendixTwapValue.js.map +1 -0
- package/dist/utils/orders/appendix/index.cjs +6 -6
- package/dist/utils/orders/appendix/index.cjs.map +1 -1
- package/dist/utils/orders/appendix/index.d.cts +3 -3
- package/dist/utils/orders/appendix/index.d.ts +3 -3
- package/dist/utils/orders/appendix/index.js +3 -3
- package/dist/utils/orders/appendix/index.js.map +1 -1
- package/dist/utils/orders/appendix/orderAppendix.test.cjs +11 -12
- package/dist/utils/orders/appendix/orderAppendix.test.cjs.map +1 -1
- package/dist/utils/orders/appendix/orderAppendix.test.js +11 -12
- package/dist/utils/orders/appendix/orderAppendix.test.js.map +1 -1
- package/dist/utils/orders/appendix/packOrderAppendix.cjs +7 -7
- package/dist/utils/orders/appendix/packOrderAppendix.cjs.map +1 -1
- package/dist/utils/orders/appendix/packOrderAppendix.js +7 -7
- package/dist/utils/orders/appendix/packOrderAppendix.js.map +1 -1
- package/dist/utils/orders/appendix/types.cjs.map +1 -1
- package/dist/utils/orders/appendix/types.d.cts +2 -2
- package/dist/utils/orders/appendix/types.d.ts +2 -2
- package/dist/utils/orders/appendix/unpackOrderAppendix.cjs +7 -6
- package/dist/utils/orders/appendix/unpackOrderAppendix.cjs.map +1 -1
- package/dist/utils/orders/appendix/unpackOrderAppendix.js +7 -6
- package/dist/utils/orders/appendix/unpackOrderAppendix.js.map +1 -1
- package/dist/utils/orders/index.cjs +3 -3
- package/dist/utils/orders/index.cjs.map +1 -1
- package/dist/utils/orders/index.d.cts +5 -5
- package/dist/utils/orders/index.d.ts +5 -5
- package/dist/utils/orders/index.js +1 -1
- package/dist/utils/orders/index.js.map +1 -1
- package/dist/utils/productTypeFilter.cjs.map +1 -1
- package/dist/utils/productTypeFilter.js.map +1 -1
- package/package.json +6 -2
- package/src/abis/index.ts +6 -6
- package/src/consts/chainEnvToChain.ts +2 -2
- package/src/consts/productIds.ts +1 -1
- package/src/deployments/core/deployment.inkMainnet.json +13 -0
- package/src/deployments/core/deployment.inkSepolia.json +13 -0
- package/src/deployments/index.ts +5 -5
- package/src/eip712/getNadoEIP712Domain.ts +1 -1
- package/src/eip712/index.ts +6 -6
- package/src/types/ChainEnv.ts +1 -1
- package/src/types/index.ts +3 -3
- package/src/types/orderAppendixTypes.ts +6 -2
- package/src/utils/createDeterministicLinkedSignerPrivateKey.ts +1 -1
- package/src/utils/index.ts +6 -6
- package/src/utils/math/index.ts +4 -4
- package/src/utils/orders/appendix/appendixIsolatedValue.ts +49 -0
- package/src/utils/orders/appendix/appendixTwapValue.ts +46 -0
- package/src/utils/orders/appendix/index.ts +3 -3
- package/src/utils/orders/appendix/orderAppendix.test.ts +10 -11
- package/src/utils/orders/appendix/packOrderAppendix.ts +8 -8
- package/src/utils/orders/appendix/types.ts +5 -5
- package/src/utils/orders/appendix/unpackOrderAppendix.ts +8 -7
- package/src/utils/orders/index.ts +1 -1
- package/src/utils/productTypeFilter.ts +2 -2
- package/dist/deployments/core/deployment.InkSepolia.json +0 -13
- package/dist/deployments/core/deployment.arbitrumOne.json +0 -18
- package/dist/utils/orders/appendix/appendixTWAPValue.cjs.map +0 -1
- package/dist/utils/orders/appendix/appendixTWAPValue.d.cts +0 -31
- package/dist/utils/orders/appendix/appendixTWAPValue.d.ts +0 -31
- package/dist/utils/orders/appendix/appendixTWAPValue.js +0 -26
- package/dist/utils/orders/appendix/appendixTWAPValue.js.map +0 -1
- package/src/deployments/core/deployment.InkSepolia.json +0 -13
- package/src/deployments/core/deployment.arbitrumOne.json +0 -18
- package/src/utils/orders/appendix/appendixTWAPValue.ts +0 -51
package/dist/utils/index.cjs
CHANGED
|
@@ -17,36 +17,36 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
17
17
|
// src/utils/index.ts
|
|
18
18
|
var utils_exports = {};
|
|
19
19
|
module.exports = __toCommonJS(utils_exports);
|
|
20
|
-
__reExport(utils_exports, require("./
|
|
21
|
-
__reExport(utils_exports, require("./interest.cjs"), module.exports);
|
|
22
|
-
__reExport(utils_exports, require("./productTypeFilter.cjs"), module.exports);
|
|
20
|
+
__reExport(utils_exports, require("./asyncResult.cjs"), module.exports);
|
|
23
21
|
__reExport(utils_exports, require("./balanceValue.cjs"), module.exports);
|
|
24
22
|
__reExport(utils_exports, require("./bytes32.cjs"), module.exports);
|
|
25
23
|
__reExport(utils_exports, require("./createDeterministicLinkedSignerPrivateKey.cjs"), module.exports);
|
|
26
|
-
__reExport(utils_exports, require("./isWriteableContract.cjs"), module.exports);
|
|
27
24
|
__reExport(utils_exports, require("./errors/index.cjs"), module.exports);
|
|
28
|
-
__reExport(utils_exports, require("./math/index.cjs"), module.exports);
|
|
29
|
-
__reExport(utils_exports, require("./asyncResult.cjs"), module.exports);
|
|
30
25
|
__reExport(utils_exports, require("./getValidatedAddress.cjs"), module.exports);
|
|
31
26
|
__reExport(utils_exports, require("./getValidatedHex.cjs"), module.exports);
|
|
27
|
+
__reExport(utils_exports, require("./interest.cjs"), module.exports);
|
|
28
|
+
__reExport(utils_exports, require("./isWriteableContract.cjs"), module.exports);
|
|
32
29
|
__reExport(utils_exports, require("./mapValues.cjs"), module.exports);
|
|
30
|
+
__reExport(utils_exports, require("./math/index.cjs"), module.exports);
|
|
31
|
+
__reExport(utils_exports, require("./orders/index.cjs"), module.exports);
|
|
32
|
+
__reExport(utils_exports, require("./productTypeFilter.cjs"), module.exports);
|
|
33
33
|
__reExport(utils_exports, require("./time.cjs"), module.exports);
|
|
34
34
|
__reExport(utils_exports, require("./toPrintableObject.cjs"), module.exports);
|
|
35
35
|
// Annotate the CommonJS export names for ESM import in node:
|
|
36
36
|
0 && (module.exports = {
|
|
37
|
-
...require("./
|
|
38
|
-
...require("./interest.cjs"),
|
|
39
|
-
...require("./productTypeFilter.cjs"),
|
|
37
|
+
...require("./asyncResult.cjs"),
|
|
40
38
|
...require("./balanceValue.cjs"),
|
|
41
39
|
...require("./bytes32.cjs"),
|
|
42
40
|
...require("./createDeterministicLinkedSignerPrivateKey.cjs"),
|
|
43
|
-
...require("./isWriteableContract.cjs"),
|
|
44
41
|
...require("./errors/index.cjs"),
|
|
45
|
-
...require("./math/index.cjs"),
|
|
46
|
-
...require("./asyncResult.cjs"),
|
|
47
42
|
...require("./getValidatedAddress.cjs"),
|
|
48
43
|
...require("./getValidatedHex.cjs"),
|
|
44
|
+
...require("./interest.cjs"),
|
|
45
|
+
...require("./isWriteableContract.cjs"),
|
|
49
46
|
...require("./mapValues.cjs"),
|
|
47
|
+
...require("./math/index.cjs"),
|
|
48
|
+
...require("./orders/index.cjs"),
|
|
49
|
+
...require("./productTypeFilter.cjs"),
|
|
50
50
|
...require("./time.cjs"),
|
|
51
51
|
...require("./toPrintableObject.cjs")
|
|
52
52
|
});
|
package/dist/utils/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from './
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from './asyncResult';\nexport * from './balanceValue';\nexport * from './bytes32';\nexport * from './createDeterministicLinkedSignerPrivateKey';\nexport * from './errors';\nexport * from './getValidatedAddress';\nexport * from './getValidatedHex';\nexport * from './interest';\nexport * from './isWriteableContract';\nexport * from './mapValues';\nexport * from './math';\nexport * from './orders';\nexport * from './productTypeFilter';\nexport * from './time';\nexport * from './toPrintableObject';\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,0BAAc,8BAAd;AACA,0BAAc,+BADd;AAEA,0BAAc,0BAFd;AAGA,0BAAc,4DAHd;AAIA,0BAAc,+BAJd;AAKA,0BAAc,sCALd;AAMA,0BAAc,kCANd;AAOA,0BAAc,2BAPd;AAQA,0BAAc,sCARd;AASA,0BAAc,4BATd;AAUA,0BAAc,6BAVd;AAWA,0BAAc,+BAXd;AAYA,0BAAc,oCAZd;AAaA,0BAAc,uBAbd;AAcA,0BAAc,oCAdd;","names":[]}
|
package/dist/utils/index.d.cts
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { getDefaultRecvTime } from './orders/recvTime.cjs';
|
|
3
|
-
export { packTWAPOrderAppendixValue, unpackTWAPOrderAppendixValue } from './orders/appendix/appendixTWAPValue.cjs';
|
|
4
|
-
export { unpackOrderAppendix } from './orders/appendix/unpackOrderAppendix.cjs';
|
|
5
|
-
export { packOrderAppendix } from './orders/appendix/packOrderAppendix.cjs';
|
|
6
|
-
export { PackedOrderAppendixBits } from './orders/appendix/types.cjs';
|
|
7
|
-
export { bitMaskValue } from './orders/appendix/bitMaskValue.cjs';
|
|
8
|
-
export { calcBorrowRateForTimeRange, calcBorrowRatePerSecond, calcRealizedDepositRateForTimeRange, calcTotalBorrowed, calcTotalDeposited, calcUtilizationRatio } from './interest.cjs';
|
|
9
|
-
export { isPerpBalance, isPerpProduct, isSpotBalance, isSpotProduct } from './productTypeFilter.cjs';
|
|
1
|
+
export { AsyncResult, asyncResult } from './asyncResult.cjs';
|
|
10
2
|
export { calcPerpBalanceNotionalValue, calcPerpBalanceValue, calcSpotBalanceValue } from './balanceValue.cjs';
|
|
11
3
|
export { subaccountFromBytes32, subaccountFromHex, subaccountNameBytesToStr, subaccountNameToBytes12, subaccountToBytes32, subaccountToHex } from './bytes32.cjs';
|
|
12
4
|
export { createDeterministicLinkedSignerPrivateKey } from './createDeterministicLinkedSignerPrivateKey.cjs';
|
|
13
|
-
export { isWriteableContract } from './isWriteableContract.cjs';
|
|
14
5
|
export { WalletNotProvidedError } from './errors/WalletNotProvidedError.cjs';
|
|
15
|
-
export { BigDecimalish, toBigDecimal } from './math/bigDecimal.cjs';
|
|
16
|
-
export { toIntegerString } from './math/toIntegerString.cjs';
|
|
17
|
-
export { toBigInt } from './math/toBigInt.cjs';
|
|
18
|
-
export { clampBigDecimal } from './math/clamp.cjs';
|
|
19
|
-
export { sumBigDecimalBy } from './math/sumBigDecimalBy.cjs';
|
|
20
|
-
export { NADO_PRODUCT_DECIMALS, addDecimals, removeDecimals } from './math/decimalAdjustment.cjs';
|
|
21
|
-
export { BigDecimals } from './math/BigDecimals.cjs';
|
|
22
|
-
export { AsyncResult, asyncResult } from './asyncResult.cjs';
|
|
23
6
|
export { getValidatedAddress } from './getValidatedAddress.cjs';
|
|
24
7
|
export { getValidatedHex } from './getValidatedHex.cjs';
|
|
8
|
+
export { calcBorrowRateForTimeRange, calcBorrowRatePerSecond, calcRealizedDepositRateForTimeRange, calcTotalBorrowed, calcTotalDeposited, calcUtilizationRatio } from './interest.cjs';
|
|
9
|
+
export { isWriteableContract } from './isWriteableContract.cjs';
|
|
25
10
|
export { mapValues } from './mapValues.cjs';
|
|
11
|
+
export { BigDecimalish, toBigDecimal } from './math/bigDecimal.cjs';
|
|
12
|
+
export { BigDecimals } from './math/BigDecimals.cjs';
|
|
13
|
+
export { clampBigDecimal } from './math/clamp.cjs';
|
|
14
|
+
export { NADO_PRODUCT_DECIMALS, addDecimals, removeDecimals } from './math/decimalAdjustment.cjs';
|
|
15
|
+
export { sumBigDecimalBy } from './math/sumBigDecimalBy.cjs';
|
|
16
|
+
export { toBigInt } from './math/toBigInt.cjs';
|
|
17
|
+
export { toIntegerString } from './math/toIntegerString.cjs';
|
|
18
|
+
export { packTwapOrderAppendixValue, unpackTwapOrderAppendixValue } from './orders/appendix/appendixTwapValue.cjs';
|
|
19
|
+
export { bitMaskValue } from './orders/appendix/bitMaskValue.cjs';
|
|
20
|
+
export { packOrderAppendix } from './orders/appendix/packOrderAppendix.cjs';
|
|
21
|
+
export { PackedOrderAppendixBits } from './orders/appendix/types.cjs';
|
|
22
|
+
export { unpackOrderAppendix } from './orders/appendix/unpackOrderAppendix.cjs';
|
|
23
|
+
export { getOrderNonce, getRecvTimeFromOrderNonce } from './orders/orderNonce.cjs';
|
|
24
|
+
export { getDefaultRecvTime } from './orders/recvTime.cjs';
|
|
25
|
+
export { isPerpBalance, isPerpProduct, isSpotBalance, isSpotProduct } from './productTypeFilter.cjs';
|
|
26
26
|
export { TimeInSeconds, millisToSeconds, nowInSeconds } from './time.cjs';
|
|
27
27
|
export { toPrintableObject } from './toPrintableObject.cjs';
|
|
28
28
|
export { default as BigDecimal } from 'bignumber.js';
|
|
29
|
-
import '../types/orderAppendixTypes.cjs';
|
|
30
|
-
import '../types/OrderExecutionType.cjs';
|
|
31
|
-
import '../types/productTypes.cjs';
|
|
32
29
|
import '../types/balanceTypes.cjs';
|
|
33
30
|
import '../types/healthTypes.cjs';
|
|
31
|
+
import '../types/productTypes.cjs';
|
|
34
32
|
import 'viem';
|
|
35
33
|
import '../types/bytes.cjs';
|
|
36
34
|
import '../types/subaccountTypes.cjs';
|
|
37
35
|
import '../types/viemTypes.cjs';
|
|
36
|
+
import '../types/orderAppendixTypes.cjs';
|
|
37
|
+
import '../types/OrderExecutionType.cjs';
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { getDefaultRecvTime } from './orders/recvTime.js';
|
|
3
|
-
export { packTWAPOrderAppendixValue, unpackTWAPOrderAppendixValue } from './orders/appendix/appendixTWAPValue.js';
|
|
4
|
-
export { unpackOrderAppendix } from './orders/appendix/unpackOrderAppendix.js';
|
|
5
|
-
export { packOrderAppendix } from './orders/appendix/packOrderAppendix.js';
|
|
6
|
-
export { PackedOrderAppendixBits } from './orders/appendix/types.js';
|
|
7
|
-
export { bitMaskValue } from './orders/appendix/bitMaskValue.js';
|
|
8
|
-
export { calcBorrowRateForTimeRange, calcBorrowRatePerSecond, calcRealizedDepositRateForTimeRange, calcTotalBorrowed, calcTotalDeposited, calcUtilizationRatio } from './interest.js';
|
|
9
|
-
export { isPerpBalance, isPerpProduct, isSpotBalance, isSpotProduct } from './productTypeFilter.js';
|
|
1
|
+
export { AsyncResult, asyncResult } from './asyncResult.js';
|
|
10
2
|
export { calcPerpBalanceNotionalValue, calcPerpBalanceValue, calcSpotBalanceValue } from './balanceValue.js';
|
|
11
3
|
export { subaccountFromBytes32, subaccountFromHex, subaccountNameBytesToStr, subaccountNameToBytes12, subaccountToBytes32, subaccountToHex } from './bytes32.js';
|
|
12
4
|
export { createDeterministicLinkedSignerPrivateKey } from './createDeterministicLinkedSignerPrivateKey.js';
|
|
13
|
-
export { isWriteableContract } from './isWriteableContract.js';
|
|
14
5
|
export { WalletNotProvidedError } from './errors/WalletNotProvidedError.js';
|
|
15
|
-
export { BigDecimalish, toBigDecimal } from './math/bigDecimal.js';
|
|
16
|
-
export { toIntegerString } from './math/toIntegerString.js';
|
|
17
|
-
export { toBigInt } from './math/toBigInt.js';
|
|
18
|
-
export { clampBigDecimal } from './math/clamp.js';
|
|
19
|
-
export { sumBigDecimalBy } from './math/sumBigDecimalBy.js';
|
|
20
|
-
export { NADO_PRODUCT_DECIMALS, addDecimals, removeDecimals } from './math/decimalAdjustment.js';
|
|
21
|
-
export { BigDecimals } from './math/BigDecimals.js';
|
|
22
|
-
export { AsyncResult, asyncResult } from './asyncResult.js';
|
|
23
6
|
export { getValidatedAddress } from './getValidatedAddress.js';
|
|
24
7
|
export { getValidatedHex } from './getValidatedHex.js';
|
|
8
|
+
export { calcBorrowRateForTimeRange, calcBorrowRatePerSecond, calcRealizedDepositRateForTimeRange, calcTotalBorrowed, calcTotalDeposited, calcUtilizationRatio } from './interest.js';
|
|
9
|
+
export { isWriteableContract } from './isWriteableContract.js';
|
|
25
10
|
export { mapValues } from './mapValues.js';
|
|
11
|
+
export { BigDecimalish, toBigDecimal } from './math/bigDecimal.js';
|
|
12
|
+
export { BigDecimals } from './math/BigDecimals.js';
|
|
13
|
+
export { clampBigDecimal } from './math/clamp.js';
|
|
14
|
+
export { NADO_PRODUCT_DECIMALS, addDecimals, removeDecimals } from './math/decimalAdjustment.js';
|
|
15
|
+
export { sumBigDecimalBy } from './math/sumBigDecimalBy.js';
|
|
16
|
+
export { toBigInt } from './math/toBigInt.js';
|
|
17
|
+
export { toIntegerString } from './math/toIntegerString.js';
|
|
18
|
+
export { packTwapOrderAppendixValue, unpackTwapOrderAppendixValue } from './orders/appendix/appendixTwapValue.js';
|
|
19
|
+
export { bitMaskValue } from './orders/appendix/bitMaskValue.js';
|
|
20
|
+
export { packOrderAppendix } from './orders/appendix/packOrderAppendix.js';
|
|
21
|
+
export { PackedOrderAppendixBits } from './orders/appendix/types.js';
|
|
22
|
+
export { unpackOrderAppendix } from './orders/appendix/unpackOrderAppendix.js';
|
|
23
|
+
export { getOrderNonce, getRecvTimeFromOrderNonce } from './orders/orderNonce.js';
|
|
24
|
+
export { getDefaultRecvTime } from './orders/recvTime.js';
|
|
25
|
+
export { isPerpBalance, isPerpProduct, isSpotBalance, isSpotProduct } from './productTypeFilter.js';
|
|
26
26
|
export { TimeInSeconds, millisToSeconds, nowInSeconds } from './time.js';
|
|
27
27
|
export { toPrintableObject } from './toPrintableObject.js';
|
|
28
28
|
export { default as BigDecimal } from 'bignumber.js';
|
|
29
|
-
import '../types/orderAppendixTypes.js';
|
|
30
|
-
import '../types/OrderExecutionType.js';
|
|
31
|
-
import '../types/productTypes.js';
|
|
32
29
|
import '../types/balanceTypes.js';
|
|
33
30
|
import '../types/healthTypes.js';
|
|
31
|
+
import '../types/productTypes.js';
|
|
34
32
|
import 'viem';
|
|
35
33
|
import '../types/bytes.js';
|
|
36
34
|
import '../types/subaccountTypes.js';
|
|
37
35
|
import '../types/viemTypes.js';
|
|
36
|
+
import '../types/orderAppendixTypes.js';
|
|
37
|
+
import '../types/OrderExecutionType.js';
|
package/dist/utils/index.js
CHANGED
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
// src/utils/index.ts
|
|
2
|
-
export * from "./
|
|
3
|
-
export * from "./interest.js";
|
|
4
|
-
export * from "./productTypeFilter.js";
|
|
2
|
+
export * from "./asyncResult.js";
|
|
5
3
|
export * from "./balanceValue.js";
|
|
6
4
|
export * from "./bytes32.js";
|
|
7
5
|
export * from "./createDeterministicLinkedSignerPrivateKey.js";
|
|
8
|
-
export * from "./isWriteableContract.js";
|
|
9
6
|
export * from "./errors/index.js";
|
|
10
|
-
export * from "./math/index.js";
|
|
11
|
-
export * from "./asyncResult.js";
|
|
12
7
|
export * from "./getValidatedAddress.js";
|
|
13
8
|
export * from "./getValidatedHex.js";
|
|
9
|
+
export * from "./interest.js";
|
|
10
|
+
export * from "./isWriteableContract.js";
|
|
14
11
|
export * from "./mapValues.js";
|
|
12
|
+
export * from "./math/index.js";
|
|
13
|
+
export * from "./orders/index.js";
|
|
14
|
+
export * from "./productTypeFilter.js";
|
|
15
15
|
export * from "./time.js";
|
|
16
16
|
export * from "./toPrintableObject.js";
|
|
17
17
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from './
|
|
1
|
+
{"version":3,"sources":["../../src/utils/index.ts"],"sourcesContent":["export * from './asyncResult';\nexport * from './balanceValue';\nexport * from './bytes32';\nexport * from './createDeterministicLinkedSignerPrivateKey';\nexport * from './errors';\nexport * from './getValidatedAddress';\nexport * from './getValidatedHex';\nexport * from './interest';\nexport * from './isWriteableContract';\nexport * from './mapValues';\nexport * from './math';\nexport * from './orders';\nexport * from './productTypeFilter';\nexport * from './time';\nexport * from './toPrintableObject';\n"],"mappings":";AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -18,20 +18,20 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
18
18
|
var math_exports = {};
|
|
19
19
|
module.exports = __toCommonJS(math_exports);
|
|
20
20
|
__reExport(math_exports, require("./bigDecimal.cjs"), module.exports);
|
|
21
|
-
__reExport(math_exports, require("./
|
|
22
|
-
__reExport(math_exports, require("./toBigInt.cjs"), module.exports);
|
|
21
|
+
__reExport(math_exports, require("./BigDecimals.cjs"), module.exports);
|
|
23
22
|
__reExport(math_exports, require("./clamp.cjs"), module.exports);
|
|
24
|
-
__reExport(math_exports, require("./sumBigDecimalBy.cjs"), module.exports);
|
|
25
23
|
__reExport(math_exports, require("./decimalAdjustment.cjs"), module.exports);
|
|
26
|
-
__reExport(math_exports, require("./
|
|
24
|
+
__reExport(math_exports, require("./sumBigDecimalBy.cjs"), module.exports);
|
|
25
|
+
__reExport(math_exports, require("./toBigInt.cjs"), module.exports);
|
|
26
|
+
__reExport(math_exports, require("./toIntegerString.cjs"), module.exports);
|
|
27
27
|
// Annotate the CommonJS export names for ESM import in node:
|
|
28
28
|
0 && (module.exports = {
|
|
29
29
|
...require("./bigDecimal.cjs"),
|
|
30
|
-
...require("./
|
|
31
|
-
...require("./toBigInt.cjs"),
|
|
30
|
+
...require("./BigDecimals.cjs"),
|
|
32
31
|
...require("./clamp.cjs"),
|
|
33
|
-
...require("./sumBigDecimalBy.cjs"),
|
|
34
32
|
...require("./decimalAdjustment.cjs"),
|
|
35
|
-
...require("./
|
|
33
|
+
...require("./sumBigDecimalBy.cjs"),
|
|
34
|
+
...require("./toBigInt.cjs"),
|
|
35
|
+
...require("./toIntegerString.cjs")
|
|
36
36
|
});
|
|
37
37
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/math/index.ts"],"sourcesContent":["export * from './bigDecimal';\nexport * from './
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/math/index.ts"],"sourcesContent":["export * from './bigDecimal';\nexport * from './BigDecimals';\nexport * from './clamp';\nexport * from './decimalAdjustment';\nexport * from './sumBigDecimalBy';\nexport * from './toBigInt';\nexport * from './toIntegerString';\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,yBAAc,6BAAd;AACA,yBAAc,8BADd;AAEA,yBAAc,wBAFd;AAGA,yBAAc,oCAHd;AAIA,yBAAc,kCAJd;AAKA,yBAAc,2BALd;AAMA,yBAAc,kCANd;","names":[]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { BigDecimalish, toBigDecimal } from './bigDecimal.cjs';
|
|
2
|
-
export {
|
|
3
|
-
export { toBigInt } from './toBigInt.cjs';
|
|
2
|
+
export { BigDecimals } from './BigDecimals.cjs';
|
|
4
3
|
export { clampBigDecimal } from './clamp.cjs';
|
|
5
|
-
export { sumBigDecimalBy } from './sumBigDecimalBy.cjs';
|
|
6
4
|
export { NADO_PRODUCT_DECIMALS, addDecimals, removeDecimals } from './decimalAdjustment.cjs';
|
|
7
|
-
export {
|
|
5
|
+
export { sumBigDecimalBy } from './sumBigDecimalBy.cjs';
|
|
6
|
+
export { toBigInt } from './toBigInt.cjs';
|
|
7
|
+
export { toIntegerString } from './toIntegerString.cjs';
|
|
8
8
|
export { default as BigDecimal } from 'bignumber.js';
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { BigDecimalish, toBigDecimal } from './bigDecimal.js';
|
|
2
|
-
export {
|
|
3
|
-
export { toBigInt } from './toBigInt.js';
|
|
2
|
+
export { BigDecimals } from './BigDecimals.js';
|
|
4
3
|
export { clampBigDecimal } from './clamp.js';
|
|
5
|
-
export { sumBigDecimalBy } from './sumBigDecimalBy.js';
|
|
6
4
|
export { NADO_PRODUCT_DECIMALS, addDecimals, removeDecimals } from './decimalAdjustment.js';
|
|
7
|
-
export {
|
|
5
|
+
export { sumBigDecimalBy } from './sumBigDecimalBy.js';
|
|
6
|
+
export { toBigInt } from './toBigInt.js';
|
|
7
|
+
export { toIntegerString } from './toIntegerString.js';
|
|
8
8
|
export { default as BigDecimal } from 'bignumber.js';
|
package/dist/utils/math/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
// src/utils/math/index.ts
|
|
2
2
|
export * from "./bigDecimal.js";
|
|
3
|
-
export * from "./
|
|
4
|
-
export * from "./toBigInt.js";
|
|
3
|
+
export * from "./BigDecimals.js";
|
|
5
4
|
export * from "./clamp.js";
|
|
6
|
-
export * from "./sumBigDecimalBy.js";
|
|
7
5
|
export * from "./decimalAdjustment.js";
|
|
8
|
-
export * from "./
|
|
6
|
+
export * from "./sumBigDecimalBy.js";
|
|
7
|
+
export * from "./toBigInt.js";
|
|
8
|
+
export * from "./toIntegerString.js";
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/utils/math/index.ts"],"sourcesContent":["export * from './bigDecimal';\nexport * from './
|
|
1
|
+
{"version":3,"sources":["../../../src/utils/math/index.ts"],"sourcesContent":["export * from './bigDecimal';\nexport * from './BigDecimals';\nexport * from './clamp';\nexport * from './decimalAdjustment';\nexport * from './sumBigDecimalBy';\nexport * from './toBigInt';\nexport * from './toIntegerString';\n"],"mappings":";AAAA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/utils/orders/appendix/appendixIsolatedValue.ts
|
|
21
|
+
var appendixIsolatedValue_exports = {};
|
|
22
|
+
__export(appendixIsolatedValue_exports, {
|
|
23
|
+
packIsolatedOrderAppendixValue: () => packIsolatedOrderAppendixValue,
|
|
24
|
+
unpackIsolatedOrderAppendixValue: () => unpackIsolatedOrderAppendixValue
|
|
25
|
+
});
|
|
26
|
+
module.exports = __toCommonJS(appendixIsolatedValue_exports);
|
|
27
|
+
var import_math = require("../../math/index.cjs");
|
|
28
|
+
var import_bitMaskValue = require("./bitMaskValue.cjs");
|
|
29
|
+
var APPENDIX_V1_ISO_MARGIN_DECIMALS = 6;
|
|
30
|
+
var MARGIN_DECIMAL_ADJUSTMENT = import_math.NADO_PRODUCT_DECIMALS - APPENDIX_V1_ISO_MARGIN_DECIMALS;
|
|
31
|
+
function packIsolatedOrderAppendixValue({
|
|
32
|
+
margin
|
|
33
|
+
}) {
|
|
34
|
+
return (0, import_bitMaskValue.bitMaskValue)(
|
|
35
|
+
(0, import_math.toBigInt)((0, import_math.removeDecimals)(margin, MARGIN_DECIMAL_ADJUSTMENT)),
|
|
36
|
+
64
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
function unpackIsolatedOrderAppendixValue(value) {
|
|
40
|
+
const margin = (0, import_bitMaskValue.bitMaskValue)(value, 64);
|
|
41
|
+
return {
|
|
42
|
+
margin: (0, import_math.toBigInt)((0, import_math.addDecimals)(margin, MARGIN_DECIMAL_ADJUSTMENT))
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
46
|
+
0 && (module.exports = {
|
|
47
|
+
packIsolatedOrderAppendixValue,
|
|
48
|
+
unpackIsolatedOrderAppendixValue
|
|
49
|
+
});
|
|
50
|
+
//# sourceMappingURL=appendixIsolatedValue.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/utils/orders/appendix/appendixIsolatedValue.ts"],"sourcesContent":["import { OrderAppendixIsolatedFields } from '../../../types';\nimport {\n addDecimals,\n NADO_PRODUCT_DECIMALS,\n removeDecimals,\n toBigInt,\n} from '../../math';\nimport { bitMaskValue } from './bitMaskValue';\n\nconst APPENDIX_V1_ISO_MARGIN_DECIMALS = 6;\n\n/* Appendix v1 uses x6 precision, so we need to adjust precision to/from SDK's usual precision */\nconst MARGIN_DECIMAL_ADJUSTMENT =\n NADO_PRODUCT_DECIMALS - APPENDIX_V1_ISO_MARGIN_DECIMALS;\n\n/**\n * Packs the provided margin into a single 64-bit bigint.\n *\n * Bit layout (MSB → LSB):\n * | margin_x6 |\n * |-----------|\n * | 63..0 |\n * | 64 bits |\n *\n */\nexport function packIsolatedOrderAppendixValue({\n margin,\n}: OrderAppendixIsolatedFields): bigint {\n return bitMaskValue(\n toBigInt(removeDecimals(margin, MARGIN_DECIMAL_ADJUSTMENT)),\n 64,\n );\n}\n\n/**\n * Unpacks a 64-bit bigint into its component fields for Isolated orders.\n *\n * @param value 64-bit bigint to unpack\n * @returns Object with:\n * - margin_x6: bigint, from bits 63..0\n */\nexport function unpackIsolatedOrderAppendixValue(\n value: bigint,\n): OrderAppendixIsolatedFields {\n const margin = bitMaskValue(value, 64);\n return {\n margin: toBigInt(addDecimals(margin, MARGIN_DECIMAL_ADJUSTMENT)),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAKO;AACP,0BAA6B;AAE7B,IAAM,kCAAkC;AAGxC,IAAM,4BACJ,oCAAwB;AAYnB,SAAS,+BAA+B;AAAA,EAC7C;AACF,GAAwC;AACtC,aAAO;AAAA,QACL,0BAAS,4BAAe,QAAQ,yBAAyB,CAAC;AAAA,IAC1D;AAAA,EACF;AACF;AASO,SAAS,iCACd,OAC6B;AAC7B,QAAM,aAAS,kCAAa,OAAO,EAAE;AACrC,SAAO;AAAA,IACL,YAAQ,0BAAS,yBAAY,QAAQ,yBAAyB,CAAC;AAAA,EACjE;AACF;","names":[]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { OrderAppendixIsolatedFields } from '../../../types/orderAppendixTypes.cjs';
|
|
2
|
+
import '../../math/bigDecimal.cjs';
|
|
3
|
+
import 'bignumber.js';
|
|
4
|
+
import '../../../types/OrderExecutionType.cjs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Packs the provided margin into a single 64-bit bigint.
|
|
8
|
+
*
|
|
9
|
+
* Bit layout (MSB → LSB):
|
|
10
|
+
* | margin_x6 |
|
|
11
|
+
* |-----------|
|
|
12
|
+
* | 63..0 |
|
|
13
|
+
* | 64 bits |
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
declare function packIsolatedOrderAppendixValue({ margin, }: OrderAppendixIsolatedFields): bigint;
|
|
17
|
+
/**
|
|
18
|
+
* Unpacks a 64-bit bigint into its component fields for Isolated orders.
|
|
19
|
+
*
|
|
20
|
+
* @param value 64-bit bigint to unpack
|
|
21
|
+
* @returns Object with:
|
|
22
|
+
* - margin_x6: bigint, from bits 63..0
|
|
23
|
+
*/
|
|
24
|
+
declare function unpackIsolatedOrderAppendixValue(value: bigint): OrderAppendixIsolatedFields;
|
|
25
|
+
|
|
26
|
+
export { packIsolatedOrderAppendixValue, unpackIsolatedOrderAppendixValue };
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { OrderAppendixIsolatedFields } from '../../../types/orderAppendixTypes.js';
|
|
2
|
+
import '../../math/bigDecimal.js';
|
|
3
|
+
import 'bignumber.js';
|
|
4
|
+
import '../../../types/OrderExecutionType.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Packs the provided margin into a single 64-bit bigint.
|
|
8
|
+
*
|
|
9
|
+
* Bit layout (MSB → LSB):
|
|
10
|
+
* | margin_x6 |
|
|
11
|
+
* |-----------|
|
|
12
|
+
* | 63..0 |
|
|
13
|
+
* | 64 bits |
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
declare function packIsolatedOrderAppendixValue({ margin, }: OrderAppendixIsolatedFields): bigint;
|
|
17
|
+
/**
|
|
18
|
+
* Unpacks a 64-bit bigint into its component fields for Isolated orders.
|
|
19
|
+
*
|
|
20
|
+
* @param value 64-bit bigint to unpack
|
|
21
|
+
* @returns Object with:
|
|
22
|
+
* - margin_x6: bigint, from bits 63..0
|
|
23
|
+
*/
|
|
24
|
+
declare function unpackIsolatedOrderAppendixValue(value: bigint): OrderAppendixIsolatedFields;
|
|
25
|
+
|
|
26
|
+
export { packIsolatedOrderAppendixValue, unpackIsolatedOrderAppendixValue };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import "../../../chunk-5WRI5ZAA.js";
|
|
2
|
+
|
|
3
|
+
// src/utils/orders/appendix/appendixIsolatedValue.ts
|
|
4
|
+
import {
|
|
5
|
+
addDecimals,
|
|
6
|
+
NADO_PRODUCT_DECIMALS,
|
|
7
|
+
removeDecimals,
|
|
8
|
+
toBigInt
|
|
9
|
+
} from "../../math/index.js";
|
|
10
|
+
import { bitMaskValue } from "./bitMaskValue.js";
|
|
11
|
+
var APPENDIX_V1_ISO_MARGIN_DECIMALS = 6;
|
|
12
|
+
var MARGIN_DECIMAL_ADJUSTMENT = NADO_PRODUCT_DECIMALS - APPENDIX_V1_ISO_MARGIN_DECIMALS;
|
|
13
|
+
function packIsolatedOrderAppendixValue({
|
|
14
|
+
margin
|
|
15
|
+
}) {
|
|
16
|
+
return bitMaskValue(
|
|
17
|
+
toBigInt(removeDecimals(margin, MARGIN_DECIMAL_ADJUSTMENT)),
|
|
18
|
+
64
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
function unpackIsolatedOrderAppendixValue(value) {
|
|
22
|
+
const margin = bitMaskValue(value, 64);
|
|
23
|
+
return {
|
|
24
|
+
margin: toBigInt(addDecimals(margin, MARGIN_DECIMAL_ADJUSTMENT))
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
export {
|
|
28
|
+
packIsolatedOrderAppendixValue,
|
|
29
|
+
unpackIsolatedOrderAppendixValue
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=appendixIsolatedValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/utils/orders/appendix/appendixIsolatedValue.ts"],"sourcesContent":["import { OrderAppendixIsolatedFields } from '../../../types';\nimport {\n addDecimals,\n NADO_PRODUCT_DECIMALS,\n removeDecimals,\n toBigInt,\n} from '../../math';\nimport { bitMaskValue } from './bitMaskValue';\n\nconst APPENDIX_V1_ISO_MARGIN_DECIMALS = 6;\n\n/* Appendix v1 uses x6 precision, so we need to adjust precision to/from SDK's usual precision */\nconst MARGIN_DECIMAL_ADJUSTMENT =\n NADO_PRODUCT_DECIMALS - APPENDIX_V1_ISO_MARGIN_DECIMALS;\n\n/**\n * Packs the provided margin into a single 64-bit bigint.\n *\n * Bit layout (MSB → LSB):\n * | margin_x6 |\n * |-----------|\n * | 63..0 |\n * | 64 bits |\n *\n */\nexport function packIsolatedOrderAppendixValue({\n margin,\n}: OrderAppendixIsolatedFields): bigint {\n return bitMaskValue(\n toBigInt(removeDecimals(margin, MARGIN_DECIMAL_ADJUSTMENT)),\n 64,\n );\n}\n\n/**\n * Unpacks a 64-bit bigint into its component fields for Isolated orders.\n *\n * @param value 64-bit bigint to unpack\n * @returns Object with:\n * - margin_x6: bigint, from bits 63..0\n */\nexport function unpackIsolatedOrderAppendixValue(\n value: bigint,\n): OrderAppendixIsolatedFields {\n const margin = bitMaskValue(value, 64);\n return {\n margin: toBigInt(addDecimals(margin, MARGIN_DECIMAL_ADJUSTMENT)),\n };\n}\n"],"mappings":";;;AACA;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,oBAAoB;AAE7B,IAAM,kCAAkC;AAGxC,IAAM,4BACJ,wBAAwB;AAYnB,SAAS,+BAA+B;AAAA,EAC7C;AACF,GAAwC;AACtC,SAAO;AAAA,IACL,SAAS,eAAe,QAAQ,yBAAyB,CAAC;AAAA,IAC1D;AAAA,EACF;AACF;AASO,SAAS,iCACd,OAC6B;AAC7B,QAAM,SAAS,aAAa,OAAO,EAAE;AACrC,SAAO;AAAA,IACL,QAAQ,SAAS,YAAY,QAAQ,yBAAyB,CAAC;AAAA,EACjE;AACF;","names":[]}
|
|
@@ -17,26 +17,25 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
};
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
|
-
// src/utils/orders/appendix/
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
// src/utils/orders/appendix/appendixTwapValue.ts
|
|
21
|
+
var appendixTwapValue_exports = {};
|
|
22
|
+
__export(appendixTwapValue_exports, {
|
|
23
|
+
packTwapOrderAppendixValue: () => packTwapOrderAppendixValue,
|
|
24
|
+
unpackTwapOrderAppendixValue: () => unpackTwapOrderAppendixValue
|
|
25
25
|
});
|
|
26
|
-
module.exports = __toCommonJS(
|
|
26
|
+
module.exports = __toCommonJS(appendixTwapValue_exports);
|
|
27
27
|
var import_math = require("../../math/index.cjs");
|
|
28
|
-
function
|
|
28
|
+
function packTwapOrderAppendixValue({
|
|
29
29
|
numOrders,
|
|
30
30
|
slippageFrac
|
|
31
31
|
}) {
|
|
32
32
|
const numOrdersBigInt = (0, import_math.toBigInt)(numOrders);
|
|
33
33
|
const slippageX6BigInt = (0, import_math.toBigInt)((0, import_math.addDecimals)(slippageFrac, 6));
|
|
34
|
-
return (numOrdersBigInt & 0xffffffffn) <<
|
|
35
|
-
0n & 0xffffffffn;
|
|
34
|
+
return (numOrdersBigInt & 0xffffffffn) << 32n | slippageX6BigInt & 0xffffffffn;
|
|
36
35
|
}
|
|
37
|
-
function
|
|
38
|
-
const numOrders = value >>
|
|
39
|
-
const slippageX6 = value
|
|
36
|
+
function unpackTwapOrderAppendixValue(value) {
|
|
37
|
+
const numOrders = value >> 32n & 0xffffffffn;
|
|
38
|
+
const slippageX6 = value & 0xffffffffn;
|
|
40
39
|
return {
|
|
41
40
|
numOrders: Number(numOrders),
|
|
42
41
|
slippageFrac: (0, import_math.removeDecimals)(slippageX6, 6).toNumber()
|
|
@@ -44,7 +43,7 @@ function unpackTWAPOrderAppendixValue(value) {
|
|
|
44
43
|
}
|
|
45
44
|
// Annotate the CommonJS export names for ESM import in node:
|
|
46
45
|
0 && (module.exports = {
|
|
47
|
-
|
|
48
|
-
|
|
46
|
+
packTwapOrderAppendixValue,
|
|
47
|
+
unpackTwapOrderAppendixValue
|
|
49
48
|
});
|
|
50
|
-
//# sourceMappingURL=
|
|
49
|
+
//# sourceMappingURL=appendixTwapValue.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/utils/orders/appendix/appendixTwapValue.ts"],"sourcesContent":["import { OrderAppendixTwapFields } from '../../../types/orderAppendixTypes';\nimport { addDecimals, removeDecimals, toBigInt } from '../../math';\n\n/**\n * Packs the provided fields into a single 64-bit bigint.\n *\n * Bit layout (MSB → LSB):\n * | times | slippage_x6 |\n * |-----------|-------------|\n * | 63..32 | 31..0 |\n * | 32 bits | 32 bits |\n *\n * - `times` occupies bits 63..32 (most significant 32 bits)\n * - `slippage_x6` occupies bits 31..0 (least significant 32 bits)\n */\nexport function packTwapOrderAppendixValue({\n numOrders,\n slippageFrac,\n}: OrderAppendixTwapFields): bigint {\n const numOrdersBigInt = toBigInt(numOrders);\n const slippageX6BigInt = toBigInt(addDecimals(slippageFrac, 6));\n\n return (\n ((numOrdersBigInt & 0xffffffffn) << 32n) | (slippageX6BigInt & 0xffffffffn)\n );\n}\n\n/**\n * Unpacks a 64-bit bigint into its component fields for TWAP orders.\n *\n * @param value 64-bit bigint to unpack\n * @returns Object with:\n * - times: number, from bits 63..32\n * - slippage_x6: number, from bits 31..0\n */\nexport function unpackTwapOrderAppendixValue(\n value: bigint,\n): OrderAppendixTwapFields {\n const numOrders = (value >> 32n) & 0xffffffffn;\n const slippageX6 = value & 0xffffffffn;\n\n return {\n numOrders: Number(numOrders),\n slippageFrac: removeDecimals(slippageX6, 6).toNumber(),\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAsD;AAc/C,SAAS,2BAA2B;AAAA,EACzC;AAAA,EACA;AACF,GAAoC;AAClC,QAAM,sBAAkB,sBAAS,SAAS;AAC1C,QAAM,uBAAmB,0BAAS,yBAAY,cAAc,CAAC,CAAC;AAE9D,UACI,kBAAkB,gBAAgB,MAAQ,mBAAmB;AAEnE;AAUO,SAAS,6BACd,OACyB;AACzB,QAAM,YAAa,SAAS,MAAO;AACnC,QAAM,aAAa,QAAQ;AAE3B,SAAO;AAAA,IACL,WAAW,OAAO,SAAS;AAAA,IAC3B,kBAAc,4BAAe,YAAY,CAAC,EAAE,SAAS;AAAA,EACvD;AACF;","names":[]}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { OrderAppendixTwapFields } from '../../../types/orderAppendixTypes.cjs';
|
|
2
|
+
import '../../math/bigDecimal.cjs';
|
|
3
|
+
import 'bignumber.js';
|
|
4
|
+
import '../../../types/OrderExecutionType.cjs';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Packs the provided fields into a single 64-bit bigint.
|
|
8
|
+
*
|
|
9
|
+
* Bit layout (MSB → LSB):
|
|
10
|
+
* | times | slippage_x6 |
|
|
11
|
+
* |-----------|-------------|
|
|
12
|
+
* | 63..32 | 31..0 |
|
|
13
|
+
* | 32 bits | 32 bits |
|
|
14
|
+
*
|
|
15
|
+
* - `times` occupies bits 63..32 (most significant 32 bits)
|
|
16
|
+
* - `slippage_x6` occupies bits 31..0 (least significant 32 bits)
|
|
17
|
+
*/
|
|
18
|
+
declare function packTwapOrderAppendixValue({ numOrders, slippageFrac, }: OrderAppendixTwapFields): bigint;
|
|
19
|
+
/**
|
|
20
|
+
* Unpacks a 64-bit bigint into its component fields for TWAP orders.
|
|
21
|
+
*
|
|
22
|
+
* @param value 64-bit bigint to unpack
|
|
23
|
+
* @returns Object with:
|
|
24
|
+
* - times: number, from bits 63..32
|
|
25
|
+
* - slippage_x6: number, from bits 31..0
|
|
26
|
+
*/
|
|
27
|
+
declare function unpackTwapOrderAppendixValue(value: bigint): OrderAppendixTwapFields;
|
|
28
|
+
|
|
29
|
+
export { packTwapOrderAppendixValue, unpackTwapOrderAppendixValue };
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { OrderAppendixTwapFields } from '../../../types/orderAppendixTypes.js';
|
|
2
|
+
import '../../math/bigDecimal.js';
|
|
3
|
+
import 'bignumber.js';
|
|
4
|
+
import '../../../types/OrderExecutionType.js';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Packs the provided fields into a single 64-bit bigint.
|
|
8
|
+
*
|
|
9
|
+
* Bit layout (MSB → LSB):
|
|
10
|
+
* | times | slippage_x6 |
|
|
11
|
+
* |-----------|-------------|
|
|
12
|
+
* | 63..32 | 31..0 |
|
|
13
|
+
* | 32 bits | 32 bits |
|
|
14
|
+
*
|
|
15
|
+
* - `times` occupies bits 63..32 (most significant 32 bits)
|
|
16
|
+
* - `slippage_x6` occupies bits 31..0 (least significant 32 bits)
|
|
17
|
+
*/
|
|
18
|
+
declare function packTwapOrderAppendixValue({ numOrders, slippageFrac, }: OrderAppendixTwapFields): bigint;
|
|
19
|
+
/**
|
|
20
|
+
* Unpacks a 64-bit bigint into its component fields for TWAP orders.
|
|
21
|
+
*
|
|
22
|
+
* @param value 64-bit bigint to unpack
|
|
23
|
+
* @returns Object with:
|
|
24
|
+
* - times: number, from bits 63..32
|
|
25
|
+
* - slippage_x6: number, from bits 31..0
|
|
26
|
+
*/
|
|
27
|
+
declare function unpackTwapOrderAppendixValue(value: bigint): OrderAppendixTwapFields;
|
|
28
|
+
|
|
29
|
+
export { packTwapOrderAppendixValue, unpackTwapOrderAppendixValue };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import "../../../chunk-5WRI5ZAA.js";
|
|
2
|
+
|
|
3
|
+
// src/utils/orders/appendix/appendixTwapValue.ts
|
|
4
|
+
import { addDecimals, removeDecimals, toBigInt } from "../../math/index.js";
|
|
5
|
+
function packTwapOrderAppendixValue({
|
|
6
|
+
numOrders,
|
|
7
|
+
slippageFrac
|
|
8
|
+
}) {
|
|
9
|
+
const numOrdersBigInt = toBigInt(numOrders);
|
|
10
|
+
const slippageX6BigInt = toBigInt(addDecimals(slippageFrac, 6));
|
|
11
|
+
return (numOrdersBigInt & 0xffffffffn) << 32n | slippageX6BigInt & 0xffffffffn;
|
|
12
|
+
}
|
|
13
|
+
function unpackTwapOrderAppendixValue(value) {
|
|
14
|
+
const numOrders = value >> 32n & 0xffffffffn;
|
|
15
|
+
const slippageX6 = value & 0xffffffffn;
|
|
16
|
+
return {
|
|
17
|
+
numOrders: Number(numOrders),
|
|
18
|
+
slippageFrac: removeDecimals(slippageX6, 6).toNumber()
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export {
|
|
22
|
+
packTwapOrderAppendixValue,
|
|
23
|
+
unpackTwapOrderAppendixValue
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=appendixTwapValue.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/utils/orders/appendix/appendixTwapValue.ts"],"sourcesContent":["import { OrderAppendixTwapFields } from '../../../types/orderAppendixTypes';\nimport { addDecimals, removeDecimals, toBigInt } from '../../math';\n\n/**\n * Packs the provided fields into a single 64-bit bigint.\n *\n * Bit layout (MSB → LSB):\n * | times | slippage_x6 |\n * |-----------|-------------|\n * | 63..32 | 31..0 |\n * | 32 bits | 32 bits |\n *\n * - `times` occupies bits 63..32 (most significant 32 bits)\n * - `slippage_x6` occupies bits 31..0 (least significant 32 bits)\n */\nexport function packTwapOrderAppendixValue({\n numOrders,\n slippageFrac,\n}: OrderAppendixTwapFields): bigint {\n const numOrdersBigInt = toBigInt(numOrders);\n const slippageX6BigInt = toBigInt(addDecimals(slippageFrac, 6));\n\n return (\n ((numOrdersBigInt & 0xffffffffn) << 32n) | (slippageX6BigInt & 0xffffffffn)\n );\n}\n\n/**\n * Unpacks a 64-bit bigint into its component fields for TWAP orders.\n *\n * @param value 64-bit bigint to unpack\n * @returns Object with:\n * - times: number, from bits 63..32\n * - slippage_x6: number, from bits 31..0\n */\nexport function unpackTwapOrderAppendixValue(\n value: bigint,\n): OrderAppendixTwapFields {\n const numOrders = (value >> 32n) & 0xffffffffn;\n const slippageX6 = value & 0xffffffffn;\n\n return {\n numOrders: Number(numOrders),\n slippageFrac: removeDecimals(slippageX6, 6).toNumber(),\n };\n}\n"],"mappings":";;;AACA,SAAS,aAAa,gBAAgB,gBAAgB;AAc/C,SAAS,2BAA2B;AAAA,EACzC;AAAA,EACA;AACF,GAAoC;AAClC,QAAM,kBAAkB,SAAS,SAAS;AAC1C,QAAM,mBAAmB,SAAS,YAAY,cAAc,CAAC,CAAC;AAE9D,UACI,kBAAkB,gBAAgB,MAAQ,mBAAmB;AAEnE;AAUO,SAAS,6BACd,OACyB;AACzB,QAAM,YAAa,SAAS,MAAO;AACnC,QAAM,aAAa,QAAQ;AAE3B,SAAO;AAAA,IACL,WAAW,OAAO,SAAS;AAAA,IAC3B,cAAc,eAAe,YAAY,CAAC,EAAE,SAAS;AAAA,EACvD;AACF;","names":[]}
|
|
@@ -17,17 +17,17 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
17
17
|
// src/utils/orders/appendix/index.ts
|
|
18
18
|
var appendix_exports = {};
|
|
19
19
|
module.exports = __toCommonJS(appendix_exports);
|
|
20
|
-
__reExport(appendix_exports, require("./
|
|
21
|
-
__reExport(appendix_exports, require("./
|
|
20
|
+
__reExport(appendix_exports, require("./appendixTwapValue.cjs"), module.exports);
|
|
21
|
+
__reExport(appendix_exports, require("./bitMaskValue.cjs"), module.exports);
|
|
22
22
|
__reExport(appendix_exports, require("./packOrderAppendix.cjs"), module.exports);
|
|
23
23
|
__reExport(appendix_exports, require("./types.cjs"), module.exports);
|
|
24
|
-
__reExport(appendix_exports, require("./
|
|
24
|
+
__reExport(appendix_exports, require("./unpackOrderAppendix.cjs"), module.exports);
|
|
25
25
|
// Annotate the CommonJS export names for ESM import in node:
|
|
26
26
|
0 && (module.exports = {
|
|
27
|
-
...require("./
|
|
28
|
-
...require("./
|
|
27
|
+
...require("./appendixTwapValue.cjs"),
|
|
28
|
+
...require("./bitMaskValue.cjs"),
|
|
29
29
|
...require("./packOrderAppendix.cjs"),
|
|
30
30
|
...require("./types.cjs"),
|
|
31
|
-
...require("./
|
|
31
|
+
...require("./unpackOrderAppendix.cjs")
|
|
32
32
|
});
|
|
33
33
|
//# sourceMappingURL=index.cjs.map
|