@drift-labs/common 1.0.58 → 1.0.60

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 (282) hide show
  1. package/lib/_deprecated/common-math.d.ts +10 -0
  2. package/lib/_deprecated/common-math.js +9 -0
  3. package/lib/_deprecated/common-math.js.map +1 -0
  4. package/lib/_deprecated/common-ui-utils.d.ts +248 -0
  5. package/lib/_deprecated/common-ui-utils.js +59 -0
  6. package/lib/_deprecated/common-ui-utils.js.map +1 -0
  7. package/lib/_deprecated/equality-checks.d.ts +2 -0
  8. package/lib/_deprecated/equality-checks.js +7 -0
  9. package/lib/_deprecated/equality-checks.js.map +1 -0
  10. package/lib/{common-ui-utils/market.d.ts → _deprecated/market-utils.d.ts} +5 -7
  11. package/lib/_deprecated/market-utils.js +18 -0
  12. package/lib/_deprecated/market-utils.js.map +1 -0
  13. package/lib/_deprecated/order-utils.d.ts +12 -0
  14. package/lib/_deprecated/order-utils.js +18 -0
  15. package/lib/_deprecated/order-utils.js.map +1 -0
  16. package/lib/_deprecated/trading-utils.d.ts +52 -0
  17. package/lib/_deprecated/trading-utils.js +27 -0
  18. package/lib/_deprecated/trading-utils.js.map +1 -0
  19. package/lib/_deprecated/user-utils.d.ts +17 -0
  20. package/lib/_deprecated/user-utils.js +12 -0
  21. package/lib/_deprecated/user-utils.js.map +1 -0
  22. package/lib/_deprecated/utils.d.ts +40 -0
  23. package/lib/_deprecated/utils.js +47 -0
  24. package/lib/_deprecated/utils.js.map +1 -0
  25. package/lib/clients/tvFeed.js +2 -2
  26. package/lib/clients/tvFeed.js.map +1 -1
  27. package/lib/drift/Drift/clients/AuthorityDrift/DriftOperations/index.js +8 -8
  28. package/lib/drift/Drift/clients/AuthorityDrift/DriftOperations/index.js.map +1 -1
  29. package/lib/drift/Drift/clients/AuthorityDrift/index.js +9 -9
  30. package/lib/drift/Drift/clients/AuthorityDrift/index.js.map +1 -1
  31. package/lib/drift/Drift/clients/CentralServerDrift/index.js +2 -2
  32. package/lib/drift/Drift/clients/CentralServerDrift/index.js.map +1 -1
  33. package/lib/drift/base/actions/trade/editOrder.d.ts +1 -1
  34. package/lib/drift/base/actions/trade/editOrder.js.map +1 -1
  35. package/lib/drift/base/actions/trade/margin.js +4 -4
  36. package/lib/drift/base/actions/trade/margin.js.map +1 -1
  37. package/lib/drift/base/actions/trade/openPerpOrder/auction.d.ts +1 -1
  38. package/lib/drift/base/actions/trade/openPerpOrder/auction.js +4 -3
  39. package/lib/drift/base/actions/trade/openPerpOrder/auction.js.map +1 -1
  40. package/lib/drift/base/actions/trade/openPerpOrder/dlobServer/index.js +2 -2
  41. package/lib/drift/base/actions/trade/openPerpOrder/dlobServer/index.js.map +1 -1
  42. package/lib/drift/base/actions/trade/openPerpOrder/isolatedPositionDeposit.js +2 -2
  43. package/lib/drift/base/actions/trade/openPerpOrder/isolatedPositionDeposit.js.map +1 -1
  44. package/lib/drift/base/actions/trade/openPerpOrder/openPerpMarketOrder/index.d.ts +1 -1
  45. package/lib/drift/base/actions/trade/openPerpOrder/openPerpMarketOrder/index.js +4 -4
  46. package/lib/drift/base/actions/trade/openPerpOrder/openPerpMarketOrder/index.js.map +1 -1
  47. package/lib/drift/base/actions/trade/openPerpOrder/openPerpNonMarketOrder/index.d.ts +1 -1
  48. package/lib/drift/base/actions/trade/openPerpOrder/openPerpNonMarketOrder/index.js +2 -2
  49. package/lib/drift/base/actions/trade/openPerpOrder/openPerpNonMarketOrder/index.js.map +1 -1
  50. package/lib/drift/base/actions/trade/openPerpOrder/openSwiftOrder/index.js +4 -3
  51. package/lib/drift/base/actions/trade/openPerpOrder/openSwiftOrder/index.js.map +1 -1
  52. package/lib/drift/base/actions/trade/openPerpOrder/positionMaxLeverage.js +2 -2
  53. package/lib/drift/base/actions/trade/openPerpOrder/positionMaxLeverage.js.map +1 -1
  54. package/lib/drift/base/actions/user/create.js +2 -2
  55. package/lib/drift/base/actions/user/create.js.map +1 -1
  56. package/lib/drift/base/details/user/balances.js +2 -2
  57. package/lib/drift/base/details/user/balances.js.map +1 -1
  58. package/lib/drift/base/details/user/positions.js +2 -2
  59. package/lib/drift/base/details/user/positions.js.map +1 -1
  60. package/lib/index.d.ts +28 -28
  61. package/lib/index.js +44 -29
  62. package/lib/index.js.map +1 -1
  63. package/lib/utils/accounts/index.d.ts +6 -0
  64. package/lib/utils/accounts/index.js +23 -0
  65. package/lib/utils/accounts/index.js.map +1 -0
  66. package/lib/utils/accounts/init.d.ts +22 -0
  67. package/lib/utils/accounts/init.js +90 -0
  68. package/lib/utils/accounts/init.js.map +1 -0
  69. package/lib/utils/accounts/keys.d.ts +22 -0
  70. package/lib/utils/accounts/keys.js +36 -0
  71. package/lib/utils/accounts/keys.js.map +1 -0
  72. package/lib/utils/accounts/multiple.d.ts +14 -0
  73. package/lib/utils/accounts/multiple.js +45 -0
  74. package/lib/utils/accounts/multiple.js.map +1 -0
  75. package/lib/utils/accounts/signature.d.ts +6 -0
  76. package/lib/utils/accounts/signature.js +53 -0
  77. package/lib/utils/accounts/signature.js.map +1 -0
  78. package/lib/utils/accounts/subaccounts.d.ts +8 -0
  79. package/lib/utils/accounts/subaccounts.js +31 -0
  80. package/lib/utils/accounts/subaccounts.js.map +1 -0
  81. package/lib/utils/{WalletConnectionState.d.ts → accounts/wallet.d.ts} +7 -1
  82. package/lib/utils/{WalletConnectionState.js → accounts/wallet.js} +32 -2
  83. package/lib/utils/accounts/wallet.js.map +1 -0
  84. package/lib/utils/core/arrays.d.ts +2 -0
  85. package/lib/utils/core/arrays.js +25 -0
  86. package/lib/utils/core/arrays.js.map +1 -0
  87. package/lib/utils/core/async.d.ts +5 -0
  88. package/lib/utils/core/async.js +17 -0
  89. package/lib/utils/core/async.js.map +1 -0
  90. package/lib/utils/core/cache.d.ts +1 -0
  91. package/lib/utils/core/cache.js +40 -0
  92. package/lib/utils/core/cache.js.map +1 -0
  93. package/lib/utils/core/data-structures.d.ts +30 -0
  94. package/lib/utils/core/data-structures.js +84 -0
  95. package/lib/utils/core/data-structures.js.map +1 -0
  96. package/lib/utils/{equalityChecks.d.ts → core/equality.d.ts} +1 -1
  97. package/lib/utils/{equalityChecks.js → core/equality.js} +3 -3
  98. package/lib/utils/core/equality.js.map +1 -0
  99. package/lib/utils/core/fetch.js.map +1 -0
  100. package/lib/utils/core/index.d.ts +7 -0
  101. package/lib/utils/core/index.js +24 -0
  102. package/lib/utils/core/index.js.map +1 -0
  103. package/lib/utils/core/serialization.d.ts +30 -0
  104. package/lib/utils/core/serialization.js +92 -0
  105. package/lib/utils/core/serialization.js.map +1 -0
  106. package/lib/utils/{enum.js → enum/index.js} +1 -1
  107. package/lib/utils/enum/index.js.map +1 -0
  108. package/lib/utils/index.d.ts +11 -176
  109. package/lib/utils/index.js +25 -594
  110. package/lib/utils/index.js.map +1 -1
  111. package/lib/utils/markets/balances.d.ts +6 -0
  112. package/lib/utils/markets/balances.js +29 -0
  113. package/lib/utils/markets/balances.js.map +1 -0
  114. package/lib/utils/markets/config.d.ts +5 -0
  115. package/lib/utils/markets/config.js +24 -0
  116. package/lib/utils/markets/config.js.map +1 -0
  117. package/lib/utils/markets/index.d.ts +6 -0
  118. package/lib/utils/markets/index.js +23 -0
  119. package/lib/utils/markets/index.js.map +1 -0
  120. package/lib/utils/markets/interest.d.ts +25 -0
  121. package/lib/utils/markets/interest.js +65 -0
  122. package/lib/utils/markets/interest.js.map +1 -0
  123. package/lib/utils/markets/leverage.d.ts +12 -0
  124. package/lib/utils/markets/leverage.js +60 -0
  125. package/lib/utils/markets/leverage.js.map +1 -0
  126. package/lib/utils/markets/operations.d.ts +21 -0
  127. package/lib/utils/markets/operations.js +59 -0
  128. package/lib/utils/markets/operations.js.map +1 -0
  129. package/lib/utils/math/bignum.d.ts +3 -0
  130. package/lib/utils/math/bignum.js +16 -0
  131. package/lib/utils/math/bignum.js.map +1 -0
  132. package/lib/utils/math/bn.d.ts +7 -0
  133. package/lib/utils/math/bn.js +58 -0
  134. package/lib/utils/math/bn.js.map +1 -0
  135. package/lib/utils/math/index.d.ts +7 -0
  136. package/lib/utils/math/index.js +24 -0
  137. package/lib/utils/math/index.js.map +1 -0
  138. package/lib/utils/math/numbers.d.ts +13 -0
  139. package/lib/utils/math/numbers.js +56 -0
  140. package/lib/utils/math/numbers.js.map +1 -0
  141. package/lib/utils/math/precision.d.ts +19 -0
  142. package/lib/utils/math/precision.js +73 -0
  143. package/lib/utils/math/precision.js.map +1 -0
  144. package/lib/utils/math/price.d.ts +12 -0
  145. package/lib/utils/math/price.js +45 -0
  146. package/lib/utils/math/price.js.map +1 -0
  147. package/lib/utils/math/sort.d.ts +13 -0
  148. package/lib/utils/math/sort.js +33 -0
  149. package/lib/utils/math/sort.js.map +1 -0
  150. package/lib/utils/math/spread.d.ts +8 -0
  151. package/lib/utils/math/spread.js +87 -0
  152. package/lib/utils/math/spread.js.map +1 -0
  153. package/lib/utils/orderbook/index.js +4 -4
  154. package/lib/utils/orderbook/index.js.map +1 -1
  155. package/lib/utils/orders/filters.d.ts +7 -0
  156. package/lib/utils/orders/filters.js +31 -0
  157. package/lib/utils/orders/filters.js.map +1 -0
  158. package/lib/utils/orders/flags.d.ts +12 -0
  159. package/lib/utils/orders/flags.js +44 -0
  160. package/lib/utils/orders/flags.js.map +1 -0
  161. package/lib/utils/orders/index.d.ts +6 -0
  162. package/lib/utils/orders/index.js +23 -0
  163. package/lib/utils/orders/index.js.map +1 -0
  164. package/lib/utils/orders/labels.d.ts +4 -0
  165. package/lib/utils/orders/labels.js +122 -0
  166. package/lib/utils/orders/labels.js.map +1 -0
  167. package/lib/utils/orders/misc.d.ts +11 -0
  168. package/lib/utils/orders/misc.js +27 -0
  169. package/lib/utils/orders/misc.js.map +1 -0
  170. package/lib/utils/orders/oracle.d.ts +5 -0
  171. package/lib/utils/orders/oracle.js +23 -0
  172. package/lib/utils/orders/oracle.js.map +1 -0
  173. package/lib/utils/orders/sort.d.ts +38 -0
  174. package/lib/utils/orders/sort.js +83 -0
  175. package/lib/utils/orders/sort.js.map +1 -0
  176. package/lib/utils/positions/index.d.ts +2 -0
  177. package/lib/{common-ui-utils → utils/positions}/index.js +1 -5
  178. package/lib/utils/positions/index.js.map +1 -0
  179. package/lib/utils/positions/open.d.ts +4 -0
  180. package/lib/{common-ui-utils/user.js → utils/positions/open.js} +10 -81
  181. package/lib/utils/positions/open.js.map +1 -0
  182. package/lib/utils/positions/user.d.ts +37 -0
  183. package/lib/utils/positions/user.js +74 -0
  184. package/lib/utils/positions/user.js.map +1 -0
  185. package/lib/utils/settings/settings.js.map +1 -0
  186. package/lib/utils/strings/convert.d.ts +11 -0
  187. package/lib/utils/{strings.js → strings/convert.js} +2 -51
  188. package/lib/utils/strings/convert.js.map +1 -0
  189. package/lib/utils/strings/format.d.ts +14 -0
  190. package/lib/utils/strings/format.js +61 -0
  191. package/lib/utils/strings/format.js.map +1 -0
  192. package/lib/utils/strings/index.d.ts +4 -0
  193. package/lib/utils/strings/index.js +21 -0
  194. package/lib/utils/strings/index.js.map +1 -0
  195. package/lib/utils/strings/parse.d.ts +4 -0
  196. package/lib/utils/strings/parse.js +25 -0
  197. package/lib/utils/strings/parse.js.map +1 -0
  198. package/lib/utils/strings/status.d.ts +15 -0
  199. package/lib/utils/strings/status.js +21 -0
  200. package/lib/utils/strings/status.js.map +1 -0
  201. package/lib/utils/token/account.d.ts +16 -0
  202. package/lib/utils/token/account.js +36 -0
  203. package/lib/utils/token/account.js.map +1 -0
  204. package/lib/utils/{token.d.ts → token/address.d.ts} +2 -7
  205. package/lib/utils/token/address.js +30 -0
  206. package/lib/utils/token/address.js.map +1 -0
  207. package/lib/utils/token/index.d.ts +3 -0
  208. package/lib/utils/token/index.js +20 -0
  209. package/lib/utils/token/index.js.map +1 -0
  210. package/lib/utils/token/instructions.d.ts +3 -0
  211. package/lib/utils/token/instructions.js +17 -0
  212. package/lib/utils/token/instructions.js.map +1 -0
  213. package/lib/utils/trading/auction.d.ts +82 -0
  214. package/lib/utils/trading/auction.js +208 -0
  215. package/lib/utils/trading/auction.js.map +1 -0
  216. package/lib/utils/trading/index.d.ts +7 -0
  217. package/lib/utils/trading/index.js +24 -0
  218. package/lib/utils/trading/index.js.map +1 -0
  219. package/lib/utils/trading/leverage.d.ts +18 -0
  220. package/lib/utils/trading/leverage.js +79 -0
  221. package/lib/utils/trading/leverage.js.map +1 -0
  222. package/lib/utils/trading/liquidation.d.ts +22 -0
  223. package/lib/utils/trading/liquidation.js +67 -0
  224. package/lib/utils/trading/liquidation.js.map +1 -0
  225. package/lib/utils/trading/lp.d.ts +4 -0
  226. package/lib/utils/trading/lp.js +20 -0
  227. package/lib/utils/trading/lp.js.map +1 -0
  228. package/lib/utils/trading/pnl.d.ts +34 -0
  229. package/lib/utils/trading/pnl.js +88 -0
  230. package/lib/utils/trading/pnl.js.map +1 -0
  231. package/lib/utils/trading/price.d.ts +12 -0
  232. package/lib/utils/trading/price.js +36 -0
  233. package/lib/utils/trading/price.js.map +1 -0
  234. package/lib/utils/trading/size.d.ts +27 -0
  235. package/lib/utils/trading/size.js +83 -0
  236. package/lib/utils/trading/size.js.map +1 -0
  237. package/lib/utils/{validation.d.ts → validation/address.d.ts} +1 -2
  238. package/lib/utils/{validation.js → validation/address.js} +4 -6
  239. package/lib/utils/validation/address.js.map +1 -0
  240. package/lib/utils/validation/index.d.ts +3 -0
  241. package/lib/utils/validation/index.js +20 -0
  242. package/lib/utils/validation/index.js.map +1 -0
  243. package/lib/utils/validation/input.d.ts +3 -0
  244. package/lib/utils/validation/input.js +33 -0
  245. package/lib/utils/validation/input.js.map +1 -0
  246. package/lib/utils/validation/notional.d.ts +2 -0
  247. package/lib/utils/validation/notional.js +8 -0
  248. package/lib/utils/validation/notional.js.map +1 -0
  249. package/package.json +92 -5
  250. package/lib/common-ui-utils/commonUiUtils.d.ts +0 -251
  251. package/lib/common-ui-utils/commonUiUtils.js +0 -647
  252. package/lib/common-ui-utils/commonUiUtils.js.map +0 -1
  253. package/lib/common-ui-utils/index.d.ts +0 -6
  254. package/lib/common-ui-utils/index.js.map +0 -1
  255. package/lib/common-ui-utils/market.js +0 -134
  256. package/lib/common-ui-utils/market.js.map +0 -1
  257. package/lib/common-ui-utils/order.d.ts +0 -25
  258. package/lib/common-ui-utils/order.js +0 -191
  259. package/lib/common-ui-utils/order.js.map +0 -1
  260. package/lib/common-ui-utils/settings/settings.js.map +0 -1
  261. package/lib/common-ui-utils/trading.d.ts +0 -79
  262. package/lib/common-ui-utils/trading.js +0 -313
  263. package/lib/common-ui-utils/trading.js.map +0 -1
  264. package/lib/common-ui-utils/user.d.ts +0 -18
  265. package/lib/common-ui-utils/user.js.map +0 -1
  266. package/lib/utils/WalletConnectionState.js.map +0 -1
  267. package/lib/utils/enum.js.map +0 -1
  268. package/lib/utils/equalityChecks.js.map +0 -1
  269. package/lib/utils/fetch.js.map +0 -1
  270. package/lib/utils/math.d.ts +0 -31
  271. package/lib/utils/math.js +0 -181
  272. package/lib/utils/math.js.map +0 -1
  273. package/lib/utils/strings.d.ts +0 -34
  274. package/lib/utils/strings.js.map +0 -1
  275. package/lib/utils/token.js +0 -45
  276. package/lib/utils/token.js.map +0 -1
  277. package/lib/utils/validation.js.map +0 -1
  278. /package/lib/utils/{fetch.d.ts → core/fetch.d.ts} +0 -0
  279. /package/lib/utils/{fetch.js → core/fetch.js} +0 -0
  280. /package/lib/utils/{enum.d.ts → enum/index.d.ts} +0 -0
  281. /package/lib/{common-ui-utils → utils}/settings/settings.d.ts +0 -0
  282. /package/lib/{common-ui-utils → utils}/settings/settings.js +0 -0
