@drift-labs/sdk 0.2.0-master.30 → 0.2.0-master.32
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/lib/admin.d.ts +11 -7
- package/lib/admin.js +50 -12
- package/lib/clearingHouse.d.ts +26 -23
- package/lib/clearingHouse.js +290 -652
- package/lib/clearingHouseUser.d.ts +1 -1
- package/lib/clearingHouseUser.js +9 -12
- package/lib/config.js +1 -1
- package/lib/constants/numericConstants.d.ts +7 -0
- package/lib/constants/numericConstants.js +8 -1
- package/lib/constants/spotMarkets.js +4 -4
- package/lib/dlob/DLOB.d.ts +7 -5
- package/lib/dlob/DLOB.js +159 -88
- package/lib/dlob/DLOBNode.d.ts +2 -0
- package/lib/dlob/DLOBNode.js +3 -0
- package/lib/dlob/NodeList.d.ts +2 -1
- package/lib/dlob/NodeList.js +10 -4
- package/lib/events/types.d.ts +2 -1
- package/lib/events/types.js +1 -0
- package/lib/factory/bigNum.d.ts +1 -0
- package/lib/factory/bigNum.js +14 -0
- package/lib/idl/clearing_house.json +1091 -611
- package/lib/math/amm.d.ts +2 -2
- package/lib/math/amm.js +31 -28
- package/lib/math/market.d.ts +1 -1
- package/lib/math/market.js +6 -6
- package/lib/math/spotBalance.js +7 -8
- package/lib/math/trade.js +11 -11
- package/lib/types.d.ts +118 -41
- package/lib/types.js +34 -4
- package/package.json +4 -2
- package/src/admin.ts +129 -29
- package/src/clearingHouse.ts +380 -787
- package/src/clearingHouseUser.ts +11 -14
- package/src/config.ts +1 -1
- package/src/constants/numericConstants.ts +7 -0
- package/src/constants/spotMarkets.ts +5 -4
- package/src/dlob/DLOB.ts +221 -103
- package/src/dlob/DLOBNode.ts +5 -0
- package/src/dlob/NodeList.ts +15 -5
- package/src/events/types.ts +3 -0
- package/src/factory/bigNum.ts +23 -0
- package/src/idl/clearing_house.json +1091 -611
- package/src/math/amm.ts +42 -29
- package/src/math/market.ts +9 -4
- package/src/math/spotBalance.ts +11 -8
- package/src/math/trade.ts +11 -11
- package/src/types.ts +82 -41
- package/tests/bn/test.ts +13 -8
- package/tests/dlob/helpers.ts +56 -33
- package/tests/dlob/test.ts +1397 -495
- package/src/assert/assert.js +0 -9
- package/src/events/eventList.js +0 -77
- package/src/examples/makeTradeExample.js +0 -157
- package/src/token/index.js +0 -38
- package/src/tx/types.js +0 -2
- package/src/tx/utils.js +0 -17
- package/src/util/computeUnits.js +0 -27
- package/src/util/getTokenAddress.js +0 -9
- package/src/util/promiseTimeout.js +0 -14
- package/src/util/tps.js +0 -27
package/lib/admin.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/// <reference types="bn.js" />
|
|
2
2
|
import { PublicKey, TransactionSignature } from '@solana/web3.js';
|
|
3
|
-
import { FeeStructure, OracleGuardRails, OracleSource } from './types';
|
|
3
|
+
import { FeeStructure, OracleGuardRails, OracleSource, ExchangeStatus, MarketStatus, ContractTier, AssetTier } from './types';
|
|
4
4
|
import { BN } from '@project-serum/anchor';
|
|
5
5
|
import { ClearingHouse } from './clearingHouse';
|
|
6
6
|
export declare class Admin extends ClearingHouse {
|
|
7
|
-
initialize(usdcMint: PublicKey,
|
|
8
|
-
initializeSpotMarket(mint: PublicKey, optimalUtilization:
|
|
7
|
+
initialize(usdcMint: PublicKey, _adminControlsPrices: boolean): Promise<[TransactionSignature]>;
|
|
8
|
+
initializeSpotMarket(mint: PublicKey, optimalUtilization: number, optimalRate: number, maxRate: number, oracle: PublicKey, oracleSource: OracleSource, initialAssetWeight: BN, maintenanceAssetWeight: BN, initialLiabilityWeight: BN, maintenanceLiabilityWeight: BN, imfFactor?: BN, liquidationFee?: BN, activeStatus?: boolean): Promise<TransactionSignature>;
|
|
9
9
|
initializeSerumFulfillmentConfig(marketIndex: number, serumMarket: PublicKey, serumProgram: PublicKey): Promise<TransactionSignature>;
|
|
10
|
-
initializeMarket(priceOracle: PublicKey, baseAssetReserve: BN, quoteAssetReserve: BN, periodicity: BN, pegMultiplier?: BN, oracleSource?: OracleSource, marginRatioInitial?: number, marginRatioMaintenance?: number, liquidationFee?: BN): Promise<TransactionSignature>;
|
|
10
|
+
initializeMarket(priceOracle: PublicKey, baseAssetReserve: BN, quoteAssetReserve: BN, periodicity: BN, pegMultiplier?: BN, oracleSource?: OracleSource, marginRatioInitial?: number, marginRatioMaintenance?: number, liquidationFee?: BN, activeStatus?: boolean): Promise<TransactionSignature>;
|
|
11
11
|
moveAmmPrice(marketIndex: number, baseAssetReserve: BN, quoteAssetReserve: BN, sqrtK?: BN): Promise<TransactionSignature>;
|
|
12
12
|
updateK(sqrtK: BN, marketIndex: number): Promise<TransactionSignature>;
|
|
13
13
|
updateConcentrationScale(marketIndex: number, concentrationScale: BN): Promise<TransactionSignature>;
|
|
@@ -33,6 +33,7 @@ export declare class Admin extends ClearingHouse {
|
|
|
33
33
|
updateWithdrawGuardThreshold(marketIndex: number, withdrawGuardThreshold: BN): Promise<TransactionSignature>;
|
|
34
34
|
updateSpotMarketIfFactor(marketIndex: number, userIfFactor: BN, totalIfFactor: BN): Promise<TransactionSignature>;
|
|
35
35
|
updateSpotMarketRevenueSettlePeriod(marketIndex: number, revenueSettlePeriod: BN): Promise<TransactionSignature>;
|
|
36
|
+
updateSpotMarketMaxTokenDeposits(marketIndex: number, maxTokenDeposits: BN): Promise<TransactionSignature>;
|
|
36
37
|
updateInsuranceWithdrawEscrowPeriod(marketIndex: number, insuranceWithdrawEscrowPeriod: BN): Promise<TransactionSignature>;
|
|
37
38
|
updateLpCooldownTime(marketIndex: number, cooldownTime: BN): Promise<TransactionSignature>;
|
|
38
39
|
updateMarketOracle(marketIndex: number, oracle: PublicKey, oracleSource: OracleSource): Promise<TransactionSignature>;
|
|
@@ -42,9 +43,12 @@ export declare class Admin extends ClearingHouse {
|
|
|
42
43
|
updateWhitelistMint(whitelistMint?: PublicKey): Promise<TransactionSignature>;
|
|
43
44
|
updateDiscountMint(discountMint: PublicKey): Promise<TransactionSignature>;
|
|
44
45
|
updateMaxDeposit(maxDeposit: BN): Promise<TransactionSignature>;
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
updateSpotMarketMarginWeights(spotMarketIndex: number, initialAssetWeight: BN, maintenanceAssetWeight: BN, initialLiabilityWeight: BN, maintenanceLiabilityWeight: BN, imfFactor?: BN): Promise<TransactionSignature>;
|
|
47
|
+
updateSpotMarketAssetTier(spotMarketIndex: number, assetTier: AssetTier): Promise<TransactionSignature>;
|
|
48
|
+
updateSpotMarketStatus(spotMarketIndex: number, marketStatus: MarketStatus): Promise<TransactionSignature>;
|
|
49
|
+
updatePerpMarketStatus(perpMarketIndex: number, marketStatus: MarketStatus): Promise<TransactionSignature>;
|
|
50
|
+
updatePerpMarketContractTier(perpMarketIndex: number, contractTier: ContractTier): Promise<TransactionSignature>;
|
|
51
|
+
updateExchangeStatus(exchangeStatus: ExchangeStatus): Promise<TransactionSignature>;
|
|
48
52
|
updatePerpAuctionDuration(minDuration: BN | number): Promise<TransactionSignature>;
|
|
49
53
|
updateSpotAuctionDuration(defaultAuctionDuration: number): Promise<TransactionSignature>;
|
|
50
54
|
updateMaxBaseAssetAmountRatio(marketIndex: number, maxBaseAssetAmountRatio: number): Promise<TransactionSignature>;
|
package/lib/admin.js
CHANGED
|
@@ -36,13 +36,13 @@ const numericConstants_1 = require("./constants/numericConstants");
|
|
|
36
36
|
const trade_1 = require("./math/trade");
|
|
37
37
|
const amm_1 = require("./math/amm");
|
|
38
38
|
class Admin extends clearingHouse_1.ClearingHouse {
|
|
39
|
-
async initialize(usdcMint,
|
|
39
|
+
async initialize(usdcMint, _adminControlsPrices) {
|
|
40
40
|
const stateAccountRPCResponse = await this.connection.getParsedAccountInfo(await this.getStatePublicKey());
|
|
41
41
|
if (stateAccountRPCResponse.value !== null) {
|
|
42
42
|
throw new Error('Clearing house already initialized');
|
|
43
43
|
}
|
|
44
44
|
const [clearingHouseStatePublicKey] = await (0, pda_1.getClearingHouseStateAccountPublicKeyAndNonce)(this.program.programId);
|
|
45
|
-
const initializeTx = await this.program.transaction.initialize(
|
|
45
|
+
const initializeTx = await this.program.transaction.initialize({
|
|
46
46
|
accounts: {
|
|
47
47
|
admin: this.wallet.publicKey,
|
|
48
48
|
state: clearingHouseStatePublicKey,
|
|
@@ -56,12 +56,12 @@ class Admin extends clearingHouse_1.ClearingHouse {
|
|
|
56
56
|
const { txSig: initializeTxSig } = await this.txSender.send(initializeTx, [], this.opts);
|
|
57
57
|
return [initializeTxSig];
|
|
58
58
|
}
|
|
59
|
-
async initializeSpotMarket(mint, optimalUtilization, optimalRate, maxRate, oracle, oracleSource, initialAssetWeight, maintenanceAssetWeight, initialLiabilityWeight, maintenanceLiabilityWeight, imfFactor = new anchor_1.BN(0), liquidationFee = numericConstants_1.ZERO) {
|
|
59
|
+
async initializeSpotMarket(mint, optimalUtilization, optimalRate, maxRate, oracle, oracleSource, initialAssetWeight, maintenanceAssetWeight, initialLiabilityWeight, maintenanceLiabilityWeight, imfFactor = new anchor_1.BN(0), liquidationFee = numericConstants_1.ZERO, activeStatus = true) {
|
|
60
60
|
const spotMarketIndex = this.getStateAccount().numberOfSpotMarkets;
|
|
61
61
|
const spotMarket = await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex);
|
|
62
62
|
const spotMarketVault = await (0, pda_1.getSpotMarketVaultPublicKey)(this.program.programId, spotMarketIndex);
|
|
63
63
|
const insuranceFundVault = await (0, pda_1.getInsuranceFundVaultPublicKey)(this.program.programId, spotMarketIndex);
|
|
64
|
-
const initializeTx = await this.program.transaction.initializeSpotMarket(optimalUtilization, optimalRate, maxRate, oracleSource, initialAssetWeight, maintenanceAssetWeight, initialLiabilityWeight, maintenanceLiabilityWeight, imfFactor, liquidationFee, {
|
|
64
|
+
const initializeTx = await this.program.transaction.initializeSpotMarket(optimalUtilization, optimalRate, maxRate, oracleSource, initialAssetWeight, maintenanceAssetWeight, initialLiabilityWeight, maintenanceLiabilityWeight, imfFactor, liquidationFee, activeStatus, {
|
|
65
65
|
accounts: {
|
|
66
66
|
admin: this.wallet.publicKey,
|
|
67
67
|
state: await this.getStatePublicKey(),
|
|
@@ -103,9 +103,9 @@ class Admin extends clearingHouse_1.ClearingHouse {
|
|
|
103
103
|
},
|
|
104
104
|
});
|
|
105
105
|
}
|
|
106
|
-
async initializeMarket(priceOracle, baseAssetReserve, quoteAssetReserve, periodicity, pegMultiplier = numericConstants_1.PEG_PRECISION, oracleSource = types_1.OracleSource.PYTH, marginRatioInitial = 2000, marginRatioMaintenance = 500, liquidationFee = numericConstants_1.ZERO) {
|
|
106
|
+
async initializeMarket(priceOracle, baseAssetReserve, quoteAssetReserve, periodicity, pegMultiplier = numericConstants_1.PEG_PRECISION, oracleSource = types_1.OracleSource.PYTH, marginRatioInitial = 2000, marginRatioMaintenance = 500, liquidationFee = numericConstants_1.ZERO, activeStatus = true) {
|
|
107
107
|
const marketPublicKey = await (0, pda_1.getMarketPublicKey)(this.program.programId, this.getStateAccount().numberOfMarkets);
|
|
108
|
-
const initializeMarketTx = await this.program.transaction.initializeMarket(baseAssetReserve, quoteAssetReserve, periodicity, pegMultiplier, oracleSource, marginRatioInitial, marginRatioMaintenance, liquidationFee, {
|
|
108
|
+
const initializeMarketTx = await this.program.transaction.initializeMarket(baseAssetReserve, quoteAssetReserve, periodicity, pegMultiplier, oracleSource, marginRatioInitial, marginRatioMaintenance, liquidationFee, activeStatus, {
|
|
109
109
|
accounts: {
|
|
110
110
|
state: await this.getStatePublicKey(),
|
|
111
111
|
admin: this.wallet.publicKey,
|
|
@@ -366,6 +366,15 @@ class Admin extends clearingHouse_1.ClearingHouse {
|
|
|
366
366
|
},
|
|
367
367
|
});
|
|
368
368
|
}
|
|
369
|
+
async updateSpotMarketMaxTokenDeposits(marketIndex, maxTokenDeposits) {
|
|
370
|
+
return await this.program.rpc.updateSpotMarketMaxTokenDeposits(maxTokenDeposits, {
|
|
371
|
+
accounts: {
|
|
372
|
+
admin: this.wallet.publicKey,
|
|
373
|
+
state: await this.getStatePublicKey(),
|
|
374
|
+
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, marketIndex),
|
|
375
|
+
},
|
|
376
|
+
});
|
|
377
|
+
}
|
|
369
378
|
async updateInsuranceWithdrawEscrowPeriod(marketIndex, insuranceWithdrawEscrowPeriod) {
|
|
370
379
|
return await this.program.rpc.updateInsuranceWithdrawEscrowPeriod(insuranceWithdrawEscrowPeriod, {
|
|
371
380
|
accounts: {
|
|
@@ -444,24 +453,53 @@ class Admin extends clearingHouse_1.ClearingHouse {
|
|
|
444
453
|
},
|
|
445
454
|
});
|
|
446
455
|
}
|
|
447
|
-
async
|
|
448
|
-
return await this.program.rpc.
|
|
456
|
+
async updateSpotMarketMarginWeights(spotMarketIndex, initialAssetWeight, maintenanceAssetWeight, initialLiabilityWeight, maintenanceLiabilityWeight, imfFactor = new anchor_1.BN(0)) {
|
|
457
|
+
return await this.program.rpc.updateSpotMarketMarginWeights(initialAssetWeight, maintenanceAssetWeight, initialLiabilityWeight, maintenanceLiabilityWeight, imfFactor, {
|
|
458
|
+
accounts: {
|
|
459
|
+
admin: this.wallet.publicKey,
|
|
460
|
+
state: await this.getStatePublicKey(),
|
|
461
|
+
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
462
|
+
},
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
async updateSpotMarketAssetTier(spotMarketIndex, assetTier) {
|
|
466
|
+
return await this.program.rpc.updateSpotMarketAssetTier(assetTier, {
|
|
467
|
+
accounts: {
|
|
468
|
+
admin: this.wallet.publicKey,
|
|
469
|
+
state: await this.getStatePublicKey(),
|
|
470
|
+
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
471
|
+
},
|
|
472
|
+
});
|
|
473
|
+
}
|
|
474
|
+
async updateSpotMarketStatus(spotMarketIndex, marketStatus) {
|
|
475
|
+
return await this.program.rpc.updateSpotMarketStatus(marketStatus, {
|
|
476
|
+
accounts: {
|
|
477
|
+
admin: this.wallet.publicKey,
|
|
478
|
+
state: await this.getStatePublicKey(),
|
|
479
|
+
spotMarket: await (0, pda_1.getSpotMarketPublicKey)(this.program.programId, spotMarketIndex),
|
|
480
|
+
},
|
|
481
|
+
});
|
|
482
|
+
}
|
|
483
|
+
async updatePerpMarketStatus(perpMarketIndex, marketStatus) {
|
|
484
|
+
return await this.program.rpc.updatePerpMarketStatus(marketStatus, {
|
|
449
485
|
accounts: {
|
|
450
486
|
admin: this.wallet.publicKey,
|
|
451
487
|
state: await this.getStatePublicKey(),
|
|
488
|
+
market: await (0, pda_1.getMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
452
489
|
},
|
|
453
490
|
});
|
|
454
491
|
}
|
|
455
|
-
async
|
|
456
|
-
return await this.program.rpc.
|
|
492
|
+
async updatePerpMarketContractTier(perpMarketIndex, contractTier) {
|
|
493
|
+
return await this.program.rpc.updatePerpMarketContractTier(contractTier, {
|
|
457
494
|
accounts: {
|
|
458
495
|
admin: this.wallet.publicKey,
|
|
459
496
|
state: await this.getStatePublicKey(),
|
|
497
|
+
market: await (0, pda_1.getMarketPublicKey)(this.program.programId, perpMarketIndex),
|
|
460
498
|
},
|
|
461
499
|
});
|
|
462
500
|
}
|
|
463
|
-
async
|
|
464
|
-
return await this.program.rpc.
|
|
501
|
+
async updateExchangeStatus(exchangeStatus) {
|
|
502
|
+
return await this.program.rpc.updateExchangeStatus(exchangeStatus, {
|
|
465
503
|
accounts: {
|
|
466
504
|
admin: this.wallet.publicKey,
|
|
467
505
|
state: await this.getStatePublicKey(),
|
package/lib/clearingHouse.d.ts
CHANGED
|
@@ -14,6 +14,14 @@ import { ClearingHouseConfig } from './clearingHouseConfig';
|
|
|
14
14
|
import { ClearingHouseUser } from './clearingHouseUser';
|
|
15
15
|
import { ClearingHouseUserAccountSubscriptionConfig } from './clearingHouseUserConfig';
|
|
16
16
|
import { ClearingHouseUserStats } from './clearingHouseUserStats';
|
|
17
|
+
declare type RemainingAccountParams = {
|
|
18
|
+
userAccounts: UserAccount[];
|
|
19
|
+
writablePerpMarketIndexes?: number[];
|
|
20
|
+
writableSpotMarketIndexes?: number[];
|
|
21
|
+
readablePerpMarketIndex?: number;
|
|
22
|
+
readableSpotMarketIndex?: number;
|
|
23
|
+
useMarketLastSlotCache?: boolean;
|
|
24
|
+
};
|
|
17
25
|
/**
|
|
18
26
|
* # ClearingHouse
|
|
19
27
|
* This class is the main way to interact with Drift Protocol. It allows you to subscribe to the various accounts where the Market's state is stored, as well as: opening positions, liquidating, settling funding, depositing & withdrawing, and more.
|
|
@@ -75,6 +83,7 @@ export declare class ClearingHouse {
|
|
|
75
83
|
updateUserCustomMarginRatio(marginRatio: number, userId?: number): Promise<TransactionSignature>;
|
|
76
84
|
updateUserDelegate(delegate: PublicKey, userId?: number): Promise<TransactionSignature>;
|
|
77
85
|
getUserAccountsForDelegate(delegate: PublicKey): Promise<UserAccount[]>;
|
|
86
|
+
deleteUser(userId?: number): Promise<TransactionSignature>;
|
|
78
87
|
getUser(userId?: number): ClearingHouseUser;
|
|
79
88
|
getUsers(): ClearingHouseUser[];
|
|
80
89
|
getUserStats(): ClearingHouseUserStats;
|
|
@@ -85,13 +94,13 @@ export declare class ClearingHouse {
|
|
|
85
94
|
getUserAccountAndSlot(userId?: number): DataAndSlot<UserAccount> | undefined;
|
|
86
95
|
getSpotPosition(marketIndex: number): SpotPosition | undefined;
|
|
87
96
|
getQuoteAssetTokenAmount(): BN;
|
|
88
|
-
getRemainingAccounts(params:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
getOrder(orderId:
|
|
97
|
+
getRemainingAccounts(params: RemainingAccountParams): AccountMeta[];
|
|
98
|
+
getRemainingAccountMapsForUsers(userAccounts: UserAccount[]): {
|
|
99
|
+
oracleAccountMap: Map<string, AccountMeta>;
|
|
100
|
+
spotMarketAccountMap: Map<number, AccountMeta>;
|
|
101
|
+
perpMarketAccountMap: Map<number, AccountMeta>;
|
|
102
|
+
};
|
|
103
|
+
getOrder(orderId: number): Order | undefined;
|
|
95
104
|
getOrderByUserId(userOrderId: number): Order | undefined;
|
|
96
105
|
deposit(amount: BN, marketIndex: number, collateralAccountPublicKey: PublicKey, userId?: number, reduceOnly?: boolean): Promise<TransactionSignature>;
|
|
97
106
|
getDepositInstruction(amount: BN, marketIndex: number, userTokenAccount: PublicKey, userId?: number, reduceOnly?: boolean, userInitialized?: boolean): Promise<TransactionInstruction>;
|
|
@@ -142,11 +151,11 @@ export declare class ClearingHouse {
|
|
|
142
151
|
getUpdateAMMsIx(marketIndexes: number[]): Promise<TransactionInstruction>;
|
|
143
152
|
settleExpiredMarket(marketIndex: number): Promise<TransactionSignature>;
|
|
144
153
|
getSettleExpiredMarketIx(marketIndex: number): Promise<TransactionInstruction>;
|
|
145
|
-
cancelOrder(orderId?:
|
|
146
|
-
getCancelOrderIx(orderId?:
|
|
154
|
+
cancelOrder(orderId?: number): Promise<TransactionSignature>;
|
|
155
|
+
getCancelOrderIx(orderId?: number): Promise<TransactionInstruction>;
|
|
147
156
|
cancelOrderByUserId(userOrderId: number): Promise<TransactionSignature>;
|
|
148
157
|
getCancelOrderByUserIdIx(userOrderId: number): Promise<TransactionInstruction>;
|
|
149
|
-
fillOrder(userAccountPublicKey: PublicKey, user: UserAccount, order?: Order, makerInfo?: MakerInfo, referrerInfo?: ReferrerInfo): Promise<TransactionSignature>;
|
|
158
|
+
fillOrder(userAccountPublicKey: PublicKey, user: UserAccount, order?: Pick<Order, 'marketIndex' | 'orderId'>, makerInfo?: MakerInfo, referrerInfo?: ReferrerInfo): Promise<TransactionSignature>;
|
|
150
159
|
getFillOrderIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, order: Pick<Order, 'marketIndex' | 'orderId'>, makerInfo?: MakerInfo, referrerInfo?: ReferrerInfo): Promise<TransactionInstruction>;
|
|
151
160
|
placeSpotOrder(orderParams: OptionalOrderParams): Promise<TransactionSignature>;
|
|
152
161
|
getPlaceSpotOrderIx(orderParams: OptionalOrderParams): Promise<TransactionInstruction>;
|
|
@@ -154,8 +163,6 @@ export declare class ClearingHouse {
|
|
|
154
163
|
getFillSpotOrderIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, order?: Order, fulfillmentConfig?: SerumV3FulfillmentConfigAccount, makerInfo?: MakerInfo, referrerInfo?: ReferrerInfo): Promise<TransactionInstruction>;
|
|
155
164
|
triggerOrder(userAccountPublicKey: PublicKey, user: UserAccount, order: Order): Promise<TransactionSignature>;
|
|
156
165
|
getTriggerOrderIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, order: Order): Promise<TransactionInstruction>;
|
|
157
|
-
triggerSpotOrder(userAccountPublicKey: PublicKey, user: UserAccount, order: Order): Promise<TransactionSignature>;
|
|
158
|
-
getTriggerSpotOrderIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, order: Order): Promise<TransactionInstruction>;
|
|
159
166
|
placeAndTake(orderParams: OptionalOrderParams, makerInfo?: MakerInfo, referrerInfo?: ReferrerInfo): Promise<TransactionSignature>;
|
|
160
167
|
getPlaceAndTakeIx(orderParams: OptionalOrderParams, makerInfo?: MakerInfo, referrerInfo?: ReferrerInfo): Promise<TransactionInstruction>;
|
|
161
168
|
placeAndMake(orderParams: OptionalOrderParams, takerInfo: TakerInfo, referrerInfo?: ReferrerInfo): Promise<TransactionSignature>;
|
|
@@ -176,25 +183,20 @@ export declare class ClearingHouse {
|
|
|
176
183
|
getSettleExpiredPositionIx(settleeUserAccountPublicKey: PublicKey, settleeUserAccount: UserAccount, marketIndex: number): Promise<TransactionInstruction>;
|
|
177
184
|
liquidatePerp(userAccountPublicKey: PublicKey, userAccount: UserAccount, marketIndex: number, maxBaseAssetAmount: BN): Promise<TransactionSignature>;
|
|
178
185
|
getLiquidatePerpIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, marketIndex: number, maxBaseAssetAmount: BN): Promise<TransactionInstruction>;
|
|
179
|
-
|
|
180
|
-
|
|
186
|
+
liquidateSpot(userAccountPublicKey: PublicKey, userAccount: UserAccount, assetMarketIndex: number, liabilityMarketIndex: number, maxLiabilityTransfer: BN): Promise<TransactionSignature>;
|
|
187
|
+
getLiquidateSpotIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, assetMarketIndex: number, liabilityMarketIndex: number, maxLiabilityTransfer: BN): Promise<TransactionInstruction>;
|
|
181
188
|
liquidateBorrowForPerpPnl(userAccountPublicKey: PublicKey, userAccount: UserAccount, perpMarketIndex: number, liabilityMarketIndex: number, maxLiabilityTransfer: BN): Promise<TransactionSignature>;
|
|
182
189
|
getLiquidateBorrowForPerpPnlIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, perpMarketIndex: number, liabilityMarketIndex: number, maxLiabilityTransfer: BN): Promise<TransactionInstruction>;
|
|
183
190
|
liquidatePerpPnlForDeposit(userAccountPublicKey: PublicKey, userAccount: UserAccount, perpMarketIndex: number, assetMarketIndex: number, maxPnlTransfer: BN): Promise<TransactionSignature>;
|
|
184
191
|
getLiquidatePerpPnlForDepositIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, perpMarketIndex: number, assetMarketIndex: number, maxPnlTransfer: BN): Promise<TransactionInstruction>;
|
|
185
192
|
resolvePerpBankruptcy(userAccountPublicKey: PublicKey, userAccount: UserAccount, marketIndex: number): Promise<TransactionSignature>;
|
|
186
193
|
getResolvePerpBankruptcyIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, marketIndex: number): Promise<TransactionInstruction>;
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
getRemainingAccountsWithCounterparty(params: {
|
|
190
|
-
counterPartyUserAccount: UserAccount;
|
|
191
|
-
writablePerpMarketIndex?: number;
|
|
192
|
-
writableSpotMarketIndexes?: number[];
|
|
193
|
-
}): AccountMeta[];
|
|
194
|
+
resolveSpotBankruptcy(userAccountPublicKey: PublicKey, userAccount: UserAccount, marketIndex: number): Promise<TransactionSignature>;
|
|
195
|
+
getResolveSpotBankruptcyIx(userAccountPublicKey: PublicKey, userAccount: UserAccount, marketIndex: number): Promise<TransactionInstruction>;
|
|
194
196
|
updateFundingRate(oracle: PublicKey, marketIndex: number): Promise<TransactionSignature>;
|
|
195
197
|
getUpdateFundingRateIx(oracle: PublicKey, marketIndex: number): Promise<TransactionInstruction>;
|
|
196
|
-
settleFundingPayment(
|
|
197
|
-
getSettleFundingPaymentIx(
|
|
198
|
+
settleFundingPayment(userAccountPublicKey: PublicKey): Promise<TransactionSignature>;
|
|
199
|
+
getSettleFundingPaymentIx(userAccountPublicKey: PublicKey): Promise<TransactionInstruction>;
|
|
198
200
|
triggerEvent(eventName: keyof ClearingHouseAccountEvents, data?: any): void;
|
|
199
201
|
getOracleDataForMarket(marketIndex: number): OraclePriceData;
|
|
200
202
|
getOracleDataForSpotMarket(marketIndex: number): OraclePriceData;
|
|
@@ -208,3 +210,4 @@ export declare class ClearingHouse {
|
|
|
208
210
|
resolvePerpPnlDeficit(spotMarketIndex: number, perpMarketIndex: number): Promise<TransactionSignature>;
|
|
209
211
|
getResolvePerpPnlDeficitIx(spotMarketIndex: number, perpMarketIndex: number): Promise<TransactionInstruction>;
|
|
210
212
|
}
|
|
213
|
+
export {};
|