@drift-labs/sdk 2.70.0-beta.1 → 2.71.0-beta.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/VERSION CHANGED
@@ -1 +1 @@
1
- 2.70.0-beta.1
1
+ 2.71.0-beta.0
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.69.0",
2
+ "version": "2.70.0",
3
3
  "name": "drift",
4
4
  "instructions": [
5
5
  {
@@ -95,7 +95,13 @@ function getAuctionPriceForOracleOffsetAuction(order, slot, oraclePrice) {
95
95
  }
96
96
  exports.getAuctionPriceForOracleOffsetAuction = getAuctionPriceForOracleOffsetAuction;
97
97
  function deriveOracleAuctionParams({ direction, oraclePrice, auctionStartPrice, auctionEndPrice, limitPrice, }) {
98
- let oraclePriceOffset = limitPrice.sub(oraclePrice);
98
+ let oraclePriceOffset;
99
+ if (limitPrice.eq(_1.ZERO) || oraclePrice.eq(_1.ZERO)) {
100
+ oraclePriceOffset = _1.ZERO;
101
+ }
102
+ else {
103
+ oraclePriceOffset = limitPrice.sub(oraclePrice);
104
+ }
99
105
  if (oraclePriceOffset.eq(_1.ZERO)) {
100
106
  oraclePriceOffset = (0, types_1.isVariant)(direction, 'long')
101
107
  ? auctionEndPrice.sub(oraclePrice).add(_1.ONE)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.70.0-beta.1",
3
+ "version": "2.71.0-beta.0",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "2.69.0",
2
+ "version": "2.70.0",
3
3
  "name": "drift",
4
4
  "instructions": [
5
5
  {
@@ -127,7 +127,14 @@ export function deriveOracleAuctionParams({
127
127
  auctionEndPrice: BN;
128
128
  limitPrice: BN;
129
129
  }): { auctionStartPrice: BN; auctionEndPrice: BN; oraclePriceOffset: number } {
130
- let oraclePriceOffset = limitPrice.sub(oraclePrice);
130
+ let oraclePriceOffset;
131
+
132
+ if (limitPrice.eq(ZERO) || oraclePrice.eq(ZERO)) {
133
+ oraclePriceOffset = ZERO;
134
+ } else {
135
+ oraclePriceOffset = limitPrice.sub(oraclePrice);
136
+ }
137
+
131
138
  if (oraclePriceOffset.eq(ZERO)) {
132
139
  oraclePriceOffset = isVariant(direction, 'long')
133
140
  ? auctionEndPrice.sub(oraclePrice).add(ONE)