@drift-labs/sdk 2.31.1-beta.12 → 2.31.1-beta.13
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 +1 -1
- package/lib/dlob/orderBookLevels.js +2 -2
- package/lib/idl/drift.json +1 -1
- package/package.json +1 -1
- package/src/dlob/orderBookLevels.ts +3 -2
- package/src/idl/drift.json +1 -1
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.31.1-beta.
|
|
1
|
+
2.31.1-beta.13
|
|
@@ -92,7 +92,7 @@ function getVammL2Generator({ marketAccount, oraclePriceData, numOrders, now, })
|
|
|
92
92
|
pegMultiplier: updatedAmm.pegMultiplier,
|
|
93
93
|
};
|
|
94
94
|
const getL2Bids = function* () {
|
|
95
|
-
while (numBids < numOrders) {
|
|
95
|
+
while (numBids < numOrders && baseSize.gt(__1.ZERO)) {
|
|
96
96
|
const [afterSwapQuoteReserves, afterSwapBaseReserves] = (0, __1.calculateAmmReservesAfterSwap)(bidAmm, 'base', baseSize, __1.SwapDirection.ADD);
|
|
97
97
|
const quoteSwapped = (0, __1.calculateQuoteAssetAmountSwapped)(bidAmm.quoteAssetReserve.sub(afterSwapQuoteReserves).abs(), bidAmm.pegMultiplier, __1.SwapDirection.ADD);
|
|
98
98
|
const price = quoteSwapped.mul(__1.BASE_PRECISION).div(baseSize);
|
|
@@ -115,7 +115,7 @@ function getVammL2Generator({ marketAccount, oraclePriceData, numOrders, now, })
|
|
|
115
115
|
pegMultiplier: updatedAmm.pegMultiplier,
|
|
116
116
|
};
|
|
117
117
|
const getL2Asks = function* () {
|
|
118
|
-
while (numAsks < numOrders) {
|
|
118
|
+
while (numAsks < numOrders && askSize.gt(__1.ZERO)) {
|
|
119
119
|
const [afterSwapQuoteReserves, afterSwapBaseReserves] = (0, __1.calculateAmmReservesAfterSwap)(askAmm, 'base', askSize, __1.SwapDirection.REMOVE);
|
|
120
120
|
const quoteSwapped = (0, __1.calculateQuoteAssetAmountSwapped)(askAmm.quoteAssetReserve.sub(afterSwapQuoteReserves).abs(), askAmm.pegMultiplier, __1.SwapDirection.REMOVE);
|
|
121
121
|
const price = quoteSwapped.mul(__1.BASE_PRECISION).div(askSize);
|
package/lib/idl/drift.json
CHANGED
package/package.json
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
PositionDirection,
|
|
13
13
|
standardizePrice,
|
|
14
14
|
SwapDirection,
|
|
15
|
+
ZERO,
|
|
15
16
|
} from '..';
|
|
16
17
|
import { PublicKey } from '@solana/web3.js';
|
|
17
18
|
|
|
@@ -169,7 +170,7 @@ export function getVammL2Generator({
|
|
|
169
170
|
pegMultiplier: updatedAmm.pegMultiplier,
|
|
170
171
|
};
|
|
171
172
|
const getL2Bids = function* () {
|
|
172
|
-
while (numBids < numOrders) {
|
|
173
|
+
while (numBids < numOrders && baseSize.gt(ZERO)) {
|
|
173
174
|
const [afterSwapQuoteReserves, afterSwapBaseReserves] =
|
|
174
175
|
calculateAmmReservesAfterSwap(
|
|
175
176
|
bidAmm,
|
|
@@ -208,7 +209,7 @@ export function getVammL2Generator({
|
|
|
208
209
|
pegMultiplier: updatedAmm.pegMultiplier,
|
|
209
210
|
};
|
|
210
211
|
const getL2Asks = function* () {
|
|
211
|
-
while (numAsks < numOrders) {
|
|
212
|
+
while (numAsks < numOrders && askSize.gt(ZERO)) {
|
|
212
213
|
const [afterSwapQuoteReserves, afterSwapBaseReserves] =
|
|
213
214
|
calculateAmmReservesAfterSwap(
|
|
214
215
|
askAmm,
|
package/src/idl/drift.json
CHANGED