@drift-labs/sdk 2.42.0-beta.1 → 2.42.0-beta.10
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/bun.lockb +0 -0
- package/lib/addresses/pda.d.ts +1 -0
- package/lib/adminClient.d.ts +1 -0
- package/lib/constants/numericConstants.d.ts +62 -59
- package/lib/constants/numericConstants.js +2 -1
- package/lib/constants/spotMarkets.d.ts +1 -0
- package/lib/dlob/DLOB.d.ts +10 -16
- package/lib/dlob/DLOB.js +9 -39
- package/lib/dlob/DLOBNode.d.ts +1 -0
- package/lib/dlob/NodeList.d.ts +1 -0
- package/lib/dlob/orderBookLevels.d.ts +2 -1
- package/lib/driftClient.d.ts +12 -4
- package/lib/driftClient.js +51 -38
- package/lib/factory/bigNum.d.ts +8 -7
- package/lib/jupiter/jupiterClient.d.ts +1 -0
- package/lib/marinade/index.d.ts +1 -0
- package/lib/math/amm.d.ts +2 -1
- package/lib/math/auction.d.ts +1 -0
- package/lib/math/conversion.d.ts +2 -1
- package/lib/math/funding.d.ts +1 -0
- package/lib/math/funding.js +2 -1
- package/lib/math/insurance.d.ts +1 -0
- package/lib/math/margin.d.ts +1 -0
- package/lib/math/market.d.ts +2 -1
- package/lib/math/market.js +3 -2
- package/lib/math/oracles.d.ts +1 -0
- package/lib/math/orders.d.ts +1 -0
- package/lib/math/position.d.ts +1 -0
- package/lib/math/repeg.d.ts +1 -0
- package/lib/math/spotBalance.d.ts +3 -2
- package/lib/math/spotMarket.d.ts +2 -1
- package/lib/math/spotMarket.js +9 -3
- package/lib/math/spotPosition.d.ts +4 -3
- package/lib/math/spotPosition.js +18 -7
- package/lib/math/superStake.d.ts +1 -0
- package/lib/math/trade.d.ts +1 -0
- package/lib/math/utils.d.ts +1 -0
- package/lib/oracles/pythClient.d.ts +2 -1
- package/lib/oracles/strictOraclePrice.d.ts +1 -0
- package/lib/oracles/types.d.ts +1 -0
- package/lib/orderParams.d.ts +1 -0
- package/lib/phoenix/phoenixSubscriber.d.ts +1 -0
- package/lib/serum/serumSubscriber.d.ts +1 -0
- package/lib/tokenFaucet.d.ts +1 -0
- package/lib/types.d.ts +7 -0
- package/lib/types.js +2 -0
- package/lib/user.d.ts +3 -2
- package/lib/user.js +29 -26
- package/package.json +2 -1
- package/src/constants/numericConstants.ts +1 -0
- package/src/dlob/DLOB.ts +23 -67
- package/src/driftClient.ts +79 -53
- package/src/math/funding.ts +6 -1
- package/src/math/market.ts +12 -7
- package/src/math/spotMarket.ts +13 -3
- package/src/math/spotPosition.ts +29 -7
- package/src/types.ts +2 -0
- package/src/user.ts +64 -31
- package/tests/amm/test.ts +7 -5
- package/tests/auctions/test.ts +22 -11
- package/tests/dlob/helpers.ts +15 -13
- package/tests/tx/priorityFeeCalculator.ts +1 -1
- package/tests/user/test.ts +171 -24
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.42.0-beta.
|
|
1
|
+
2.42.0-beta.10
|
package/bun.lockb
CHANGED
|
Binary file
|
package/lib/addresses/pda.d.ts
CHANGED
package/lib/adminClient.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="bn.js" />
|
|
1
2
|
import { PublicKey, TransactionSignature } from '@solana/web3.js';
|
|
2
3
|
import { FeeStructure, OracleGuardRails, OracleSource, ExchangeStatus, MarketStatus, ContractTier, AssetTier, SpotFulfillmentConfigStatus } from './types';
|
|
3
4
|
import { BN } from '@coral-xyz/anchor';
|
|
@@ -1,60 +1,63 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
4
|
-
export declare const
|
|
5
|
-
export declare const
|
|
6
|
-
export declare const
|
|
7
|
-
export declare const
|
|
8
|
-
export declare const
|
|
9
|
-
export declare const
|
|
10
|
-
export declare const
|
|
11
|
-
export declare const
|
|
12
|
-
export declare const
|
|
13
|
-
export declare const
|
|
14
|
-
export declare const
|
|
15
|
-
export declare const
|
|
16
|
-
export declare const
|
|
17
|
-
export declare const
|
|
18
|
-
export declare const
|
|
19
|
-
export declare const
|
|
20
|
-
export declare const
|
|
21
|
-
export declare const
|
|
22
|
-
export declare const
|
|
23
|
-
export declare const
|
|
24
|
-
export declare const
|
|
25
|
-
export declare const
|
|
26
|
-
export declare const
|
|
27
|
-
export declare const
|
|
28
|
-
export declare const
|
|
29
|
-
export declare const
|
|
30
|
-
export declare const
|
|
31
|
-
export declare const
|
|
32
|
-
export declare const
|
|
33
|
-
export declare const
|
|
34
|
-
export declare const
|
|
35
|
-
export declare const
|
|
36
|
-
export declare const
|
|
37
|
-
export declare const
|
|
38
|
-
export declare const
|
|
39
|
-
export declare const
|
|
40
|
-
export declare const
|
|
41
|
-
export declare const
|
|
42
|
-
export declare const
|
|
43
|
-
export declare const
|
|
44
|
-
export declare const
|
|
45
|
-
export declare const
|
|
46
|
-
export declare const
|
|
47
|
-
export declare const
|
|
48
|
-
export declare const
|
|
49
|
-
export declare const
|
|
50
|
-
export declare const
|
|
51
|
-
export declare const
|
|
52
|
-
export declare const
|
|
53
|
-
export declare const
|
|
54
|
-
export declare const
|
|
55
|
-
export declare const
|
|
1
|
+
/// <reference types="bn.js" />
|
|
2
|
+
import { BN } from '../';
|
|
3
|
+
export declare const ZERO: BN;
|
|
4
|
+
export declare const ONE: BN;
|
|
5
|
+
export declare const TWO: BN;
|
|
6
|
+
export declare const THREE: BN;
|
|
7
|
+
export declare const FOUR: BN;
|
|
8
|
+
export declare const FIVE: BN;
|
|
9
|
+
export declare const SIX: BN;
|
|
10
|
+
export declare const SEVEN: BN;
|
|
11
|
+
export declare const EIGHT: BN;
|
|
12
|
+
export declare const NINE: BN;
|
|
13
|
+
export declare const TEN: BN;
|
|
14
|
+
export declare const TEN_THOUSAND: BN;
|
|
15
|
+
export declare const BN_MAX: BN;
|
|
16
|
+
export declare const TEN_MILLION: BN;
|
|
17
|
+
export declare const MAX_LEVERAGE: BN;
|
|
18
|
+
export declare const MAX_LEVERAGE_ORDER_SIZE: BN;
|
|
19
|
+
export declare const PERCENTAGE_PRECISION_EXP: BN;
|
|
20
|
+
export declare const PERCENTAGE_PRECISION: BN;
|
|
21
|
+
export declare const CONCENTRATION_PRECISION: BN;
|
|
22
|
+
export declare const QUOTE_PRECISION_EXP: BN;
|
|
23
|
+
export declare const FUNDING_RATE_BUFFER_PRECISION_EXP: BN;
|
|
24
|
+
export declare const PRICE_PRECISION_EXP: BN;
|
|
25
|
+
export declare const FUNDING_RATE_PRECISION_EXP: BN;
|
|
26
|
+
export declare const PEG_PRECISION_EXP: BN;
|
|
27
|
+
export declare const AMM_RESERVE_PRECISION_EXP: BN;
|
|
28
|
+
export declare const SPOT_MARKET_RATE_PRECISION_EXP: BN;
|
|
29
|
+
export declare const SPOT_MARKET_RATE_PRECISION: BN;
|
|
30
|
+
export declare const SPOT_MARKET_CUMULATIVE_INTEREST_PRECISION_EXP: BN;
|
|
31
|
+
export declare const SPOT_MARKET_CUMULATIVE_INTEREST_PRECISION: BN;
|
|
32
|
+
export declare const SPOT_MARKET_UTILIZATION_PRECISION_EXP: BN;
|
|
33
|
+
export declare const SPOT_MARKET_UTILIZATION_PRECISION: BN;
|
|
34
|
+
export declare const SPOT_MARKET_WEIGHT_PRECISION: BN;
|
|
35
|
+
export declare const SPOT_MARKET_BALANCE_PRECISION_EXP: BN;
|
|
36
|
+
export declare const SPOT_MARKET_BALANCE_PRECISION: BN;
|
|
37
|
+
export declare const SPOT_MARKET_IMF_PRECISION_EXP: BN;
|
|
38
|
+
export declare const SPOT_MARKET_IMF_PRECISION: BN;
|
|
39
|
+
export declare const LIQUIDATION_FEE_PRECISION: BN;
|
|
40
|
+
export declare const QUOTE_PRECISION: BN;
|
|
41
|
+
export declare const PRICE_PRECISION: BN;
|
|
42
|
+
export declare const FUNDING_RATE_PRECISION: BN;
|
|
43
|
+
export declare const FUNDING_RATE_BUFFER_PRECISION: BN;
|
|
44
|
+
export declare const PEG_PRECISION: BN;
|
|
45
|
+
export declare const AMM_RESERVE_PRECISION: BN;
|
|
46
|
+
export declare const BASE_PRECISION: BN;
|
|
47
|
+
export declare const BASE_PRECISION_EXP: BN;
|
|
48
|
+
export declare const AMM_TO_QUOTE_PRECISION_RATIO: BN;
|
|
49
|
+
export declare const PRICE_DIV_PEG: BN;
|
|
50
|
+
export declare const PRICE_TO_QUOTE_PRECISION: BN;
|
|
51
|
+
export declare const AMM_TIMES_PEG_TO_QUOTE_PRECISION_RATIO: BN;
|
|
52
|
+
export declare const MARGIN_PRECISION: BN;
|
|
53
|
+
export declare const BID_ASK_SPREAD_PRECISION: BN;
|
|
54
|
+
export declare const LIQUIDATION_PCT_PRECISION: BN;
|
|
55
|
+
export declare const FUNDING_RATE_OFFSET_DENOMINATOR: BN;
|
|
56
|
+
export declare const FIVE_MINUTE: BN;
|
|
57
|
+
export declare const ONE_HOUR: BN;
|
|
58
|
+
export declare const ONE_YEAR: BN;
|
|
56
59
|
export declare const QUOTE_SPOT_MARKET_INDEX = 0;
|
|
57
|
-
export declare const LAMPORTS_PRECISION:
|
|
58
|
-
export declare const LAMPORTS_EXP:
|
|
59
|
-
export declare const OPEN_ORDER_MARGIN_REQUIREMENT:
|
|
60
|
-
export declare const DEFAULT_REVENUE_SINCE_LAST_FUNDING_SPREAD_RETREAT:
|
|
60
|
+
export declare const LAMPORTS_PRECISION: BN;
|
|
61
|
+
export declare const LAMPORTS_EXP: BN;
|
|
62
|
+
export declare const OPEN_ORDER_MARGIN_REQUIREMENT: BN;
|
|
63
|
+
export declare const DEFAULT_REVENUE_SINCE_LAST_FUNDING_SPREAD_RETREAT: BN;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.MARGIN_PRECISION = exports.AMM_TIMES_PEG_TO_QUOTE_PRECISION_RATIO = exports.PRICE_TO_QUOTE_PRECISION = exports.PRICE_DIV_PEG = exports.AMM_TO_QUOTE_PRECISION_RATIO = exports.BASE_PRECISION_EXP = exports.BASE_PRECISION = exports.AMM_RESERVE_PRECISION = exports.PEG_PRECISION = exports.FUNDING_RATE_BUFFER_PRECISION = exports.FUNDING_RATE_PRECISION = exports.PRICE_PRECISION = exports.QUOTE_PRECISION = exports.LIQUIDATION_FEE_PRECISION = exports.SPOT_MARKET_IMF_PRECISION = exports.SPOT_MARKET_IMF_PRECISION_EXP = exports.SPOT_MARKET_BALANCE_PRECISION = exports.SPOT_MARKET_BALANCE_PRECISION_EXP = exports.SPOT_MARKET_WEIGHT_PRECISION = exports.SPOT_MARKET_UTILIZATION_PRECISION = exports.SPOT_MARKET_UTILIZATION_PRECISION_EXP = exports.SPOT_MARKET_CUMULATIVE_INTEREST_PRECISION = exports.SPOT_MARKET_CUMULATIVE_INTEREST_PRECISION_EXP = exports.SPOT_MARKET_RATE_PRECISION = exports.SPOT_MARKET_RATE_PRECISION_EXP = exports.AMM_RESERVE_PRECISION_EXP = exports.PEG_PRECISION_EXP = exports.FUNDING_RATE_PRECISION_EXP = exports.PRICE_PRECISION_EXP = exports.FUNDING_RATE_BUFFER_PRECISION_EXP = exports.QUOTE_PRECISION_EXP = exports.CONCENTRATION_PRECISION = exports.PERCENTAGE_PRECISION = exports.PERCENTAGE_PRECISION_EXP = exports.MAX_LEVERAGE_ORDER_SIZE = exports.MAX_LEVERAGE = exports.TEN_MILLION = exports.BN_MAX = exports.TEN_THOUSAND = exports.TEN = exports.NINE = exports.EIGHT = exports.SEVEN = exports.SIX = exports.FIVE = exports.FOUR = exports.THREE = exports.TWO = exports.ONE = exports.ZERO = void 0;
|
|
4
|
-
exports.DEFAULT_REVENUE_SINCE_LAST_FUNDING_SPREAD_RETREAT = exports.OPEN_ORDER_MARGIN_REQUIREMENT = exports.LAMPORTS_EXP = exports.LAMPORTS_PRECISION = exports.QUOTE_SPOT_MARKET_INDEX = exports.ONE_YEAR = exports.ONE_HOUR = exports.FIVE_MINUTE = exports.LIQUIDATION_PCT_PRECISION = exports.BID_ASK_SPREAD_PRECISION = void 0;
|
|
4
|
+
exports.DEFAULT_REVENUE_SINCE_LAST_FUNDING_SPREAD_RETREAT = exports.OPEN_ORDER_MARGIN_REQUIREMENT = exports.LAMPORTS_EXP = exports.LAMPORTS_PRECISION = exports.QUOTE_SPOT_MARKET_INDEX = exports.ONE_YEAR = exports.ONE_HOUR = exports.FIVE_MINUTE = exports.FUNDING_RATE_OFFSET_DENOMINATOR = exports.LIQUIDATION_PCT_PRECISION = exports.BID_ASK_SPREAD_PRECISION = void 0;
|
|
5
5
|
const web3_js_1 = require("@solana/web3.js");
|
|
6
6
|
const __1 = require("../");
|
|
7
7
|
exports.ZERO = new __1.BN(0);
|
|
@@ -56,6 +56,7 @@ exports.AMM_TIMES_PEG_TO_QUOTE_PRECISION_RATIO = exports.AMM_RESERVE_PRECISION.m
|
|
|
56
56
|
exports.MARGIN_PRECISION = exports.TEN_THOUSAND;
|
|
57
57
|
exports.BID_ASK_SPREAD_PRECISION = new __1.BN(1000000); // 10^6
|
|
58
58
|
exports.LIQUIDATION_PCT_PRECISION = exports.TEN_THOUSAND;
|
|
59
|
+
exports.FUNDING_RATE_OFFSET_DENOMINATOR = new __1.BN(5000);
|
|
59
60
|
exports.FIVE_MINUTE = new __1.BN(60 * 5);
|
|
60
61
|
exports.ONE_HOUR = new __1.BN(60 * 60);
|
|
61
62
|
exports.ONE_YEAR = new __1.BN(31536000);
|
package/lib/dlob/DLOB.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="bn.js" />
|
|
1
2
|
import { NodeList } from './NodeList';
|
|
2
3
|
import { BN, DLOBNode, DLOBNodeType, DriftClient, MarketType, MarketTypeStr, OraclePriceData, Order, OrderActionRecord, OrderRecord, PerpMarketAccount, PositionDirection, SlotSubscriber, SpotMarketAccount, StateAccount, TriggerOrderNode, UserMap } from '..';
|
|
3
4
|
import { PublicKey } from '@solana/web3.js';
|
|
@@ -26,6 +27,13 @@ export type MarketNodeLists = {
|
|
|
26
27
|
};
|
|
27
28
|
};
|
|
28
29
|
type OrderBookCallback = () => void;
|
|
30
|
+
/**
|
|
31
|
+
* Receives a DLOBNode and is expected to return true if the node should
|
|
32
|
+
* be taken into account when generating, or false otherwise.
|
|
33
|
+
*
|
|
34
|
+
* Currently used in getRestingLimitBids and getRestingLimitAsks.
|
|
35
|
+
*/
|
|
36
|
+
export type DLOBFilterFcn = (node: DLOBNode) => boolean;
|
|
29
37
|
export type NodeToFill = {
|
|
30
38
|
node: DLOBNode;
|
|
31
39
|
makerNodes: DLOBNode[];
|
|
@@ -70,22 +78,8 @@ export declare class DLOB {
|
|
|
70
78
|
getTakingBids(marketIndex: number, marketType: MarketType, slot: number, oraclePriceData: OraclePriceData): Generator<DLOBNode>;
|
|
71
79
|
getTakingAsks(marketIndex: number, marketType: MarketType, slot: number, oraclePriceData: OraclePriceData): Generator<DLOBNode>;
|
|
72
80
|
private getBestNode;
|
|
73
|
-
getRestingLimitAsks(marketIndex: number, slot: number, marketType: MarketType, oraclePriceData: OraclePriceData): Generator<DLOBNode>;
|
|
74
|
-
|
|
75
|
-
* Filters the limit asks that are resting and do not cross fallback bid
|
|
76
|
-
* Taking orders can only fill against orders that meet this criteria
|
|
77
|
-
*
|
|
78
|
-
* @returns
|
|
79
|
-
*/
|
|
80
|
-
getMakerLimitAsks(marketIndex: number, slot: number, marketType: MarketType, oraclePriceData: OraclePriceData, fallbackBid?: BN): Generator<DLOBNode>;
|
|
81
|
-
getRestingLimitBids(marketIndex: number, slot: number, marketType: MarketType, oraclePriceData: OraclePriceData): Generator<DLOBNode>;
|
|
82
|
-
/**
|
|
83
|
-
* Filters the limit bids that are post only, have been place for sufficiently long or are below the fallback ask
|
|
84
|
-
* Market orders can only fill against orders that meet this criteria
|
|
85
|
-
*
|
|
86
|
-
* @returns
|
|
87
|
-
*/
|
|
88
|
-
getMakerLimitBids(marketIndex: number, slot: number, marketType: MarketType, oraclePriceData: OraclePriceData, fallbackAsk?: BN): Generator<DLOBNode>;
|
|
81
|
+
getRestingLimitAsks(marketIndex: number, slot: number, marketType: MarketType, oraclePriceData: OraclePriceData, filterFcn?: DLOBFilterFcn): Generator<DLOBNode>;
|
|
82
|
+
getRestingLimitBids(marketIndex: number, slot: number, marketType: MarketType, oraclePriceData: OraclePriceData, filterFcn?: DLOBFilterFcn): Generator<DLOBNode>;
|
|
89
83
|
getAsks(marketIndex: number, fallbackAsk: BN | undefined, slot: number, marketType: MarketType, oraclePriceData: OraclePriceData): Generator<DLOBNode>;
|
|
90
84
|
getBids(marketIndex: number, fallbackBid: BN | undefined, slot: number, marketType: MarketType, oraclePriceData: OraclePriceData): Generator<DLOBNode>;
|
|
91
85
|
findCrossingRestingLimitOrders(marketIndex: number, slot: number, marketType: MarketType, oraclePriceData: OraclePriceData): NodeToFill[];
|
package/lib/dlob/DLOB.js
CHANGED
|
@@ -572,7 +572,7 @@ class DLOB {
|
|
|
572
572
|
return bestNode.order.slot.lt(currentNode.order.slot);
|
|
573
573
|
});
|
|
574
574
|
}
|
|
575
|
-
*getBestNode(generatorList, oraclePriceData, slot, compareFcn) {
|
|
575
|
+
*getBestNode(generatorList, oraclePriceData, slot, compareFcn, filterFcn) {
|
|
576
576
|
const generators = generatorList.map((generator) => {
|
|
577
577
|
return {
|
|
578
578
|
next: generator.next(),
|
|
@@ -600,6 +600,10 @@ class DLOB {
|
|
|
600
600
|
bestGenerator.next = bestGenerator.generator.next();
|
|
601
601
|
continue;
|
|
602
602
|
}
|
|
603
|
+
if (filterFcn && filterFcn(bestGenerator.next.value)) {
|
|
604
|
+
bestGenerator.next = bestGenerator.generator.next();
|
|
605
|
+
continue;
|
|
606
|
+
}
|
|
603
607
|
yield bestGenerator.next.value;
|
|
604
608
|
bestGenerator.next = bestGenerator.generator.next();
|
|
605
609
|
}
|
|
@@ -608,7 +612,7 @@ class DLOB {
|
|
|
608
612
|
}
|
|
609
613
|
}
|
|
610
614
|
}
|
|
611
|
-
*getRestingLimitAsks(marketIndex, slot, marketType, oraclePriceData) {
|
|
615
|
+
*getRestingLimitAsks(marketIndex, slot, marketType, oraclePriceData, filterFcn) {
|
|
612
616
|
if ((0, __1.isVariant)(marketType, 'spot') && !oraclePriceData) {
|
|
613
617
|
throw new Error('Must provide OraclePriceData to get spot asks');
|
|
614
618
|
}
|
|
@@ -626,26 +630,9 @@ class DLOB {
|
|
|
626
630
|
return bestNode
|
|
627
631
|
.getPrice(oraclePriceData, slot)
|
|
628
632
|
.lt(currentNode.getPrice(oraclePriceData, slot));
|
|
629
|
-
});
|
|
633
|
+
}, filterFcn);
|
|
630
634
|
}
|
|
631
|
-
|
|
632
|
-
* Filters the limit asks that are resting and do not cross fallback bid
|
|
633
|
-
* Taking orders can only fill against orders that meet this criteria
|
|
634
|
-
*
|
|
635
|
-
* @returns
|
|
636
|
-
*/
|
|
637
|
-
*getMakerLimitAsks(marketIndex, slot, marketType, oraclePriceData, fallbackBid) {
|
|
638
|
-
const isPerpMarket = (0, __1.isVariant)(marketType, 'perp');
|
|
639
|
-
for (const node of this.getRestingLimitAsks(marketIndex, slot, marketType, oraclePriceData)) {
|
|
640
|
-
if (isPerpMarket &&
|
|
641
|
-
fallbackBid &&
|
|
642
|
-
node.getPrice(oraclePriceData, slot).lte(fallbackBid)) {
|
|
643
|
-
continue;
|
|
644
|
-
}
|
|
645
|
-
yield node;
|
|
646
|
-
}
|
|
647
|
-
}
|
|
648
|
-
*getRestingLimitBids(marketIndex, slot, marketType, oraclePriceData) {
|
|
635
|
+
*getRestingLimitBids(marketIndex, slot, marketType, oraclePriceData, filterFcn) {
|
|
649
636
|
if ((0, __1.isVariant)(marketType, 'spot') && !oraclePriceData) {
|
|
650
637
|
throw new Error('Must provide OraclePriceData to get spot bids');
|
|
651
638
|
}
|
|
@@ -663,24 +650,7 @@ class DLOB {
|
|
|
663
650
|
return bestNode
|
|
664
651
|
.getPrice(oraclePriceData, slot)
|
|
665
652
|
.gt(currentNode.getPrice(oraclePriceData, slot));
|
|
666
|
-
});
|
|
667
|
-
}
|
|
668
|
-
/**
|
|
669
|
-
* Filters the limit bids that are post only, have been place for sufficiently long or are below the fallback ask
|
|
670
|
-
* Market orders can only fill against orders that meet this criteria
|
|
671
|
-
*
|
|
672
|
-
* @returns
|
|
673
|
-
*/
|
|
674
|
-
*getMakerLimitBids(marketIndex, slot, marketType, oraclePriceData, fallbackAsk) {
|
|
675
|
-
const isPerpMarket = (0, __1.isVariant)(marketType, 'perp');
|
|
676
|
-
for (const node of this.getRestingLimitBids(marketIndex, slot, marketType, oraclePriceData)) {
|
|
677
|
-
if (isPerpMarket &&
|
|
678
|
-
fallbackAsk &&
|
|
679
|
-
node.getPrice(oraclePriceData, slot).gte(fallbackAsk)) {
|
|
680
|
-
continue;
|
|
681
|
-
}
|
|
682
|
-
yield node;
|
|
683
|
-
}
|
|
653
|
+
}, filterFcn);
|
|
684
654
|
}
|
|
685
655
|
*getAsks(marketIndex, fallbackAsk, slot, marketType, oraclePriceData) {
|
|
686
656
|
if ((0, __1.isVariant)(marketType, 'spot') && !oraclePriceData) {
|
package/lib/dlob/DLOBNode.d.ts
CHANGED
package/lib/dlob/NodeList.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="bn.js" />
|
|
1
2
|
import { BN, DLOBNode, OraclePriceData, PerpMarketAccount } from '..';
|
|
2
3
|
import { PublicKey } from '@solana/web3.js';
|
|
3
4
|
type liquiditySource = 'serum' | 'vamm' | 'dlob' | 'phoenix';
|
|
@@ -26,7 +27,7 @@ export type L3OrderBook = {
|
|
|
26
27
|
asks: L3Level[];
|
|
27
28
|
bids: L3Level[];
|
|
28
29
|
};
|
|
29
|
-
export declare const DEFAULT_TOP_OF_BOOK_QUOTE_AMOUNTS:
|
|
30
|
+
export declare const DEFAULT_TOP_OF_BOOK_QUOTE_AMOUNTS: BN[];
|
|
30
31
|
/**
|
|
31
32
|
* Get an {@link Generator<L2Level>} generator from a {@link Generator<DLOBNode>}
|
|
32
33
|
* @param dlobNodes e.g. {@link DLOB#getRestingLimitAsks} or {@link DLOB#getRestingLimitBids}
|
package/lib/driftClient.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
+
/// <reference types="bn.js" />
|
|
2
3
|
import { AnchorProvider, BN, Program, ProgramAccount } from '@coral-xyz/anchor';
|
|
3
4
|
import { StateAccount, IWallet, PositionDirection, UserAccount, PerpMarketAccount, OrderParams, Order, SpotMarketAccount, SpotPosition, MakerInfo, TakerInfo, OptionalOrderParams, ReferrerInfo, MarketType, TxParams, SerumV3FulfillmentConfigAccount, ReferrerNameAccount, OrderTriggerCondition, PerpMarketExtendedInfo, UserStatsAccount, PhoenixV1FulfillmentConfigAccount, ModifyOrderPolicy, SwapReduceOnly } from './types';
|
|
4
5
|
import * as anchor from '@coral-xyz/anchor';
|
|
@@ -103,7 +104,7 @@ export declare class DriftClient {
|
|
|
103
104
|
* @param includeDelegates
|
|
104
105
|
*/
|
|
105
106
|
updateWallet(newWallet: IWallet, subAccountIds?: number[], activeSubAccountId?: number, includeDelegates?: boolean, authoritySubaccountMap?: Map<string, number[]>): Promise<boolean>;
|
|
106
|
-
switchActiveUser(subAccountId: number, authority?: PublicKey): void
|
|
107
|
+
switchActiveUser(subAccountId: number, authority?: PublicKey): Promise<void>;
|
|
107
108
|
addUser(subAccountId: number, authority?: PublicKey, userAccount?: UserAccount): Promise<boolean>;
|
|
108
109
|
/**
|
|
109
110
|
* Adds and subscribes to users based on params set by the constructor or by updateWallet.
|
|
@@ -115,9 +116,16 @@ export declare class DriftClient {
|
|
|
115
116
|
getNextSubAccountId(): Promise<number>;
|
|
116
117
|
initializeReferrerName(name: string): Promise<TransactionSignature>;
|
|
117
118
|
updateUserName(name: string, subAccountId?: number): Promise<TransactionSignature>;
|
|
118
|
-
updateUserCustomMarginRatio(
|
|
119
|
+
updateUserCustomMarginRatio(updates: {
|
|
120
|
+
marginRatio: number;
|
|
121
|
+
subAccountId: number;
|
|
122
|
+
}[]): Promise<TransactionSignature>;
|
|
123
|
+
getUpdateUserCustomMarginRatioIx(marginRatio: number, subAccountId?: number): Promise<TransactionInstruction>;
|
|
119
124
|
getUpdateUserMarginTradingEnabledIx(marginTradingEnabled: boolean, subAccountId?: number, userAccountPublicKey?: PublicKey): Promise<TransactionInstruction>;
|
|
120
|
-
updateUserMarginTradingEnabled(
|
|
125
|
+
updateUserMarginTradingEnabled(updates: {
|
|
126
|
+
marginTradingEnabled: boolean;
|
|
127
|
+
subAccountId: number;
|
|
128
|
+
}[]): Promise<TransactionSignature>;
|
|
121
129
|
updateUserDelegate(delegate: PublicKey, subAccountId?: number): Promise<TransactionSignature>;
|
|
122
130
|
fetchAllUserAccounts(includeIdle?: boolean): Promise<ProgramAccount<UserAccount>[]>;
|
|
123
131
|
getUserAccountsForDelegate(delegate: PublicKey): Promise<UserAccount[]>;
|
|
@@ -269,7 +277,7 @@ export declare class DriftClient {
|
|
|
269
277
|
* @param bracketOrdersParams
|
|
270
278
|
* @returns
|
|
271
279
|
*/
|
|
272
|
-
sendMarketOrderAndGetSignedFillTx(orderParams: OptionalOrderParams, userAccountPublicKey: PublicKey, userAccount: UserAccount, makerInfo?: MakerInfo | MakerInfo[], txParams?: TxParams, bracketOrdersParams?: OptionalOrderParams[], referrerInfo?: ReferrerInfo
|
|
280
|
+
sendMarketOrderAndGetSignedFillTx(orderParams: OptionalOrderParams, userAccountPublicKey: PublicKey, userAccount: UserAccount, makerInfo?: MakerInfo | MakerInfo[], txParams?: TxParams, bracketOrdersParams?: OptionalOrderParams[], referrerInfo?: ReferrerInfo): Promise<{
|
|
273
281
|
txSig: TransactionSignature;
|
|
274
282
|
signedFillTx: Transaction;
|
|
275
283
|
}>;
|
package/lib/driftClient.js
CHANGED
|
@@ -294,6 +294,7 @@ class DriftClient {
|
|
|
294
294
|
* @param includeDelegates
|
|
295
295
|
*/
|
|
296
296
|
async updateWallet(newWallet, subAccountIds, activeSubAccountId, includeDelegates, authoritySubaccountMap) {
|
|
297
|
+
var _a, _b;
|
|
297
298
|
const newProvider = new anchor_1.AnchorProvider(this.connection,
|
|
298
299
|
// @ts-ignore
|
|
299
300
|
newWallet, this.opts);
|
|
@@ -308,6 +309,10 @@ class DriftClient {
|
|
|
308
309
|
this.activeSubAccountId = activeSubAccountId;
|
|
309
310
|
this.userStatsAccountPublicKey = undefined;
|
|
310
311
|
this.includeDelegates = includeDelegates !== null && includeDelegates !== void 0 ? includeDelegates : false;
|
|
312
|
+
const walletSupportsVersionedTxns =
|
|
313
|
+
//@ts-ignore
|
|
314
|
+
(_b = (_a = this.wallet.supportedTransactionVersions) === null || _a === void 0 ? void 0 : _a.size) !== null && _b !== void 0 ? _b : 0 > 1;
|
|
315
|
+
this.txVersion = walletSupportsVersionedTxns ? 0 : 'legacy';
|
|
311
316
|
if (includeDelegates && subAccountIds) {
|
|
312
317
|
throw new Error('Can only pass one of includeDelegates or subAccountIds. If you want to specify subaccount ids for multiple authorities, pass authoritySubaccountMap instead');
|
|
313
318
|
}
|
|
@@ -339,10 +344,24 @@ class DriftClient {
|
|
|
339
344
|
}
|
|
340
345
|
return success;
|
|
341
346
|
}
|
|
342
|
-
switchActiveUser(subAccountId, authority) {
|
|
347
|
+
async switchActiveUser(subAccountId, authority) {
|
|
348
|
+
var _a;
|
|
349
|
+
const authorityChanged = authority && !((_a = this.authority) === null || _a === void 0 ? void 0 : _a.equals(authority));
|
|
343
350
|
this.activeSubAccountId = subAccountId;
|
|
344
351
|
this.authority = authority !== null && authority !== void 0 ? authority : this.authority;
|
|
345
352
|
this.userStatsAccountPublicKey = (0, pda_1.getUserStatsAccountPublicKey)(this.program.programId, this.authority);
|
|
353
|
+
/* If changing the user authority ie switching from delegate to non-delegate account, need to re-subscribe to the user stats account */
|
|
354
|
+
if (authorityChanged) {
|
|
355
|
+
if (this.userStats && this.userStats.isSubscribed) {
|
|
356
|
+
await this.userStats.unsubscribe();
|
|
357
|
+
}
|
|
358
|
+
this.userStats = new userStats_1.UserStats({
|
|
359
|
+
driftClient: this,
|
|
360
|
+
userStatsAccountPublicKey: this.userStatsAccountPublicKey,
|
|
361
|
+
accountSubscription: this.userAccountSubscriptionConfig,
|
|
362
|
+
});
|
|
363
|
+
this.userStats.subscribe();
|
|
364
|
+
}
|
|
346
365
|
}
|
|
347
366
|
async addUser(subAccountId, authority, userAccount) {
|
|
348
367
|
authority = authority !== null && authority !== void 0 ? authority : this.authority;
|
|
@@ -503,15 +522,25 @@ class DriftClient {
|
|
|
503
522
|
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
504
523
|
return txSig;
|
|
505
524
|
}
|
|
506
|
-
async updateUserCustomMarginRatio(
|
|
507
|
-
const
|
|
525
|
+
async updateUserCustomMarginRatio(updates) {
|
|
526
|
+
const ixs = await Promise.all(updates.map(async ({ marginRatio, subAccountId }) => {
|
|
527
|
+
const ix = await this.getUpdateUserCustomMarginRatioIx(marginRatio, subAccountId);
|
|
528
|
+
return ix;
|
|
529
|
+
}));
|
|
530
|
+
const tx = await this.buildTransaction(ixs, this.txParams);
|
|
531
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
532
|
+
return txSig;
|
|
533
|
+
}
|
|
534
|
+
async getUpdateUserCustomMarginRatioIx(marginRatio, subAccountId = 0) {
|
|
535
|
+
const userAccountPublicKey = (0, pda_1.getUserAccountPublicKeySync)(this.program.programId, this.wallet.publicKey, subAccountId);
|
|
536
|
+
await this.addUser(subAccountId, this.wallet.publicKey);
|
|
537
|
+
const ix = this.program.instruction.updateUserCustomMarginRatio(subAccountId, marginRatio, {
|
|
508
538
|
accounts: {
|
|
509
|
-
user:
|
|
539
|
+
user: userAccountPublicKey,
|
|
510
540
|
authority: this.wallet.publicKey,
|
|
511
541
|
},
|
|
512
542
|
});
|
|
513
|
-
|
|
514
|
-
return txSig;
|
|
543
|
+
return ix;
|
|
515
544
|
}
|
|
516
545
|
async getUpdateUserMarginTradingEnabledIx(marginTradingEnabled, subAccountId = 0, userAccountPublicKey) {
|
|
517
546
|
const userAccountPublicKeyToUse = userAccountPublicKey ||
|
|
@@ -534,19 +563,11 @@ class DriftClient {
|
|
|
534
563
|
remainingAccounts,
|
|
535
564
|
});
|
|
536
565
|
}
|
|
537
|
-
async updateUserMarginTradingEnabled(
|
|
538
|
-
const
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
});
|
|
543
|
-
const tx = await this.program.transaction.updateUserMarginTradingEnabled(subAccountId, marginTradingEnabled, {
|
|
544
|
-
accounts: {
|
|
545
|
-
user: userAccountPublicKey,
|
|
546
|
-
authority: this.wallet.publicKey,
|
|
547
|
-
},
|
|
548
|
-
remainingAccounts,
|
|
549
|
-
});
|
|
566
|
+
async updateUserMarginTradingEnabled(updates) {
|
|
567
|
+
const ixs = await Promise.all(updates.map(async ({ marginTradingEnabled, subAccountId }) => {
|
|
568
|
+
return await this.getUpdateUserMarginTradingEnabledIx(marginTradingEnabled, subAccountId);
|
|
569
|
+
}));
|
|
570
|
+
const tx = await this.buildTransaction(ixs, this.txParams);
|
|
550
571
|
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
551
572
|
return txSig;
|
|
552
573
|
}
|
|
@@ -925,28 +946,25 @@ class DriftClient {
|
|
|
925
946
|
* @param reduceOnly
|
|
926
947
|
*/
|
|
927
948
|
async deposit(amount, marketIndex, associatedTokenAccount, subAccountId, reduceOnly = false) {
|
|
928
|
-
const tx = new web3_js_1.Transaction();
|
|
929
|
-
tx.add(web3_js_1.ComputeBudgetProgram.setComputeUnitLimit({
|
|
930
|
-
units: 600000,
|
|
931
|
-
}));
|
|
932
949
|
const additionalSigners = [];
|
|
933
950
|
const spotMarketAccount = this.getSpotMarketAccount(marketIndex);
|
|
934
951
|
const isSolMarket = spotMarketAccount.mint.equals(spotMarkets_1.WRAPPED_SOL_MINT);
|
|
935
952
|
const signerAuthority = this.wallet.publicKey;
|
|
936
953
|
const createWSOLTokenAccount = isSolMarket && associatedTokenAccount.equals(signerAuthority);
|
|
954
|
+
const instructions = [];
|
|
937
955
|
if (createWSOLTokenAccount) {
|
|
938
956
|
const { ixs, pubkey } = await this.getWrappedSolAccountCreationIxs(amount, true);
|
|
939
957
|
associatedTokenAccount = pubkey;
|
|
940
|
-
|
|
941
|
-
tx.add(ix);
|
|
942
|
-
});
|
|
958
|
+
instructions.push(...ixs);
|
|
943
959
|
}
|
|
944
960
|
const depositCollateralIx = await this.getDepositInstruction(amount, marketIndex, associatedTokenAccount, subAccountId, reduceOnly, true);
|
|
945
|
-
|
|
961
|
+
instructions.push(depositCollateralIx);
|
|
946
962
|
// Close the wrapped sol account at the end of the transaction
|
|
947
963
|
if (createWSOLTokenAccount) {
|
|
948
|
-
|
|
964
|
+
instructions.push((0, spl_token_1.createCloseAccountInstruction)(associatedTokenAccount, signerAuthority, signerAuthority, []));
|
|
949
965
|
}
|
|
966
|
+
const txParams = { ...this.txParams, computeUnits: 600000 };
|
|
967
|
+
const tx = await this.buildTransaction(instructions, txParams);
|
|
950
968
|
const { txSig, slot } = await this.sendTransaction(tx, additionalSigners, this.opts);
|
|
951
969
|
this.spotMarketLastSlotCache.set(marketIndex, slot);
|
|
952
970
|
return txSig;
|
|
@@ -1349,8 +1367,7 @@ class DriftClient {
|
|
|
1349
1367
|
* @param bracketOrdersParams
|
|
1350
1368
|
* @returns
|
|
1351
1369
|
*/
|
|
1352
|
-
async sendMarketOrderAndGetSignedFillTx(orderParams, userAccountPublicKey, userAccount, makerInfo, txParams, bracketOrdersParams = new Array(), referrerInfo
|
|
1353
|
-
var _a, _b;
|
|
1370
|
+
async sendMarketOrderAndGetSignedFillTx(orderParams, userAccountPublicKey, userAccount, makerInfo, txParams, bracketOrdersParams = new Array(), referrerInfo) {
|
|
1354
1371
|
const marketIndex = orderParams.marketIndex;
|
|
1355
1372
|
const orderId = userAccount.nextOrderId;
|
|
1356
1373
|
const bracketOrderIxs = [];
|
|
@@ -1363,11 +1380,8 @@ class DriftClient {
|
|
|
1363
1380
|
orderId,
|
|
1364
1381
|
marketIndex,
|
|
1365
1382
|
}, makerInfo, referrerInfo);
|
|
1366
|
-
const walletSupportsVersionedTxns =
|
|
1367
|
-
//@ts-ignore
|
|
1368
|
-
(_b = (_a = this.wallet.supportedTransactionVersions) === null || _a === void 0 ? void 0 : _a.size) !== null && _b !== void 0 ? _b : 0 > 1;
|
|
1369
1383
|
// use versioned transactions if there is a lookup table account and wallet is compatible
|
|
1370
|
-
if (
|
|
1384
|
+
if (this.txVersion === 0) {
|
|
1371
1385
|
const versionedMarketOrderTx = await this.buildTransaction([placePerpOrderIx].concat(bracketOrderIxs), txParams, 0);
|
|
1372
1386
|
const versionedFillTx = await this.buildTransaction([fillPerpOrderIx], txParams, 0);
|
|
1373
1387
|
const [signedVersionedMarketOrderTx, signedVersionedFillTx] = await this.provider.wallet.signAllTransactions([
|
|
@@ -3238,12 +3252,11 @@ class DriftClient {
|
|
|
3238
3252
|
return undefined;
|
|
3239
3253
|
}
|
|
3240
3254
|
sendTransaction(tx, additionalSigners, opts, preSigned) {
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
return this.txSender.send(tx, additionalSigners, opts, preSigned);
|
|
3255
|
+
if (tx instanceof web3_js_1.VersionedTransaction) {
|
|
3256
|
+
return this.txSender.sendVersionedTransaction(tx, additionalSigners, opts, preSigned);
|
|
3244
3257
|
}
|
|
3245
3258
|
else {
|
|
3246
|
-
return this.txSender.
|
|
3259
|
+
return this.txSender.send(tx, additionalSigners, opts, preSigned);
|
|
3247
3260
|
}
|
|
3248
3261
|
}
|
|
3249
3262
|
async buildTransaction(instructions, txParams, txVersion, lookupTables) {
|
package/lib/factory/bigNum.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="bn.js" />
|
|
1
2
|
import { BN } from '@coral-xyz/anchor';
|
|
2
3
|
export declare class BigNum {
|
|
3
4
|
val: BN;
|
|
@@ -43,11 +44,11 @@ export declare class BigNum {
|
|
|
43
44
|
gte(bn: BigNum | BN, ignorePrecision?: boolean): boolean;
|
|
44
45
|
lte(bn: BigNum | BN, ignorePrecision?: boolean): boolean;
|
|
45
46
|
eq(bn: BigNum | BN, ignorePrecision?: boolean): boolean;
|
|
46
|
-
eqZero():
|
|
47
|
-
gtZero():
|
|
48
|
-
ltZero():
|
|
49
|
-
gteZero():
|
|
50
|
-
lteZero():
|
|
47
|
+
eqZero(): boolean;
|
|
48
|
+
gtZero(): boolean;
|
|
49
|
+
ltZero(): boolean;
|
|
50
|
+
gteZero(): boolean;
|
|
51
|
+
lteZero(): boolean;
|
|
51
52
|
abs(): BigNum;
|
|
52
53
|
neg(): BigNum;
|
|
53
54
|
toString: (base?: number | 'hex', length?: number) => string;
|
|
@@ -87,8 +88,8 @@ export declare class BigNum {
|
|
|
87
88
|
toNotional(useTradePrecision?: boolean, precisionOverride?: number): string;
|
|
88
89
|
toMillified(precision?: number, rounded?: boolean): string;
|
|
89
90
|
toJSON(): {
|
|
90
|
-
val:
|
|
91
|
-
precision:
|
|
91
|
+
val: string;
|
|
92
|
+
precision: string;
|
|
92
93
|
};
|
|
93
94
|
isNeg(): boolean;
|
|
94
95
|
isPos(): boolean;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="bn.js" />
|
|
1
2
|
import { AddressLookupTableAccount, Connection, PublicKey, TransactionInstruction, TransactionMessage, VersionedTransaction } from '@solana/web3.js';
|
|
2
3
|
import { BN } from '@coral-xyz/anchor';
|
|
3
4
|
export type SwapMode = 'ExactIn' | 'ExactOut';
|
package/lib/marinade/index.d.ts
CHANGED
package/lib/math/amm.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="bn.js" />
|
|
1
2
|
import { BN } from '@coral-xyz/anchor';
|
|
2
3
|
import { AMM, PositionDirection, SwapDirection, PerpMarketAccount } from '../types';
|
|
3
4
|
import { OraclePriceData } from '../oracles/types';
|
|
@@ -86,7 +87,7 @@ export declare function getSwapDirection(inputAssetType: AssetType, positionDire
|
|
|
86
87
|
* @param market
|
|
87
88
|
* @returns cost : Precision PRICE_PRECISION
|
|
88
89
|
*/
|
|
89
|
-
export declare function calculateTerminalPrice(market: PerpMarketAccount):
|
|
90
|
+
export declare function calculateTerminalPrice(market: PerpMarketAccount): BN;
|
|
90
91
|
export declare function calculateMaxBaseAssetAmountToTrade(amm: AMM, limit_price: BN, direction: PositionDirection, oraclePriceData?: OraclePriceData, now?: BN): [BN, PositionDirection];
|
|
91
92
|
export declare function calculateQuoteAssetAmountSwapped(quoteAssetReserves: BN, pegMultiplier: BN, swapDirection: SwapDirection): BN;
|
|
92
93
|
export declare function calculateMaxBaseAssetAmountFillable(amm: AMM, orderDirection: PositionDirection): BN;
|
package/lib/math/auction.d.ts
CHANGED
package/lib/math/conversion.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
import { BN } from '../';
|
|
2
|
+
export declare const convertToNumber: (bigNumber: BN, precision?: BN) => number;
|
package/lib/math/funding.d.ts
CHANGED
package/lib/math/funding.js
CHANGED
|
@@ -72,7 +72,8 @@ async function calculateAllEstimatedFundingRate(market, oraclePriceData, markPri
|
|
|
72
72
|
// console.log('shrink orac:', liveOracleTwap.toString(), '->', oracleTwap.toString());
|
|
73
73
|
// }
|
|
74
74
|
const twapSpread = markTwap.sub(oracleTwap);
|
|
75
|
-
const
|
|
75
|
+
const twapSpreadWithOffset = twapSpread.add(oracleTwap.abs().div(numericConstants_1.FUNDING_RATE_OFFSET_DENOMINATOR));
|
|
76
|
+
const twapSpreadPct = twapSpreadWithOffset
|
|
76
77
|
.mul(numericConstants_1.PRICE_PRECISION)
|
|
77
78
|
.mul(new anchor_1.BN(100))
|
|
78
79
|
.div(oracleTwap);
|
package/lib/math/insurance.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="bn.js" />
|
|
1
2
|
import { BN } from '../index';
|
|
2
3
|
export declare function stakeAmountToShares(amount: BN, totalIfShares: BN, insuranceFundVaultBalance: BN): BN;
|
|
3
4
|
export declare function unstakeSharesToAmount(nShares: BN, totalIfShares: BN, insuranceFundVaultBalance: BN): BN;
|