@drift-labs/sdk 2.112.0-beta.0 → 2.112.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/driftClient.d.ts +5 -5
- package/lib/browser/driftClient.js +12 -12
- package/lib/node/driftClient.d.ts +5 -5
- package/lib/node/driftClient.js +12 -12
- package/package.json +1 -1
- package/src/driftClient.ts +12 -12
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.112.0-beta.
|
|
1
|
+
2.112.0-beta.2
|
|
@@ -577,25 +577,25 @@ export declare class DriftClient {
|
|
|
577
577
|
takerStats: PublicKey;
|
|
578
578
|
takerUserAccount: UserAccount;
|
|
579
579
|
signingAuthority: PublicKey;
|
|
580
|
-
}, precedingIxs?: TransactionInstruction[],
|
|
580
|
+
}, precedingIxs?: TransactionInstruction[], overrideCustomIxIndex?: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
581
581
|
getPlaceSignedMsgTakerPerpOrderIxs(signedSignedMsgOrderParams: SignedMsgOrderParams, marketIndex: number, takerInfo: {
|
|
582
582
|
taker: PublicKey;
|
|
583
583
|
takerStats: PublicKey;
|
|
584
584
|
takerUserAccount: UserAccount;
|
|
585
585
|
signingAuthority: PublicKey;
|
|
586
|
-
}, precedingIxs?: TransactionInstruction[],
|
|
586
|
+
}, precedingIxs?: TransactionInstruction[], overrideCustomIxIndex?: number): Promise<TransactionInstruction[]>;
|
|
587
587
|
placeAndMakeSignedMsgPerpOrder(signedSignedMsgOrderParams: SignedMsgOrderParams, signedMsgOrderUuid: Uint8Array, takerInfo: {
|
|
588
588
|
taker: PublicKey;
|
|
589
589
|
takerStats: PublicKey;
|
|
590
590
|
takerUserAccount: UserAccount;
|
|
591
591
|
signingAuthority: PublicKey;
|
|
592
|
-
}, orderParams: OptionalOrderParams, referrerInfo?: ReferrerInfo, txParams?: TxParams, subAccountId?: number, precedingIxs?: TransactionInstruction[],
|
|
592
|
+
}, orderParams: OptionalOrderParams, referrerInfo?: ReferrerInfo, txParams?: TxParams, subAccountId?: number, precedingIxs?: TransactionInstruction[], overrideCustomIxIndex?: number): Promise<TransactionSignature>;
|
|
593
593
|
getPlaceAndMakeSignedMsgPerpOrderIxs(signedSignedMsgOrderParams: SignedMsgOrderParams, signedMsgOrderUuid: Uint8Array, takerInfo: {
|
|
594
594
|
taker: PublicKey;
|
|
595
595
|
takerStats: PublicKey;
|
|
596
596
|
takerUserAccount: UserAccount;
|
|
597
597
|
signingAuthority: PublicKey;
|
|
598
|
-
}, orderParams: OptionalOrderParams, referrerInfo?: ReferrerInfo, subAccountId?: number, precedingIxs?: TransactionInstruction[],
|
|
598
|
+
}, orderParams: OptionalOrderParams, referrerInfo?: ReferrerInfo, subAccountId?: number, precedingIxs?: TransactionInstruction[], overrideCustomIxIndex?: number): Promise<TransactionInstruction[]>;
|
|
599
599
|
preparePlaceAndTakeSpotOrder(orderParams: OptionalOrderParams, fulfillmentConfig?: SerumV3FulfillmentConfigAccount, makerInfo?: MakerInfo, referrerInfo?: ReferrerInfo, txParams?: TxParams, subAccountId?: number): Promise<{
|
|
600
600
|
placeAndTakeSpotOrderTx: anchor.web3.Transaction | anchor.web3.VersionedTransaction;
|
|
601
601
|
}>;
|
|
@@ -902,7 +902,7 @@ export declare class DriftClient {
|
|
|
902
902
|
};
|
|
903
903
|
}, feedId: string, encodedVaaAddress: PublicKey): Promise<TransactionInstruction>;
|
|
904
904
|
postPythLazerOracleUpdate(feedIds: number[], pythMessageHex: string): Promise<string>;
|
|
905
|
-
getPostPythLazerOracleUpdateIxs(feedIds: number[], pythMessageHex: string, precedingIxs?: TransactionInstruction[],
|
|
905
|
+
getPostPythLazerOracleUpdateIxs(feedIds: number[], pythMessageHex: string, precedingIxs?: TransactionInstruction[], overrideCustomIxIndex?: number): Promise<TransactionInstruction[]>;
|
|
906
906
|
getPostSwitchboardOnDemandUpdateAtomicIx(feed: PublicKey, recentSlothash?: Slothash, numSignatures?: number): Promise<TransactionInstruction | undefined>;
|
|
907
907
|
postSwitchboardOnDemandUpdate(feed: PublicKey, recentSlothash?: Slothash, numSignatures?: number): Promise<TransactionSignature>;
|
|
908
908
|
private getBuildEncodedVaaIxs;
|
|
@@ -420,8 +420,8 @@ class DriftClient {
|
|
|
420
420
|
this.userStatsAccountPublicKey = undefined;
|
|
421
421
|
this.includeDelegates = includeDelegates !== null && includeDelegates !== void 0 ? includeDelegates : false;
|
|
422
422
|
const walletSupportsVersionedTxns =
|
|
423
|
-
//@ts-
|
|
424
|
-
(_b = (_a = this.wallet.supportedTransactionVersions) === null || _a === void 0 ? void 0 : _a.size) !== null && _b !== void 0 ? _b : 0 > 1;
|
|
423
|
+
//@ts-expect-error
|
|
424
|
+
((_b = (_a = this.wallet.supportedTransactionVersions) === null || _a === void 0 ? void 0 : _a.size) !== null && _b !== void 0 ? _b : 0) > 1;
|
|
425
425
|
this.txVersion = walletSupportsVersionedTxns ? 0 : 'legacy';
|
|
426
426
|
if (includeDelegates && subAccountIds) {
|
|
427
427
|
throw new Error('Can only pass one of includeDelegates or subAccountIds. If you want to specify subaccount ids for multiple authorities, pass authoritySubaccountMap instead');
|
|
@@ -3322,12 +3322,12 @@ class DriftClient {
|
|
|
3322
3322
|
signMessage(message, keypair = this.wallet.payer) {
|
|
3323
3323
|
return Buffer.from(tweetnacl_1.default.sign.detached(message, keypair.secretKey));
|
|
3324
3324
|
}
|
|
3325
|
-
async placeSignedMsgTakerOrder(signedSignedMsgOrderParams, marketIndex, takerInfo, precedingIxs = [],
|
|
3326
|
-
const ixs = await this.getPlaceSignedMsgTakerPerpOrderIxs(signedSignedMsgOrderParams, marketIndex, takerInfo, precedingIxs,
|
|
3325
|
+
async placeSignedMsgTakerOrder(signedSignedMsgOrderParams, marketIndex, takerInfo, precedingIxs = [], overrideCustomIxIndex, txParams) {
|
|
3326
|
+
const ixs = await this.getPlaceSignedMsgTakerPerpOrderIxs(signedSignedMsgOrderParams, marketIndex, takerInfo, precedingIxs, overrideCustomIxIndex);
|
|
3327
3327
|
const { txSig } = await this.sendTransaction(await this.buildTransaction(ixs, txParams), [], this.opts);
|
|
3328
3328
|
return txSig;
|
|
3329
3329
|
}
|
|
3330
|
-
async getPlaceSignedMsgTakerPerpOrderIxs(signedSignedMsgOrderParams, marketIndex, takerInfo, precedingIxs = [],
|
|
3330
|
+
async getPlaceSignedMsgTakerPerpOrderIxs(signedSignedMsgOrderParams, marketIndex, takerInfo, precedingIxs = [], overrideCustomIxIndex) {
|
|
3331
3331
|
const remainingAccounts = this.getRemainingAccounts({
|
|
3332
3332
|
userAccounts: [takerInfo.takerUserAccount],
|
|
3333
3333
|
useMarketLastSlotCache: true,
|
|
@@ -3341,7 +3341,7 @@ class DriftClient {
|
|
|
3341
3341
|
messageLengthBuffer,
|
|
3342
3342
|
signedSignedMsgOrderParams.orderParams,
|
|
3343
3343
|
]);
|
|
3344
|
-
const signedMsgOrderParamsSignatureIx = (0, ed25519Utils_1.createMinimalEd25519VerifyIx)(
|
|
3344
|
+
const signedMsgOrderParamsSignatureIx = (0, ed25519Utils_1.createMinimalEd25519VerifyIx)(overrideCustomIxIndex || precedingIxs.length + 1, 12, signedMsgIxData, 0);
|
|
3345
3345
|
const isDelegateSigner = takerInfo.signingAuthority.equals(takerInfo.takerUserAccount.delegate);
|
|
3346
3346
|
const placeTakerSignedMsgPerpOrderIx = this.program.instruction.placeSignedMsgTakerOrder(signedMsgIxData, isDelegateSigner, {
|
|
3347
3347
|
accounts: {
|
|
@@ -3356,14 +3356,14 @@ class DriftClient {
|
|
|
3356
3356
|
});
|
|
3357
3357
|
return [signedMsgOrderParamsSignatureIx, placeTakerSignedMsgPerpOrderIx];
|
|
3358
3358
|
}
|
|
3359
|
-
async placeAndMakeSignedMsgPerpOrder(signedSignedMsgOrderParams, signedMsgOrderUuid, takerInfo, orderParams, referrerInfo, txParams, subAccountId, precedingIxs = [],
|
|
3360
|
-
const ixs = await this.getPlaceAndMakeSignedMsgPerpOrderIxs(signedSignedMsgOrderParams, signedMsgOrderUuid, takerInfo, orderParams, referrerInfo, subAccountId, precedingIxs,
|
|
3359
|
+
async placeAndMakeSignedMsgPerpOrder(signedSignedMsgOrderParams, signedMsgOrderUuid, takerInfo, orderParams, referrerInfo, txParams, subAccountId, precedingIxs = [], overrideCustomIxIndex) {
|
|
3360
|
+
const ixs = await this.getPlaceAndMakeSignedMsgPerpOrderIxs(signedSignedMsgOrderParams, signedMsgOrderUuid, takerInfo, orderParams, referrerInfo, subAccountId, precedingIxs, overrideCustomIxIndex);
|
|
3361
3361
|
const { txSig, slot } = await this.sendTransaction(await this.buildTransaction(ixs, txParams), [], this.opts);
|
|
3362
3362
|
this.perpMarketLastSlotCache.set(orderParams.marketIndex, slot);
|
|
3363
3363
|
return txSig;
|
|
3364
3364
|
}
|
|
3365
|
-
async getPlaceAndMakeSignedMsgPerpOrderIxs(signedSignedMsgOrderParams, signedMsgOrderUuid, takerInfo, orderParams, referrerInfo, subAccountId, precedingIxs = [],
|
|
3366
|
-
const [signedMsgOrderSignatureIx, placeTakerSignedMsgPerpOrderIx] = await this.getPlaceSignedMsgTakerPerpOrderIxs(signedSignedMsgOrderParams, orderParams.marketIndex, takerInfo, precedingIxs,
|
|
3365
|
+
async getPlaceAndMakeSignedMsgPerpOrderIxs(signedSignedMsgOrderParams, signedMsgOrderUuid, takerInfo, orderParams, referrerInfo, subAccountId, precedingIxs = [], overrideCustomIxIndex) {
|
|
3366
|
+
const [signedMsgOrderSignatureIx, placeTakerSignedMsgPerpOrderIx] = await this.getPlaceSignedMsgTakerPerpOrderIxs(signedSignedMsgOrderParams, orderParams.marketIndex, takerInfo, precedingIxs, overrideCustomIxIndex);
|
|
3367
3367
|
orderParams = (0, orderParams_1.getOrderParams)(orderParams, { marketType: types_1.MarketType.PERP });
|
|
3368
3368
|
const userStatsPublicKey = this.getUserStatsAccountPublicKey();
|
|
3369
3369
|
const user = await this.getUserAccountPublicKey(subAccountId);
|
|
@@ -4744,9 +4744,9 @@ class DriftClient {
|
|
|
4744
4744
|
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
4745
4745
|
return txSig;
|
|
4746
4746
|
}
|
|
4747
|
-
async getPostPythLazerOracleUpdateIxs(feedIds, pythMessageHex, precedingIxs = [],
|
|
4747
|
+
async getPostPythLazerOracleUpdateIxs(feedIds, pythMessageHex, precedingIxs = [], overrideCustomIxIndex) {
|
|
4748
4748
|
const pythMessageBytes = Buffer.from(pythMessageHex, 'hex');
|
|
4749
|
-
const verifyIx = (0, ed25519Utils_1.createMinimalEd25519VerifyIx)(
|
|
4749
|
+
const verifyIx = (0, ed25519Utils_1.createMinimalEd25519VerifyIx)(overrideCustomIxIndex || precedingIxs.length + 1, 12, pythMessageBytes);
|
|
4750
4750
|
const remainingAccountsMeta = feedIds.map((feedId) => {
|
|
4751
4751
|
return {
|
|
4752
4752
|
pubkey: (0, pda_1.getPythLazerOraclePublicKey)(this.program.programId, feedId),
|
|
@@ -577,25 +577,25 @@ export declare class DriftClient {
|
|
|
577
577
|
takerStats: PublicKey;
|
|
578
578
|
takerUserAccount: UserAccount;
|
|
579
579
|
signingAuthority: PublicKey;
|
|
580
|
-
}, precedingIxs?: TransactionInstruction[],
|
|
580
|
+
}, precedingIxs?: TransactionInstruction[], overrideCustomIxIndex?: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
581
581
|
getPlaceSignedMsgTakerPerpOrderIxs(signedSignedMsgOrderParams: SignedMsgOrderParams, marketIndex: number, takerInfo: {
|
|
582
582
|
taker: PublicKey;
|
|
583
583
|
takerStats: PublicKey;
|
|
584
584
|
takerUserAccount: UserAccount;
|
|
585
585
|
signingAuthority: PublicKey;
|
|
586
|
-
}, precedingIxs?: TransactionInstruction[],
|
|
586
|
+
}, precedingIxs?: TransactionInstruction[], overrideCustomIxIndex?: number): Promise<TransactionInstruction[]>;
|
|
587
587
|
placeAndMakeSignedMsgPerpOrder(signedSignedMsgOrderParams: SignedMsgOrderParams, signedMsgOrderUuid: Uint8Array, takerInfo: {
|
|
588
588
|
taker: PublicKey;
|
|
589
589
|
takerStats: PublicKey;
|
|
590
590
|
takerUserAccount: UserAccount;
|
|
591
591
|
signingAuthority: PublicKey;
|
|
592
|
-
}, orderParams: OptionalOrderParams, referrerInfo?: ReferrerInfo, txParams?: TxParams, subAccountId?: number, precedingIxs?: TransactionInstruction[],
|
|
592
|
+
}, orderParams: OptionalOrderParams, referrerInfo?: ReferrerInfo, txParams?: TxParams, subAccountId?: number, precedingIxs?: TransactionInstruction[], overrideCustomIxIndex?: number): Promise<TransactionSignature>;
|
|
593
593
|
getPlaceAndMakeSignedMsgPerpOrderIxs(signedSignedMsgOrderParams: SignedMsgOrderParams, signedMsgOrderUuid: Uint8Array, takerInfo: {
|
|
594
594
|
taker: PublicKey;
|
|
595
595
|
takerStats: PublicKey;
|
|
596
596
|
takerUserAccount: UserAccount;
|
|
597
597
|
signingAuthority: PublicKey;
|
|
598
|
-
}, orderParams: OptionalOrderParams, referrerInfo?: ReferrerInfo, subAccountId?: number, precedingIxs?: TransactionInstruction[],
|
|
598
|
+
}, orderParams: OptionalOrderParams, referrerInfo?: ReferrerInfo, subAccountId?: number, precedingIxs?: TransactionInstruction[], overrideCustomIxIndex?: number): Promise<TransactionInstruction[]>;
|
|
599
599
|
preparePlaceAndTakeSpotOrder(orderParams: OptionalOrderParams, fulfillmentConfig?: SerumV3FulfillmentConfigAccount, makerInfo?: MakerInfo, referrerInfo?: ReferrerInfo, txParams?: TxParams, subAccountId?: number): Promise<{
|
|
600
600
|
placeAndTakeSpotOrderTx: anchor.web3.Transaction | anchor.web3.VersionedTransaction;
|
|
601
601
|
}>;
|
|
@@ -902,7 +902,7 @@ export declare class DriftClient {
|
|
|
902
902
|
};
|
|
903
903
|
}, feedId: string, encodedVaaAddress: PublicKey): Promise<TransactionInstruction>;
|
|
904
904
|
postPythLazerOracleUpdate(feedIds: number[], pythMessageHex: string): Promise<string>;
|
|
905
|
-
getPostPythLazerOracleUpdateIxs(feedIds: number[], pythMessageHex: string, precedingIxs?: TransactionInstruction[],
|
|
905
|
+
getPostPythLazerOracleUpdateIxs(feedIds: number[], pythMessageHex: string, precedingIxs?: TransactionInstruction[], overrideCustomIxIndex?: number): Promise<TransactionInstruction[]>;
|
|
906
906
|
getPostSwitchboardOnDemandUpdateAtomicIx(feed: PublicKey, recentSlothash?: Slothash, numSignatures?: number): Promise<TransactionInstruction | undefined>;
|
|
907
907
|
postSwitchboardOnDemandUpdate(feed: PublicKey, recentSlothash?: Slothash, numSignatures?: number): Promise<TransactionSignature>;
|
|
908
908
|
private getBuildEncodedVaaIxs;
|
package/lib/node/driftClient.js
CHANGED
|
@@ -420,8 +420,8 @@ class DriftClient {
|
|
|
420
420
|
this.userStatsAccountPublicKey = undefined;
|
|
421
421
|
this.includeDelegates = includeDelegates !== null && includeDelegates !== void 0 ? includeDelegates : false;
|
|
422
422
|
const walletSupportsVersionedTxns =
|
|
423
|
-
//@ts-
|
|
424
|
-
(_b = (_a = this.wallet.supportedTransactionVersions) === null || _a === void 0 ? void 0 : _a.size) !== null && _b !== void 0 ? _b : 0 > 1;
|
|
423
|
+
//@ts-expect-error
|
|
424
|
+
((_b = (_a = this.wallet.supportedTransactionVersions) === null || _a === void 0 ? void 0 : _a.size) !== null && _b !== void 0 ? _b : 0) > 1;
|
|
425
425
|
this.txVersion = walletSupportsVersionedTxns ? 0 : 'legacy';
|
|
426
426
|
if (includeDelegates && subAccountIds) {
|
|
427
427
|
throw new Error('Can only pass one of includeDelegates or subAccountIds. If you want to specify subaccount ids for multiple authorities, pass authoritySubaccountMap instead');
|
|
@@ -3322,12 +3322,12 @@ class DriftClient {
|
|
|
3322
3322
|
signMessage(message, keypair = this.wallet.payer) {
|
|
3323
3323
|
return Buffer.from(tweetnacl_1.default.sign.detached(message, keypair.secretKey));
|
|
3324
3324
|
}
|
|
3325
|
-
async placeSignedMsgTakerOrder(signedSignedMsgOrderParams, marketIndex, takerInfo, precedingIxs = [],
|
|
3326
|
-
const ixs = await this.getPlaceSignedMsgTakerPerpOrderIxs(signedSignedMsgOrderParams, marketIndex, takerInfo, precedingIxs,
|
|
3325
|
+
async placeSignedMsgTakerOrder(signedSignedMsgOrderParams, marketIndex, takerInfo, precedingIxs = [], overrideCustomIxIndex, txParams) {
|
|
3326
|
+
const ixs = await this.getPlaceSignedMsgTakerPerpOrderIxs(signedSignedMsgOrderParams, marketIndex, takerInfo, precedingIxs, overrideCustomIxIndex);
|
|
3327
3327
|
const { txSig } = await this.sendTransaction(await this.buildTransaction(ixs, txParams), [], this.opts);
|
|
3328
3328
|
return txSig;
|
|
3329
3329
|
}
|
|
3330
|
-
async getPlaceSignedMsgTakerPerpOrderIxs(signedSignedMsgOrderParams, marketIndex, takerInfo, precedingIxs = [],
|
|
3330
|
+
async getPlaceSignedMsgTakerPerpOrderIxs(signedSignedMsgOrderParams, marketIndex, takerInfo, precedingIxs = [], overrideCustomIxIndex) {
|
|
3331
3331
|
const remainingAccounts = this.getRemainingAccounts({
|
|
3332
3332
|
userAccounts: [takerInfo.takerUserAccount],
|
|
3333
3333
|
useMarketLastSlotCache: true,
|
|
@@ -3341,7 +3341,7 @@ class DriftClient {
|
|
|
3341
3341
|
messageLengthBuffer,
|
|
3342
3342
|
signedSignedMsgOrderParams.orderParams,
|
|
3343
3343
|
]);
|
|
3344
|
-
const signedMsgOrderParamsSignatureIx = (0, ed25519Utils_1.createMinimalEd25519VerifyIx)(
|
|
3344
|
+
const signedMsgOrderParamsSignatureIx = (0, ed25519Utils_1.createMinimalEd25519VerifyIx)(overrideCustomIxIndex || precedingIxs.length + 1, 12, signedMsgIxData, 0);
|
|
3345
3345
|
const isDelegateSigner = takerInfo.signingAuthority.equals(takerInfo.takerUserAccount.delegate);
|
|
3346
3346
|
const placeTakerSignedMsgPerpOrderIx = this.program.instruction.placeSignedMsgTakerOrder(signedMsgIxData, isDelegateSigner, {
|
|
3347
3347
|
accounts: {
|
|
@@ -3356,14 +3356,14 @@ class DriftClient {
|
|
|
3356
3356
|
});
|
|
3357
3357
|
return [signedMsgOrderParamsSignatureIx, placeTakerSignedMsgPerpOrderIx];
|
|
3358
3358
|
}
|
|
3359
|
-
async placeAndMakeSignedMsgPerpOrder(signedSignedMsgOrderParams, signedMsgOrderUuid, takerInfo, orderParams, referrerInfo, txParams, subAccountId, precedingIxs = [],
|
|
3360
|
-
const ixs = await this.getPlaceAndMakeSignedMsgPerpOrderIxs(signedSignedMsgOrderParams, signedMsgOrderUuid, takerInfo, orderParams, referrerInfo, subAccountId, precedingIxs,
|
|
3359
|
+
async placeAndMakeSignedMsgPerpOrder(signedSignedMsgOrderParams, signedMsgOrderUuid, takerInfo, orderParams, referrerInfo, txParams, subAccountId, precedingIxs = [], overrideCustomIxIndex) {
|
|
3360
|
+
const ixs = await this.getPlaceAndMakeSignedMsgPerpOrderIxs(signedSignedMsgOrderParams, signedMsgOrderUuid, takerInfo, orderParams, referrerInfo, subAccountId, precedingIxs, overrideCustomIxIndex);
|
|
3361
3361
|
const { txSig, slot } = await this.sendTransaction(await this.buildTransaction(ixs, txParams), [], this.opts);
|
|
3362
3362
|
this.perpMarketLastSlotCache.set(orderParams.marketIndex, slot);
|
|
3363
3363
|
return txSig;
|
|
3364
3364
|
}
|
|
3365
|
-
async getPlaceAndMakeSignedMsgPerpOrderIxs(signedSignedMsgOrderParams, signedMsgOrderUuid, takerInfo, orderParams, referrerInfo, subAccountId, precedingIxs = [],
|
|
3366
|
-
const [signedMsgOrderSignatureIx, placeTakerSignedMsgPerpOrderIx] = await this.getPlaceSignedMsgTakerPerpOrderIxs(signedSignedMsgOrderParams, orderParams.marketIndex, takerInfo, precedingIxs,
|
|
3365
|
+
async getPlaceAndMakeSignedMsgPerpOrderIxs(signedSignedMsgOrderParams, signedMsgOrderUuid, takerInfo, orderParams, referrerInfo, subAccountId, precedingIxs = [], overrideCustomIxIndex) {
|
|
3366
|
+
const [signedMsgOrderSignatureIx, placeTakerSignedMsgPerpOrderIx] = await this.getPlaceSignedMsgTakerPerpOrderIxs(signedSignedMsgOrderParams, orderParams.marketIndex, takerInfo, precedingIxs, overrideCustomIxIndex);
|
|
3367
3367
|
orderParams = (0, orderParams_1.getOrderParams)(orderParams, { marketType: types_1.MarketType.PERP });
|
|
3368
3368
|
const userStatsPublicKey = this.getUserStatsAccountPublicKey();
|
|
3369
3369
|
const user = await this.getUserAccountPublicKey(subAccountId);
|
|
@@ -4744,9 +4744,9 @@ class DriftClient {
|
|
|
4744
4744
|
const { txSig } = await this.sendTransaction(tx, [], this.opts);
|
|
4745
4745
|
return txSig;
|
|
4746
4746
|
}
|
|
4747
|
-
async getPostPythLazerOracleUpdateIxs(feedIds, pythMessageHex, precedingIxs = [],
|
|
4747
|
+
async getPostPythLazerOracleUpdateIxs(feedIds, pythMessageHex, precedingIxs = [], overrideCustomIxIndex) {
|
|
4748
4748
|
const pythMessageBytes = Buffer.from(pythMessageHex, 'hex');
|
|
4749
|
-
const verifyIx = (0, ed25519Utils_1.createMinimalEd25519VerifyIx)(
|
|
4749
|
+
const verifyIx = (0, ed25519Utils_1.createMinimalEd25519VerifyIx)(overrideCustomIxIndex || precedingIxs.length + 1, 12, pythMessageBytes);
|
|
4750
4750
|
const remainingAccountsMeta = feedIds.map((feedId) => {
|
|
4751
4751
|
return {
|
|
4752
4752
|
pubkey: (0, pda_1.getPythLazerOraclePublicKey)(this.program.programId, feedId),
|
package/package.json
CHANGED
package/src/driftClient.ts
CHANGED
|
@@ -769,8 +769,8 @@ export class DriftClient {
|
|
|
769
769
|
this.userStatsAccountPublicKey = undefined;
|
|
770
770
|
this.includeDelegates = includeDelegates ?? false;
|
|
771
771
|
const walletSupportsVersionedTxns =
|
|
772
|
-
//@ts-
|
|
773
|
-
this.wallet.supportedTransactionVersions?.size ?? 0 > 1;
|
|
772
|
+
//@ts-expect-error
|
|
773
|
+
(this.wallet.supportedTransactionVersions?.size ?? 0) > 1;
|
|
774
774
|
this.txVersion = walletSupportsVersionedTxns ? 0 : 'legacy';
|
|
775
775
|
|
|
776
776
|
if (includeDelegates && subAccountIds) {
|
|
@@ -6177,7 +6177,7 @@ export class DriftClient {
|
|
|
6177
6177
|
signingAuthority: PublicKey;
|
|
6178
6178
|
},
|
|
6179
6179
|
precedingIxs: TransactionInstruction[] = [],
|
|
6180
|
-
|
|
6180
|
+
overrideCustomIxIndex?: number,
|
|
6181
6181
|
txParams?: TxParams
|
|
6182
6182
|
): Promise<TransactionSignature> {
|
|
6183
6183
|
const ixs = await this.getPlaceSignedMsgTakerPerpOrderIxs(
|
|
@@ -6185,7 +6185,7 @@ export class DriftClient {
|
|
|
6185
6185
|
marketIndex,
|
|
6186
6186
|
takerInfo,
|
|
6187
6187
|
precedingIxs,
|
|
6188
|
-
|
|
6188
|
+
overrideCustomIxIndex
|
|
6189
6189
|
);
|
|
6190
6190
|
const { txSig } = await this.sendTransaction(
|
|
6191
6191
|
await this.buildTransaction(ixs, txParams),
|
|
@@ -6205,7 +6205,7 @@ export class DriftClient {
|
|
|
6205
6205
|
signingAuthority: PublicKey;
|
|
6206
6206
|
},
|
|
6207
6207
|
precedingIxs: TransactionInstruction[] = [],
|
|
6208
|
-
|
|
6208
|
+
overrideCustomIxIndex?: number
|
|
6209
6209
|
): Promise<TransactionInstruction[]> {
|
|
6210
6210
|
const remainingAccounts = this.getRemainingAccounts({
|
|
6211
6211
|
userAccounts: [takerInfo.takerUserAccount],
|
|
@@ -6226,7 +6226,7 @@ export class DriftClient {
|
|
|
6226
6226
|
]);
|
|
6227
6227
|
|
|
6228
6228
|
const signedMsgOrderParamsSignatureIx = createMinimalEd25519VerifyIx(
|
|
6229
|
-
|
|
6229
|
+
overrideCustomIxIndex || precedingIxs.length + 1,
|
|
6230
6230
|
12,
|
|
6231
6231
|
signedMsgIxData,
|
|
6232
6232
|
0
|
|
@@ -6272,7 +6272,7 @@ export class DriftClient {
|
|
|
6272
6272
|
txParams?: TxParams,
|
|
6273
6273
|
subAccountId?: number,
|
|
6274
6274
|
precedingIxs: TransactionInstruction[] = [],
|
|
6275
|
-
|
|
6275
|
+
overrideCustomIxIndex?: number
|
|
6276
6276
|
): Promise<TransactionSignature> {
|
|
6277
6277
|
const ixs = await this.getPlaceAndMakeSignedMsgPerpOrderIxs(
|
|
6278
6278
|
signedSignedMsgOrderParams,
|
|
@@ -6282,7 +6282,7 @@ export class DriftClient {
|
|
|
6282
6282
|
referrerInfo,
|
|
6283
6283
|
subAccountId,
|
|
6284
6284
|
precedingIxs,
|
|
6285
|
-
|
|
6285
|
+
overrideCustomIxIndex
|
|
6286
6286
|
);
|
|
6287
6287
|
const { txSig, slot } = await this.sendTransaction(
|
|
6288
6288
|
await this.buildTransaction(ixs, txParams),
|
|
@@ -6307,7 +6307,7 @@ export class DriftClient {
|
|
|
6307
6307
|
referrerInfo?: ReferrerInfo,
|
|
6308
6308
|
subAccountId?: number,
|
|
6309
6309
|
precedingIxs: TransactionInstruction[] = [],
|
|
6310
|
-
|
|
6310
|
+
overrideCustomIxIndex?: number
|
|
6311
6311
|
): Promise<TransactionInstruction[]> {
|
|
6312
6312
|
const [signedMsgOrderSignatureIx, placeTakerSignedMsgPerpOrderIx] =
|
|
6313
6313
|
await this.getPlaceSignedMsgTakerPerpOrderIxs(
|
|
@@ -6315,7 +6315,7 @@ export class DriftClient {
|
|
|
6315
6315
|
orderParams.marketIndex,
|
|
6316
6316
|
takerInfo,
|
|
6317
6317
|
precedingIxs,
|
|
6318
|
-
|
|
6318
|
+
overrideCustomIxIndex
|
|
6319
6319
|
);
|
|
6320
6320
|
|
|
6321
6321
|
orderParams = getOrderParams(orderParams, { marketType: MarketType.PERP });
|
|
@@ -9074,12 +9074,12 @@ export class DriftClient {
|
|
|
9074
9074
|
feedIds: number[],
|
|
9075
9075
|
pythMessageHex: string,
|
|
9076
9076
|
precedingIxs: TransactionInstruction[] = [],
|
|
9077
|
-
|
|
9077
|
+
overrideCustomIxIndex?: number
|
|
9078
9078
|
): Promise<TransactionInstruction[]> {
|
|
9079
9079
|
const pythMessageBytes = Buffer.from(pythMessageHex, 'hex');
|
|
9080
9080
|
|
|
9081
9081
|
const verifyIx = createMinimalEd25519VerifyIx(
|
|
9082
|
-
|
|
9082
|
+
overrideCustomIxIndex || precedingIxs.length + 1,
|
|
9083
9083
|
12,
|
|
9084
9084
|
pythMessageBytes
|
|
9085
9085
|
);
|