@nadohq/shared 0.1.0-alpha.8 → 0.1.0

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.
Files changed (290) hide show
  1. package/dist/abis/index.cjs +12 -12
  2. package/dist/abis/index.cjs.map +1 -1
  3. package/dist/abis/index.d.cts +6 -6
  4. package/dist/abis/index.d.ts +6 -6
  5. package/dist/abis/index.js +6 -6
  6. package/dist/abis/index.js.map +1 -1
  7. package/dist/{chunk-TUJ4HQKF.js → chunk-2GPIH63F.js} +3 -3
  8. package/dist/chunk-2GPIH63F.js.map +1 -0
  9. package/dist/consts/chainEnvToChain.cjs +2 -2
  10. package/dist/consts/chainEnvToChain.cjs.map +1 -1
  11. package/dist/consts/chainEnvToChain.d.cts +329 -39
  12. package/dist/consts/chainEnvToChain.d.ts +329 -39
  13. package/dist/consts/chainEnvToChain.js +3 -3
  14. package/dist/consts/chainEnvToChain.js.map +1 -1
  15. package/dist/consts/productIds.cjs +1 -1
  16. package/dist/consts/productIds.cjs.map +1 -1
  17. package/dist/consts/productIds.d.cts +1 -1
  18. package/dist/consts/productIds.d.ts +1 -1
  19. package/dist/consts/productIds.js +1 -1
  20. package/dist/consts/productIds.js.map +1 -1
  21. package/dist/deployments/core/deployment.inkMainnet.json +13 -0
  22. package/dist/deployments/core/deployment.inkSepolia.json +13 -0
  23. package/dist/deployments/index.cjs +6 -6
  24. package/dist/deployments/index.cjs.map +1 -1
  25. package/dist/deployments/index.js +5 -5
  26. package/dist/deployments/index.js.map +1 -1
  27. package/dist/eip712/eip712ValueTypes.cjs.map +1 -1
  28. package/dist/eip712/eip712ValueTypes.d.cts +3 -3
  29. package/dist/eip712/eip712ValueTypes.d.ts +3 -3
  30. package/dist/eip712/getNadoEIP712Domain.cjs.map +1 -1
  31. package/dist/eip712/getNadoEIP712Domain.js.map +1 -1
  32. package/dist/eip712/getNadoEIP712PrimaryType.d.cts +1 -1
  33. package/dist/eip712/getNadoEIP712PrimaryType.d.ts +1 -1
  34. package/dist/eip712/getNadoEIP712Types.d.cts +1 -1
  35. package/dist/eip712/getNadoEIP712Types.d.ts +1 -1
  36. package/dist/eip712/getNadoEIP712Values.d.cts +1 -1
  37. package/dist/eip712/getNadoEIP712Values.d.ts +1 -1
  38. package/dist/eip712/getSignedTransactionRequest.d.cts +1 -1
  39. package/dist/eip712/getSignedTransactionRequest.d.ts +1 -1
  40. package/dist/eip712/index.cjs +13 -13
  41. package/dist/eip712/index.cjs.map +1 -1
  42. package/dist/eip712/index.d.cts +9 -9
  43. package/dist/eip712/index.d.ts +9 -9
  44. package/dist/eip712/index.js +6 -6
  45. package/dist/eip712/index.js.map +1 -1
  46. package/dist/eip712/orderDigest.d.cts +1 -1
  47. package/dist/eip712/orderDigest.d.ts +1 -1
  48. package/dist/eip712/signableRequestType.d.cts +1 -1
  49. package/dist/eip712/signableRequestType.d.ts +1 -1
  50. package/dist/eip712/signatureParamTypes.cjs.map +1 -1
  51. package/dist/eip712/signatureParamTypes.d.cts +13 -13
  52. package/dist/eip712/signatureParamTypes.d.ts +13 -13
  53. package/dist/encoding/encoding.cjs +21 -0
  54. package/dist/encoding/encoding.cjs.map +1 -1
  55. package/dist/encoding/encoding.d.cts +28 -4
  56. package/dist/encoding/encoding.d.ts +28 -4
  57. package/dist/encoding/encoding.js +24 -1
  58. package/dist/encoding/encoding.js.map +1 -1
  59. package/dist/encoding/index.d.cts +3 -3
  60. package/dist/encoding/index.d.ts +3 -3
  61. package/dist/execute/approveDepositAllowance.cjs.map +1 -1
  62. package/dist/execute/approveDepositAllowance.d.cts +2 -2
  63. package/dist/execute/approveDepositAllowance.d.ts +2 -2
  64. package/dist/execute/approveDepositAllowance.js.map +1 -1
  65. package/dist/execute/depositCollateral.cjs.map +1 -1
  66. package/dist/execute/depositCollateral.d.cts +2 -2
  67. package/dist/execute/depositCollateral.d.ts +2 -2
  68. package/dist/execute/depositCollateral.js.map +1 -1
  69. package/dist/execute/index.d.cts +1 -1
  70. package/dist/execute/index.d.ts +1 -1
  71. package/dist/index.d.cts +35 -35
  72. package/dist/index.d.ts +35 -35
  73. package/dist/types/ChainEnv.cjs +1 -1
  74. package/dist/types/ChainEnv.cjs.map +1 -1
  75. package/dist/types/ChainEnv.d.cts +2 -2
  76. package/dist/types/ChainEnv.d.ts +2 -2
  77. package/dist/types/ChainEnv.js +1 -1
  78. package/dist/types/ChainEnv.js.map +1 -1
  79. package/dist/types/balanceTypes.cjs.map +1 -1
  80. package/dist/types/balanceTypes.d.cts +5 -5
  81. package/dist/types/balanceTypes.d.ts +5 -5
  82. package/dist/types/healthTypes.cjs.map +1 -1
  83. package/dist/types/healthTypes.d.cts +4 -4
  84. package/dist/types/healthTypes.d.ts +4 -4
  85. package/dist/types/index.cjs +7 -7
  86. package/dist/types/index.cjs.map +1 -1
  87. package/dist/types/index.d.cts +4 -4
  88. package/dist/types/index.d.ts +4 -4
  89. package/dist/types/index.js +3 -3
  90. package/dist/types/index.js.map +1 -1
  91. package/dist/types/marketTypes.cjs.map +1 -1
  92. package/dist/types/marketTypes.d.cts +4 -4
  93. package/dist/types/marketTypes.d.ts +4 -4
  94. package/dist/types/orderAppendixTypes.cjs.map +1 -1
  95. package/dist/types/orderAppendixTypes.d.cts +27 -3
  96. package/dist/types/orderAppendixTypes.d.ts +27 -3
  97. package/dist/types/productTypes.cjs.map +1 -1
  98. package/dist/types/productTypes.d.cts +16 -16
  99. package/dist/types/productTypes.d.ts +16 -16
  100. package/dist/types/productTypes.js.map +1 -1
  101. package/dist/types/viemTypes.d.cts +1 -1
  102. package/dist/types/viemTypes.d.ts +1 -1
  103. package/dist/utils/balanceValue.cjs.map +1 -1
  104. package/dist/utils/balanceValue.d.cts +5 -5
  105. package/dist/utils/balanceValue.d.ts +5 -5
  106. package/dist/utils/balanceValue.js.map +1 -1
  107. package/dist/utils/bytes32.d.cts +1 -1
  108. package/dist/utils/bytes32.d.ts +1 -1
  109. package/dist/utils/bytes32.test.cjs +2 -2
  110. package/dist/utils/bytes32.test.cjs.map +1 -1
  111. package/dist/utils/bytes32.test.js +1 -1
  112. package/dist/utils/createDeterministicLinkedSignerPrivateKey.cjs.map +1 -1
  113. package/dist/utils/createDeterministicLinkedSignerPrivateKey.js.map +1 -1
  114. package/dist/utils/index.cjs +12 -12
  115. package/dist/utils/index.cjs.map +1 -1
  116. package/dist/utils/index.d.cts +22 -22
  117. package/dist/utils/index.d.ts +22 -22
  118. package/dist/utils/index.js +6 -6
  119. package/dist/utils/index.js.map +1 -1
  120. package/dist/utils/interest.cjs +9 -9
  121. package/dist/utils/interest.cjs.map +1 -1
  122. package/dist/utils/interest.d.cts +8 -8
  123. package/dist/utils/interest.d.ts +8 -8
  124. package/dist/utils/interest.js +10 -14
  125. package/dist/utils/interest.js.map +1 -1
  126. package/dist/utils/math/{BigDecimals.cjs → BigNumbers.cjs} +13 -13
  127. package/dist/utils/math/BigNumbers.cjs.map +1 -0
  128. package/dist/utils/math/BigNumbers.d.cts +10 -0
  129. package/dist/utils/math/BigNumbers.d.ts +10 -0
  130. package/dist/utils/math/BigNumbers.js +14 -0
  131. package/dist/utils/math/BigNumbers.js.map +1 -0
  132. package/dist/utils/math/{bigDecimal.cjs → bigNumber.cjs} +12 -14
  133. package/dist/utils/math/bigNumber.cjs.map +1 -0
  134. package/dist/utils/math/bigNumber.d.cts +17 -0
  135. package/dist/utils/math/bigNumber.d.ts +17 -0
  136. package/dist/utils/math/bigNumber.js +22 -0
  137. package/dist/utils/math/bigNumber.js.map +1 -0
  138. package/dist/utils/math/clamp.cjs +3 -3
  139. package/dist/utils/math/clamp.cjs.map +1 -1
  140. package/dist/utils/math/clamp.d.cts +5 -5
  141. package/dist/utils/math/clamp.d.ts +5 -5
  142. package/dist/utils/math/clamp.js +2 -2
  143. package/dist/utils/math/clamp.js.map +1 -1
  144. package/dist/utils/math/decimalAdjustment.cjs +5 -5
  145. package/dist/utils/math/decimalAdjustment.cjs.map +1 -1
  146. package/dist/utils/math/decimalAdjustment.d.cts +6 -6
  147. package/dist/utils/math/decimalAdjustment.d.ts +6 -6
  148. package/dist/utils/math/decimalAdjustment.js +5 -5
  149. package/dist/utils/math/decimalAdjustment.js.map +1 -1
  150. package/dist/utils/math/index.cjs +10 -10
  151. package/dist/utils/math/index.cjs.map +1 -1
  152. package/dist/utils/math/index.d.cts +7 -7
  153. package/dist/utils/math/index.d.ts +7 -7
  154. package/dist/utils/math/index.js +5 -5
  155. package/dist/utils/math/index.js.map +1 -1
  156. package/dist/utils/math/{sumBigDecimalBy.cjs → sumBigNumberBy.cjs} +10 -10
  157. package/dist/utils/math/sumBigNumberBy.cjs.map +1 -0
  158. package/dist/utils/math/sumBigNumberBy.d.cts +10 -0
  159. package/dist/utils/math/sumBigNumberBy.d.ts +10 -0
  160. package/dist/utils/math/sumBigNumberBy.js +13 -0
  161. package/dist/utils/math/sumBigNumberBy.js.map +1 -0
  162. package/dist/utils/math/toBigInt.cjs.map +1 -1
  163. package/dist/utils/math/toBigInt.d.cts +3 -3
  164. package/dist/utils/math/toBigInt.d.ts +3 -3
  165. package/dist/utils/math/toBigInt.js.map +1 -1
  166. package/dist/utils/math/toIntegerString.cjs +2 -2
  167. package/dist/utils/math/toIntegerString.cjs.map +1 -1
  168. package/dist/utils/math/toIntegerString.d.cts +3 -3
  169. package/dist/utils/math/toIntegerString.d.ts +3 -3
  170. package/dist/utils/math/toIntegerString.js +2 -2
  171. package/dist/utils/math/toIntegerString.js.map +1 -1
  172. package/dist/utils/orders/appendix/appendixIsolatedValue.cjs +50 -0
  173. package/dist/utils/orders/appendix/appendixIsolatedValue.cjs.map +1 -0
  174. package/dist/utils/orders/appendix/appendixIsolatedValue.d.cts +26 -0
  175. package/dist/utils/orders/appendix/appendixIsolatedValue.d.ts +26 -0
  176. package/dist/utils/orders/appendix/appendixIsolatedValue.js +31 -0
  177. package/dist/utils/orders/appendix/appendixIsolatedValue.js.map +1 -0
  178. package/dist/utils/orders/appendix/appendixTwapValue.cjs +3 -4
  179. package/dist/utils/orders/appendix/appendixTwapValue.cjs.map +1 -1
  180. package/dist/utils/orders/appendix/appendixTwapValue.d.cts +12 -14
  181. package/dist/utils/orders/appendix/appendixTwapValue.d.ts +12 -14
  182. package/dist/utils/orders/appendix/appendixTwapValue.js +3 -4
  183. package/dist/utils/orders/appendix/appendixTwapValue.js.map +1 -1
  184. package/dist/utils/orders/appendix/index.cjs +4 -4
  185. package/dist/utils/orders/appendix/index.cjs.map +1 -1
  186. package/dist/utils/orders/appendix/index.d.cts +3 -3
  187. package/dist/utils/orders/appendix/index.d.ts +3 -3
  188. package/dist/utils/orders/appendix/index.js +2 -2
  189. package/dist/utils/orders/appendix/index.js.map +1 -1
  190. package/dist/utils/orders/appendix/orderAppendix.test.cjs +67 -14
  191. package/dist/utils/orders/appendix/orderAppendix.test.cjs.map +1 -1
  192. package/dist/utils/orders/appendix/orderAppendix.test.js +66 -13
  193. package/dist/utils/orders/appendix/orderAppendix.test.js.map +1 -1
  194. package/dist/utils/orders/appendix/packOrderAppendix.cjs +9 -5
  195. package/dist/utils/orders/appendix/packOrderAppendix.cjs.map +1 -1
  196. package/dist/utils/orders/appendix/packOrderAppendix.d.cts +1 -1
  197. package/dist/utils/orders/appendix/packOrderAppendix.d.ts +1 -1
  198. package/dist/utils/orders/appendix/packOrderAppendix.js +9 -5
  199. package/dist/utils/orders/appendix/packOrderAppendix.js.map +1 -1
  200. package/dist/utils/orders/appendix/types.cjs.map +1 -1
  201. package/dist/utils/orders/appendix/types.d.cts +6 -4
  202. package/dist/utils/orders/appendix/types.d.ts +6 -4
  203. package/dist/utils/orders/appendix/unpackOrderAppendix.cjs +22 -5
  204. package/dist/utils/orders/appendix/unpackOrderAppendix.cjs.map +1 -1
  205. package/dist/utils/orders/appendix/unpackOrderAppendix.d.cts +2 -2
  206. package/dist/utils/orders/appendix/unpackOrderAppendix.d.ts +2 -2
  207. package/dist/utils/orders/appendix/unpackOrderAppendix.js +22 -5
  208. package/dist/utils/orders/appendix/unpackOrderAppendix.js.map +1 -1
  209. package/dist/utils/orders/index.cjs +3 -3
  210. package/dist/utils/orders/index.cjs.map +1 -1
  211. package/dist/utils/orders/index.d.cts +5 -5
  212. package/dist/utils/orders/index.d.ts +5 -5
  213. package/dist/utils/orders/index.js +1 -1
  214. package/dist/utils/orders/index.js.map +1 -1
  215. package/dist/utils/productTypeFilter.cjs.map +1 -1
  216. package/dist/utils/productTypeFilter.d.cts +2 -2
  217. package/dist/utils/productTypeFilter.d.ts +2 -2
  218. package/dist/utils/productTypeFilter.js.map +1 -1
  219. package/dist/utils/toPrintableObject.cjs +29 -11
  220. package/dist/utils/toPrintableObject.cjs.map +1 -1
  221. package/dist/utils/toPrintableObject.d.cts +7 -2
  222. package/dist/utils/toPrintableObject.d.ts +7 -2
  223. package/dist/utils/toPrintableObject.js +19 -11
  224. package/dist/utils/toPrintableObject.js.map +1 -1
  225. package/package.json +14 -7
  226. package/src/abis/index.ts +6 -6
  227. package/src/consts/chainEnvToChain.ts +2 -2
  228. package/src/consts/productIds.ts +1 -1
  229. package/src/deployments/core/deployment.inkMainnet.json +13 -0
  230. package/src/deployments/core/deployment.inkSepolia.json +13 -0
  231. package/src/deployments/index.ts +5 -5
  232. package/src/eip712/eip712ValueTypes.ts +2 -2
  233. package/src/eip712/getNadoEIP712Domain.ts +1 -1
  234. package/src/eip712/index.ts +6 -6
  235. package/src/eip712/signatureParamTypes.ts +13 -13
  236. package/src/encoding/encoding.ts +43 -1
  237. package/src/execute/approveDepositAllowance.ts +2 -2
  238. package/src/execute/depositCollateral.ts +2 -2
  239. package/src/types/ChainEnv.ts +1 -1
  240. package/src/types/balanceTypes.ts +4 -4
  241. package/src/types/healthTypes.ts +4 -4
  242. package/src/types/index.ts +3 -3
  243. package/src/types/marketTypes.ts +4 -4
  244. package/src/types/orderAppendixTypes.ts +27 -2
  245. package/src/types/productTypes.ts +16 -16
  246. package/src/utils/balanceValue.ts +4 -4
  247. package/src/utils/createDeterministicLinkedSignerPrivateKey.ts +1 -1
  248. package/src/utils/index.ts +6 -6
  249. package/src/utils/interest.ts +26 -31
  250. package/src/utils/math/BigNumbers.ts +8 -0
  251. package/src/utils/math/bigNumber.ts +31 -0
  252. package/src/utils/math/clamp.ts +4 -7
  253. package/src/utils/math/decimalAdjustment.ts +11 -10
  254. package/src/utils/math/index.ts +5 -5
  255. package/src/utils/math/sumBigNumberBy.ts +18 -0
  256. package/src/utils/math/toBigInt.ts +3 -3
  257. package/src/utils/math/toIntegerString.ts +4 -4
  258. package/src/utils/orders/appendix/appendixIsolatedValue.ts +49 -0
  259. package/src/utils/orders/appendix/appendixTwapValue.ts +14 -19
  260. package/src/utils/orders/appendix/index.ts +2 -2
  261. package/src/utils/orders/appendix/orderAppendix.test.ts +68 -11
  262. package/src/utils/orders/appendix/packOrderAppendix.ts +10 -6
  263. package/src/utils/orders/appendix/types.ts +9 -7
  264. package/src/utils/orders/appendix/unpackOrderAppendix.ts +24 -7
  265. package/src/utils/orders/index.ts +1 -1
  266. package/src/utils/productTypeFilter.ts +2 -2
  267. package/src/utils/toPrintableObject.ts +32 -12
  268. package/dist/chunk-TUJ4HQKF.js.map +0 -1
  269. package/dist/deployments/core/deployment.InkSepolia.json +0 -13
  270. package/dist/deployments/core/deployment.arbitrumOne.json +0 -18
  271. package/dist/utils/math/BigDecimals.cjs.map +0 -1
  272. package/dist/utils/math/BigDecimals.d.cts +0 -8
  273. package/dist/utils/math/BigDecimals.d.ts +0 -8
  274. package/dist/utils/math/BigDecimals.js +0 -14
  275. package/dist/utils/math/BigDecimals.js.map +0 -1
  276. package/dist/utils/math/bigDecimal.cjs.map +0 -1
  277. package/dist/utils/math/bigDecimal.d.cts +0 -18
  278. package/dist/utils/math/bigDecimal.d.ts +0 -18
  279. package/dist/utils/math/bigDecimal.js +0 -23
  280. package/dist/utils/math/bigDecimal.js.map +0 -1
  281. package/dist/utils/math/sumBigDecimalBy.cjs.map +0 -1
  282. package/dist/utils/math/sumBigDecimalBy.d.cts +0 -10
  283. package/dist/utils/math/sumBigDecimalBy.d.ts +0 -10
  284. package/dist/utils/math/sumBigDecimalBy.js +0 -13
  285. package/dist/utils/math/sumBigDecimalBy.js.map +0 -1
  286. package/src/deployments/core/deployment.InkSepolia.json +0 -13
  287. package/src/deployments/core/deployment.arbitrumOne.json +0 -18
  288. package/src/utils/math/BigDecimals.ts +0 -8
  289. package/src/utils/math/bigDecimal.ts +0 -32
  290. package/src/utils/math/sumBigDecimalBy.ts +0 -18
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  require_build
3
- } from "../../../chunk-TUJ4HQKF.js";
3
+ } from "../../../chunk-2GPIH63F.js";
4
4
  import {
5
5
  __toESM
6
6
  } from "../../../chunk-5WRI5ZAA.js";
