@drift-labs/sdk 2.153.0-beta.0 → 2.153.0-beta.2
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/browser/adminClient.d.ts +4 -0
- package/lib/browser/adminClient.js +36 -0
- package/lib/browser/constants/txConstants.d.ts +0 -1
- package/lib/browser/constants/txConstants.js +1 -2
- package/lib/browser/driftClient.d.ts +6 -6
- package/lib/browser/driftClient.js +36 -184
- package/lib/browser/idl/drift.json +46 -2
- package/lib/node/adminClient.d.ts +4 -0
- package/lib/node/adminClient.d.ts.map +1 -1
- package/lib/node/adminClient.js +36 -0
- package/lib/node/constants/txConstants.d.ts +0 -1
- package/lib/node/constants/txConstants.d.ts.map +1 -1
- package/lib/node/constants/txConstants.js +1 -2
- package/lib/node/driftClient.d.ts +6 -6
- package/lib/node/driftClient.d.ts.map +1 -1
- package/lib/node/driftClient.js +36 -184
- package/lib/node/idl/drift.json +46 -2
- package/package.json +1 -1
- package/src/adminClient.ts +56 -0
- package/src/constants/txConstants.ts +0 -2
- package/src/driftClient.ts +52 -264
- package/src/idl/drift.json +46 -2
- package/lib/browser/markets.d.ts +0 -5
- package/lib/browser/markets.js +0 -16
- package/lib/node/markets.d.ts +0 -6
- package/lib/node/markets.d.ts.map +0 -1
- package/lib/node/markets.js +0 -16
- package/src/markets.ts +0 -24
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.153.0-beta.
|
|
1
|
+
2.153.0-beta.2
|
|
@@ -17,10 +17,14 @@ export declare class AdminClient extends DriftClient {
|
|
|
17
17
|
getDeleteInitializedSpotMarketIx(marketIndex: number): Promise<TransactionInstruction>;
|
|
18
18
|
initializeSerumFulfillmentConfig(marketIndex: number, serumMarket: PublicKey, serumProgram: PublicKey): Promise<TransactionSignature>;
|
|
19
19
|
getInitializeSerumFulfillmentConfigIx(marketIndex: number, serumMarket: PublicKey, serumProgram: PublicKey): Promise<TransactionInstruction>;
|
|
20
|
+
deleteSerumFulfillmentConfig(serumMarket: PublicKey): Promise<TransactionSignature>;
|
|
21
|
+
getDeleteSerumFulfillmentConfigIx(serumMarket: PublicKey): Promise<TransactionInstruction>;
|
|
20
22
|
initializePhoenixFulfillmentConfig(marketIndex: number, phoenixMarket: PublicKey): Promise<TransactionSignature>;
|
|
21
23
|
getInitializePhoenixFulfillmentConfigIx(marketIndex: number, phoenixMarket: PublicKey): Promise<TransactionInstruction>;
|
|
22
24
|
initializeOpenbookV2FulfillmentConfig(marketIndex: number, openbookMarket: PublicKey): Promise<TransactionSignature>;
|
|
23
25
|
getInitializeOpenbookV2FulfillmentConfigIx(marketIndex: number, openbookMarket: PublicKey): Promise<TransactionInstruction>;
|
|
26
|
+
deleteOpenbookV2FulfillmentConfig(openbookMarket: PublicKey): Promise<TransactionSignature>;
|
|
27
|
+
getDeleteOpenbookV2FulfillmentConfigIx(openbookMarket: PublicKey): Promise<TransactionInstruction>;
|
|
24
28
|
initializePerpMarket(marketIndex: number, priceOracle: PublicKey, baseAssetReserve: BN, quoteAssetReserve: BN, periodicity: BN, pegMultiplier?: BN, oracleSource?: OracleSource, contractTier?: ContractTier, marginRatioInitial?: number, marginRatioMaintenance?: number, liquidatorFee?: number, ifLiquidatorFee?: number, imfFactor?: number, activeStatus?: boolean, baseSpread?: number, maxSpread?: number, maxOpenInterest?: BN, maxRevenueWithdrawPerPeriod?: BN, quoteMaxInsurance?: BN, orderStepSize?: BN, orderTickSize?: BN, minOrderSize?: BN, concentrationCoefScale?: BN, curveUpdateIntensity?: number, ammJitIntensity?: number, name?: string, lpPoolId?: number): Promise<TransactionSignature>;
|
|
25
29
|
getInitializePerpMarketIx(marketIndex: number, priceOracle: PublicKey, baseAssetReserve: BN, quoteAssetReserve: BN, periodicity: BN, pegMultiplier?: BN, oracleSource?: OracleSource, contractTier?: ContractTier, marginRatioInitial?: number, marginRatioMaintenance?: number, liquidatorFee?: number, ifLiquidatorFee?: number, imfFactor?: number, activeStatus?: boolean, baseSpread?: number, maxSpread?: number, maxOpenInterest?: BN, maxRevenueWithdrawPerPeriod?: BN, quoteMaxInsurance?: BN, orderStepSize?: BN, orderTickSize?: BN, minOrderSize?: BN, concentrationCoefScale?: BN, curveUpdateIntensity?: number, ammJitIntensity?: number, name?: string, lpPoolId?: number): Promise<TransactionInstruction[]>;
|
|
26
30
|
initializeAmmCache(txParams?: TxParams): Promise<TransactionSignature>;
|
|
@@ -155,6 +155,24 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
155
155
|
},
|
|
156
156
|
});
|
|
157
157
|
}
|
|
158
|
+
async deleteSerumFulfillmentConfig(serumMarket) {
|
|
159
|
+
const deleteIx = await this.getDeleteSerumFulfillmentConfigIx(serumMarket);
|
|
160
|
+
const tx = await this.buildTransaction(deleteIx);
|
|
161
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
162
|
+
return txSig;
|
|
163
|
+
}
|
|
164
|
+
async getDeleteSerumFulfillmentConfigIx(serumMarket) {
|
|
165
|
+
const serumFulfillmentConfig = (0, pda_1.getSerumFulfillmentConfigPublicKey)(this.program.programId, serumMarket);
|
|
166
|
+
return await this.program.instruction.deleteSerumFulfillmentConfig({
|
|
167
|
+
accounts: {
|
|
168
|
+
admin: this.isSubscribed
|
|
169
|
+
? this.getStateAccount().admin
|
|
170
|
+
: this.wallet.publicKey,
|
|
171
|
+
state: await this.getStatePublicKey(),
|
|
172
|
+
serumFulfillmentConfig,
|
|
173
|
+
},
|
|
174
|
+
});
|
|
175
|
+
}
|
|
158
176
|
async initializePhoenixFulfillmentConfig(marketIndex, phoenixMarket) {
|
|
159
177
|
const initializeIx = await this.getInitializePhoenixFulfillmentConfigIx(marketIndex, phoenixMarket);
|
|
160
178
|
const tx = await this.buildTransaction(initializeIx);
|
|
@@ -205,6 +223,24 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
205
223
|
},
|
|
206
224
|
});
|
|
207
225
|
}
|
|
226
|
+
async deleteOpenbookV2FulfillmentConfig(openbookMarket) {
|
|
227
|
+
const deleteIx = await this.getDeleteOpenbookV2FulfillmentConfigIx(openbookMarket);
|
|
228
|
+
const tx = await this.buildTransaction(deleteIx);
|
|
229
|
+
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
230
|
+
return txSig;
|
|
231
|
+
}
|
|
232
|
+
async getDeleteOpenbookV2FulfillmentConfigIx(openbookMarket) {
|
|
233
|
+
const openbookV2FulfillmentConfig = (0, pda_1.getOpenbookV2FulfillmentConfigPublicKey)(this.program.programId, openbookMarket);
|
|
234
|
+
return await this.program.instruction.deleteOpenbookV2FulfillmentConfig({
|
|
235
|
+
accounts: {
|
|
236
|
+
admin: this.isSubscribed
|
|
237
|
+
? this.getStateAccount().admin
|
|
238
|
+
: this.wallet.publicKey,
|
|
239
|
+
state: await this.getStatePublicKey(),
|
|
240
|
+
openbookV2FulfillmentConfig,
|
|
241
|
+
},
|
|
242
|
+
});
|
|
243
|
+
}
|
|
208
244
|
async initializePerpMarket(marketIndex, priceOracle, baseAssetReserve, quoteAssetReserve, periodicity, pegMultiplier = numericConstants_1.PEG_PRECISION, oracleSource = types_1.OracleSource.PYTH, contractTier = types_1.ContractTier.SPECULATIVE, marginRatioInitial = 2000, marginRatioMaintenance = 500, liquidatorFee = 0, ifLiquidatorFee = 10000, imfFactor = 0, activeStatus = true, baseSpread = 0, maxSpread = 142500, maxOpenInterest = numericConstants_1.ZERO, maxRevenueWithdrawPerPeriod = numericConstants_1.ZERO, quoteMaxInsurance = numericConstants_1.ZERO, orderStepSize = numericConstants_1.BASE_PRECISION.divn(10000), orderTickSize = numericConstants_1.PRICE_PRECISION.divn(100000), minOrderSize = numericConstants_1.BASE_PRECISION.divn(10000), concentrationCoefScale = numericConstants_1.ONE, curveUpdateIntensity = 0, ammJitIntensity = 0, name = userName_1.DEFAULT_MARKET_NAME, lpPoolId = 0) {
|
|
209
245
|
const currentPerpMarketIndex = this.getStateAccount().numberOfMarkets;
|
|
210
246
|
const initializeMarketIxs = await this.getInitializePerpMarketIx(marketIndex, priceOracle, baseAssetReserve, quoteAssetReserve, periodicity, pegMultiplier, oracleSource, contractTier, marginRatioInitial, marginRatioMaintenance, liquidatorFee, ifLiquidatorFee, imfFactor, activeStatus, baseSpread, maxSpread, maxOpenInterest, maxRevenueWithdrawPerPeriod, quoteMaxInsurance, orderStepSize, orderTickSize, minOrderSize, concentrationCoefScale, curveUpdateIntensity, ammJitIntensity, name, lpPoolId);
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.FUEL_RESET_LOG_ACCOUNT = exports.NOT_CONFIRMED_ERROR_CODE = void 0;
|
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
|
5
5
|
exports.NOT_CONFIRMED_ERROR_CODE = -1001;
|
|
6
6
|
exports.FUEL_RESET_LOG_ACCOUNT = new web3_js_1.PublicKey('FuE1gqp2fzw2sDNLrbZqKsqpphJcoSW6HPaSJjGd4RZ4');
|
|
7
|
-
exports.DEFAULT_COMMITMENT_LEVEL = 'confirmed';
|
|
@@ -998,9 +998,9 @@ export declare class DriftClient {
|
|
|
998
998
|
settleFundingPayment(userAccountPublicKey: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
|
|
999
999
|
getSettleFundingPaymentIx(userAccountPublicKey: PublicKey): Promise<TransactionInstruction>;
|
|
1000
1000
|
triggerEvent(eventName: keyof DriftClientAccountEvents, data?: any): void;
|
|
1001
|
-
getOracleDataForPerpMarket(marketIndex: number): OraclePriceData
|
|
1002
|
-
getMMOracleDataForPerpMarket(marketIndex: number): MMOraclePriceData
|
|
1003
|
-
getOracleDataForSpotMarket(marketIndex: number): OraclePriceData
|
|
1001
|
+
getOracleDataForPerpMarket(marketIndex: number): OraclePriceData;
|
|
1002
|
+
getMMOracleDataForPerpMarket(marketIndex: number): MMOraclePriceData;
|
|
1003
|
+
getOracleDataForSpotMarket(marketIndex: number): OraclePriceData;
|
|
1004
1004
|
initializeInsuranceFundStake(marketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
1005
1005
|
getInitializeInsuranceFundStakeIx(marketIndex: number): Promise<TransactionInstruction>;
|
|
1006
1006
|
getAddInsuranceFundStakeIx(marketIndex: number, amount: BN, collateralAccountPublicKey: PublicKey): Promise<TransactionInstruction>;
|
|
@@ -1069,7 +1069,7 @@ export declare class DriftClient {
|
|
|
1069
1069
|
* @returns
|
|
1070
1070
|
*/
|
|
1071
1071
|
depositIntoSpotMarketRevenuePool(marketIndex: number, amount: BN, userTokenAccountPublicKey: PublicKey): Promise<TransactionSignature>;
|
|
1072
|
-
getPerpMarketExtendedInfo(marketIndex: number): PerpMarketExtendedInfo
|
|
1072
|
+
getPerpMarketExtendedInfo(marketIndex: number): PerpMarketExtendedInfo;
|
|
1073
1073
|
/**
|
|
1074
1074
|
* Calculates taker / maker fee (as a percentage, e.g. .001 = 10 basis points) for particular marketType
|
|
1075
1075
|
* @param marketType
|
|
@@ -1091,7 +1091,7 @@ export declare class DriftClient {
|
|
|
1091
1091
|
marketType: MarketType;
|
|
1092
1092
|
} | undefined;
|
|
1093
1093
|
getReceiverProgram(): Program<PythSolanaReceiver>;
|
|
1094
|
-
getSwitchboardOnDemandProgram(): Promise<Program30<Idl30
|
|
1094
|
+
getSwitchboardOnDemandProgram(): Promise<Program30<Idl30>>;
|
|
1095
1095
|
postPythPullOracleUpdateAtomic(vaaString: string, feedId: string): Promise<TransactionSignature>;
|
|
1096
1096
|
postMultiPythPullOracleUpdatesAtomic(vaaString: string, feedIds: string[]): Promise<TransactionSignature>;
|
|
1097
1097
|
getPostPythPullOracleUpdateAtomicIxs(vaaString: string, feedIds: string | string[], numSignatures?: number): Promise<TransactionInstruction[]>;
|
|
@@ -1107,7 +1107,7 @@ export declare class DriftClient {
|
|
|
1107
1107
|
getPostPythLazerOracleUpdateIxs(feedIds: number[], pythMessageHex: string, precedingIxs?: TransactionInstruction[], overrideCustomIxIndex?: number): Promise<TransactionInstruction[]>;
|
|
1108
1108
|
getPostManySwitchboardOnDemandUpdatesAtomicIxs(feeds: PublicKey[], recentSlothash?: Slothash, numSignatures?: number): Promise<TransactionInstruction[] | undefined>;
|
|
1109
1109
|
getPostSwitchboardOnDemandUpdateAtomicIx(feed: PublicKey, recentSlothash?: Slothash, numSignatures?: number): Promise<TransactionInstruction | undefined>;
|
|
1110
|
-
postSwitchboardOnDemandUpdate(feed: PublicKey, recentSlothash?: Slothash, numSignatures?: number): Promise<TransactionSignature
|
|
1110
|
+
postSwitchboardOnDemandUpdate(feed: PublicKey, recentSlothash?: Slothash, numSignatures?: number): Promise<TransactionSignature>;
|
|
1111
1111
|
private getBuildEncodedVaaIxs;
|
|
1112
1112
|
enableUserHighLeverageMode(subAccountId: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
1113
1113
|
getEnableHighLeverageModeIx(subAccountId: number, depositToTradeArgs?: {
|