@velocity-exchange/sdk 0.0.3 → 0.0.5

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 (50) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/lib/browser/decode/user.js +5 -5
  3. package/lib/browser/dlob/DLOB.js +1 -1
  4. package/lib/browser/dlob/DLOBNode.js +1 -2
  5. package/lib/browser/idl/drift.d.ts +5 -5
  6. package/lib/browser/idl/drift.json +5 -5
  7. package/lib/browser/math/auction.d.ts +1 -1
  8. package/lib/browser/math/auction.js +2 -9
  9. package/lib/browser/math/orders.js +3 -3
  10. package/lib/browser/types.d.ts +2 -2
  11. package/lib/browser/velocityClient.d.ts +6 -6
  12. package/lib/browser/velocityClient.js +1 -1
  13. package/lib/node/config.d.ts.map +1 -1
  14. package/lib/node/decode/user.js +5 -5
  15. package/lib/node/dlob/DLOB.js +1 -1
  16. package/lib/node/dlob/DLOBNode.js +1 -2
  17. package/lib/node/idl/drift.d.ts +5 -5
  18. package/lib/node/idl/drift.d.ts.map +1 -1
  19. package/lib/node/idl/drift.json +5 -5
  20. package/lib/node/math/auction.d.ts +1 -1
  21. package/lib/node/math/auction.d.ts.map +1 -1
  22. package/lib/node/math/auction.js +2 -9
  23. package/lib/node/math/orders.d.ts.map +1 -1
  24. package/lib/node/math/orders.js +3 -3
  25. package/lib/node/priorityFee/types.d.ts.map +1 -1
  26. package/lib/node/types.d.ts +2 -2
  27. package/lib/node/types.d.ts.map +1 -1
  28. package/lib/node/util/deprecatedAlias.d.ts.map +1 -1
  29. package/lib/node/velocityClient.d.ts +6 -6
  30. package/lib/node/velocityClient.d.ts.map +1 -1
  31. package/lib/node/velocityClient.js +1 -1
  32. package/lib/node/velocityClientConfig.d.ts.map +1 -1
  33. package/package.json +1 -1
  34. package/src/config.ts +4 -1
  35. package/src/decode/user.ts +5 -5
  36. package/src/dlob/DLOB.ts +1 -1
  37. package/src/dlob/DLOBNode.ts +1 -1
  38. package/src/idl/drift.json +5 -5
  39. package/src/idl/drift.ts +5 -5
  40. package/src/math/auction.ts +3 -10
  41. package/src/math/orders.ts +3 -6
  42. package/src/priorityFee/types.ts +7 -2
  43. package/src/types.ts +2 -2
  44. package/src/util/deprecatedAlias.ts +1 -5
  45. package/src/velocityClient.ts +6 -6
  46. package/src/velocityClientConfig.ts +3 -1
  47. package/tests/auctions/test.ts +4 -4
  48. package/tests/decode/test.ts +1 -1
  49. package/tests/dlob/test.ts +5 -5
  50. package/tests/user/helpers.ts +1 -1
