@drift-labs/sdk 0.1.24 → 0.1.27

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 (167) hide show
  1. package/lib/accounts/bulkAccountLoader.d.ts +1 -0
  2. package/lib/accounts/bulkAccountLoader.js +16 -2
  3. package/lib/accounts/pollingClearingHouseAccountSubscriber.js +3 -3
  4. package/lib/accounts/pollingOracleSubscriber.d.ts +26 -0
  5. package/lib/accounts/pollingOracleSubscriber.js +79 -0
  6. package/lib/accounts/pollingTokenAccountSubscriber.js +2 -2
  7. package/lib/accounts/pollingUserAccountSubscriber.js +4 -4
  8. package/lib/accounts/types.d.ts +14 -1
  9. package/lib/accounts/webSocketAccountSubscriber.js +2 -2
  10. package/lib/accounts/webSocketClearingHouseAccountSubscriber.js +1 -1
  11. package/lib/accounts/webSocketUserAccountSubscriber.js +2 -2
  12. package/lib/addresses.js +5 -1
  13. package/lib/admin.d.ts +1 -1
  14. package/lib/admin.js +15 -10
  15. package/lib/clearingHouse.d.ts +4 -4
  16. package/lib/clearingHouse.js +56 -25
  17. package/lib/clearingHouseUser.js +18 -18
  18. package/lib/constants/markets.d.ts +8 -6
  19. package/lib/constants/markets.js +85 -26
  20. package/lib/constants/numericConstants.d.ts +1 -0
  21. package/lib/constants/numericConstants.js +2 -1
  22. package/lib/examples/makeTradeExample.js +6 -6
  23. package/lib/factory/oracleClient.d.ts +5 -0
  24. package/lib/factory/oracleClient.js +16 -0
  25. package/lib/idl/clearing_house.json +22 -2
  26. package/lib/idl/switchboard_v2.json +4663 -0
  27. package/lib/index.d.ts +5 -1
  28. package/lib/index.js +10 -2
  29. package/lib/math/amm.js +12 -12
  30. package/lib/math/conversion.js +1 -1
  31. package/lib/math/funding.d.ts +6 -6
  32. package/lib/math/funding.js +5 -17
  33. package/lib/math/market.d.ts +2 -0
  34. package/lib/math/market.js +8 -3
  35. package/lib/math/orders.js +9 -9
  36. package/lib/math/position.js +1 -1
  37. package/lib/math/trade.js +18 -18
  38. package/lib/mockUSDCFaucet.js +5 -1
  39. package/lib/oracles/pythClient.d.ts +14 -0
  40. package/lib/oracles/pythClient.js +53 -0
  41. package/lib/oracles/switchboardClient.d.ts +13 -0
  42. package/lib/oracles/switchboardClient.js +76 -0
  43. package/lib/oracles/types.d.ts +15 -0
  44. package/lib/oracles/types.js +2 -0
  45. package/lib/orderParams.d.ts +1 -1
  46. package/lib/orderParams.js +3 -3
  47. package/lib/orders.d.ts +3 -2
  48. package/lib/orders.js +29 -22
  49. package/lib/tx/retryTxSender.js +1 -1
  50. package/lib/types.d.ts +1 -0
  51. package/package.json +2 -1
  52. package/src/accounts/bulkAccountLoader.js +180 -0
  53. package/src/accounts/bulkAccountLoader.js.map +1 -0
  54. package/src/accounts/bulkAccountLoader.ts +19 -0
  55. package/src/accounts/bulkUserSubscription.js +56 -0
  56. package/src/accounts/bulkUserSubscription.js.map +1 -0
  57. package/src/accounts/pollingClearingHouseAccountSubscriber.js +210 -0
  58. package/src/accounts/pollingClearingHouseAccountSubscriber.js.map +1 -0
  59. package/src/accounts/pollingOracleSubscriber.js +65 -0
  60. package/src/accounts/pollingOracleSubscriber.js.map +1 -0
  61. package/src/accounts/pollingOracleSubscriber.ts +103 -0
  62. package/src/accounts/pollingTokenAccountSubscriber.js +65 -0
  63. package/src/accounts/pollingTokenAccountSubscriber.js.map +1 -0
  64. package/src/accounts/pollingUserAccountSubscriber.js +139 -0
  65. package/src/accounts/pollingUserAccountSubscriber.js.map +1 -0
  66. package/src/accounts/types.js +1 -0
  67. package/src/accounts/types.js.map +1 -0
  68. package/src/accounts/types.ts +22 -1
  69. package/src/accounts/utils.js +1 -0
  70. package/src/accounts/utils.js.map +1 -0
  71. package/src/accounts/webSocketAccountSubscriber.js +15 -27
  72. package/src/accounts/webSocketAccountSubscriber.js.map +1 -0
  73. package/src/accounts/webSocketClearingHouseAccountSubscriber.js +212 -0
  74. package/src/accounts/webSocketClearingHouseAccountSubscriber.js.map +1 -0
  75. package/src/accounts/webSocketUserAccountSubscriber.js +78 -0
  76. package/src/accounts/webSocketUserAccountSubscriber.js.map +1 -0
  77. package/src/addresses.js +20 -44
  78. package/src/addresses.js.map +1 -0
  79. package/src/admin.js +443 -0
  80. package/src/admin.js.map +1 -0
  81. package/src/admin.ts +2 -0
  82. package/src/assert/assert.js +10 -0
  83. package/src/assert/assert.js.map +1 -0
  84. package/src/clearingHouse.js +769 -0
  85. package/src/clearingHouse.js.map +1 -0
  86. package/src/clearingHouse.ts +47 -7
  87. package/src/clearingHouseUser.js +581 -0
  88. package/src/clearingHouseUser.js.map +1 -0
  89. package/src/config.js +37 -0
  90. package/src/config.js.map +1 -0
  91. package/src/constants/markets.js +167 -0
  92. package/src/constants/markets.js.map +1 -0
  93. package/src/constants/markets.ts +93 -31
  94. package/src/constants/numericConstants.js +22 -0
  95. package/src/constants/numericConstants.js.map +1 -0
  96. package/src/constants/numericConstants.ts +1 -0
  97. package/src/factory/clearingHouse.js +65 -0
  98. package/src/factory/clearingHouse.js.map +1 -0
  99. package/src/factory/clearingHouseUser.js +35 -0
  100. package/src/factory/clearingHouseUser.js.map +1 -0
  101. package/src/factory/oracleClient.js +17 -0
  102. package/src/factory/oracleClient.js.map +1 -0
  103. package/src/factory/oracleClient.ts +22 -0
  104. package/src/idl/clearing_house.json +22 -2
  105. package/src/idl/switchboard_v2.json +4663 -0
  106. package/src/index.js +56 -0
  107. package/src/index.js.map +1 -0
  108. package/src/index.ts +5 -1
  109. package/src/math/amm.js +285 -0
  110. package/src/math/amm.js.map +1 -0
  111. package/src/math/conversion.js +16 -0
  112. package/src/math/conversion.js.map +1 -0
  113. package/src/math/funding.js +223 -0
  114. package/src/math/funding.js.map +1 -0
  115. package/src/math/funding.ts +9 -25
  116. package/src/math/insuranceFund.js +23 -0
  117. package/src/math/insuranceFund.js.map +1 -0
  118. package/src/math/market.js +30 -0
  119. package/src/math/market.js.map +1 -0
  120. package/src/math/market.ts +9 -0
  121. package/src/math/orders.js +73 -0
  122. package/src/math/orders.js.map +1 -0
  123. package/src/math/position.js +121 -0
  124. package/src/math/position.js.map +1 -0
  125. package/src/math/trade.js +182 -0
  126. package/src/math/trade.js.map +1 -0
  127. package/src/math/utils.js +27 -0
  128. package/src/math/utils.js.map +1 -0
  129. package/src/mockUSDCFaucet.js +88 -116
  130. package/src/mockUSDCFaucet.js.map +1 -0
  131. package/src/oracles/pythClient.js +39 -0
  132. package/src/oracles/pythClient.js.map +1 -0
  133. package/src/oracles/pythClient.ts +49 -0
  134. package/src/oracles/switchboardClient.js +60 -0
  135. package/src/oracles/switchboardClient.js.map +1 -0
  136. package/src/oracles/switchboardClient.ts +87 -0
  137. package/src/oracles/types.js +3 -0
  138. package/src/oracles/types.js.map +1 -0
  139. package/src/oracles/types.ts +15 -0
  140. package/src/orderParams.js +109 -0
  141. package/src/orderParams.js.map +1 -0
  142. package/src/orderParams.ts +5 -3
  143. package/src/orders.js +172 -0
  144. package/src/orders.js.map +1 -0
  145. package/src/orders.ts +17 -4
  146. package/src/token/index.js +39 -0
  147. package/src/token/index.js.map +1 -0
  148. package/src/tx/defaultTxSender.js +13 -0
  149. package/src/tx/defaultTxSender.js.map +1 -0
  150. package/src/tx/retryTxSender.js +137 -0
  151. package/src/tx/retryTxSender.js.map +1 -0
  152. package/src/tx/types.js +3 -0
  153. package/src/tx/types.js.map +1 -0
  154. package/src/tx/utils.js +9 -0
  155. package/src/tx/utils.js.map +1 -0
  156. package/src/types.js +1 -0
  157. package/src/types.js.map +1 -0
  158. package/src/types.ts +1 -0
  159. package/src/util/computeUnits.js +17 -0
  160. package/src/util/computeUnits.js.map +1 -0
  161. package/src/util/tps.js +17 -0
  162. package/src/util/tps.js.map +1 -0
  163. package/src/wallet.js +23 -0
  164. package/src/wallet.js.map +1 -0
  165. package/lib/pythClient.d.ts +0 -7
  166. package/lib/pythClient.js +0 -25
  167. package/src/pythClient.ts +0 -15