@@ -1,597 +1,28 @@
1
1
  "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MultiplexWebSocket = exports.ResultSlotIncrementer = exports.getSwiftConfirmationTimeoutMs = exports.COMMON_UTILS = exports.getTieredSortScore = exports.aprFromApy = exports.MultiSwitch = exports.Counter = exports.Ref = exports.getAnchorEnumString = exports.orderIsNull = exports.getPriceForUIOrderRecord = exports.getPriceForOrderRecord = exports.getPriceForBaseAndQuoteAmount = exports.filterTradeRecordsFromUIOrderRecords = exports.filterTradeRecordsFromOrderActionRecords = exports.uiOrderActionRecordIsTrade = exports.orderActionRecordIsTrade = exports.getUIOrderRecordsLaterThanTarget = exports.getLatestOfTwoOrderRecords = exports.getLatestOfTwoUIOrderRecords = exports.sortOrderRecords = exports.sortUIOrderRecords = exports.sortUIOrderActionRecords = exports.sortUIMatchedOrderRecordAndAction = exports.getSortScoreForOrderActionRecords = exports.getTradeInfoFromActionRecord = exports.getSortScoreForOrderRecords = exports.decodeStringifiableObject = exports.encodeStringifiableObject = exports.sleep = exports.ENUM_UTILS = exports.matchEnum = void 0;
