@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.
- package/CHANGELOG.md +15 -0
- package/lib/browser/decode/user.js +5 -5
- package/lib/browser/dlob/DLOB.js +1 -1
- package/lib/browser/dlob/DLOBNode.js +1 -2
- package/lib/browser/idl/drift.d.ts +5 -5
- package/lib/browser/idl/drift.json +5 -5
- package/lib/browser/math/auction.d.ts +1 -1
- package/lib/browser/math/auction.js +2 -9
- package/lib/browser/math/orders.js +3 -3
- package/lib/browser/types.d.ts +2 -2
- package/lib/browser/velocityClient.d.ts +6 -6
- package/lib/browser/velocityClient.js +1 -1
- package/lib/node/config.d.ts.map +1 -1
- package/lib/node/decode/user.js +5 -5
- package/lib/node/dlob/DLOB.js +1 -1
- package/lib/node/dlob/DLOBNode.js +1 -2
- package/lib/node/idl/drift.d.ts +5 -5
- package/lib/node/idl/drift.d.ts.map +1 -1
- package/lib/node/idl/drift.json +5 -5
- package/lib/node/math/auction.d.ts +1 -1
- package/lib/node/math/auction.d.ts.map +1 -1
- package/lib/node/math/auction.js +2 -9
- package/lib/node/math/orders.d.ts.map +1 -1
- package/lib/node/math/orders.js +3 -3
- package/lib/node/priorityFee/types.d.ts.map +1 -1
- package/lib/node/types.d.ts +2 -2
- package/lib/node/types.d.ts.map +1 -1
- package/lib/node/util/deprecatedAlias.d.ts.map +1 -1
- package/lib/node/velocityClient.d.ts +6 -6
- package/lib/node/velocityClient.d.ts.map +1 -1
- package/lib/node/velocityClient.js +1 -1
- package/lib/node/velocityClientConfig.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/config.ts +4 -1
- package/src/decode/user.ts +5 -5
- package/src/dlob/DLOB.ts +1 -1
- package/src/dlob/DLOBNode.ts +1 -1
- package/src/idl/drift.json +5 -5
- package/src/idl/drift.ts +5 -5
- package/src/math/auction.ts +3 -10
- package/src/math/orders.ts +3 -6
- package/src/priorityFee/types.ts +7 -2
- package/src/types.ts +2 -2
- package/src/util/deprecatedAlias.ts +1 -5
- package/src/velocityClient.ts +6 -6
- package/src/velocityClientConfig.ts +3 -1
- package/tests/auctions/test.ts +4 -4
- package/tests/decode/test.ts +1 -1
- package/tests/dlob/test.ts +5 -5
- package/tests/user/helpers.ts +1 -1
package/tests/auctions/test.ts
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
79
|
+
assert(oracleOrderParams.oraclePriceOffset.eq(new BN(-1)));
|
|
80
80
|
});
|
|
81
81
|
});
|
package/tests/decode/test.ts
CHANGED
|
@@ -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
|
|
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));
|
package/tests/dlob/test.ts
CHANGED
|
@@ -89,7 +89,7 @@ function insertOrderToDLOB(
|
|
|
89
89
|
existingPositionDirection: PositionDirection.LONG,
|
|
90
90
|
postOnly,
|
|
91
91
|
immediateOrCancel: false,
|
|
92
|
-
oraclePriceOffset: oraclePriceOffset
|
|
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
|
|
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:
|
|
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:
|
|
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:
|
|
4127
|
+
oraclePriceOffset: ZERO,
|
|
4128
4128
|
maxTs: ZERO,
|
|
4129
4129
|
postedSlotTail: 0,
|
|
4130
4130
|
};
|
package/tests/user/helpers.ts
CHANGED
|
@@ -42,7 +42,7 @@ export const mockOrder: Order = {
|
|
|
42
42
|
existingPositionDirection: PositionDirection.LONG,
|
|
43
43
|
postOnly: false,
|
|
44
44
|
immediateOrCancel: false,
|
|
45
|
-
oraclePriceOffset:
|
|
45
|
+
oraclePriceOffset: ZERO,
|
|
46
46
|
auctionDuration: 0,
|
|
47
47
|
auctionStartPrice: ZERO,
|
|
48
48
|
auctionEndPrice: ZERO,
|