@@ -1,7 +1,11 @@
1
1
  "use strict";
2
2
  var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
3
  if (k2 === undefined) k2 = k;
4
- Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[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);
5
9
  }) : (function(o, m, k, k2) {
6
10
  if (k2 === undefined) k2 = k;
7
11
  o[k2] = m[k];
@@ -40,6 +44,7 @@ const web3_js_1 = require("@solana/web3.js");
40
44
  const addresses_1 = require("./addresses");
41
45
  const utils_1 = require("./tx/utils");
42
46
  const clearingHouse_1 = require("./factory/clearingHouse");
47
+ const numericConstants_1 = require("./constants/numericConstants");
43
48
  /**
44
49
  * # ClearingHouse
45
50
  * This class is the main way to interact with Drift Protocol. It allows you to subscribe to the various accounts where the Market's state is stored, as well as: opening positions, liquidating, settling funding, depositing & withdrawing, and more.
@@ -73,8 +78,8 @@ class ClearingHouse {
73
78
  * @returns
74
79
  */
75
80
  static from(connection, wallet, clearingHouseProgramId, opts = anchor_1.Provider.defaultOptions()) {
76
- const config = clearingHouse_1.getWebSocketClearingHouseConfig(connection, wallet, clearingHouseProgramId, opts);
77
- return clearingHouse_1.getClearingHouse(config);
81
+ const config = (0, clearingHouse_1.getWebSocketClearingHouseConfig)(connection, wallet, clearingHouseProgramId, opts);
82
+ return (0, clearingHouse_1.getClearingHouse)(config);
78
83
  }
79
84
  /**
80
85
  *
@@ -126,7 +131,7 @@ class ClearingHouse {
126
131
  if (this.statePublicKey) {
127
132
  return this.statePublicKey;
128
133
  }
129
- this.statePublicKey = yield addresses_1.getClearingHouseStateAccountPublicKey(this.program.programId);
134
+ this.statePublicKey = yield (0, addresses_1.getClearingHouseStateAccountPublicKey)(this.program.programId);
130
135
  return this.statePublicKey;
131
136
  });
132
137
  }
@@ -168,7 +173,7 @@ class ClearingHouse {
168
173
  if (this.orderStatePublicKey) {
169
174
  return this.orderStatePublicKey;
170
175
  }
171
- this.orderStatePublicKey = yield addresses_1.getOrderStateAccountPublicKey(this.program.programId);
176
+ this.orderStatePublicKey = yield (0, addresses_1.getOrderStateAccountPublicKey)(this.program.programId);
172
177
  return this.orderStatePublicKey;
173
178
  });
174
179
  }
@@ -189,6 +194,8 @@ class ClearingHouse {
189
194
  this.program = newProgram;
190
195
  this.userAccountPublicKey = undefined;
191
196
  this.userAccount = undefined;
197
+ this.userOrdersAccountPublicKey = undefined;
198
+ this.userOrdersExist = undefined;
192
199
  }
193
200
  initializeUserAccount() {
194
201
  return __awaiter(this, void 0, void 0, function* () {
@@ -202,7 +209,7 @@ class ClearingHouse {
202
209
  }
203
210
  getInitializeUserInstructions() {
204
211
  return __awaiter(this, void 0, void 0, function* () {
205
- const [userAccountPublicKey, userAccountNonce] = yield addresses_1.getUserAccountPublicKeyAndNonce(this.program.programId, this.wallet.publicKey);
212
+ const [userAccountPublicKey, userAccountNonce] = yield (0, addresses_1.getUserAccountPublicKeyAndNonce)(this.program.programId, this.wallet.publicKey);
206
213
  const remainingAccounts = [];
207
214
  const optionalAccounts = {
208
215
  whitelistToken: false,
@@ -243,7 +250,7 @@ class ClearingHouse {
243
250
  if (!userAccountPublicKey) {
244
251
  userAccountPublicKey = yield this.getUserAccountPublicKey();
245
252
  }
246
- const [userOrdersAccountPublicKey, userOrdersAccountNonce] = yield addresses_1.getUserOrdersAccountPublicKeyAndNonce(this.program.programId, userAccountPublicKey);
253
+ const [userOrdersAccountPublicKey, userOrdersAccountNonce] = yield (0, addresses_1.getUserOrdersAccountPublicKeyAndNonce)(this.program.programId, userAccountPublicKey);
247
254
  return yield this.program.instruction.initializeUserOrders(userOrdersAccountNonce, {
248
255
  accounts: {
249
256
  user: userAccountPublicKey,
@@ -265,7 +272,7 @@ class ClearingHouse {
265
272
  if (this.userAccountPublicKey) {
266
273
  return this.userAccountPublicKey;
267
274
  }
268
- this.userAccountPublicKey = yield addresses_1.getUserAccountPublicKey(this.program.programId, this.wallet.publicKey);
275
+ this.userAccountPublicKey = yield (0, addresses_1.getUserAccountPublicKey)(this.program.programId, this.wallet.publicKey);
269
276
  return this.userAccountPublicKey;
270
277
  });
271
278
  }
@@ -287,7 +294,7 @@ class ClearingHouse {
287
294
  if (this.userOrdersAccountPublicKey) {
288
295
  return this.userOrdersAccountPublicKey;
289
296
  }
290
- this.userOrdersAccountPublicKey = yield addresses_1.getUserOrdersAccountPublicKey(this.program.programId, yield this.getUserAccountPublicKey());
297
+ this.userOrdersAccountPublicKey = yield (0, addresses_1.getUserOrdersAccountPublicKey)(this.program.programId, yield this.getUserAccountPublicKey());
291
298
  return this.userOrdersAccountPublicKey;
292
299
  });
293
300
  }
@@ -380,7 +387,7 @@ class ClearingHouse {
380
387
  }
381
388
  withdrawCollateral(amount, collateralAccountPublicKey) {
382
389
  return __awaiter(this, void 0, void 0, function* () {
383
- return this.txSender.send(utils_1.wrapInTx(yield this.getWithdrawCollateralIx(amount, collateralAccountPublicKey)), [], this.opts);
390
+ return this.txSender.send((0, utils_1.wrapInTx)(yield this.getWithdrawCollateralIx(amount, collateralAccountPublicKey)), [], this.opts);
384
391
  });
385
392
  }
386
393
  getWithdrawCollateralIx(amount, collateralAccountPublicKey) {
@@ -409,7 +416,7 @@ class ClearingHouse {
409
416
  }
410
417
  openPosition(direction, amount, marketIndex, limitPrice, discountToken, referrer) {
411
418
  return __awaiter(this, void 0, void 0, function* () {
412
- return yield this.txSender.send(utils_1.wrapInTx(yield this.getOpenPositionIx(direction, amount, marketIndex, limitPrice, discountToken, referrer)), [], this.opts);
419
+ return yield this.txSender.send((0, utils_1.wrapInTx)(yield this.getOpenPositionIx(direction, amount, marketIndex, limitPrice, discountToken, referrer)), [], this.opts);
413
420
  });
414
421
  }
415
422
  getOpenPositionIx(direction, amount, marketIndex, limitPrice, discountToken, referrer) {
@@ -475,7 +482,7 @@ class ClearingHouse {
475
482
  }
476
483
  placeOrder(orderParams, discountToken, referrer) {
477
484
  return __awaiter(this, void 0, void 0, function* () {
478
- return yield this.txSender.send(utils_1.wrapInTx(yield this.getPlaceOrderIx(orderParams, discountToken, referrer)), [], this.opts);
485
+ return yield this.txSender.send((0, utils_1.wrapInTx)(yield this.getPlaceOrderIx(orderParams, discountToken, referrer)), [], this.opts);
479
486
  });
480
487
  }
481
488
  getPlaceOrderIx(orderParams, discountToken, referrer) {
@@ -505,6 +512,13 @@ class ClearingHouse {
505
512
  isSigner: false,
506
513
  });
507
514
  }
515
+ if (!orderParams.oraclePriceOffset.eq(numericConstants_1.ZERO)) {
516
+ remainingAccounts.push({
517
+ pubkey: priceOracle,
518
+ isWritable: false,
519
+ isSigner: false,
520
+ });
521
+ }
508
522
  const state = this.getStateAccount();
509
523
  const orderState = this.getOrderStateAccount();
510
524
  return yield this.program.instruction.placeOrder(orderParams, {
@@ -519,23 +533,30 @@ class ClearingHouse {
519
533
  fundingRateHistory: state.fundingRateHistory,
520
534
  orderState: yield this.getOrderStatePublicKey(),
521
535
  orderHistory: orderState.orderHistory,
522
- oracle: priceOracle,
523
536
  },
524
537
  remainingAccounts,
525
538
  });
526
539
  });
527
540
  }
528
- cancelOrder(orderId) {
541
+ cancelOrder(orderId, oracle) {
529
542
  return __awaiter(this, void 0, void 0, function* () {
530
- return yield this.txSender.send(utils_1.wrapInTx(yield this.getCancelOrderIx(orderId)), [], this.opts);
543
+ return yield this.txSender.send((0, utils_1.wrapInTx)(yield this.getCancelOrderIx(orderId, oracle)), [], this.opts);
531
544
  });
532
545
  }
533
- getCancelOrderIx(orderId) {
546
+ getCancelOrderIx(orderId, oracle) {
534
547
  return __awaiter(this, void 0, void 0, function* () {
535
548
  const userAccountPublicKey = yield this.getUserAccountPublicKey();
536
549
  const userAccount = yield this.getUserAccount();
537
550
  const state = this.getStateAccount();
538
551
  const orderState = this.getOrderStateAccount();
552
+ const remainingAccounts = [];
553
+ if (oracle) {
554
+ remainingAccounts.push({
555
+ pubkey: oracle,
556
+ isWritable: false,
557
+ isSigner: false,
558
+ });
559
+ }
539
560
  return yield this.program.instruction.cancelOrder(orderId, {
540
561
  accounts: {
541
562
  state: yield this.getStatePublicKey(),
@@ -549,20 +570,29 @@ class ClearingHouse {
549
570
  orderState: yield this.getOrderStatePublicKey(),
550
571
  orderHistory: orderState.orderHistory,
551
572
  },
573
+ remainingAccounts,
552
574
  });
553
575
  });
554
576
  }
555
- cancelOrderByUserId(userOrderId) {
577
+ cancelOrderByUserId(userOrderId, oracle) {
556
578
  return __awaiter(this, void 0, void 0, function* () {
557
- return yield this.txSender.send(utils_1.wrapInTx(yield this.getCancelOrderByUserIdIx(userOrderId)), [], this.opts);
579
+ return yield this.txSender.send((0, utils_1.wrapInTx)(yield this.getCancelOrderByUserIdIx(userOrderId, oracle)), [], this.opts);
558
580
  });
559
581
  }
560
- getCancelOrderByUserIdIx(userOrderId) {
582
+ getCancelOrderByUserIdIx(userOrderId, oracle) {
561
583
  return __awaiter(this, void 0, void 0, function* () {
562
584
  const userAccountPublicKey = yield this.getUserAccountPublicKey();
563
585
  const userAccount = yield this.getUserAccount();
564
586
  const state = this.getStateAccount();
565
587
  const orderState = this.getOrderStateAccount();
588
+ const remainingAccounts = [];
589
+ if (oracle) {
590
+ remainingAccounts.push({
591
+ pubkey: oracle,
592
+ isWritable: false,
593
+ isSigner: false,
594
+ });
595
+ }
566
596
  return yield this.program.instruction.cancelOrderByUserId(userOrderId, {
567
597
  accounts: {
568
598
  state: yield this.getStatePublicKey(),
@@ -576,12 +606,13 @@ class ClearingHouse {
576
606
  orderState: yield this.getOrderStatePublicKey(),
577
607
  orderHistory: orderState.orderHistory,
578
608
  },
609
+ remainingAccounts,
579
610
  });
580
611
  });
581
612
  }
582
613
  fillOrder(userAccountPublicKey, userOrdersAccountPublicKey, order) {
583
614
  return __awaiter(this, void 0, void 0, function* () {
584
- return yield this.txSender.send(utils_1.wrapInTx(yield this.getFillOrderIx(userAccountPublicKey, userOrdersAccountPublicKey, order)), [], this.opts);
615
+ return yield this.txSender.send((0, utils_1.wrapInTx)(yield this.getFillOrderIx(userAccountPublicKey, userOrdersAccountPublicKey, order)), [], this.opts);
585
616
  });
586
617
  }
587
618
  getFillOrderIx(userAccountPublicKey, userOrdersAccountPublicKey, order) {
@@ -639,7 +670,7 @@ class ClearingHouse {
639
670
  }
640
671
  placeAndFillOrder(orderParams, discountToken, referrer) {
641
672
  return __awaiter(this, void 0, void 0, function* () {
642
- return yield this.txSender.send(utils_1.wrapInTx(yield this.getPlaceAndFillOrderIx(orderParams, discountToken, referrer)), [], this.opts);
673
+ return yield this.txSender.send((0, utils_1.wrapInTx)(yield this.getPlaceAndFillOrderIx(orderParams, discountToken, referrer)), [], this.opts);
643
674
  });
644
675
  }
645
676
  getPlaceAndFillOrderIx(orderParams, discountToken, referrer) {
@@ -700,7 +731,7 @@ class ClearingHouse {
700
731
  */
701
732
  closePosition(marketIndex, discountToken, referrer) {
702
733
  return __awaiter(this, void 0, void 0, function* () {
703
- return yield this.txSender.send(utils_1.wrapInTx(yield this.getClosePositionIx(marketIndex, discountToken, referrer)), [], this.opts);
734
+ return yield this.txSender.send((0, utils_1.wrapInTx)(yield this.getClosePositionIx(marketIndex, discountToken, referrer)), [], this.opts);
704
735
  });
705
736
  }
706
737
  getClosePositionIx(marketIndex, discountToken, referrer) {
@@ -748,7 +779,7 @@ class ClearingHouse {
748
779
  }
749
780
  liquidate(liquidateeUserAccountPublicKey) {
750
781
  return __awaiter(this, void 0, void 0, function* () {
751
- return this.txSender.send(utils_1.wrapInTx(yield this.getLiquidateIx(liquidateeUserAccountPublicKey)), [], this.opts);
782
+ return this.txSender.send((0, utils_1.wrapInTx)(yield this.getLiquidateIx(liquidateeUserAccountPublicKey)), [], this.opts);
752
783
  });
753
784
  }
754
785
  getLiquidateIx(liquidateeUserAccountPublicKey) {
@@ -792,7 +823,7 @@ class ClearingHouse {
792
823
  }
793
824
  updateFundingRate(oracle, marketIndex) {
794
825
  return __awaiter(this, void 0, void 0, function* () {
795
- return this.txSender.send(utils_1.wrapInTx(yield this.getUpdateFundingRateIx(oracle, marketIndex)), [], this.opts);
826
+ return this.txSender.send((0, utils_1.wrapInTx)(yield this.getUpdateFundingRateIx(oracle, marketIndex)), [], this.opts);
796
827
  });
797
828
  }
798
829
  getUpdateFundingRateIx(oracle, marketIndex) {
@@ -810,7 +841,7 @@ class ClearingHouse {
810
841
  }
811
842
  settleFundingPayment(userAccount, userPositionsAccount) {
812
843
  return __awaiter(this, void 0, void 0, function* () {
813
- return this.txSender.send(utils_1.wrapInTx(yield this.getSettleFundingPaymentIx(userAccount, userPositionsAccount)), [], this.opts);
844
+ return this.txSender.send((0, utils_1.wrapInTx)(yield this.getSettleFundingPaymentIx(userAccount, userPositionsAccount)), [], this.opts);
814
845
  });
815
846
  }
816
847
  getSettleFundingPaymentIx(userAccount, userPositionsAccount) {
@@ -39,8 +39,8 @@ class ClearingHouseUser {
39
39
  static from(clearingHouse, authority) {
40
40
  if (clearingHouse.accountSubscriber.type !== 'websocket')
41
41
  throw 'This method only works for clearing houses with a websocket account listener. Try using the getClearingHouseUser factory method to initialize a ClearingHouseUser instead';
42
- const config = clearingHouseUser_1.getWebSocketClearingHouseUserConfig(clearingHouse, authority);
43
- return clearingHouseUser_1.getClearingHouseUser(config);
42
+ const config = (0, clearingHouseUser_1.getWebSocketClearingHouseUserConfig)(clearingHouse, authority);
43
+ return (0, clearingHouseUser_1.getClearingHouseUser)(config);
44
44
  }
45
45
  /**
46
46
  * Subscribe to ClearingHouseUser state accounts
@@ -113,7 +113,7 @@ class ClearingHouseUser {
113
113
  if (this.userAccountPublicKey) {
114
114
  return this.userAccountPublicKey;
115
115
  }
116
- this.userAccountPublicKey = yield addresses_1.getUserAccountPublicKey(this.clearingHouse.program.programId, this.authority);
116
+ this.userAccountPublicKey = yield (0, addresses_1.getUserAccountPublicKey)(this.clearingHouse.program.programId, this.authority);
117
117
  return this.userAccountPublicKey;
118
118
  });
119
119
  }
@@ -122,7 +122,7 @@ class ClearingHouseUser {
122
122
  if (this.userOrdersAccountPublicKey) {
123
123
  return this.userOrdersAccountPublicKey;
124
124
  }
125
- this.userOrdersAccountPublicKey = yield _1.getUserOrdersAccountPublicKey(this.clearingHouse.program.programId, yield this.getUserAccountPublicKey());
125
+ this.userOrdersAccountPublicKey = yield (0, _1.getUserOrdersAccountPublicKey)(this.clearingHouse.program.programId, yield this.getUserAccountPublicKey());
126
126
  return this.userOrdersAccountPublicKey;
127
127
  });
128
128
  }
@@ -155,7 +155,7 @@ class ClearingHouseUser {
155
155
  getInitialMarginRequirement() {
156
156
  return this.getUserPositionsAccount().positions.reduce((marginRequirement, marketPosition) => {
157
157
  const market = this.clearingHouse.getMarket(marketPosition.marketIndex);
158
- return marginRequirement.add(_1.calculateBaseAssetValue(market, marketPosition)
158
+ return marginRequirement.add((0, _1.calculateBaseAssetValue)(market, marketPosition)
159
159
  .mul(new _1.BN(market.marginRatioInitial))
160
160
  .div(numericConstants_1.MARGIN_PRECISION));
161
161
  }, numericConstants_1.ZERO);
@@ -166,7 +166,7 @@ class ClearingHouseUser {
166
166
  getPartialMarginRequirement() {
167
167
  return this.getUserPositionsAccount().positions.reduce((marginRequirement, marketPosition) => {
168
168
  const market = this.clearingHouse.getMarket(marketPosition.marketIndex);
169
- return marginRequirement.add(_1.calculateBaseAssetValue(market, marketPosition)
169
+ return marginRequirement.add((0, _1.calculateBaseAssetValue)(market, marketPosition)
170
170
  .mul(new _1.BN(market.marginRatioPartial))
171
171
  .div(numericConstants_1.MARGIN_PRECISION));
172
172
  }, numericConstants_1.ZERO);
@@ -180,7 +180,7 @@ class ClearingHouseUser {
180
180
  .positions.filter((pos) => marketIndex ? pos.marketIndex === marketIndex : true)
181
181
  .reduce((pnl, marketPosition) => {
182
182
  const market = this.clearingHouse.getMarket(marketPosition.marketIndex);
183
- return pnl.add(_1.calculatePositionPNL(market, marketPosition, withFunding));
183
+ return pnl.add((0, _1.calculatePositionPNL)(market, marketPosition, withFunding));
184
184
  }, numericConstants_1.ZERO);
185
185
  }
186
186
  /**
@@ -192,7 +192,7 @@ class ClearingHouseUser {
192
192
  .positions.filter((pos) => marketIndex ? pos.marketIndex === marketIndex : true)
193
193
  .reduce((pnl, marketPosition) => {
194
194
  const market = this.clearingHouse.getMarket(marketPosition.marketIndex);
195
- return pnl.add(_1.calculatePositionFundingPNL(market, marketPosition));
195
+ return pnl.add((0, _1.calculatePositionFundingPNL)(market, marketPosition));
196
196
  }, numericConstants_1.ZERO);
197
197
  }
198
198
  /**
@@ -210,7 +210,7 @@ class ClearingHouseUser {
210
210
  getTotalPositionValue() {
211
211
  return this.getUserPositionsAccount().positions.reduce((positionValue, marketPosition) => {
212
212
  const market = this.clearingHouse.getMarket(marketPosition.marketIndex);
213
- return positionValue.add(_1.calculateBaseAssetValue(market, marketPosition));
213
+ return positionValue.add((0, _1.calculateBaseAssetValue)(market, marketPosition));
214
214
  }, numericConstants_1.ZERO);
215
215
  }
216
216
  /**
@@ -220,7 +220,7 @@ class ClearingHouseUser {
220
220
  getPositionValue(marketIndex) {
221
221
  const userPosition = this.getUserPosition(marketIndex) || this.getEmptyPosition(marketIndex);
222
222
  const market = this.clearingHouse.getMarket(userPosition.marketIndex);
223
- return _1.calculateBaseAssetValue(market, userPosition);
223
+ return (0, _1.calculateBaseAssetValue)(market, userPosition);
224
224
  }
225
225
  getPositionSide(currentPosition) {
226
226
  if (currentPosition.baseAssetAmount.gt(numericConstants_1.ZERO)) {
@@ -239,10 +239,10 @@ class ClearingHouseUser {
239
239
  */
240
240
  getPositionEstimatedExitPriceAndPnl(position, amountToClose) {
241
241
  const market = this.clearingHouse.getMarket(position.marketIndex);
242
- const entryPrice = position_1.calculateEntryPrice(position);
242
+ const entryPrice = (0, position_1.calculateEntryPrice)(position);
243
243
  if (amountToClose) {
244
244
  if (amountToClose.eq(numericConstants_1.ZERO)) {
245
- return [_1.calculateMarkPrice(market), numericConstants_1.ZERO];
245
+ return [(0, _1.calculateMarkPrice)(market), numericConstants_1.ZERO];
246
246
  }
247
247
  position = {
248
248
  baseAssetAmount: amountToClose,
@@ -251,7 +251,7 @@ class ClearingHouseUser {
251
251
  quoteAssetAmount: position.quoteAssetAmount,
252
252
  };
253
253
  }
254
- const baseAssetValue = _1.calculateBaseAssetValue(market, position);
254
+ const baseAssetValue = (0, _1.calculateBaseAssetValue)(market, position);
255
255
  if (position.baseAssetAmount.eq(numericConstants_1.ZERO)) {
256
256
  return [numericConstants_1.ZERO, numericConstants_1.ZERO];
257
257
  }
@@ -376,13 +376,13 @@ class ClearingHouseUser {
376
376
  if (proposedBaseAssetAmount.eq(numericConstants_1.ZERO))
377
377
  return new _1.BN(-1);
378
378
  const market = this.clearingHouse.getMarket(proposedMarketPosition.marketIndex);
379
- const proposedMarketPositionValue = _1.calculateBaseAssetValue(market, proposedMarketPosition);
379
+ const proposedMarketPositionValue = (0, _1.calculateBaseAssetValue)(market, proposedMarketPosition);
380
380
  // total position value after trade
381
381
  const totalPositionValueAfterTrade = totalPositionValueExcludingTargetMarket.add(proposedMarketPositionValue);
382
382
  const marginRequirementExcludingTargetMarket = this.getUserPositionsAccount().positions.reduce((totalMarginRequirement, position) => {
383
383
  if (!position.marketIndex.eq(marketPosition.marketIndex)) {
384
384
  const market = this.clearingHouse.getMarket(position.marketIndex);
385
- const positionValue = _1.calculateBaseAssetValue(market, position);
385
+ const positionValue = (0, _1.calculateBaseAssetValue)(market, position);
386
386
  const marketMarginRequirement = positionValue
387
387
  .mul(partial
388
388
  ? new _1.BN(market.marginRatioPartial)
@@ -426,13 +426,13 @@ class ClearingHouseUser {
426
426
  }
427
427
  let markPriceAfterTrade;
428
428
  if (positionBaseSizeChange.eq(numericConstants_1.ZERO)) {
429
- markPriceAfterTrade = _1.calculateMarkPrice(this.clearingHouse.getMarket(marketPosition.marketIndex));
429
+ markPriceAfterTrade = (0, _1.calculateMarkPrice)(this.clearingHouse.getMarket(marketPosition.marketIndex));
430
430
  }
431
431
  else {
432
432
  const direction = positionBaseSizeChange.gt(numericConstants_1.ZERO)
433
433
  ? _1.PositionDirection.LONG
434
434
  : _1.PositionDirection.SHORT;
435
- markPriceAfterTrade = _1.calculateTradeSlippage(direction, positionBaseSizeChange.abs(), this.clearingHouse.getMarket(marketPosition.marketIndex), 'base')[3]; // newPrice after swap
435
+ markPriceAfterTrade = (0, _1.calculateTradeSlippage)(direction, positionBaseSizeChange.abs(), this.clearingHouse.getMarket(marketPosition.marketIndex), 'base')[3]; // newPrice after swap
436
436
  }
437
437
  if (priceDelta.gt(markPriceAfterTrade)) {
438
438
  return new _1.BN(-1);
@@ -483,7 +483,7 @@ class ClearingHouseUser {
483
483
  getMaxTradeSizeUSDC(targetMarketIndex, tradeSide) {
484
484
  const currentPosition = this.getUserPosition(targetMarketIndex) ||
485
485
  this.getEmptyPosition(targetMarketIndex);
486
- const targetSide = types_1.isVariant(tradeSide, 'short') ? 'short' : 'long';
486
+ const targetSide = (0, types_1.isVariant)(tradeSide, 'short') ? 'short' : 'long';
487
487
  const currentPositionSide = (currentPosition === null || currentPosition === void 0 ? void 0 : currentPosition.baseAssetAmount.isNeg())
488
488
  ? 'short'
489
489
  : 'long';
@@ -1,12 +1,14 @@
1
1
  /// <reference types="bn.js" />
2
- import { BN } from '../';
3
- declare type Market = {
2
+ import { BN, OracleSource } from '../';
3
+ export declare type MarketConfig = {
4
+ fullName?: string;
5
+ category?: string[];
4
6
  symbol: string;
5
7
  baseAssetSymbol: string;
6
8
  marketIndex: BN;
7
- devnetPythOracle: string;
8
- mainnetPythOracle: string;
9
+ devnetPublicKey: string;
10
+ mainnetPublicKey: string;
9
11
  launchTs: number;
12
+ oracleSource: OracleSource;
10
13
  };
11
- export declare const Markets: Market[];
12
- export {};
14
+ export declare const Markets: MarketConfig[];
@@ -4,108 +4,167 @@ exports.Markets = void 0;
4
4
  const __1 = require("../");
5
5
  exports.Markets = [
6
6
  {
7
+ fullName: 'Solana',
8
+ category: ['L1', 'Infra'],
7
9
  symbol: 'SOL-PERP',
8
10
  baseAssetSymbol: 'SOL',
9
11
  marketIndex: new __1.BN(0),
10
- devnetPythOracle: 'J83w4HKfqxwcq3BEMMkPFSppX3gqekLyLJBexebFVkix',
11
- mainnetPythOracle: 'H6ARHf6YXhGYeQfUzQNGk6rDNnLBQKrenN712K4AQJEG',
12
+ devnetPublicKey: 'J83w4HKfqxwcq3BEMMkPFSppX3gqekLyLJBexebFVkix',
13
+ mainnetPublicKey: 'H6ARHf6YXhGYeQfUzQNGk6rDNnLBQKrenN712K4AQJEG',
12
14
  launchTs: 1635209696886,
15
+ oracleSource: __1.OracleSource.PYTH,
13
16
  },
14
17
  {
18
+ fullName: 'Bitcoin',
19
+ category: ['L1', 'Payment'],
15
20
  symbol: 'BTC-PERP',
16
21
  baseAssetSymbol: 'BTC',
17
22
  marketIndex: new __1.BN(1),
18
- devnetPythOracle: 'HovQMDrbAgAYPCmHVSrezcSmkMtXSSUsLDFANExrZh2J',
19
- mainnetPythOracle: 'GVXRSBjFk6e6J3NbVPXohDJetcTjaeeuykUpbQF8UoMU',
23
+ devnetPublicKey: 'HovQMDrbAgAYPCmHVSrezcSmkMtXSSUsLDFANExrZh2J',
24
+ mainnetPublicKey: 'GVXRSBjFk6e6J3NbVPXohDJetcTjaeeuykUpbQF8UoMU',
20
25
  launchTs: 1637691088868,
26
+ oracleSource: __1.OracleSource.PYTH,
21
27
  },
22
28
  {
29
+ fullName: 'Ethereum',
30
+ category: ['L1', 'Infra'],
23
31
  symbol: 'ETH-PERP',
24
32
  baseAssetSymbol: 'ETH',
25
33
  marketIndex: new __1.BN(2),
26
- devnetPythOracle: 'EdVCmQ9FSPcVe5YySXDPCRmc8aDQLKJ9xvYBMZPie1Vw',
27
- mainnetPythOracle: 'JBu1AL4obBcCMqKBBxhpWCNUt136ijcuMZLFvTP7iWdB',
34
+ devnetPublicKey: 'EdVCmQ9FSPcVe5YySXDPCRmc8aDQLKJ9xvYBMZPie1Vw',
35
+ mainnetPublicKey: 'JBu1AL4obBcCMqKBBxhpWCNUt136ijcuMZLFvTP7iWdB',
28
36
  launchTs: 1637691133472,
37
+ oracleSource: __1.OracleSource.PYTH,
29
38
  },
30
39
  {
40
+ fullName: 'Terra',
41
+ category: ['L1', 'Infra'],
31
42
  symbol: 'LUNA-PERP',
32
43
  baseAssetSymbol: 'LUNA',
33
44
  marketIndex: new __1.BN(3),
34
- devnetPythOracle: '8PugCXTAHLM9kfLSQWe2njE5pzAgUdpPk3Nx5zSm7BD3',
35
- mainnetPythOracle: '5bmWuR1dgP4avtGYMNKLuxumZTVKGgoN2BCMXWDNL9nY',
45
+ devnetPublicKey: '8PugCXTAHLM9kfLSQWe2njE5pzAgUdpPk3Nx5zSm7BD3',
46
+ mainnetPublicKey: '5bmWuR1dgP4avtGYMNKLuxumZTVKGgoN2BCMXWDNL9nY',
36
47
  launchTs: 1638821738525,
48
+ oracleSource: __1.OracleSource.PYTH,
37
49
  },
38
50
  {
39
51
  symbol: 'AVAX-PERP',
52
+ category: ['L1', 'Infra'],
40
53
  baseAssetSymbol: 'AVAX',
41
54
  marketIndex: new __1.BN(4),
42
- devnetPythOracle: 'FVb5h1VmHPfVb1RfqZckchq18GxRv4iKt8T4eVTQAqdz',
43
- mainnetPythOracle: 'Ax9ujW5B9oqcv59N8m6f1BpTBq2rGeGaBcpKjC5UYsXU',
55
+ devnetPublicKey: 'FVb5h1VmHPfVb1RfqZckchq18GxRv4iKt8T4eVTQAqdz',
56
+ mainnetPublicKey: 'Ax9ujW5B9oqcv59N8m6f1BpTBq2rGeGaBcpKjC5UYsXU',
44
57
  launchTs: 1639092501080,
58
+ oracleSource: __1.OracleSource.PYTH,
45
59
  },
46
60
  {
61
+ fullName: 'Binance Coin',
47
62
  symbol: 'BNB-PERP',
63
+ category: ['L1', 'Exchange'],
48
64
  baseAssetSymbol: 'BNB',
49
65
  marketIndex: new __1.BN(5),
50
- devnetPythOracle: 'GwzBgrXb4PG59zjce24SF2b9JXbLEjJJTBkmytuEZj1b',
51
- mainnetPythOracle: '4CkQJBxhU8EZ2UjhigbtdaPbpTe6mqf811fipYBFbSYN',
66
+ devnetPublicKey: 'GwzBgrXb4PG59zjce24SF2b9JXbLEjJJTBkmytuEZj1b',
67
+ mainnetPublicKey: '4CkQJBxhU8EZ2UjhigbtdaPbpTe6mqf811fipYBFbSYN',
52
68
  launchTs: 1639523193012,
69
+ oracleSource: __1.OracleSource.PYTH,
53
70
  },
54
71
  {
72
+ fullName: 'Polygon',
73
+ category: ['L1', 'Infra'],
55
74
  symbol: 'MATIC-PERP',
56
75
  baseAssetSymbol: 'MATIC',
57
76
  marketIndex: new __1.BN(6),
58
- devnetPythOracle: 'FBirwuDFuRAu4iSGc7RGxN5koHB7EJM1wbCmyPuQoGur',
59
- mainnetPythOracle: '7KVswB9vkCgeM3SHP7aGDijvdRAHK8P5wi9JXViCrtYh',
77
+ devnetPublicKey: 'FBirwuDFuRAu4iSGc7RGxN5koHB7EJM1wbCmyPuQoGur',
78
+ mainnetPublicKey: '7KVswB9vkCgeM3SHP7aGDijvdRAHK8P5wi9JXViCrtYh',
60
79
  launchTs: 1641488603564,
80
+ oracleSource: __1.OracleSource.PYTH,
61
81
  },
62
82
  {
83
+ fullName: 'Cosmos',
84
+ category: ['L1', 'Infra'],
63
85
  symbol: 'ATOM-PERP',
64
86
  baseAssetSymbol: 'ATOM',
65
87
  marketIndex: new __1.BN(7),
66
- devnetPythOracle: '7YAze8qFUMkBnyLVdKT4TFUUFui99EwS5gfRArMcrvFk',
67
- mainnetPythOracle: 'CrCpTerNqtZvqLcKqz1k13oVeXV9WkMD2zA9hBKXrsbN',
88
+ devnetPublicKey: '7YAze8qFUMkBnyLVdKT4TFUUFui99EwS5gfRArMcrvFk',
89
+ mainnetPublicKey: 'CrCpTerNqtZvqLcKqz1k13oVeXV9WkMD2zA9hBKXrsbN',
68
90
  launchTs: 1641920238195,
91
+ oracleSource: __1.OracleSource.PYTH,
69
92
  },
70
93
  {
94
+ fullName: 'Polkadot',
71
95
  symbol: 'DOT-PERP',
72
96
  baseAssetSymbol: 'DOT',
73
97
  marketIndex: new __1.BN(8),
74
- devnetPythOracle: '4dqq5VBpN4EwYb7wyywjjfknvMKu7m78j9mKZRXTj462',
75
- mainnetPythOracle: 'EcV1X1gY2yb4KXxjVQtTHTbioum2gvmPnFk4zYAt7zne',
98
+ devnetPublicKey: '4dqq5VBpN4EwYb7wyywjjfknvMKu7m78j9mKZRXTj462',
99
+ mainnetPublicKey: 'EcV1X1gY2yb4KXxjVQtTHTbioum2gvmPnFk4zYAt7zne',
76
100
  launchTs: 1642629253786,
101
+ oracleSource: __1.OracleSource.PYTH,
77
102
  },
78
103
  {
104
+ fullName: 'Cardano',
105
+ category: ['L1', 'Infra'],
79
106
  symbol: 'ADA-PERP',
80
107
  baseAssetSymbol: 'ADA',
81
108
  marketIndex: new __1.BN(9),
82
- devnetPythOracle: '8oGTURNmSQkrBS1AQ5NjB2p8qY34UVmMA9ojrw8vnHus',
83
- mainnetPythOracle: '3pyn4svBbxJ9Wnn3RVeafyLWfzie6yC5eTig2S62v9SC',
109
+ devnetPublicKey: '8oGTURNmSQkrBS1AQ5NjB2p8qY34UVmMA9ojrw8vnHus',
110
+ mainnetPublicKey: '3pyn4svBbxJ9Wnn3RVeafyLWfzie6yC5eTig2S62v9SC',
84
111
  launchTs: 1643084413000,
112
+ oracleSource: __1.OracleSource.PYTH,
85
113
  },
86
114
  {
115
+ fullName: 'Algorand',
116
+ category: ['L1', 'Infra'],
87
117
  symbol: 'ALGO-PERP',
88
118
  baseAssetSymbol: 'ALGO',
89
119
  marketIndex: new __1.BN(10),
90
- devnetPythOracle: 'c1A946dY5NHuVda77C8XXtXytyR3wK1SCP3eA9VRfC3',
91
- mainnetPythOracle: 'HqFyq1wh1xKvL7KDqqT7NJeSPdAqsDqnmBisUC2XdXAX',
120
+ devnetPublicKey: 'c1A946dY5NHuVda77C8XXtXytyR3wK1SCP3eA9VRfC3',
121
+ mainnetPublicKey: 'HqFyq1wh1xKvL7KDqqT7NJeSPdAqsDqnmBisUC2XdXAX',
92
122
  launchTs: 1643686767000,
123
+ oracleSource: __1.OracleSource.PYTH,
93
124
  },
94
125
  {
126
+ fullName: 'FTX Coin',
127
+ category: ['L1', 'Exchange'],
95
128
  symbol: 'FTT-PERP',
96
129
  baseAssetSymbol: 'FTT',
97
130
  marketIndex: new __1.BN(11),
98
- devnetPythOracle: '6vivTRs5ZPeeXbjo7dfburfaYDWoXjBtdtuYgQRuGfu',
99
- mainnetPythOracle: '8JPJJkmDScpcNmBRKGZuPuG2GYAveQgP3t5gFuMymwvF',
131
+ devnetPublicKey: '6vivTRs5ZPeeXbjo7dfburfaYDWoXjBtdtuYgQRuGfu',
132
+ mainnetPublicKey: '8JPJJkmDScpcNmBRKGZuPuG2GYAveQgP3t5gFuMymwvF',
100
133
  launchTs: 1644382122000,
134
+ oracleSource: __1.OracleSource.PYTH,
101
135
  },
102
136
  {
137
+ fullName: 'Litecoin',
138
+ category: ['L1', 'Payments'],
103
139
  symbol: 'LTC-PERP',
104
140
  baseAssetSymbol: 'LTC',
105
141
  marketIndex: new __1.BN(12),
106
- devnetPythOracle: 'BLArYBCUYhdWiY8PCUTpvFE21iaJq85dvxLk9bYMobcU',
107
- mainnetPythOracle: '8RMnV1eD55iqUFJLMguPkYBkq8DCtx81XcmAja93LvRR',
142
+ devnetPublicKey: 'BLArYBCUYhdWiY8PCUTpvFE21iaJq85dvxLk9bYMobcU',
143
+ mainnetPublicKey: '8RMnV1eD55iqUFJLMguPkYBkq8DCtx81XcmAja93LvRR',
108
144
  launchTs: 1645027429000,
145
+ oracleSource: __1.OracleSource.PYTH,
146
+ },
147
+ {
148
+ fullName: 'Ripple',
149
+ category: ['L1', 'Payments'],
150
+ symbol: 'XRP-PERP',
151
+ baseAssetSymbol: 'XRP',
152
+ marketIndex: new __1.BN(13),
153
+ devnetPublicKey: 'WMW5xc3HypXwTnPesyUT49uLsyHwNURsWAEk39onKuk',
154
+ mainnetPublicKey: 'WMW5xc3HypXwTnPesyUT49uLsyHwNURsWAEk39onKuk',
155
+ launchTs: 1647543166000,
156
+ oracleSource: __1.OracleSource.SWITCHBOARD,
157
+ },
158
+ {
159
+ fullName: 'Ape',
160
+ category: ['NFT'],
161
+ symbol: 'APE-PERP',
162
+ baseAssetSymbol: 'APE',
163
+ marketIndex: new __1.BN(14),
164
+ devnetPublicKey: 'AwH6kBrJbkL9JTeqRd7Q59EdWh6UjPtoqoA5M4x4K2fA',
165
+ mainnetPublicKey: '74zeQpprjNtEghGiC3VEPsR9y4kR2GTd4Rq9YVk9tnjz',
166
+ launchTs: 1648475932000,
167
+ oracleSource: __1.OracleSource.SWITCHBOARD,
109
168
  },
110
169
  // {
111
170
  // symbol: 'mSOL-PERP',
@@ -3,6 +3,7 @@ import { BN } from '../';
3
3
  export declare const ZERO: BN;
4
4
  export declare const ONE: BN;
5
5
  export declare const TWO: BN;
6
+ export declare const TEN: BN;
6
7
  export declare const TEN_THOUSAND: BN;
7
8
  export declare const BN_MAX: BN;
8
9
  export declare const MAX_LEVERAGE: BN;
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.MARGIN_PRECISION = exports.AMM_TIMES_PEG_TO_QUOTE_PRECISION_RATIO = exports.PRICE_TO_QUOTE_PRECISION = exports.AMM_TO_QUOTE_PRECISION_RATIO = exports.BASE_PRECISION = exports.AMM_RESERVE_PRECISION = exports.PEG_PRECISION = exports.FUNDING_PAYMENT_PRECISION = exports.MARK_PRICE_PRECISION = exports.QUOTE_PRECISION = exports.MAX_LEVERAGE = exports.BN_MAX = exports.TEN_THOUSAND = exports.TWO = exports.ONE = exports.ZERO = void 0;
3
+ exports.MARGIN_PRECISION = exports.AMM_TIMES_PEG_TO_QUOTE_PRECISION_RATIO = exports.PRICE_TO_QUOTE_PRECISION = exports.AMM_TO_QUOTE_PRECISION_RATIO = exports.BASE_PRECISION = exports.AMM_RESERVE_PRECISION = exports.PEG_PRECISION = exports.FUNDING_PAYMENT_PRECISION = exports.MARK_PRICE_PRECISION = exports.QUOTE_PRECISION = exports.MAX_LEVERAGE = exports.BN_MAX = exports.TEN_THOUSAND = exports.TEN = exports.TWO = exports.ONE = exports.ZERO = void 0;
4
4
  const __1 = require("../");
5
5
  exports.ZERO = new __1.BN(0);
6
6
  exports.ONE = new __1.BN(1);
7
7
  exports.TWO = new __1.BN(2);
8
+ exports.TEN = new __1.BN(10);
8
9
  exports.TEN_THOUSAND = new __1.BN(10000);
9
10
  exports.BN_MAX = new __1.BN(Number.MAX_SAFE_INTEGER);
10
11
  exports.MAX_LEVERAGE = new __1.BN(5);