4
- const sdk_1 = require("@drift-labs/sdk");
5
- const insuranceFund_1 = require("./insuranceFund");
6
- const enum_1 = require("./enum");
7
- Object.defineProperty(exports, "matchEnum", { enumerable: true, get: function () { return enum_1.matchEnum; } });
8
- Object.defineProperty(exports, "ENUM_UTILS", { enumerable: true, get: function () { return enum_1.ENUM_UTILS; } });
9
- async function sleep(ms) {
10
- return new Promise((resolve) => setTimeout(resolve, ms));
11
- }
12
- exports.sleep = sleep;
13
- const getStringifiableObjectEntry = (value) => {
14
- // If BN
15
- // if (value instanceof BN) { /* This method would be much safer but don't think it's possible to ensure that instances of classes match when they're in different npm packages */
16
- if (Object.keys(value).sort().join(',') === 'length,negative,red,words') {
17
- return [value.toString(), '_bgnm_'];
18
- }
19
- // If PublicKey
20
- // if (value instanceof PublicKey) { { /* This method would be much safer but don't think it's possible to ensure that instances of classes match when they're in different npm packages */
21
- if (Object.keys(value).sort().join(',') === '_bn') {
22
- return [value.toString(), '_pbky_'];
23
- }
24
- if (typeof value === 'object') {
25
- return [(0, exports.encodeStringifiableObject)(value), ''];
26
- }
27
- return [value, ''];
28
- };
29
- /**
30
- * Converts an objects with potential Pubkeys and BNs in it into a form that can be JSON stringified. When pubkeys get converted a _pbky_ suffix will be added to their key, and _bgnm_ for BNs.
31
- *
32
- * e.g.
33
- * input : {
34
- * QuoteAmount: BN
35
- * }
36
- *
37
- * output: {
38
- * _bgnm_QuoteAmount: string
39
- * }
40
- * @param value
41
- * @returns
42
- */
43
- const encodeStringifiableObject = (value) => {
44
- if (typeof value !== 'object')
45
- return value;
46
- if (Array.isArray(value)) {
47
- return value.map((entry) => (0, exports.encodeStringifiableObject)(entry));
48
- }
49
- const buildJsonObject = {};
50
- if (!value)
51
- return value;
52
- Object.entries(value).forEach(([key, val]) => {
53
- const [convertedVal, keyTag] = getStringifiableObjectEntry(val);
54
- buildJsonObject[`${keyTag}${key}`] = convertedVal;
55
- });
56
- return buildJsonObject;
57
- };
58
- exports.encodeStringifiableObject = encodeStringifiableObject;
59
- /**
60
- * Converts a parsed object with potential Pubkeys and BNs in it (in string form) to their proper form. Pubkey values must have a key starting in _pbky_ and BN values must have a key starting in _bnnm_
61
- *
62
- * * e.g.
63
- * input : {
64
- * _bgnm_QuoteAmount: string
65
- * }
66
- *
67
- * output: {
68
- * QuoteAmount: BN
69
- * }
70
- * @param value
71
- * @returns
72
- */
73
- const decodeStringifiableObject = (value) => {
74
- if (typeof value !== 'object')
75
- return value;
76
- if (Array.isArray(value)) {
77
- return value.map((entry) => (0, exports.decodeStringifiableObject)(entry));
78
- }
79
- const buildJsonObject = {};
80
- Object.entries(value)
81
- .filter((val) => val != undefined && val != null)
82
- .forEach(([key, val]) => {
83
- if (key.match(/^_pbky_/)) {
84
- buildJsonObject[key.replace('_pbky_', '')] = new sdk_1.PublicKey(val);
85
- return;
86
- }
87
- if (key.match(/^_bgnm_/)) {
88
- buildJsonObject[key.replace('_bgnm_', '')] = new sdk_1.BN(val);
89
- return;
90
- }
91
- if (typeof val === 'object' && val != undefined && val != null) {
92
- buildJsonObject[key] = (0, exports.decodeStringifiableObject)(val);
93
- return;
94
- }
95
- buildJsonObject[key] = val;
96
- });
97
- return buildJsonObject;
98
- };
99
- exports.decodeStringifiableObject = decodeStringifiableObject;
100
- const getChronologicalValueForOrderAction = (action) => {
101
- return (0, enum_1.matchEnum)(action, sdk_1.OrderAction.PLACE)
102
- ? 0
103
- : (0, enum_1.matchEnum)(action, sdk_1.OrderAction.FILL)
104
- ? 1
105
- : 2;
106
- };
107
- /**
108
- * Returns 1 if the first Order is chronologically later than the second Order, -1 if before, 0 if equal
109
- * @param orderA
110
- * @param orderB
111
- * @returns
112
- */
113
- const getSortScoreForOrderRecords = (orderA, orderB) => {
114
- if (orderA.slot !== orderB.slot) {
115
- return orderA.slot > orderB.slot ? 1 : -1;
116
- }
117
- return 0;
118
- };
119
- exports.getSortScoreForOrderRecords = getSortScoreForOrderRecords;
120
- const getTradeInfoFromActionRecord = (actionRecord) => {
121
- return {
122
- ts: actionRecord.ts,
123
- baseAssetAmount: actionRecord.taker
124
- ? actionRecord.takerOrderBaseAssetAmount
125
- : actionRecord.makerOrderBaseAssetAmount,
126
- baseAssetAmountFilled: actionRecord.taker
127
- ? actionRecord.takerOrderCumulativeBaseAssetAmountFilled
128
- : actionRecord.makerOrderCumulativeBaseAssetAmountFilled,
129
- quoteAssetAmountFilled: actionRecord.taker
130
- ? actionRecord.takerOrderCumulativeQuoteAssetAmountFilled
131
- : actionRecord.makerOrderCumulativeQuoteAssetAmountFilled,
132
- };
133
- };
134
- exports.getTradeInfoFromActionRecord = getTradeInfoFromActionRecord;
135
- /**
136
- * Returns 1 if the first Order is chronologically later than the second Order, -1 if before, 0 if equal
137
- * @param orderA
138
- * @param orderB
139
- * @returns
140
- */
141
- const getSortScoreForOrderActionRecords = (orderA, orderB) => {
142
- if (orderA.slot !== orderB.slot) {
143
- return orderA.slot > orderB.slot ? 1 : -1;
144
- }
145
- if (!(0, enum_1.matchEnum)(orderA.action, orderB.action)) {
146
- // @ts-ignore
147
- const orderAActionVal = getChronologicalValueForOrderAction(orderA.action);
148
- // @ts-ignore
149
- const orderBActionVal = getChronologicalValueForOrderAction(orderB.action);
150
- return orderAActionVal > orderBActionVal ? 1 : -1;
151
- }
152
- // @ts-ignore
153
- if (orderA.fillRecordId && orderB.fillRecordId) {
154
- if (!orderA.fillRecordId.eq(orderB.fillRecordId)) {
155
- // @ts-ignore
156
- return orderA.fillRecordId.gt(orderB.fillRecordId) ? 1 : -1;
157
- }
158
- }
159
- return 0;
160
- };
161
- exports.getSortScoreForOrderActionRecords = getSortScoreForOrderActionRecords;
162
- const sortUIMatchedOrderRecordAndAction = (records, direction = 'desc') => {
163
- const ascSortedRecords = records.sort((a, b) => (0, exports.getSortScoreForOrderActionRecords)(a.actionRecord, b.actionRecord));
164
- return direction === 'desc' ? ascSortedRecords.reverse() : ascSortedRecords;
165
- };
166
- exports.sortUIMatchedOrderRecordAndAction = sortUIMatchedOrderRecordAndAction;
167
- const sortUIOrderActionRecords = (records, direction = 'desc') => {
168
- const ascSortedRecords = records.sort(exports.getSortScoreForOrderActionRecords);
169
- return direction === 'desc' ? ascSortedRecords.reverse() : ascSortedRecords;
170
- };
171
- exports.sortUIOrderActionRecords = sortUIOrderActionRecords;
172
- const sortUIOrderRecords = (records, direction = 'desc') => {
173
- const ascSortedRecords = records.sort(exports.getSortScoreForOrderRecords);
174
- return direction === 'desc' ? ascSortedRecords.reverse() : ascSortedRecords;
175
- };
176
- exports.sortUIOrderRecords = sortUIOrderRecords;
177
- const sortOrderRecords = (records, direction = 'desc') => {
178
- const ascSortedRecords = records.sort(exports.getSortScoreForOrderRecords);
179
- return direction === 'desc' ? ascSortedRecords.reverse() : ascSortedRecords;
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
180
15
  };