@@ -17,7 +17,7 @@ import { unpackOrderAppendix } from "./unpackOrderAppendix.js";
17
17
  };
18
18
  const packed = packOrderAppendix(appendix);
19
19
  const unpacked = unpackOrderAppendix(packed);
20
- (0, import_globals.expect)(packed).toBe(4096n);
20
+ (0, import_globals.expect)(packed).toBe(4097n);
21
21
  (0, import_globals.expect)(unpacked.orderExecutionType).toBe(appendix.orderExecutionType);
22
22
  (0, import_globals.expect)(unpacked.triggerType).toBe(appendix.triggerType);
23
23
  (0, import_globals.expect)(unpacked.reduceOnly).toBeFalsy();
@@ -30,7 +30,7 @@ import { unpackOrderAppendix } from "./unpackOrderAppendix.js";
30
30
  };
31
31
  const packed = packOrderAppendix(appendix);
32
32
  const unpacked = unpackOrderAppendix(packed);
33
- (0, import_globals.expect)(packed).toBe(6144n);
33
+ (0, import_globals.expect)(packed).toBe(6145n);
34
34
  (0, import_globals.expect)(unpacked.reduceOnly).toBe(true);
35
35
  });
36
36
  (0, import_globals.it)("should handle all orderExecutionType values", () => {
@@ -61,12 +61,12 @@ import { unpackOrderAppendix } from "./unpackOrderAppendix.js";
61
61
  const appendix = {
62
62
  orderExecutionType: "default",
63
63
  triggerType: "price",
64
- isolated: { margin: 123456789012345678901234n }
64
+ isolated: { margin: 12345678901000000000000n }
65
65
  };
66
66
  const packed = packOrderAppendix(appendix);
67
67
  const unpacked = unpackOrderAppendix(packed);
68
- (0, import_globals.expect)(packed).toBe(530242871277196831127717244047616n);
69
- (0, import_globals.expect)(unpacked.isolated?.margin).toBe(123456789012345678901234n);
68
+ (0, import_globals.expect)(packed).toBe(227737579102942800187821658369n);
69
+ (0, import_globals.expect)(unpacked.isolated?.margin).toBe(appendix.isolated?.margin);
70
70
  });
71
71
  (0, import_globals.it)("should handle TWAP fields", () => {
72
72
  const appendix = {
@@ -76,7 +76,7 @@ import { unpackOrderAppendix } from "./unpackOrderAppendix.js";
76
76
  };
77
77
  const packed = packOrderAppendix(appendix);
78
78
  const unpacked = unpackOrderAppendix(packed);
79
- (0, import_globals.expect)(packed).toBe(792281717376363744483197591552n);
79
+ (0, import_globals.expect)(packed).toBe(792281717376363744483197591553n);
80
80
  (0, import_globals.expect)(unpacked.twap).toMatchObject({ numOrders: 10, slippageFrac: 5e-3 });
81
81
  });
82
82
  (0, import_globals.it)("should handle max values for all fields for iso orders", () => {
@@ -84,17 +84,17 @@ import { unpackOrderAppendix } from "./unpackOrderAppendix.js";
84
84
  orderExecutionType: "post_only",
85
85
  triggerType: void 0,
86
86
  reduceOnly: true,
87
- isolated: { margin: 79228162514264337593543950335n }
88
- // 2^96-1
87
+ isolated: { margin: 18446744073709551615n }
88
+ // 2^64-1
89
89
  };
90
90
  const packed = packOrderAppendix(appendix);
91
91
  const unpacked = unpackOrderAppendix(packed);
92
92
  (0, import_globals.expect)(unpacked.orderExecutionType).toBe(appendix.orderExecutionType);
93
93
  (0, import_globals.expect)(unpacked.triggerType).toBe(appendix.triggerType);
94
94
  (0, import_globals.expect)(unpacked.reduceOnly).toBe(appendix.reduceOnly);
95
- (0, import_globals.expect)(unpacked.isolated?.margin).toBe(79228162514264337593543950335n);
95
+ (0, import_globals.expect)(unpacked.isolated?.margin).toBe(18446744000000000000n);
96
96
  (0, import_globals.expect)(unpacked.twap).toBe(void 0);
97
- (0, import_globals.expect)(packed).toBe(340282366920938463463374607427473248000n);
97
+ (0, import_globals.expect)(packed).toBe(340282365561237229015142145n);
98
98
  });