@@ -28,7 +28,7 @@ describe('Auction Tests', () => {
28
28
  oracleOrderParams.auctionEndPrice.eq(new BN(10).mul(PRICE_PRECISION))
29
29
  );
30
30
  assert(
31
- oracleOrderParams.oraclePriceOffset === 20 * PRICE_PRECISION.toNumber()
31
+ oracleOrderParams.oraclePriceOffset.eq(new BN(20).mul(PRICE_PRECISION))
32
32
  );
33
33
 
34
34
  oracleOrderParams = deriveOracleAuctionParams({
@@ -41,7 +41,7 @@ describe('Auction Tests', () => {
41
41
 
42
42
  assert(oracleOrderParams.auctionStartPrice.eq(new BN(0)));
43
43
  assert(oracleOrderParams.auctionEndPrice.eq(new BN(0)));
44
- assert(oracleOrderParams.oraclePriceOffset === 1);
44
+ assert(oracleOrderParams.oraclePriceOffset.eq(new BN(1)));
45
45
 
46
46
  oraclePrice = new BN(100).mul(PRICE_PRECISION);
47
47
  auctionStartPrice = new BN(110).mul(PRICE_PRECISION);
@@ -63,7 +63,7 @@ describe('Auction Tests', () => {
63
63
  oracleOrderParams.auctionEndPrice.eq(new BN(-10).mul(PRICE_PRECISION))
64
64
  );
65
65
  assert(
66
- oracleOrderParams.oraclePriceOffset === -20 * PRICE_PRECISION.toNumber()
66
+ oracleOrderParams.oraclePriceOffset.eq(new BN(-20).mul(PRICE_PRECISION))
67
67
  );
68
68
 
69
69
  oracleOrderParams = deriveOracleAuctionParams({
@@ -76,6 +76,6 @@ describe('Auction Tests', () => {
76
76
 
77
77
  assert(oracleOrderParams.auctionStartPrice.eq(new BN(0)));
78
78
  assert(oracleOrderParams.auctionEndPrice.eq(new BN(0)));
79
- assert(oracleOrderParams.oraclePriceOffset === -1);
79
+ assert(oracleOrderParams.oraclePriceOffset.eq(new BN(-1)));
80
80
  });
81
81
  });
@@ -221,7 +221,7 @@ function testOrder(anchor: Order, custom: Order) {
221
221
  );
222
222
  assert(anchor.postOnly === custom.postOnly);
223
223
  assert(anchor.immediateOrCancel === custom.immediateOrCancel);
224
- assert(anchor.oraclePriceOffset === custom.oraclePriceOffset);
224
+ assert(anchor.oraclePriceOffset.eq(custom.oraclePriceOffset));
225
225
  assert(anchor.auctionDuration === custom.auctionDuration);
226
226
  assert(anchor.auctionStartPrice.eq(custom.auctionStartPrice));
227
227
  assert(anchor.auctionEndPrice.eq(custom.auctionEndPrice));
@@ -89,7 +89,7 @@ function insertOrderToDLOB(
89
89
  existingPositionDirection: PositionDirection.LONG,
90
90
  postOnly,
91
91
  immediateOrCancel: false,
92
- oraclePriceOffset: oraclePriceOffset.toNumber(),
92
+ oraclePriceOffset: oraclePriceOffset,
93
93
  auctionDuration,
94
94
  auctionStartPrice,
95
95
  auctionEndPrice,
@@ -144,7 +144,7 @@ function insertTriggerOrderToDLOB(
144
144
  existingPositionDirection: PositionDirection.LONG,
145
145
  postOnly: false,
146
146
  immediateOrCancel: true,
147
- oraclePriceOffset: oraclePriceOffset.toNumber(),
147
+ oraclePriceOffset: oraclePriceOffset,
148
148
  auctionDuration: 10,
149
149
  auctionStartPrice,
150
150
  auctionEndPrice,
@@ -3943,7 +3943,7 @@ describe('DLOB Perp Tests', () => {
3943
3943
  triggerCondition: OrderTriggerCondition.ABOVE,
3944
3944
  existingPositionDirection: direction,
3945
3945
  immediateOrCancel: false,
3946
- oraclePriceOffset: 0,
3946
+ oraclePriceOffset: ZERO,
3947
3947
  maxTs: ZERO,
3948
3948
  postedSlotTail: 0,
3949
3949
  };
@@ -4045,7 +4045,7 @@ describe('DLOB Perp Tests', () => {
4045
4045
  triggerCondition: OrderTriggerCondition.ABOVE,
4046
4046
  existingPositionDirection: PositionDirection.LONG,
4047
4047
  immediateOrCancel: false,
4048
- oraclePriceOffset: 0,
4048
+ oraclePriceOffset: ZERO,
4049
4049
  maxTs: ZERO,
4050
4050
  postedSlotTail: 0,
4051
4051
  };
@@ -4124,7 +4124,7 @@ describe('DLOB Perp Tests', () => {
4124
4124
  triggerCondition: OrderTriggerCondition.ABOVE,
4125
4125
  existingPositionDirection: PositionDirection.LONG,
4126
4126
  immediateOrCancel: false,
4127
- oraclePriceOffset: 0,
4127
+ oraclePriceOffset: ZERO,
4128
4128
  maxTs: ZERO,
4129
4129
  postedSlotTail: 0,
4130
4130
  };
@@ -42,7 +42,7 @@ export const mockOrder: Order = {
42
42
  existingPositionDirection: PositionDirection.LONG,
43
43
  postOnly: false,
44
44
  immediateOrCancel: false,
45
- oraclePriceOffset: 0,
45
+ oraclePriceOffset: ZERO,
46
46
  auctionDuration: 0,
47
47
  auctionStartPrice: ZERO,
48
48
  auctionEndPrice: ZERO,