@drift-labs/sdk 2.52.0-beta.14 → 2.52.0-beta.15
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/math/orders.d.ts +1 -1
- package/lib/math/orders.js +2 -2
- package/package.json +1 -1
- package/src/math/orders.ts +8 -3
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.52.0-beta.
|
|
1
|
+
2.52.0-beta.15
|
package/lib/math/orders.d.ts
CHANGED
|
@@ -11,7 +11,7 @@ export declare function standardizePrice(price: BN, tickSize: BN, direction: Pos
|
|
|
11
11
|
export declare function getLimitPrice(order: Order, oraclePriceData: OraclePriceData, slot: number, fallbackPrice?: BN): BN | undefined;
|
|
12
12
|
export declare function hasLimitPrice(order: Order, slot: number): boolean;
|
|
13
13
|
export declare function hasAuctionPrice(order: Order, slot: number): boolean;
|
|
14
|
-
export declare function isFillableByVAMM(order: Order, market: PerpMarketAccount, oraclePriceData: OraclePriceData, slot: number, ts: number): boolean;
|
|
14
|
+
export declare function isFillableByVAMM(order: Order, market: PerpMarketAccount, oraclePriceData: OraclePriceData, slot: number, ts: number, minAuctionDuration: number): boolean;
|
|
15
15
|
export declare function calculateBaseAssetAmountForAmmToFulfill(order: Order, market: PerpMarketAccount, oraclePriceData: OraclePriceData, slot: number): BN;
|
|
16
16
|
export declare function calculateBaseAssetAmountToFillUpToLimitPrice(order: Order, amm: AMM, limitPrice: BN, oraclePriceData: OraclePriceData): BN;
|
|
17
17
|
export declare function isOrderExpired(order: Order, ts: number, enforceBuffer?: boolean): boolean;
|
package/lib/math/orders.js
CHANGED
|
@@ -124,8 +124,8 @@ function hasAuctionPrice(order, slot) {
|
|
|
124
124
|
(!order.auctionStartPrice.eq(numericConstants_1.ZERO) || !order.auctionEndPrice.eq(numericConstants_1.ZERO)));
|
|
125
125
|
}
|
|
126
126
|
exports.hasAuctionPrice = hasAuctionPrice;
|
|
127
|
-
function isFillableByVAMM(order, market, oraclePriceData, slot, ts) {
|
|
128
|
-
return (((0, auction_1.
|
|
127
|
+
function isFillableByVAMM(order, market, oraclePriceData, slot, ts, minAuctionDuration) {
|
|
128
|
+
return (((0, auction_1.isFallbackAvailableLiquiditySource)(order, minAuctionDuration, slot) &&
|
|
129
129
|
calculateBaseAssetAmountForAmmToFulfill(order, market, oraclePriceData, slot).gte(market.amm.minOrderSize)) ||
|
|
130
130
|
isOrderExpired(order, ts));
|
|
131
131
|
}
|
package/package.json
CHANGED
package/src/math/orders.ts
CHANGED
|
@@ -10,7 +10,11 @@ import {
|
|
|
10
10
|
import { ZERO, TWO } from '../constants/numericConstants';
|
|
11
11
|
import { BN } from '@coral-xyz/anchor';
|
|
12
12
|
import { OraclePriceData } from '../oracles/types';
|
|
13
|
-
import {
|
|
13
|
+
import {
|
|
14
|
+
getAuctionPrice,
|
|
15
|
+
isAuctionComplete,
|
|
16
|
+
isFallbackAvailableLiquiditySource,
|
|
17
|
+
} from './auction';
|
|
14
18
|
import {
|
|
15
19
|
calculateMaxBaseAssetAmountFillable,
|
|
16
20
|
calculateMaxBaseAssetAmountToTrade,
|
|
@@ -186,10 +190,11 @@ export function isFillableByVAMM(
|
|
|
186
190
|
market: PerpMarketAccount,
|
|
187
191
|
oraclePriceData: OraclePriceData,
|
|
188
192
|
slot: number,
|
|
189
|
-
ts: number
|
|
193
|
+
ts: number,
|
|
194
|
+
minAuctionDuration: number
|
|
190
195
|
): boolean {
|
|
191
196
|
return (
|
|
192
|
-
(
|
|
197
|
+
(isFallbackAvailableLiquiditySource(order, minAuctionDuration, slot) &&
|
|
193
198
|
calculateBaseAssetAmountForAmmToFulfill(
|
|
194
199
|
order,
|
|
195
200
|
market,
|