99
99
  (0, import_globals.it)("should handle max values for all fields for TWAP orders", () => {
100
100
  const appendix = {
@@ -102,7 +102,6 @@ import { unpackOrderAppendix } from "./unpackOrderAppendix.js";
102
102
  triggerType: "twap_custom_amounts",
103
103
  reduceOnly: true,
104
104
  twap: {
105
- // max 32-bit unsigned int
106
105
  numOrders: 4294967295,
107
106
  slippageFrac: 1e-6
108
107
  }
@@ -114,7 +113,61 @@ import { unpackOrderAppendix } from "./unpackOrderAppendix.js";
114
113
  (0, import_globals.expect)(unpacked.reduceOnly).toBe(appendix.reduceOnly);
115
114
  (0, import_globals.expect)(unpacked.twap?.slippageFrac).toBe(1e-6);
116
115
  (0, import_globals.expect)(unpacked.twap?.numOrders).toBe(4294967295);
117
- (0, import_globals.expect)(packed).toBe(340282366841710300967557013911933828608n);
116
+ (0, import_globals.expect)(packed).toBe(340282366841710300967557013911933828609n);
117
+ });
118
+ (0, import_globals.it)("should handle builder fields", () => {
119
+ const appendix = {
120
+ orderExecutionType: "default",
121
+ builder: { builderId: 123, builderFeeRate: 500 }
122
+ };
123
+ const packed = packOrderAppendix(appendix);
124
+ const unpacked = unpackOrderAppendix(packed);
125
+ (0, import_globals.expect)(unpacked.builder?.builderId).toBe(123);
126
+ (0, import_globals.expect)(unpacked.builder?.builderFeeRate).toBe(500);
127
+ });
128
+ (0, import_globals.it)("should handle builder with zero fee rate", () => {
129
+ const appendix = {
130
+ orderExecutionType: "default",
131
+ builder: { builderId: 42, builderFeeRate: 0 }
132
+ };
133
+ const packed = packOrderAppendix(appendix);
134
+ const unpacked = unpackOrderAppendix(packed);
135
+ (0, import_globals.expect)(unpacked.builder?.builderId).toBe(42);
136
+ (0, import_globals.expect)(unpacked.builder?.builderFeeRate).toBe(0);
137
+ });
138
+ (0, import_globals.it)("should handle builder with max values", () => {
139
+ const appendix = {
140
+ orderExecutionType: "default",
141
+ builder: { builderId: 65535, builderFeeRate: 1023 }
142
+ // 16 bits, 10 bits max
143
+ };
144
+ const packed = packOrderAppendix(appendix);
145
+ const unpacked = unpackOrderAppendix(packed);
146
+ (0, import_globals.expect)(unpacked.builder?.builderId).toBe(65535);
147
+ (0, import_globals.expect)(unpacked.builder?.builderFeeRate).toBe(1023);
148
+ });
149
+ (0, import_globals.it)("should handle builder combined with other flags", () => {
150
+ const appendix = {
151
+ orderExecutionType: "ioc",
152
+ reduceOnly: true,
153
+ triggerType: "price",
154
+ builder: { builderId: 5, builderFeeRate: 100 }
155
+ };
156
+ const packed = packOrderAppendix(appendix);
157
+ const unpacked = unpackOrderAppendix(packed);
158
+ (0, import_globals.expect)(unpacked.orderExecutionType).toBe("ioc");
159
+ (0, import_globals.expect)(unpacked.reduceOnly).toBe(true);
160
+ (0, import_globals.expect)(unpacked.triggerType).toBe("price");
161
+ (0, import_globals.expect)(unpacked.builder?.builderId).toBe(5);
162
+ (0, import_globals.expect)(unpacked.builder?.builderFeeRate).toBe(100);
163
+ });
164
+ (0, import_globals.it)("should not return builder fields when builderId is 0", () => {
165
+ const appendix = {
166
+ orderExecutionType: "default"
167
+ };
168
+ const packed = packOrderAppendix(appendix);
169
+ const unpacked = unpackOrderAppendix(packed);
170
+ (0, import_globals.expect)(unpacked.builder).toBeUndefined();
118
171
  });
119
172
  });
120
173
  //# sourceMappingURL=orderAppendix.test.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/utils/orders/appendix/orderAppendix.test.ts"],"sourcesContent":["import { describe, expect, it } from '@jest/globals';\nimport { OrderAppendix, OrderExecutionType } from '../../../types';\nimport { packOrderAppendix } from './packOrderAppendix';\nimport { unpackOrderAppendix } from './unpackOrderAppendix';\n\ndescribe('OrderAppendix packing/unpacking', () => {\n it('should pack and unpack an order appendix without iso/twap values', () => {\n const appendix: OrderAppendix = {\n orderExecutionType: 'default',\n triggerType: 'price',\n };\n const packed = packOrderAppendix(appendix);\n const unpacked = unpackOrderAppendix(packed);\n expect(packed).toBe(4096n);\n expect(unpacked.orderExecutionType).toBe(appendix.orderExecutionType);\n expect(unpacked.triggerType).toBe(appendix.triggerType);\n expect(unpacked.reduceOnly).toBeFalsy();\n });\n\n it('should handle reduceOnly true', () => {\n const appendix: OrderAppendix = {\n orderExecutionType: 'default',\n triggerType: 'price',\n reduceOnly: true,\n };\n const packed = packOrderAppendix(appendix);\n const unpacked = unpackOrderAppendix(packed);\n expect(packed).toBe(6144n);\n expect(unpacked.reduceOnly).toBe(true);\n });\n\n it('should handle all orderExecutionType values', () => {\n const types: OrderExecutionType[] = ['default', 'ioc', 'fok', 'post_only'];\n for (const type of types) {\n const appendix: OrderAppendix = {\n orderExecutionType: type,\n triggerType: 'price',\n };\n const packed = packOrderAppendix(appendix);\n const unpacked = unpackOrderAppendix(packed);\n expect(unpacked.orderExecutionType).toBe(type);\n }\n });\n\n it('should handle all triggerType values', () => {\n const triggers = ['price', 'twap', 'twap_custom_amounts'] as const;\n for (const trigger of triggers) {\n const appendix: OrderAppendix = {\n orderExecutionType: 'default',\n triggerType: trigger,\n };\n const packed = packOrderAppendix(appendix);\n const unpacked = unpackOrderAppendix(packed);\n expect(unpacked.triggerType).toBe(trigger);\n }\n });\n\n it('should handle isolated margin', () => {\n const appendix: OrderAppendix = {\n orderExecutionType: 'default',\n triggerType: 'price',\n\n isolated: { margin: 123456789012345678901234n },\n };\n const packed = packOrderAppendix(appendix);\n const unpacked = unpackOrderAppendix(packed);\n expect(packed).toBe(530242871277196831127717244047616n);\n expect(unpacked.isolated?.margin).toBe(123456789012345678901234n);\n });\n\n it('should handle TWAP fields', () => {\n const appendix: OrderAppendix = {\n orderExecutionType: 'default',\n triggerType: 'twap',\n\n twap: { numOrders: 10, slippageFrac: 0.005 },\n };\n const packed = packOrderAppendix(appendix);\n const unpacked = unpackOrderAppendix(packed);\n expect(packed).toBe(792281717376363744483197591552n);\n expect(unpacked.twap).toMatchObject({ numOrders: 10, slippageFrac: 0.005 });\n });\n\n it('should handle max values for all fields for iso orders', () => {\n const appendix: OrderAppendix = {\n orderExecutionType: 'post_only',\n triggerType: undefined,\n reduceOnly: true,\n isolated: { margin: 79228162514264337593543950335n }, // 2^96-1\n };\n const packed = packOrderAppendix(appendix);\n const unpacked = unpackOrderAppendix(packed);\n expect(unpacked.orderExecutionType).toBe(appendix.orderExecutionType);\n expect(unpacked.triggerType).toBe(appendix.triggerType);\n expect(unpacked.reduceOnly).toBe(appendix.reduceOnly);\n expect(unpacked.isolated?.margin).toBe(79228162514264337593543950335n);\n expect(unpacked.twap).toBe(undefined);\n expect(packed).toBe(340282366920938463463374607427473248000n);\n });\n\n it('should handle max values for all fields for TWAP orders', () => {\n const appendix: OrderAppendix = {\n orderExecutionType: 'post_only',\n triggerType: 'twap_custom_amounts',\n reduceOnly: true,\n twap: {\n // max 32-bit unsigned int\n numOrders: 4294967295,\n slippageFrac: 0.000001,\n },\n };\n const packed = packOrderAppendix(appendix);\n const unpacked = unpackOrderAppendix(packed);\n expect(unpacked.orderExecutionType).toBe(appendix.orderExecutionType);\n expect(unpacked.triggerType).toBe(appendix.triggerType);\n expect(unpacked.reduceOnly).toBe(appendix.reduceOnly);\n expect(unpacked.twap?.slippageFrac).toBe(0.000001);\n expect(unpacked.twap?.numOrders).toBe(4294967295);\n expect(packed).toBe(340282366841710300967557013911933828608n);\n });\n});\n"],"mappings":";;;;;;;;AAAA,qBAAqC;AAErC,SAAS,yBAAyB;AAClC,SAAS,2BAA2B;AAAA,IAEpC,yBAAS,mCAAmC,MAAM;AAChD,yBAAG,oEAAoE,MAAM;AAC3E,UAAM,WAA0B;AAAA,MAC9B,oBAAoB;AAAA,MACpB,aAAa;AAAA,IACf;AACA,UAAM,SAAS,kBAAkB,QAAQ;AACzC,UAAM,WAAW,oBAAoB,MAAM;AAC3C,+BAAO,MAAM,EAAE,KAAK,KAAK;AACzB,+BAAO,SAAS,kBAAkB,EAAE,KAAK,SAAS,kBAAkB;AACpE,+BAAO,SAAS,WAAW,EAAE,KAAK,SAAS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+BAAO,SAAS,WAAW,EAAE,KAAK,SAAS,WAAW;AACtD,+BAAO,SAAS,UAAU,EAAE,KAAK,SAAS,UAAU;AACpD,+BAAO,SAAS,MAAM,YAAY,EAAE,KAAK,IAAQ;AACjD,+BAAO,SAAS,MAAM,SAAS,EAAE,KAAK,UAAU;AAChD,+BAAO,MAAM,EAAE,KAAK,wCAAwC;AAAA,EAC9D,CAAC;AACH,CAAC;","names":[]}