181
- exports.sortOrderRecords = sortOrderRecords;
182
- const getLatestOfTwoUIOrderRecords = (orderA, orderB) => {
183
- return (0, exports.getSortScoreForOrderRecords)(orderA, orderB) === 1 ? orderA : orderB;
184
- };
185
- exports.getLatestOfTwoUIOrderRecords = getLatestOfTwoUIOrderRecords;
186
- const getLatestOfTwoOrderRecords = (orderA, orderB) => {
187
- return (0, exports.getSortScoreForOrderRecords)(orderA, orderB) === 1 ? orderA : orderB;
188
- };
189
- exports.getLatestOfTwoOrderRecords = getLatestOfTwoOrderRecords;
190
- const getUIOrderRecordsLaterThanTarget = (target, records) => records.filter((record) => (0, exports.getLatestOfTwoUIOrderRecords)(record, target) === record);
191
- exports.getUIOrderRecordsLaterThanTarget = getUIOrderRecordsLaterThanTarget;
192
- // Trade records are order records which have been filled
193
- const orderActionRecordIsTrade = (orderRecord) => orderRecord.baseAssetAmountFilled.gt(sdk_1.ZERO) &&
194
- // @ts-ignore
195
- (0, enum_1.matchEnum)(orderRecord.action, sdk_1.OrderAction.FILL) &&
196
- true;
197
- exports.orderActionRecordIsTrade = orderActionRecordIsTrade;
198
- const uiOrderActionRecordIsTrade = (orderRecord) => orderRecord.baseAssetAmountFilled.gtZero() &&
199
- (0, enum_1.matchEnum)(orderRecord.action, sdk_1.OrderAction.FILL) &&
200
- true;
201
- exports.uiOrderActionRecordIsTrade = uiOrderActionRecordIsTrade;
202
- // Trade records are order records which have been filled
203
- const filterTradeRecordsFromOrderActionRecords = (orderRecords) => orderRecords.filter(exports.orderActionRecordIsTrade);
204
- exports.filterTradeRecordsFromOrderActionRecords = filterTradeRecordsFromOrderActionRecords;
205
- // Trade records are order records which have been filled
206
- const filterTradeRecordsFromUIOrderRecords = (orderRecords) => orderRecords.filter(exports.uiOrderActionRecordIsTrade);
207
- exports.filterTradeRecordsFromUIOrderRecords = filterTradeRecordsFromUIOrderRecords;
208
- /**
209
- * Returns the average price for a given base amount and quote amount.
210
- * @param quoteAmount
211
- * @param baseAmount
212
- * @returns PRICE_PRECISION
213
- */
214
- const getPriceForBaseAndQuoteAmount = (quoteAmount, baseAmount) => {
215
- return quoteAmount
216
- .mul(sdk_1.PRICE_PRECISION)
217
- .mul(sdk_1.BASE_PRECISION)
218
- .div(sdk_1.QUOTE_PRECISION)
219
- .div(sdk_1.BigNum.from(baseAmount, sdk_1.BASE_PRECISION_EXP).val);
220
- };
221
- exports.getPriceForBaseAndQuoteAmount = getPriceForBaseAndQuoteAmount;
222
- const getPriceForOrderRecord = (orderRecord) => {
223
- return (0, exports.getPriceForBaseAndQuoteAmount)(
224
- // @ts-ignore
225
- orderRecord.quoteAssetAmountFilled,
226
- // @ts-ignore
227
- orderRecord.baseAssetAmountFilled);
228
- };
229
- exports.getPriceForOrderRecord = getPriceForOrderRecord;
230
- const getPriceForUIOrderRecord = (orderRecord) => {
231
- return orderRecord.quoteAssetAmountFilled
232
- .shiftTo(sdk_1.AMM_RESERVE_PRECISION_EXP)
233
- .shift(sdk_1.PRICE_PRECISION_EXP)
234
- .div(orderRecord.baseAssetAmountFilled.shiftTo(sdk_1.BASE_PRECISION_EXP))
235
- .shiftTo(sdk_1.PRICE_PRECISION_EXP);
236
- };
237
- exports.getPriceForUIOrderRecord = getPriceForUIOrderRecord;
238
- const orderIsNull = (order, side) => {
239
- return side === 'taker' ? !order.taker : !order.maker;
240
- };
241
- exports.orderIsNull = orderIsNull;
242
- const getAnchorEnumString = (enumVal) => {
243
- return Object.keys(enumVal)[0];
244
- };
245
- exports.getAnchorEnumString = getAnchorEnumString;
246
- class Ref {
247
- constructor(val) {
248
- this.val = val;
249
- }
250
- set(val) {
251
- this.val = val;
252
- }
253
- get() {
254
- return this.val;
255
- }
256
- }
257
- exports.Ref = Ref;
258
- class Counter {
259
- constructor() {
260
- this.val = 0;
261
- }
262
- get() {
263
- return this.val;
264
- }
265
- increment(value = 1) {
266
- this.val += value;
267
- }
268
- reset() {
269
- this.val = 0;
270
- }
271
- }
272
- exports.Counter = Counter;
273
- /**
274
- * A class which allows a group of switches to seperately turn a multiswitch on or off. The base state is the state of the "multiswitch" when all of the constituent switches are off. When any of the switches are "on" then the multiswitch flips to the opposite state
275
- *
276
- * If baseState is on => any switch being "on" will turn the multiswitch off.
277
- * If baseState is off => any switch being "off" will turn the multiswitch off.
278
- */
279
- class MultiSwitch {
280
- constructor(baseState = 'off') {
281
- this.baseState = baseState;
282
- this.switches = [];
283
- this.switchValue = 0;
284
- }
285
- getSwitchKey(key) {
286
- // If first time using switch, add to list of switches
287
- if (!this.switches.includes(key)) {
288
- this.switches.push(key);
289
- }
290
- const switchIndex = this.switches.indexOf(key);
291
- return 2 ** switchIndex;
292
- }
293
- switchOn(key) {
294
- if (this.baseState === 'on') {
295
- this._switchOff(key);
296
- return;
297
- }
298
- this._switchOn(key);
299
- }
300
- switchOff(key) {
301
- if (this.baseState === 'on') {
302
- this._switchOn(key);
303
- return;
304
- }
305
- this._switchOff(key);
306
- }
307
- _switchOff(key) {
308
- const switchKey = this.getSwitchKey(key);
309
- this.switchValue &= ~switchKey;
310
- }
311
- _switchOn(key) {
312
- const switchKey = this.getSwitchKey(key);
313
- this.switchValue |= switchKey;
314
- }
315
- get isOn() {
316
- // When the base state is on, then if any switch is on the multi-switch is off
317
- if (this.baseState === 'on') {
318
- return this.switchValue === 0;
319
- }
320
- if (this.baseState === 'off') {
321
- return this.switchValue > 0;
322
- }
323
- }
324
- }
325
- exports.MultiSwitch = MultiSwitch;
326
- /**
327
- * Returns the quote amount of the current open interest for a market, using the current oracle price
328
- * @param marketIndex
329
- * @param marketType
330
- * @param driftClient
331
- * @returns
332
- */
333
- const getCurrentOpenInterestForMarket = (marketIndex, marketType, driftClient) => {
334
- if (enum_1.ENUM_UTILS.match(marketType, sdk_1.MarketType.PERP)) {
335
- const market = driftClient.getPerpMarketAccount(marketIndex);
336
- const OI = sdk_1.BigNum.from(market.amm.baseAssetAmountLong.add(market.amm.baseAssetAmountShort.abs()), sdk_1.BASE_PRECISION_EXP);
337
- const priceData = driftClient.getOraclePriceDataAndSlot(market.amm.oracle, market.amm.oracleSource);
338
- const price = sdk_1.BigNum.from(priceData.data.price, sdk_1.PRICE_PRECISION_EXP);
339
- const quoteOIforMarket = price.toNum() * OI.toNum();
340
- return quoteOIforMarket;
341
- }
342
- else {
343
- throw new Error('Invalid market type for Open Interest calculation');
344
- }
345
- };
346
- /**
347
- * Gets the deposit APR for a spot market, in percent
348
- * @param marketIndex
349
- * @param marketType
350
- * @param driftClient
351
- * @returns
352
- */
353
- const getDepositAprForMarket = (marketIndex, marketType, driftClient) => {
354
- if (enum_1.ENUM_UTILS.match(marketType, sdk_1.MarketType.SPOT)) {
355
- const marketAccount = driftClient.getSpotMarketAccount(marketIndex);
356
- const depositApr = sdk_1.BigNum.from((0, sdk_1.calculateDepositRate)(marketAccount), sdk_1.SPOT_MARKET_RATE_PRECISION_EXP);
357
- const depositAprPct = depositApr.toNum() * 100;
358
- return depositAprPct;
359
- }
360
- else {
361
- throw new Error('Invalid market type for Deposit APR calculation');
362
- }
363
- };
364
- /**
365
- * Get's the borrow APR for a spot market, in percent
366
- * @param marketIndex
367
- * @param marketType
368
- * @param driftClient
369
- * @returns
370
- */
371
- const getBorrowAprForMarket = (marketIndex, marketType, driftClient) => {
372
- if (enum_1.ENUM_UTILS.match(marketType, sdk_1.MarketType.SPOT)) {
373
- const marketAccount = driftClient.getSpotMarketAccount(marketIndex);
374
- const depositApr = sdk_1.BigNum.from((0, sdk_1.calculateBorrowRate)(marketAccount), sdk_1.SPOT_MARKET_RATE_PRECISION_EXP);
375
- const depositAprPct = depositApr.toNum() * 100;
376
- return depositAprPct;
377
- }
378
- else {
379
- throw new Error('Invalid market type for Borrow APR calculation');
380
- }
381
- };
382
- const getTotalBorrowsForMarket = (market, driftClient) => {
383
- const marketAccount = driftClient.getSpotMarketAccount(market.marketIndex);
384
- const totalBorrowsTokenAmount = (0, sdk_1.getTokenAmount)(marketAccount.borrowBalance, driftClient.getSpotMarketAccount(marketAccount.marketIndex), sdk_1.SpotBalanceType.BORROW);
385
- const totalBorrowsAmountBigNum = sdk_1.BigNum.from(totalBorrowsTokenAmount, market.precisionExp);
386
- const priceData = driftClient.getOraclePriceDataAndSlot(marketAccount.oracle, marketAccount.oracleSource);
387
- const price = sdk_1.BigNum.from(priceData.data.price, sdk_1.PRICE_PRECISION_EXP);
388
- const totalBorrowsQuote = price.toNum() * totalBorrowsAmountBigNum.toNum();
389
- return Number(totalBorrowsQuote.toFixed(2));
390
- };
391
- const getTotalDepositsForMarket = (market, driftClient) => {
392
- const marketAccount = driftClient.getSpotMarketAccount(market.marketIndex);
393
- const totalDepositsTokenAmount = (0, sdk_1.getTokenAmount)(marketAccount.depositBalance, marketAccount, sdk_1.SpotBalanceType.DEPOSIT);
394
- const totalDepositsTokenAmountBigNum = sdk_1.BigNum.from(totalDepositsTokenAmount, market.precisionExp);
395
- const priceData = driftClient.getOraclePriceDataAndSlot(marketAccount.oracle, marketAccount.oracleSource);
396
- const price = sdk_1.BigNum.from(priceData.data.price, sdk_1.PRICE_PRECISION_EXP);
397
- const totalDepositsBase = totalDepositsTokenAmountBigNum.toNum();
398
- const totalDepositsQuote = price.toNum() * totalDepositsTokenAmountBigNum.toNum();
399
- return {
400
- totalDepositsBase,
401
- totalDepositsQuote,
402
- };
403
- };
404
- /**
405
- * Check if numbers divide exactly, accounting for floating point division annoyingness
406
- * @param numerator
407
- * @param denominator
408
- * @returns
409
- */
410
- const dividesExactly = (numerator, denominator) => {
411
- const division = numerator / denominator;
412
- const remainder = division % 1;
413
- if (remainder === 0)
414
- return true;
415
- // Because of floating point weirdness, we're just going to assume that if the remainder after dividing is less than 1/10^6 then the numbers do divide exactly
416
- if (Math.abs(remainder - 1) < 1 / 10 ** 6)
417
- return true;
418
- return false;
419
- };
420
- const toSnakeCase = (str) => str.replace(/[^\w]/g, '_').toLowerCase();
421
- const toCamelCase = (str) => {
422
- const words = str.split(/[_\-\s]+/); // split on underscores, hyphens, and spaces
423
- const firstWord = words[0].toLowerCase();
424
- const restWords = words
425
- .slice(1)
426
- .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase());
427
- return [firstWord, ...restWords].join('');
428
- };
429
- const aprFromApy = (apy, compoundsPerYear) => {
430
- const compoundedAmount = 1 + apy * 0.01;
431
- const estimatedApr = (Math.pow(compoundedAmount, 1 / compoundsPerYear) - 1) * compoundsPerYear;
432
- return estimatedApr * 100;
433
- };
434
- exports.aprFromApy = aprFromApy;
435
- /**
436
- * Helper utility to get a sort score for "tiered" parameters.
437
- *
438
- * Example: Want to sort students by Grade, but fall back to using Age if they are equal. This method will accept an array for each student of [grade, age] and return the appropriate sort score for each.
439
- *
440
- * @param aScores
441
- * @param bScores
442
- * @returns
443
- */
444
- const getTieredSortScore = (aScores, bScores) => {
445
- var _a, _b;
446
- const maxIndex = Math.max(aScores.length, bScores.length);
447
- for (let i = 0; i < maxIndex; i++) {
448
- const aScore = (_a = aScores[i]) !== null && _a !== void 0 ? _a : Number.MIN_SAFE_INTEGER;
449
- const bScore = (_b = bScores[i]) !== null && _b !== void 0 ? _b : Number.MIN_SAFE_INTEGER;
450
- if (aScore !== bScore)
451
- return aScore - bScore;
452
- }
453
- return 0;
454
- };
455
- exports.getTieredSortScore = getTieredSortScore;
456
- const normalizeBaseAssetSymbol = (symbol) => {
457
- return symbol.replace(/^1M/, '');
458
- };
459
- /**
460
- * Returns the number of standard deviations between a target value and the history of values to compare it to.
461
- * @param target
462
- * @param previousValues
463
- * @returns
464
- */
465
- const calculateZScore = (target, previousValues) => {
466
- const meanValue = calculateMean(previousValues);
467
- const standardDeviationValue = calculateStandardDeviation(previousValues, meanValue);
468
- const zScore = (target - meanValue) / standardDeviationValue;
469
- return zScore;
470
- };
471
- const calculateMean = (numbers) => {
472
- const sum = numbers.reduce((total, num) => total + num, 0);
473
- return sum / numbers.length;
474
- };
475
- const calculateMedian = (numbers) => {
476
- const sortedNumbers = numbers.sort();
477
- const middleIndex = Math.floor(sortedNumbers.length / 2);
478
- if (sortedNumbers.length % 2 === 0) {
479
- return (sortedNumbers[middleIndex - 1] + sortedNumbers[middleIndex]) / 2;
480
- }
481
- else {
482
- return sortedNumbers[middleIndex];
483
- }
484
- };
485
- const calculateStandardDeviation = (numbers, mean) => {
486
- const squaredDifferences = numbers.map((num) => Math.pow(num - mean, 2));
487
- const sumSquaredDifferences = squaredDifferences.reduce((total, diff) => total + diff, 0);
488
- const variance = sumSquaredDifferences / numbers.length;
489
- return Math.sqrt(variance);
490
- };
491
- const glueArray = (size, elements) => {
492
- const gluedElements = [];
493
- elements.forEach((element, index) => {
494
- const gluedIndex = Math.floor(index / size);
495
- if (gluedElements[gluedIndex]) {
496
- gluedElements[gluedIndex].push(element);
497
- }
498
- else {
499
- gluedElements[gluedIndex] = [element];
500
- }
501
- });
502
- return gluedElements;
503
- };
504
- const bnMin = (numbers) => {
505
- let min = numbers[0];
506
- for (let i = 1; i < numbers.length; i++) {
507
- if (numbers[i].lt(min)) {
508
- min = numbers[i];
509
- }
510
- }
511
- return min;
512
- };
513
- const bnMax = (numbers) => {
514
- let max = numbers[0];
515
- for (let i = 1; i < numbers.length; i++) {
516
- if (numbers[i].gt(max)) {
517
- max = numbers[i];
518
- }
519
- }
520
- return max;
521
- };
522
- const bnMedian = (numbers) => {
523
- const sortedNumbers = numbers.sort((a, b) => a.cmp(b));
524
- const middleIndex = Math.floor(sortedNumbers.length / 2);
525
- if (sortedNumbers.length % 2 === 0) {
526
- return sortedNumbers[middleIndex - 1]
527
- .add(sortedNumbers[middleIndex])
528
- .div(new sdk_1.BN(2));
529
- }
530
- else {
531
- return sortedNumbers[middleIndex];
532
- }
533
- };
534
- const bnMean = (numbers) => {
535
- let sum = new sdk_1.BN(0);
536
- for (let i = 0; i < numbers.length; i++) {
537
- sum = sum.add(numbers[i]);
538
- }
539
- return sum.div(new sdk_1.BN(numbers.length));
540
- };
541
- const timedPromise = async (promise) => {
542
- const start = Date.now();
543
- const promiseResult = await promise;
544
- return {
545
- promiseTime: Date.now() - start,
546
- promiseResult,
547
- };
548
- };
549
- const chunks = (array, size) => {
550
- return new Array(Math.ceil(array.length / size))
551
- .fill(null)
552
- .map((_, index) => index * size)
553
- .map((begin) => array.slice(begin, begin + size));
554
- };
555
- const getMultipleAccountsInfoChunked = async (connection, accounts) => {
556
- const accountChunks = chunks(accounts, 100); // 100 is limit for getMultipleAccountsInfo
557
- const responses = await Promise.all(accountChunks.map((chunk) => connection.getMultipleAccountsInfo(chunk)));
558
- return responses.flat();
559
- };
560
- exports.COMMON_UTILS = {
561
- getIfVaultBalance: insuranceFund_1.getIfVaultBalance,
562
- getIfStakingVaultApr: insuranceFund_1.getIfStakingVaultApr,
563
- getCurrentOpenInterestForMarket,
564
- getDepositAprForMarket,
565
- getBorrowAprForMarket,
566
- getTotalBorrowsForMarket,
567
- getTotalDepositsForMarket,
568
- dividesExactly,
569
- toSnakeCase,
570
- toCamelCase,
571
- getTieredSortScore: exports.getTieredSortScore,
572
- normalizeBaseAssetSymbol,
573
- calculateZScore,
574
- glueArray,
575
- timedPromise,
576
- chunks,
577
- getMultipleAccountsInfoChunked,
578
- MATH: {
579
- NUM: {
580
- mean: calculateMean,
581
- median: calculateMedian,
582
- },
583
- BN: {
584
- bnMax,
585
- bnMin,
586
- bnMean,
587
- bnMedian,
588
- },
589
- },
590
- };
591
- var signedMsgs_1 = require("./signedMsgs");
592
- Object.defineProperty(exports, "getSwiftConfirmationTimeoutMs", { enumerable: true, get: function () { return signedMsgs_1.getSwiftConfirmationTimeoutMs; } });
593
- var ResultSlotIncrementer_1 = require("./ResultSlotIncrementer");
594
- Object.defineProperty(exports, "ResultSlotIncrementer", { enumerable: true, get: function () { return ResultSlotIncrementer_1.ResultSlotIncrementer; } });
595
- var MultiplexWebSocket_1 = require("./MultiplexWebSocket");
596
- Object.defineProperty(exports, "MultiplexWebSocket", { enumerable: true, get: function () { return MultiplexWebSocket_1.MultiplexWebSocket; } });
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./math"), exports);
18
+ __exportStar(require("./strings"), exports);
19
+ __exportStar(require("./enum"), exports);
20
+ __exportStar(require("./validation"), exports);
21
+ __exportStar(require("./token"), exports);
22
+ __exportStar(require("./trading"), exports);
23
+ __exportStar(require("./markets"), exports);
24
+ __exportStar(require("./orders"), exports);
25
+ __exportStar(require("./positions"), exports);
26
+ __exportStar(require("./accounts"), exports);
27
+ __exportStar(require("./core"), exports);
597
28
  //# sourceMappingURL=index.js.map