1
+ {"version":3,"sources":["../../../../src/utils/orders/appendix/orderAppendix.test.ts"],"sourcesContent":["import { describe, expect, it } from '@jest/globals';\nimport { OrderAppendix, OrderExecutionType } from '../../../types';\nimport { packOrderAppendix } from './packOrderAppendix';\nimport { unpackOrderAppendix } from './unpackOrderAppendix';\n\ndescribe('OrderAppendix packing/unpacking', () => {\n it('should pack and unpack an order appendix without iso/twap values', () => {\n const appendix: OrderAppendix = {\n orderExecutionType: 'default',\n triggerType: 'price',\n };\n const packed = packOrderAppendix(appendix);\n const unpacked = unpackOrderAppendix(packed);\n expect(packed).toBe(4097n);\n expect(unpacked.orderExecutionType).toBe(appendix.orderExecutionType);\n expect(unpacked.triggerType).toBe(appendix.triggerType);\n expect(unpacked.reduceOnly).toBeFalsy();\n });\n\n it('should handle reduceOnly true', () => {\n const appendix: OrderAppendix = {\n orderExecutionType: 'default',\n triggerType: 'price',\n reduceOnly: true,\n };\n const packed = packOrderAppendix(appendix);\n const unpacked = unpackOrderAppendix(packed);\n expect(packed).toBe(6145n);\n expect(unpacked.reduceOnly).toBe(true);\n });\n\n it('should handle all orderExecutionType values', () => {\n const types: OrderExecutionType[] = ['default', 'ioc', 'fok', 'post_only'];\n for (const type of types) {\n const appendix: OrderAppendix = {\n orderExecutionType: type,\n triggerType: 'price',\n };\n const packed = packOrderAppendix(appendix);\n const unpacked = unpackOrderAppendix(packed);\n expect(unpacked.orderExecutionType).toBe(type);\n }\n });\n\n it('should handle all triggerType values', () => {\n const triggers = ['price', 'twap', 'twap_custom_amounts'] as const;\n for (const trigger of triggers) {\n const appendix: OrderAppendix = {\n orderExecutionType: 'default',\n triggerType: trigger,\n };\n const packed = packOrderAppendix(appendix);\n const unpacked = unpackOrderAppendix(packed);\n expect(unpacked.triggerType).toBe(trigger);\n }\n });\n\n it('should handle isolated margin', () => {\n const appendix: OrderAppendix = {\n orderExecutionType: 'default',\n triggerType: 'price',\n\n isolated: { margin: 12345678901000000000000n },\n };\n const packed = packOrderAppendix(appendix);\n const unpacked = unpackOrderAppendix(packed);\n expect(packed).toBe(227737579102942800187821658369n);\n expect(unpacked.isolated?.margin).toBe(appendix.isolated?.margin);\n });\n\n it('should handle TWAP fields', () => {\n const appendix: OrderAppendix = {\n orderExecutionType: 'default',\n triggerType: 'twap',\n\n twap: { numOrders: 10, slippageFrac: 0.005 },\n };\n const packed = packOrderAppendix(appendix);\n const unpacked = unpackOrderAppendix(packed);\n expect(packed).toBe(792281717376363744483197591553n);\n expect(unpacked.twap).toMatchObject({ numOrders: 10, slippageFrac: 0.005 });\n });\n\n it('should handle max values for all fields for iso orders', () => {\n const appendix: OrderAppendix = {\n orderExecutionType: 'post_only',\n triggerType: undefined,\n reduceOnly: true,\n isolated: { margin: 18446744073709551615n }, // 2^64-1\n };\n const packed = packOrderAppendix(appendix);\n const unpacked = unpackOrderAppendix(packed);\n expect(unpacked.orderExecutionType).toBe(appendix.orderExecutionType);\n expect(unpacked.triggerType).toBe(appendix.triggerType);\n expect(unpacked.reduceOnly).toBe(appendix.reduceOnly);\n expect(unpacked.isolated?.margin).toBe(18446744000000000000n);\n expect(unpacked.twap).toBe(undefined);\n expect(packed).toBe(340282365561237229015142145n);\n });\n\n it('should handle max values for all fields for TWAP orders', () => {\n const appendix: OrderAppendix = {\n orderExecutionType: 'post_only',\n triggerType: 'twap_custom_amounts',\n reduceOnly: true,\n twap: {\n numOrders: 4294967295,\n slippageFrac: 0.000001,\n },\n };\n const packed = packOrderAppendix(appendix);\n const unpacked = unpackOrderAppendix(packed);\n expect(unpacked.orderExecutionType).toBe(appendix.orderExecutionType);\n expect(unpacked.triggerType).toBe(appendix.triggerType);\n expect(unpacked.reduceOnly).toBe(appendix.reduceOnly);\n expect(unpacked.twap?.slippageFrac).toBe(0.000001);\n expect(unpacked.twap?.numOrders).toBe(4294967295);\n expect(packed).toBe(340282366841710300967557013911933828609n);\n });\n\n it('should handle builder fields', () => {\n const appendix: OrderAppendix = {\n orderExecutionType: 'default',\n builder: { builderId: 123, builderFeeRate: 500 },\n };\n const packed = packOrderAppendix(appendix);\n const unpacked = unpackOrderAppendix(packed);\n expect(unpacked.builder?.builderId).toBe(123);\n expect(unpacked.builder?.builderFeeRate).toBe(500);\n });\n\n it('should handle builder with zero fee rate', () => {\n const appendix: OrderAppendix = {\n orderExecutionType: 'default',\n builder: { builderId: 42, builderFeeRate: 0 },\n };\n const packed = packOrderAppendix(appendix);\n const unpacked = unpackOrderAppendix(packed);\n expect(unpacked.builder?.builderId).toBe(42);\n expect(unpacked.builder?.builderFeeRate).toBe(0);\n });\n\n it('should handle builder with max values', () => {\n const appendix: OrderAppendix = {\n orderExecutionType: 'default',\n builder: { builderId: 65535, builderFeeRate: 1023 }, // 16 bits, 10 bits max\n };\n const packed = packOrderAppendix(appendix);\n const unpacked = unpackOrderAppendix(packed);\n expect(unpacked.builder?.builderId).toBe(65535);\n expect(unpacked.builder?.builderFeeRate).toBe(1023);\n });\n\n it('should handle builder combined with other flags', () => {\n const appendix: OrderAppendix = {\n orderExecutionType: 'ioc',\n reduceOnly: true,\n triggerType: 'price',\n builder: { builderId: 5, builderFeeRate: 100 },\n };\n const packed = packOrderAppendix(appendix);\n const unpacked = unpackOrderAppendix(packed);\n expect(unpacked.orderExecutionType).toBe('ioc');\n expect(unpacked.reduceOnly).toBe(true);\n expect(unpacked.triggerType).toBe('price');\n expect(unpacked.builder?.builderId).toBe(5);\n expect(unpacked.builder?.builderFeeRate).toBe(100);\n });\n\n it('should not return builder fields when builderId is 0', () => {\n const appendix: OrderAppendix = {\n orderExecutionType: 'default',\n };\n const packed = packOrderAppendix(appendix);\n const unpacked = unpackOrderAppendix(packed);\n expect(unpacked.builder).toBeUndefined();\n });\n});\n"],"mappings":";;;;;;;;AAAA,qBAAqC;AAErC,SAAS,yBAAyB;AAClC,SAAS,2BAA2B;AAAA,IAEpC,yBAAS,mCAAmC,MAAM;AAChD,yBAAG,oEAAoE,MAAM;AAC3E,UAAM,WAA0B;AAAA,MAC9B,oBAAoB;AAAA,MACpB,aAAa;AAAA,IACf;AACA,UAAM,SAAS,kBAAkB,QAAQ;AACzC,UAAM,WAAW,oBAAoB,MAAM;AAC3C,+BAAO,MAAM,EAAE,KAAK,KAAK;AACzB,+BAAO,SAAS,kBAAkB,EAAE,KAAK,SAAS,kBAAkB;AACpE,+BAAO,SAAS,WAAW,EAAE,KAAK,SAAS,WAAW;AACtD,+BAAO,SAAS,UAAU,EAAE,UAAU;AAAA,EACxC,CAAC;AAED,yBAAG,iCAAiC,MAAM;AACxC,UAAM,WAA0B;AAAA,MAC9B,oBAAoB;AAAA,MACpB,aAAa;AAAA,MACb,YAAY;AAAA,IACd;AACA,UAAM,SAAS,kBAAkB,QAAQ;AACzC,UAAM,WAAW,oBAAoB,MAAM;AAC3C,+BAAO,MAAM,EAAE,KAAK,KAAK;AACzB,+BAAO,SAAS,UAAU,EAAE,KAAK,IAAI;AAAA,EACvC,CAAC;AAED,yBAAG,+CAA+C,MAAM;AACtD,UAAM,QAA8B,CAAC,WAAW,OAAO,OAAO,WAAW;AACzE,eAAW,QAAQ,OAAO;AACxB,YAAM,WAA0B;AAAA,QAC9B,oBAAoB;AAAA,QACpB,aAAa;AAAA,MACf;AACA,YAAM,SAAS,kBAAkB,QAAQ;AACzC,YAAM,WAAW,oBAAoB,MAAM;AAC3C,iCAAO,SAAS,kBAAkB,EAAE,KAAK,IAAI;AAAA,IAC/C;AAAA,EACF,CAAC;AAED,yBAAG,wCAAwC,MAAM;AAC/C,UAAM,WAAW,CAAC,SAAS,QAAQ,qBAAqB;AACxD,eAAW,WAA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derAppendix
24
24
  });
25
25
  module.exports = __toCommonJS(packOrderAppendix_exports);
26
- var import_toBigInt = require("../../math/toBigInt.cjs");
26
+ var import_appendixIsolatedValue = require("./appendixIsolatedValue.cjs");
27
27
  var import_appendixTwapValue = require("./appendixTwapValue.cjs");
28
28
  var import_bitMaskValue = require("./bitMaskValue.cjs");
29
29
  function mapOrderAppendixToBitValues(appendix) {
@@ -32,7 +32,7 @@ function mapOrderAppendixToBitValues(appendix) {
32
32
  return (0, import_appendixTwapValue.packTwapOrderAppendixValue)(appendix.twap);
33
33
  }
34
34
  if (appendix.isolated) {
35
- return (0, import_toBigInt.toBigInt)(appendix.isolated.margin);
35
+ return (0, import_appendixIsolatedValue.packIsolatedOrderAppendixValue)(appendix.isolated);
36
36
  }
37
37
  return 0n;
38
38
  })();
@@ -62,18 +62,22 @@ function mapOrderAppendixToBitValues(appendix) {
62
62
  })();
63
63
  return {
64
64
  value,
65
+ builderId: appendix.builder?.builderId ?? 0,
66
+ builderFeeRate: appendix.builder?.builderFeeRate ?? 0,
65
67
  reserved: 0,
66
68
  trigger,
67
69
  reduceOnly: appendix.reduceOnly ? 1 : 0,
68
70
  orderType,
69
71
  isolated: appendix.isolated ? 1 : 0,
70
- version: 0
72
+ version: 1
71
73
  };
72
74
  }
73
75
  function packOrderAppendix(appendix) {
74
76
  const bits = mapOrderAppendixToBitValues(appendix);
75
- let packed = (0, import_bitMaskValue.bitMaskValue)(bits.value, 96);
76
- packed = packed << 18n | (0, import_bitMaskValue.bitMaskValue)(bits.reserved, 18);
77
+ let packed = (0, import_bitMaskValue.bitMaskValue)(bits.value, 64);
78
+ packed = packed << 16n | (0, import_bitMaskValue.bitMaskValue)(bits.builderId, 16);
79
+ packed = packed << 10n | (0, import_bitMaskValue.bitMaskValue)(bits.builderFeeRate, 10);
80
+ packed = packed << 24n | (0, import_bitMaskValue.bitMaskValue)(bits.reserved, 24);
77
81
  packed = packed << 2n | (0, import_bitMaskValue.bitMaskValue)(bits.trigger, 2);
78
82
  packed = packed << 1n | (0, import_bitMaskValue.bitMaskValue)(bits.reduceOnly, 1);
79
83
  packed = packed << 2n | (0, import_bitMaskValue.bitMaskValue)(bits.orderType, 2);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/utils/orders/appendix/packOrderAppendix.ts"],"sourcesContent":["import { OrderAppendix } from '../../../types/orderAppendixTypes';\nimport { toBigInt } from '../../math/toBigInt';\nimport { packTwapOrderAppendixValue } from './appendixTwapValue';\nimport { bitMaskValue } from './bitMaskValue';\nimport { PackedOrderAppendixBits } from './types';\n\nfunction mapOrderAppendixToBitValues(\n appendix: OrderAppendix,\n): PackedOrderAppendixBits {\n const value = (() => {\n if (appendix.twap) {\n return packTwapOrderAppendixValue(appendix.twap);\n }\n if (appendix.isolated) {\n return toBigInt(appendix.isolated.margin);\n }\n return 0n;\n })();\n const trigger = (() => {\n switch (appendix.triggerType) {\n case 'price':\n return 1;\n case 'twap':\n return 2;\n case 'twap_custom_amounts':\n return 3;\n default:\n return 0;\n }\n })();\n const orderType = (() => {\n switch (appendix.orderExecutionType) {\n case 'default':\n return 0;\n case 'ioc':\n return 1;\n case 'fok':\n return 2;\n case 'post_only':\n return 3;\n }\n })();\n\n return {\n value,\n reserved: 0,\n trigger,\n reduceOnly: appendix.reduceOnly ? 1 : 0,\n orderType,\n isolated: appendix.isolated ? 1 : 0,\n version: 0,\n };\n}\n\n/**\n * Pack the OrderAppendix fields into a single bigint.\n * @param appendix\n */\nexport function packOrderAppendix(appendix: OrderAppendix): bigint {\n const bits = mapOrderAppendixToBitValues(appendix);\n\n // Ensure value is within 96 bits\n let packed = bitMaskValue(bits.value, 96);\n packed = (packed << 18n) | bitMaskValue(bits.reserved, 18);\n packed = (packed << 2n) | bitMaskValue(bits.trigger, 2);\n packed = (packed << 1n) | bitMaskValue(bits.reduceOnly, 1);\n packed = (packed << 2n) | bitMaskValue(bits.orderType, 2);\n packed = (packed << 1n) | bitMaskValue(bits.isolated, 1);\n packed = (packed << 8n)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a,KAAK,UAAU,CAAC;AACvD,WAAU,UAAU,SAAM,kCAAa,KAAK,SAAS,CAAC;AACtD,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../../src/utils/orders/appendix/packOrderAppendix.ts"],"sourcesContent":["import { OrderAppendix } from '../../../types/orderAppendixTypes';\nimport { packIsolatedOrderAppendixValue } from './appendixIsolatedValue';\nimport { packTwapOrderAppendixValue } from './appendixTwapValue';\nimport { bitMaskValue } from './bitMaskValue';\nimport { PackedOrderAppendixBits } from './types';\n\nfunction mapOrderAppendixToBitValues(\n appendix: OrderAppendix,\n): PackedOrderAppendixBits {\n const value = (() => {\n if (appendix.twap) {\n return packTwapOrderAppendixValue(appendix.twap);\n }\n if (appendix.isolated) {\n return packIsolatedOrderAppendixValue(appendix.isolated);\n }\n return 0n;\n })();\n const trigger = (() => {\n switch (appendix.triggerType) {\n case 'price':\n return 1;\n case 'twap':\n return 2;\n case 'twap_custom_amounts':\n return 3;\n default:\n return 0;\n }\n })();\n const orderType = (() => {\n switch (appendix.orderExecutionType) {\n case 'default':\n return 0;\n case 'ioc':\n return 1;\n case 'fok':\n return 2;\n case 'post_only':\n return 3;\n }\n })();\n\n return {\n value,\n builderId: appendix.builder?.builderId ?? 0,\n builderFeeRate: appendix.builder?.builderFeeRate ?? 0,\n reserved: 0,\n trigger,\n reduceOnly: appendix.reduceOnly ? 1 : 0,\n orderType,\n isolated: appendix.isolated ? 1 : 0,\n version: 1,\n };\n}\n\n/**\n * Pack the OrderAppendix fields into a single bigint.\n * @param appendix\n */\nexport function packOrderAppendix(appendix: OrderAppendix): bigint {\n const bits = mapOrderAppendixToBitValues(appendix);\n\n // Ensure value is within 64 bits\n let packed = bitMaskValue(bits.value, 64);\n packed = (packed << 16n) | bitMaskValue(bits.builderId, 16);\n packed = (packed << 10n) | bitMaskValue(bits.builderFeeRate, 10);\n packed = (packed << 24n) | bitMaskValue(bits.reserved, 24);\n packed = (packed << 2n) | bitMaskValue(bits.trigger, 2);\n packed = (packed << 1n) | bitMaskValue(bits.reduceOnly, 1);\n packed = (packed << 2n) | bitMaskValue(bits.orderType, 2);\n packed = (packed << 1n) | bitMaskValue(bits.isolated, 1);\n packed = (packed << 8n) | bitMaskValue(bits.version, 8);\n return packed;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,mCAA+C;AAC/C,+BAA2C;AAC3C,0BAA6B;AAG7B,SAAS,4BACP,UACyB;AACzB,QAAM,SAAS,MAAM;AACnB,QAAI,SAAS,MAAM;AACjB,iBAAO,qDAA2B,SAAS,IAAI;AAAA,IACjD;AACA,QAAI,SAAS,UAAU;AACrB,iBAAO,6DAA+B,SAAS,QAAQ;AAAA,IACzD;AACA,WAAO;AAAA,EACT,GAAG;AACH,QAAM,WAAW,MAAM;AACrB,YAAQ,SAAS,aAAa;AAAA,MAC5B,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT;AACE,eAAO;AAAA,IACX;AAAA,EACF,GAAG;AACH,QAAM,aAAa,MAAM;AACvB,YAAQ,SAAS,oBAAoB;AAAA,MACnC,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,IACX;AAAA,EACF,GAAG;AAEH,SAAO;AAAA,IACL;AAAA,IACA,WAAW,SAAS,SAAS,aAAa;AAAA,IAC1C,gBAAgB,SAAS,SAAS,kBAAkB;AAAA,IACpD,UAAU;AAAA,IACV;AAAA,IACA,YAAY,SAAS,aAAa,IAAI;AAAA,IACtC;AAAA,IACA,UAAU,SAAS,WAAW,IAAI;AAAA,IAClC,SAAS;AAAA,EACX;AACF;AAMO,SAAS,kBAAkB,UAAiC;AACjE,QAAM,OAAO,4BAA4B,QAAQ;AAGjD,MAAI,aAAS,kCAAa,KAAK,OAAO,EAAE;AACxC,WAAU,UAAU,UAAO,kCAAa,KAAK,WAAW,EAAE;AAC1D,WAAU,UAAU,UAAO,kCAAa,KAAK,gBAAgB,EAAE;AAC/D,WAAU,UAAU,UAAO,kCAAa,KAAK,UAAU,EAAE;AACzD,WAAU,UAAU,SAAM,kCAAa,KAAK,SAAS,CAAC;AACtD,WAAU,UAAU,SAAM,kCAAa,KAAK,YAAY,CAAC;AACzD,WAAU,UAAU,SAAM,kCAAa,KAAK,WAAW,CAAC;AACxD,WAAU,UAAU,SAAM,kCAAa,KAAK,UAAU,CAAC;AACvD,WAAU,UAAU,SAAM,kCAAa,KAAK,SAAS,CAAC;AACtD,SAAO;AACT;","names":[]}
@@ -1,5 +1,5 @@
1
1
  import { OrderAppendix } from '../../../types/orderAppendixTypes.cjs';
2
- import '../../math/bigDecimal.cjs';
2
+ import '../../math/bigNumber.cjs';
3
3
  import 'bignumber.js';
4
4
  import '../../../types/OrderExecutionType.cjs';
5
5
 
@@ -1,5 +1,5 @@
1
1
  import { OrderAppendix } from '../../../types/orderAppendixTypes.js';
2
- import '../../math/bigDecimal.js';
2
+ import '../../math/bigNumber.js';
3
3
  import 'bignumber.js';
4
4
  import '../../../types/OrderExecutionType.js';
5
5
 
@@ -1,7 +1,7 @@
1
1
  import "../../../chunk-5WRI5ZAA.js";
2
2
 
3
3
  // src/utils/orders/appendix/packOrderAppendix.ts
4
- import { toBigInt } from "../../math/toBigInt.js";
4
+ import { packIsolatedOrderAppendixValue } from "./appendixIsolatedValue.js";
5
5
  import { packTwapOrderAppendixValue } from "./appendixTwapValue.js";
6
6
  import { bitMaskValue } from "./bitMaskValue.js";
7
7
  function mapOrderAppendixToBitValues(appendix) {
@@ -10,7 +10,7 @@ function mapOrderAppendixToBitValues(appendix) {
10
10
  return packTwapOrderAppendixValue(appendix.twap);
11
11
  }
12
12
  if (appendix.isolated) {
13
- return toBigInt(appendix.isolated.margin);
13
+ return packIsolatedOrderAppendixValue(appendix.isolated);
14
14
  }
15
15
  return 0n;
16
16
  })();
@@ -40,18 +40,22 @@ function mapOrderAppendixToBitValues(appendix) {
40
40
  })();
41
41
  return {
42
42
  value,
43
+ builderId: appendix.builder?.builderId ?? 0,
44
+ builderFeeRate: appendix.builder?.builderFeeRate ?? 0,
43
45
  reserved: 0,
44
46
  trigger,
45
47
  reduceOnly: appendix.reduceOnly ? 1 : 0,
46
48
  orderType,
47
49
  isolated: appendix.isolated ? 1 : 0,
48
- version: 0
50
+ version: 1
49
51
  };
50
52
  }
51
53
  function packOrderAppendix(appendix) {
52
54
  const bits = mapOrderAppendixToBitValues(appendix);
53
- let packed = bitMaskValue(bits.value, 96);
54
- packed = packed << 18n | bitMaskValue(bits.reserved, 18);
55
+ let packed = bitMaskValue(bits.value, 64);
56
+ packed = packed << 16n | bitMaskValue(bits.builderId, 16);
57
+ packed = packed << 10n | bitMaskValue(bits.builderFeeRate, 10);
58
+ packed = packed << 24n | bitMaskValue(bits.reserved, 24);
55
59
  packed = packed << 2n | bitMaskValue(bits.trigger, 2);
56
60
  packed = packed << 1n | bitMaskValue(bits.reduceOnly, 1);
57
61
  packed = packed << 2n | bitMaskValue(bits.orderType, 2);
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/utils/orders/appendix/packOrderAppendix.ts"],"sourcesContent":["import { OrderAppendix } from '../../../types/orderAppendixTypes';\nimport { toBigInt } from '../../math/toBigInt';\nimport { packTwapOrderAppendixValue } from './appendixTwapValue';\nimport { bitMaskValue } from './bitMaskValue';\nimport { PackedOrderAppendixBits } from './types';\n\nfunction mapOrderAppendixToBitValues(\n appendix: OrderAppendix,\n): PackedOrderAppendixBits {\n const value = (() => {\n if (appendix.twap) {\n return packTwapOrderAppendixValue(appendix.twap);\n }\n if (appendix.isolated) {\n return toBigInt(appendix.isolated.margin);\n }\n return 0n;\n })();\n const trigger = (() => {\n switch (appendix.triggerType) {\n case 'price':\n return 1;\n case 'twap':\n return 2;\n case 'twap_custom_amounts':\n return 3;\n default:\n return 0;\n }\n })();\n const orderType = (() => {\n switch (appendix.orderExecutionType) {\n case 'default':\n return 0;\n case 'ioc':\n return 1;\n case 'fok':\n return 2;\n case 'post_only':\n return 3;\n }\n })();\n\n return {\n value,\n reserved: 0,\n trigger,\n reduceOnly: appendix.reduceOnly ? 1 : 0,\n orderType,\n isolated: appendix.isolated ? 1 : 0,\n version: 0,\n };\n}\n\n/**\n * Pack the OrderAppendix fields into a single bigint.\n * @param appendix\n */\nexport function packOrderAppendix(appendix: OrderAppendix): bigint {\n const bits = mapOrderAppendixToBitValues(appendix);\n\n // Ensure value is within 96 bits\n let packed = bitMaskValue(bits.value, 96);\n packed = (packed << 18n) | bitMaskValue(bits.reserved, 18);\n packed = (packed << 2n) | bitMaskValue(bits.trigger, 2);\n packed = (packed << 1n) | bitMaskValue(bits.reduceOnly, 1);\n packed = (packed << 2n) | bitMaskValue(bits.orderType, 2);\n packed = (packed << 1n) | bitMaskValue(bits.isolated, 1);\n packed = (packed << 8n) | bitMaskValue(bits.version, 8);\n return packed;\n}\n"],"mappings":";;;AACA,SAAS,gBAAgB;AACzB,SAAS,kCAAkC;AAC3C,SAAS,oBAAoB;AAG7B,SAAS,4BACP,UACyB;AACzB,QAAM,SAAS,MAAM;AACnB,QAAI,SAAS,MAAM;AACjB,aAAO,2BAA2B,SAAS,IAAI;AAAA,IACjD;AACA,QAAI,SAAS,UAAU;AACrB,aAAO,SAAS,SAAS,SAAS,MAAM;AAAA,IAC1C;AACA,WAAO;AAAA,EACT,GAAG;AACH,QAAM,WAAW,MAAM;AACrB,YAAQ,SAAS,aAAa;AAAA,MAC5B,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT;AACE,eAAO;AAAA,IACX;AAAA,EACF,GAAG;AACH,QAAM,aAAa,MAAM;AACvB,YAAQ,SAAS,oBAAoB;AAAA,MACnC,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,IACX;AAAA,EACF,GAAG;AAEH,SAAO;AAAA,IACL;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA,YAAY,SAAS,aAAa,IAAI;AAAA,IACtC;AAAA,IACA,UAAU,SAAS,WAAW,IAAI;AAAA,IAClC,SAAS;AAAA,EACX;AACF;AAMO,SAAS,kBAAkB,UAAiC;AACjE,QAAM,OAAO,4BAA4B,QAAQ;AAGjD,MAAI,SAAS,aAAa,KAAK,OAAO,EAAE;AACxC,WAAU,UAAU,MAAO,aAAa,KAAK,UAAU,EAAE;AACzD,WAAU,UAAU,KAAM,aAAa,KAAK,SAAS,CAAC;AACtD,WAAU,UAAU,KAAM,aAAa,KAAK,YAAY,CAAC;AACzD,WAAU,UAAU,KAAM,aAAa,KAAK,WAAW,CAAC;AACxD,WAAU,UAAU,KAAM,aAAa,KAAK,UAAU,CAAC;AACvD,WAAU,UAAU,KAAM,aAAa,KAAK,SAAS,CAAC;AACtD,SAAO;AACT;","names":[]}
1
+ {"version":3,"sources":["../../../../src/utils/orders/appendix/packOrderAppendix.ts"],"sourcesContent":["import { OrderAppendix } from '../../../types/orderAppendixTypes';\nimport { packIsolatedOrderAppendixValue } from './appendixIsolatedValue';\nimport { packTwapOrderAppendixValue } from './appendixTwapValue';\nimport { bitMaskValue } from './bitMaskValue';\nimport { PackedOrderAppendixBits } from './types';\n\nfunction mapOrderAppendixToBitValues(\n appendix: OrderAppendix,\n): PackedOrderAppendixBits {\n const value = (() => {\n if (appendix.twap) {\n return packTwapOrderAppendixValue(appendix.twap);\n }\n if (appendix.isolated) {\n return packIsolatedOrderAppendixValue(appendix.isolated);\n }\n return 0n;\n })();\n const trigger = (() => {\n switch (appendix.triggerType) {\n case 'price':\n return 1;\n case 'twap':\n return 2;\n case 'twap_custom_amounts':\n return 3;\n default:\n return 0;\n }\n })();\n const orderType = (() => {\n switch (appendix.orderExecutionType) {\n case 'default':\n return 0;\n case 'ioc':\n return 1;\n case 'fok':\n return 2;\n case 'post_only':\n return 3;\n }\n })();\n\n return {\n value,\n builderId: appendix.builder?.builderId ?? 0,\n builderFeeRate: appendix.builder?.builderFeeRate ?? 0,\n reserved: 0,\n trigger,\n reduceOnly: appendix.reduceOnly ? 1 : 0,\n orderType,\n isolated: appendix.isolated ? 1 : 0,\n version: 1,\n };\n}\n\n/**\n * Pack the OrderAppendix fields into a single bigint.\n * @param appendix\n */\nexport function packOrderAppendix(appendix: OrderAppendix): bigint {\n const bits = mapOrderAppendixToBitValues(appendix);\n\n // Ensure value is within 64 bits\n let packed = bitMaskValue(bits.value, 64);\n packed = (packed << 16n) | bitMaskValue(bits.builderId, 16);\n packed = (packed << 10n) | bitMaskValue(bits.builderFeeRate, 10);\n packed = (packed << 24n) | bitMaskValue(bits.reserved, 24);\n packed = (packed << 2n) | bitMaskValue(bits.trigger, 2);\n packed = (packed << 1n) | bitMaskValue(bits.reduceOnly, 1);\n packed = (packed << 2n) | bitMaskValue(bits.orderType, 2);\n packed = (packed << 1n) | bitMaskValue(bits.isolated, 1);\n packed = (packed << 8n) | bitMaskValue(bits.version, 8);\n return packed;\n}\n"],"mappings":";;;AACA,SAAS,sCAAsC;AAC/C,SAAS,kCAAkC;AAC3C,SAAS,oBAAoB;AAG7B,SAAS,4BACP,UACyB;AACzB,QAAM,SAAS,MAAM;AACnB,QAAI,SAAS,MAAM;AACjB,aAAO,2BAA2B,SAAS,IAAI;AAAA,IACjD;AACA,QAAI,SAAS,UAAU;AACrB,aAAO,+BAA+B,SAAS,QAAQ;AAAA,IACzD;AACA,WAAO;AAAA,EACT,GAAG;AACH,QAAM,WAAW,MAAM;AACrB,YAAQ,SAAS,aAAa;AAAA,MAC5B,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT;AACE,eAAO;AAAA,IACX;AAAA,EACF,GAAG;AACH,QAAM,aAAa,MAAM;AACvB,YAAQ,SAAS,oBAAoB;AAAA,MACnC,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,IACX;AAAA,EACF,GAAG;AAEH,SAAO;AAAA,IACL;AAAA,IACA,WAAW,SAAS,SAAS,aAAa;AAAA,IAC1C,gBAAgB,SAAS,SAAS,kBAAkB;AAAA,IACpD,UAAU;AAAA,IACV;AAAA,IACA,YAAY,SAAS,aAAa,IAAI;AAAA,IACtC;AAAA,IACA,UAAU,SAAS,WAAW,IAAI;AAAA,IAClC,SAAS;AAAA,EACX;AACF;AAMO,SAAS,kBAAkB,UAAiC;AACjE,QAAM,OAAO,4BAA4B,QAAQ;AAGjD,MAAI,SAAS,aAAa,KAAK,OAAO,EAAE;AACxC,WAAU,UAAU,MAAO,aAAa,KAAK,WAAW,EAAE;AAC1D,WAAU,UAAU,MAAO,aAAa,KAAK,gBAAgB,EAAE;AAC/D,WAAU,UAAU,MAAO,aAAa,KAAK,UAAU,EAAE;AACzD,WAAU,UAAU,KAAM,aAAa,KAAK,SAAS,CAAC;AACtD,WAAU,UAAU,KAAM,aAAa,KAAK,YAAY,CAAC;AACzD,WAAU,UAAU,KAAM,aAAa,KAAK,WAAW,CAAC;AACxD,WAAU,UAAU,KAAM,aAAa,KAAK,UAAU,CAAC;AACvD,WAAU,UAAU,KAAM,aAAa,KAAK,SAAS,CAAC;AACtD,SAAO;AACT;","names":[]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/utils/orders/appendix/types.ts"],"sourcesContent":["/**\n * Bit layout for OrderAppendix packing (MSB → LSB):\n *\n * | value | reserved | trigger | reduceOnly | orderType | isolated | version |\n * |-----------|----------|---------|------------|-----------|----------|---------|\n * | 127..32 | 31..14 | 13..12 | 11 | 10..9 | 8 | 7..0 |\n * | 96 bits | 18 bits | 2 bits | 1 bit | 2 bits | 1 bit | 8 bits |\n */\nexport interface PackedOrderAppendixBits {\n value: bigint; // 96 bits\n reserved: number; // 18 bits, set to 0\n trigger: number; // 2 bits\n reduceOnly: number; // 1 bit\n orderType: number; // 2 bits\n isolated: number; // 1 bit\n version: number; // 8 bits, set to 0\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
1
+ {"version":3,"sources":["../../../../src/utils/orders/appendix/types.ts"],"sourcesContent":["/**\n * Bit layout for OrderAppendix packing (MSB → LSB):\n *\n * | value | builderId | builderFeeRate | reserved | trigger | reduceOnly | orderType | isolated | version |\n * |-----------|-----------|----------------|----------|---------|------------|-----------|----------|---------|\n * | 127..64 | 63..48 | 47..38 | 37..14 | 13..12 | 11 | 10..9 | 8 | 7..0 |\n * | 64 bits | 16 bits | 10 bits | 24 bits | 2 bits | 1 bit | 2 bits | 1 bit | 8 bits |\n */\nexport interface PackedOrderAppendixBits {\n value: bigint; // 64 bits\n builderId: number; // 16 bits\n builderFeeRate: number; // 10 bits\n reserved: number; // 24 bits, set to 0\n trigger: number; // 2 bits\n reduceOnly: number; // 1 bit\n orderType: number; // 2 bits\n isolated: number; // 1 bit\n version: number; // 8 bits, set to 1\n}\n"],"mappings":";;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
@@ -1,13 +1,15 @@
1
1
  /**
2
2
  * Bit layout for OrderAppendix packing (MSB → LSB):
3
3
  *
4
- * | value | reserved | trigger | reduceOnly | orderType | isolated | version |
5
- * |-----------|----------|---------|------------|-----------|----------|---------|
6
- * | 127..32 | 31..14 | 13..12 | 11 | 10..9 | 8 | 7..0 |
7
- * | 96 bits | 18 bits | 2 bits | 1 bit | 2 bits | 1 bit | 8 bits |
4
+ * | value | builderId | builderFeeRate | reserved | trigger | reduceOnly | orderType | isolated | version |
5
+ * |-----------|-----------|----------------|----------|---------|------------|-----------|----------|---------|
6
+ * | 127..64 | 63..48 | 47..38 | 37..14 | 13..12 | 11 | 10..9 | 8 | 7..0 |
7
+ * | 64 bits | 16 bits | 10 bits | 24 bits | 2 bits | 1 bit | 2 bits | 1 bit | 8 bits |
8
8
  */
9
9
  interface PackedOrderAppendixBits {
10
10
  value: bigint;
11
+ builderId: number;
12
+ builderFeeRate: number;
11
13
  reserved: number;
12
14
  trigger: number;
13
15
  reduceOnly: number;
@@ -1,13 +1,15 @@
1
1
  /**
2
2
  * Bit layout for OrderAppendix packing (MSB → LSB):
3
3
  *
4
- * | value | reserved | trigger | reduceOnly | orderType | isolated | version |
5
- * |-----------|----------|---------|------------|-----------|----------|---------|
6
- * | 127..32 | 31..14 | 13..12 | 11 | 10..9 | 8 | 7..0 |
7
- * | 96 bits | 18 bits | 2 bits | 1 bit | 2 bits | 1 bit | 8 bits |
4
+ * | value | builderId | builderFeeRate | reserved | trigger | reduceOnly | orderType | isolated | version |
5
+ * |-----------|-----------|----------------|----------|---------|------------|-----------|----------|---------|
6
+ * | 127..64 | 63..48 | 47..38 | 37..14 | 13..12 | 11 | 10..9 | 8 | 7..0 |
7
+ * | 64 bits | 16 bits | 10 bits | 24 bits | 2 bits | 1 bit | 2 bits | 1 bit | 8 bits |
8
8
  */
9
9
  interface PackedOrderAppendixBits {
10
10
  value: bigint;
11
+ builderId: number;
12
+ builderFeeRate: number;
11
13
  reserved: number;
12
14
  trigger: number;
13
15
  reduceOnly: number;
@@ -24,6 +24,7 @@ __export(unpackOrderAppendix_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(unpackOrderAppendix_exports);
26
26
  var import_math = require("../../math/index.cjs");
27
+ var import_appendixIsolatedValue = require("./appendixIsolatedValue.cjs");
27
28
  var import_appendixTwapValue = require("./appendixTwapValue.cjs");
28
29
  var import_bitMaskValue = require("./bitMaskValue.cjs");
29
30
  function mapBitValuesToAppendix(bits) {
@@ -57,7 +58,7 @@ function mapBitValuesToAppendix(bits) {
57
58
  })();
58
59
  const isolatedFields = (() => {
59
60
  if (bits.isolated) {
60
- return { margin: bits.value };
61
+ return (0, import_appendixIsolatedValue.unpackIsolatedOrderAppendixValue)(bits.value);
61
62
  }
62
63
  return void 0;
63
64
  })();
@@ -66,12 +67,22 @@ function mapBitValuesToAppendix(bits) {
66
67
  return (0, import_appendixTwapValue.unpackTwapOrderAppendixValue)(bits.value);
67
68
  }
68
69
  })();
70
+ const builderFields = (() => {
71
+ if (bits.builderId) {
72
+ return {
73
+ builderId: bits.builderId,
74
+ builderFeeRate: bits.builderFeeRate
75
+ };
76
+ }
77
+ return void 0;
78
+ })();
69
79
  return {
70
80
  reduceOnly: !!bits.reduceOnly,
71
81
  orderExecutionType,
72
82
  triggerType,
73
83
  isolated: isolatedFields,
74
- twap: twapFields
84
+ twap: twapFields,
85
+ builder: builderFields
75
86
  };
76
87
  }
77
88
  function unpackOrderAppendix(packed) {
@@ -86,11 +97,17 @@ function unpackOrderAppendix(packed) {
86
97
  temp >>= 1n;
87
98
  const trigger = Number((0, import_bitMaskValue.bitMaskValue)(temp, 2));
88
99
  temp >>= 2n;
89
- const reserved = Number((0, import_bitMaskValue.bitMaskValue)(temp, 18));
90
- temp >>= 18n;
91
- const value = (0, import_bitMaskValue.bitMaskValue)(temp, 96);
100
+ const reserved = Number((0, import_bitMaskValue.bitMaskValue)(temp, 24));
101
+ temp >>= 24n;
102
+ const builderFeeRate = Number((0, import_bitMaskValue.bitMaskValue)(temp, 10));
103
+ temp >>= 10n;
104
+ const builderId = Number((0, import_bitMaskValue.bitMaskValue)(temp, 16));
105
+ temp >>= 16n;
106
+ const value = (0, import_bitMaskValue.bitMaskValue)(temp, 64);
92
107
  return mapBitValuesToAppendix({
93
108
  value,
109
+ builderId,
110
+ builderFeeRate,
94
111
  reserved,
95
112
  trigger,
96
113
  reduceOnly,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/utils/orders/appendix/unpackOrderAppendix.ts"],"sourcesContent":["import { OrderAppendix } from '../../../types/orderAppendixTypes';\nimport { BigDecimalish, toBigInt } from '../../math';\nimport { unpackTwapOrderAppendixValue } from './appendixTwapValue';\nimport { bitMaskValue } from './bitMaskValue';\nimport { PackedOrderAppendixBits } from './types';\n\nfunction mapBitValuesToAppendix(bits: PackedOrderAppendixBits): OrderAppendix {\n const triggerType = (() => {\n switch (bits.trigger) {\n case 1:\n return 'price';\n case 2:\n return 'twap';\n case 3:\n return 'twap_custom_amounts';\n default:\n return undefined;\n }\n })();\n const orderExecutionType = (() => {\n switch (bits.orderType) {\n case 0:\n return 'default';\n case 1:\n return 'ioc';\n case 2:\n return 'fok';\n case 3:\n return 'post_only';\n default:\n throw new Error(\n `[mapBitValuesToAppendix] Unknown order type: ${bits.orderType}`,\n );\n }\n })();\n const isolatedFields = (() => {\n if (bits.isolated) {\n return { margin: bits.value };\n }\n return undefined;\n })();\n const twapFields = (() => {\n if (triggerType === 'twap' || triggerType === 'twap_custom_amounts') {\n return unpackTwapOrderAppendixValue(bits.value);\n }\n })();\n\n return {\n reduceOnly: !!bits.reduceOnly,\n orderExecutionType,\n triggerType,\n isolated: isolatedFields,\n twap: twapFields,\n };\n}\n\n/**\n * Unpack the OrderAppendix fields from a packed bigint.\n * @param packed\n */\nexport function unpackOrderAppendix(packed: BigDecimalish): OrderAppendix {\n let temp = toBigInt(packed);\n // Bitmasks lowest 8 bits for version\n const version = Number(bitMaskValue(temp, 8));\n // Shift out the version bits\n temp >>= 8n;\n // Repeat for the rest of the fields\n const isolated = Number(bitMaskValue(temp, 1));\n temp >>= 1n;\n const orderType = Number(bitMaskValue(temp, 2));\n temp >>= 2n;\n const reduceOnly = Number(bitMaskValue(temp, 1));\n temp >>= 1n;\n const trigger = Number(bitMaskValue(temp, 2));\n temp >>= 2n;\n const reserved = Number(bitMaskValue(temp, 18));\n temp >>= 18n;\n // The remaining bits are the value, which should be 96 bits\n const value = bitMaskValue(temp, 96);\n\n return mapBitValuesToAppendix({\n value,\n reserved,\n trigger,\n reduceOnly,\n orderType,\n isolated,\n version,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAwC;AACxC,+BAA6C;AAC7C,0BAA6B;AAG7B,SAAS,uBAAuB,MAA8C;AAC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AC;AAC9C,WAAS;AAET,QAAM,YAAQ,kCAAa,MAAM,EAAE;AAEnC,SAAO,uBAAuB;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../../../../src/utils/orders/appendix/unpackOrderAppendix.ts"],"sourcesContent":["import { OrderAppendix } from '../../../types/orderAppendixTypes';\nimport { BigNumberish, toBigInt } from '../../math';\nimport { unpackIsolatedOrderAppendixValue } from './appendixIsolatedValue';\nimport { unpackTwapOrderAppendixValue } from './appendixTwapValue';\nimport { bitMaskValue } from './bitMaskValue';\nimport { PackedOrderAppendixBits } from './types';\n\nfunction mapBitValuesToAppendix(bits: PackedOrderAppendixBits): OrderAppendix {\n const triggerType = (() => {\n switch (bits.trigger) {\n case 1:\n return 'price';\n case 2:\n return 'twap';\n case 3:\n return 'twap_custom_amounts';\n default:\n return undefined;\n }\n })();\n const orderExecutionType = (() => {\n switch (bits.orderType) {\n case 0:\n return 'default';\n case 1:\n return 'ioc';\n case 2:\n return 'fok';\n case 3:\n return 'post_only';\n default:\n throw new Error(\n `[mapBitValuesToAppendix] Unknown order type: ${bits.orderType}`,\n );\n }\n })();\n const isolatedFields = (() => {\n if (bits.isolated) {\n return unpackIsolatedOrderAppendixValue(bits.value);\n }\n return undefined;\n })();\n const twapFields = (() => {\n if (triggerType === 'twap' || triggerType === 'twap_custom_amounts') {\n return unpackTwapOrderAppendixValue(bits.value);\n }\n })();\n const builderFields = (() => {\n if (bits.builderId) {\n return {\n builderId: bits.builderId,\n builderFeeRate: bits.builderFeeRate,\n };\n }\n return undefined;\n })();\n\n return {\n reduceOnly: !!bits.reduceOnly,\n orderExecutionType,\n triggerType,\n isolated: isolatedFields,\n twap: twapFields,\n builder: builderFields,\n };\n}\n\n/**\n * Unpack the OrderAppendix fields from a packed bigint.\n * @param packed\n */\nexport function unpackOrderAppendix(packed: BigNumberish): OrderAppendix {\n let temp = toBigInt(packed);\n // Bitmasks lowest 8 bits for version\n const version = Number(bitMaskValue(temp, 8));\n // Shift out the version bits\n temp >>= 8n;\n // Repeat for the rest of the fields\n const isolated = Number(bitMaskValue(temp, 1));\n temp >>= 1n;\n const orderType = Number(bitMaskValue(temp, 2));\n temp >>= 2n;\n const reduceOnly = Number(bitMaskValue(temp, 1));\n temp >>= 1n;\n const trigger = Number(bitMaskValue(temp, 2));\n temp >>= 2n;\n const reserved = Number(bitMaskValue(temp, 24));\n temp >>= 24n;\n const builderFeeRate = Number(bitMaskValue(temp, 10));\n temp >>= 10n;\n const builderId = Number(bitMaskValue(temp, 16));\n temp >>= 16n;\n // The remaining bits are the value, which should be 64 bits\n const value = bitMaskValue(temp, 64);\n\n return mapBitValuesToAppendix({\n value,\n builderId,\n builderFeeRate,\n reserved,\n trigger,\n reduceOnly,\n orderType,\n isolated,\n version,\n });\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAuC;AACvC,mCAAiD;AACjD,+BAA6C;AAC7C,0BAA6B;AAG7B,SAAS,uBAAuB,MAA8C;AAC5E,QAAM,eAAe,MAAM;AACzB,YAAQ,KAAK,SAAS;AAAA,MACpB,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT;AACE,eAAO;AAAA,IACX;AAAA,EACF,GAAG;AACH,QAAM,sBAAsB,MAAM;AAChC,YAAQ,KAAK,WAAW;AAAA,MACtB,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT;AACE,cAAM,IAAI;AAAA,UACR,gDAAgD,KAAK,SAAS;AAAA,QAChE;AAAA,IACJ;AAAA,EACF,GAAG;AACH,QAAM,kBAAkB,MAAM;AAC5B,QAAI,KAAK,UAAU;AACjB,iBAAO,+DAA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5 +1,5 @@
1
1
  import { OrderAppendix } from '../../../types/orderAppendixTypes.cjs';
2
- import { BigDecimalish } from '../../math/bigDecimal.cjs';
2
+ import { BigNumberish } from '../../math/bigNumber.cjs';
3
3
  import '../../../types/OrderExecutionType.cjs';
4
4
  import 'bignumber.js';
5
5
 
@@ -7,6 +7,6 @@ import 'bignumber.js';
7
7
  * Unpack the OrderAppendix fields from a packed bigint.
8
8
  * @param packed
9
9
  */
10
- declare function unpackOrderAppendix(packed: BigDecimalish): OrderAppendix;
10
+ declare function unpackOrderAppendix(packed: BigNumberish): OrderAppendix;
11
11
 
12
12
  export { unpackOrderAppendix };
@@ -1,5 +1,5 @@
1
1
  import { OrderAppendix } from '../../../types/orderAppendixTypes.js';
2
- import { BigDecimalish } from '../../math/bigDecimal.js';
2
+ import { BigNumberish } from '../../math/bigNumber.js';
3
3
  import '../../../types/OrderExecutionType.js';
4
4
  import 'bignumber.js';
5
5
 
@@ -7,6 +7,6 @@ import 'bignumber.js';
7
7
  * Unpack the OrderAppendix fields from a packed bigint.
8
8
  * @param packed
9
9
  */
10
- declare function unpackOrderAppendix(packed: BigDecimalish): OrderAppendix;
10
+ declare function unpackOrderAppendix(packed: BigNumberish): OrderAppendix;
11
11
 
12
12
  export { unpackOrderAppendix };
@@ -2,6 +2,7 @@ import "../../../chunk-5WRI5ZAA.js";
2
2
 
3
3
  // src/utils/orders/appendix/unpackOrderAppendix.ts
4
4
  import { toBigInt } from "../../math/index.js";
5
+ import { unpackIsolatedOrderAppendixValue } from "./appendixIsolatedValue.js";
5
6
  import { unpackTwapOrderAppendixValue } from "./appendixTwapValue.js";
6
7
  import { bitMaskValue } from "./bitMaskValue.js";
7
8
  function mapBitValuesToAppendix(bits) {
@@ -35,7 +36,7 @@ function mapBitValuesToAppendix(bits) {
35
36
  })();
36
37
  const isolatedFields = (() => {
37
38
  if (bits.isolated) {
38
- return { margin: bits.value };
39
+ return unpackIsolatedOrderAppendixValue(bits.value);
39
40
  }
40
41
  return void 0;
41
42
  })();
@@ -44,12 +45,22 @@ function mapBitValuesToAppendix(bits) {
44
45
  return unpackTwapOrderAppendixValue(bits.value);
45
46
  }
46
47
  })();
48
+ const builderFields = (() => {
49
+ if (bits.builderId) {
50
+ return {
51
+ builderId: bits.builderId,
52
+ builderFeeRate: bits.builderFeeRate
53
+ };
54
+ }
55
+ return void 0;
56
+ })();
47
57
  return {
48
58
  reduceOnly: !!bits.reduceOnly,
49
59
  orderExecutionType,
50
60
  triggerType,
51
61
  isolated: isolatedFields,
52
- twap: twapFields
62
+ twap: twapFields,
63
+ builder: builderFields
53
64
  };
54
65
  }
55
66
  function unpackOrderAppendix(packed) {
@@ -64,11 +75,17 @@ function unpackOrderAppendix(packed) {
64
75
  temp >>= 1n;
65
76
  const trigger = Number(bitMaskValue(temp, 2));
66
77
  temp >>= 2n;
67
- const reserved = Number(bitMaskValue(temp, 18));
68
- temp >>= 18n;
69
- const value = bitMaskValue(temp, 96);
78
+ const reserved = Number(bitMaskValue(temp, 24));
79
+ temp >>= 24n;
80
+ const builderFeeRate = Number(bitMaskValue(temp, 10));
81
+ temp >>= 10n;
82
+ const builderId = Number(bitMaskValue(temp, 16));
83
+ temp >>= 16n;
84
+ const value = bitMaskValue(temp, 64);
70
85
  return mapBitValuesToAppendix({
71
86
  value,
87
+ builderId,
88
+ builderFeeRate,
72
89
  reserved,
73
90
  trigger,
74
91
  reduceOnly,
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/utils/orders/appendix/unpackOrderAppendix.ts"],"sourcesContent":["import { OrderAppendix } from '../../../types/orderAppendixTypes';\nimport { BigDecimalish, toBigInt } from '../../math';\nimport { unpackTwapOrderAppendixValue } from './appendixTwapValue';\nimport { bitMaskValue } from './bitMaskValue';\nimport { PackedOrderAppendixBits } from './types';\n\nfunction mapBitValuesToAppendix(bits: PackedOrderAppendixBits): OrderAppendix {\n const triggerType = (() => {\n switch (bits.trigger) {\n case 1:\n return 'price';\n case 2:\n return 'twap';\n case 3:\n return 'twap_custom_amounts';\n default:\n return undefined;\n }\n })();\n const orderExecutionType = (() => {\n switch (bits.orderType) {\n case 0:\n return 'default';\n case 1:\n return 'ioc';\n case 2:\n return 'fok';\n case 3:\n return 'post_only';\n default:\n throw new Error(\n `[mapBitValuesToAppendix] Unknown order type: ${bits.orderType}`,\n );\n }\n })();\n const isolatedFields = (() => {\n if (bits.isolated) {\n return { margin: bits.value };\n }\n return undefined;\n })();\n const twapFields = (() => {\n if (triggerType === 'twap' || triggerType === 'twap_custom_amounts') {\n return unpackTwapOrderAppendixValue(bits.value);\n }\n })();\n\n return {\n reduceOnly: !!bits.reduceOnly,\n orderExecutionType,\n triggerType,\n isolated: isolatedFields,\n twap: twapFields,\n };\n}\n\n/**\n * Unpack the OrderAppendix fields from a packed bigint.\n * @param packed\n */\nexport function unpackOrderAppendix(packed: BigDecimalish): OrderAppendix {\n let temp = toBigInt(packed);\n // Bitmasks lowest 8 bits for version\n const version = Number(bitMaskValue(temp, 8));\n // Shift out the version bits\n temp >>= 8n;\n // Repeat for the rest of the fields\n const isolated = Number(bitMaskValue(temp, 1));\n temp >>= 1n;\n const orderType = Number(bitMaskValue(temp, 2));\n temp >>= 2n;\n const reduceOnly = Number(bitMaskValue(temp, 1));\n temp >>= 1n;\n const trigger = Number(bitMaskValue(temp, 2));\n temp >>= 2n;\n const reserved = Number(bitMaskValue(temp, 18));\n temp >>= 18n;\n // The remaining bits are the value, which should be 96 bits\n const value = bitMaskValue(temp, 96);\n\n return mapBitValuesToAppendix({\n value,\n reserved,\n trigger,\n reduceOnly,\n orderType,\n isolated,\n version,\n });\n}\n"],"mappings":";;;AACA,SAAwB,gBAAgB;AACxC,SAAS,oCAAoC;AAC7C,SAAS,oBAAoB;AAG7B,SAAS,uBAAuB,MAA8C;AAC5E,QAAM,eAAe,MAAM;AACzB,YAAQ,KAAK,SAAS;AAAA,MACpB,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;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;AAAA,IACA;AAAA,EACF,CAAC;AACH;","names":[]}
1
+ {"version":3,"sources":["../../../../src/utils/orders/appendix/unpackOrderAppendix.ts"],"sourcesContent":["import { OrderAppendix } from '../../../types/orderAppendixTypes';\nimport { BigNumberish, toBigInt } from '../../math';\nimport { unpackIsolatedOrderAppendixValue } from './appendixIsolatedValue';\nimport { unpackTwapOrderAppendixValue } from './appendixTwapValue';\nimport { bitMaskValue } from './bitMaskValue';\nimport { PackedOrderAppendixBits } from './types';\n\nfunction mapBitValuesToAppendix(bits: PackedOrderAppendixBits): OrderAppendix {\n const triggerType = (() => {\n switch (bits.trigger) {\n case 1:\n return 'price';\n case 2:\n return 'twap';\n case 3:\n return 'twap_custom_amounts';\n default:\n return undefined;\n }\n })();\n const orderExecutionType = (() => {\n switch (bits.orderType) {\n case 0:\n return 'default';\n case 1:\n return 'ioc';\n case 2:\n return 'fok';\n case 3:\n return 'post_only';\n default:\n throw new Error(\n `[mapBitValuesToAppendix] Unknown order type: ${bits.orderType}`,\n );\n }\n })();\n const isolatedFields = (() => {\n if (bits.isolated) {\n return unpackIsolatedOrderAppendixValue(bits.value);\n }\n return undefined;\n })();\n const twapFields = (() => {\n if (triggerType === 'twap' || triggerType === 'twap_custom_amounts') {\n return unpackTwapOrderAppendixValue(bits.value);\n }\n })();\n const builderFields = (() => {\n if (bits.builderId) {\n return {\n builderId: bits.builderId,\n builderFeeRate: bits.builderFeeRate,\n };\n }\n return undefined;\n })();\n\n return {\n reduceOnly: !!bits.reduceOnly,\n orderExecutionType,\n triggerType,\n isolated: isolatedFields,\n twap: twapFields,\n builder: builderFields,\n };\n}\n\n/**\n * Unpack the OrderAppendix fields from a packed bigint.\n * @param packed\n */\nexport function unpackOrderAppendix(packed: BigNumberish): OrderAppendix {\n let temp = toBigInt(packed);\n // Bitmasks lowest 8 bits for version\n const version = Number(bitMaskValue(temp, 8));\n // Shift out the version bits\n temp >>= 8n;\n // Repeat for the rest of the fields\n const isolated = Number(bitMaskValue(temp, 1));\n temp >>= 1n;\n const orderType = Number(bitMaskValue(temp, 2));\n temp >>= 2n;\n const reduceOnly = Number(bitMaskValue(temp, 1));\n temp >>= 1n;\n const trigger = Number(bitMaskValue(temp, 2));\n temp >>= 2n;\n const reserved = Number(bitMaskValue(temp, 24));\n temp >>= 24n;\n const builderFeeRate = Number(bitMaskValue(temp, 10));\n temp >>= 10n;\n const builderId = Number(bitMaskValue(temp, 16));\n temp >>= 16n;\n // The remaining bits are the value, which should be 64 bits\n const value = bitMaskValue(temp, 64);\n\n return mapBitValuesToAppendix({\n value,\n builderId,\n builderFeeRate,\n reserved,\n trigger,\n reduceOnly,\n orderType,\n isolated,\n version,\n });\n}\n"],"mappings":";;;AACA,SAAuB,gBAAgB;AACvC,SAAS,wCAAwC;AACjD,SAAS,oCAAoC;AAC7C,SAAS,oBAAoB;AAG7B,SAAS,uBAAuB,MAA8C;AAC5E,QAAM,eAAe,MAAM;AACzB,YAAQ,KAAK,SAAS;AAAA,MACpB,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT;AACE,eAAO;AAAA,IACX;AAAA,EACF,GAAG;AACH,QAAM,sBAAsB,MAAM;AAChC,YAAQ,KAAK,WAAW;AAAA,MACtB,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT,KAAK;AACH,eAAO;AAAA,MACT;AACE,cAAM,IAAI;AAAA,UACR,gDAAgD,KAAK,SAAS;AAAA,QAChE;AAAA,IACJ;AAAA,EACF,GAAG;AACH,QAAM,kBAAkB,MAAM;AAC5B,QAAI,KAAK,UAAU;AACjB,aAAO,iCAAiC,KAAK,KAAK;AAAA,IACpD;AACA,WAAO;AAAA,EACT,GAAG;AACH,QAAM,cAAc,MAAM;AACxB,QAAI,gBAAgB,UAAU,gBAAgB,uBAAuB;AACnE,aAAO,6BAA6B,KAAK,KAAK;AAAA,IAChD;AAAA,EACF,GAAG;AACH,QAAM,iBAAiB,MAAM;AAC3B,QAAI,KAAK,WAAW;AAClB,aAAO;AAAA,QACL,WAAW,KAAK;AAAA,QAChB,gBAAgB,KAAK;AAAA,MACvB;AAAA,IACF;AACA,WAAO;AAAA,EACT,GAAG;AAEH,SAAO;AAAA,IACL,YAAY,CAAC,CAAC,KAAK;AAAA,IACnB;AAAA,IACA;AAAA,IACA,UAAU;AAAA,IACV,MAAM;AAAA,IACN,SAAS;AAAA,EACX;AACF;AAMO,SAAS,oBAAoB,QAAqC;AACvE,MAAI,OAAO,SAAS,MAAM;AAE1B,QAAM,UAAU,OAAO,aAAa,MAAM,CAAC,CAAC;AAE5C,WAAS;AAET,QAAM,WAAW,OAAO,aAAa,MAAM,CAAC,CAAC;AAC7C,WAAS;AACT,QAAM,YAAY,OAAO,aAAa,MAAM,CAAC,CAAC;AAC9C,WAAS;AACT,QAAM,aAAa,OAAO,aAAa,MAAM,CAAC,CAAC;AAC/C,WAAS;AACT,QAAM,UAAU,OAAO,aAAa,MAAM,CAAC,CAAC;AAC5C,WAAS;AACT,QAAM,WAAW,OAAO,aAAa,MAAM,EAAE,CAAC;AAC9C,WAAS;AACT,QAAM,iBAAiB,OAAO,aAAa,MAAM,EAAE,CAAC;AACpD,WAAS;AACT,QAAM,YAAY,OAAO,aAAa,MAAM,EAAE,CAAC;AAC/C,WAAS;AAET,QAAM,QAAQ,aAAa,MAAM,EAAE;AAEnC,SAAO,uBAAuB;AAAA,IAC5B;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF,CAAC;AACH;","names":[]}
@@ -17,13 +17,13 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
17
17
  // src/utils/orders/index.ts
18
18
  var orders_exports = {};
19
19
  module.exports = __toCommonJS(orders_exports);
20
+ __reExport(orders_exports, require("./appendix/index.cjs"), module.exports);
20
21
  __reExport(orders_exports, require("./orderNonce.cjs"), module.exports);
21
22
  __reExport(orders_exports, require("./recvTime.cjs"), module.exports);
22
- __reExport(orders_exports, require("./appendix/index.cjs"), module.exports);
23
23
  // Annotate the CommonJS export names for ESM import in node:
24
24
  0 && (module.exports = {
25
+ ...require("./appendix/index.cjs"),
25
26
  ...require("./orderNonce.cjs"),
26
- ...require("./recvTime.cjs"),
27
- ...require("./appendix/index.cjs")
27
+ ...require("./recvTime.cjs")
28
28
  });
29
29
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/utils/orders/index.ts"],"sourcesContent":["export * from './orderNonce';\nexport * from './recvTime';\nexport * from './appendix';\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,2BAAc,6BAAd;AACA,2BAAc,2BADd;AAEA,2BAAc,iCAFd;","names":[]}
1
+ {"version":3,"sources":["../../../src/utils/orders/index.ts"],"sourcesContent":["export * from './appendix';\nexport * from './orderNonce';\nexport * from './recvTime';\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,2BAAc,iCAAd;AACA,2BAAc,6BADd;AAEA,2BAAc,2BAFd;","names":[]}
@@ -1,11 +1,11 @@
1
- export { getOrderNonce, getRecvTimeFromOrderNonce } from './orderNonce.cjs';
2
- export { getDefaultRecvTime } from './recvTime.cjs';
3
1
  export { packTwapOrderAppendixValue, unpackTwapOrderAppendixValue } from './appendix/appendixTwapValue.cjs';
4
- export { unpackOrderAppendix } from './appendix/unpackOrderAppendix.cjs';
2
+ export { bitMaskValue } from './appendix/bitMaskValue.cjs';
5
3
  export { packOrderAppendix } from './appendix/packOrderAppendix.cjs';
6
4
  export { PackedOrderAppendixBits } from './appendix/types.cjs';
7
- export { bitMaskValue } from './appendix/bitMaskValue.cjs';
5
+ export { unpackOrderAppendix } from './appendix/unpackOrderAppendix.cjs';
6
+ export { getOrderNonce, getRecvTimeFromOrderNonce } from './orderNonce.cjs';
7
+ export { getDefaultRecvTime } from './recvTime.cjs';
8
8
  import '../../types/orderAppendixTypes.cjs';
9
- import '../math/bigDecimal.cjs';
9
+ import '../math/bigNumber.cjs';
10
10
  import 'bignumber.js';
11
11
  import '../../types/OrderExecutionType.cjs';