@drift-labs/sdk-browser 2.104.0-beta.24 → 2.104.0-beta.25
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 +2 -0
- package/lib/browser/driftClient.js +15 -0
- package/lib/node/driftClient.d.ts +2 -0
- package/lib/node/driftClient.js +15 -0
- package/package.json +1 -1
- package/src/driftClient.ts +40 -0
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.104.0-beta.
|
|
1
|
+
2.104.0-beta.25
|
|
@@ -834,6 +834,8 @@ export declare class DriftClient {
|
|
|
834
834
|
disableUserHighLeverageMode(user: PublicKey, userAccount?: UserAccount, txParams?: TxParams): Promise<TransactionSignature>;
|
|
835
835
|
getDisableHighLeverageModeIx(user: PublicKey, userAccount?: UserAccount): Promise<TransactionInstruction>;
|
|
836
836
|
fetchHighLeverageModeConfig(): Promise<HighLeverageModeConfig>;
|
|
837
|
+
updateUserProtectedMakerOrders(subAccountId: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
838
|
+
getUpdateUserProtectedMakerOrdersIx(subAccountId: number): Promise<TransactionInstruction>;
|
|
837
839
|
private handleSignedTransaction;
|
|
838
840
|
private handlePreSignedTransaction;
|
|
839
841
|
private isVersionedTransaction;
|
|
@@ -4688,6 +4688,21 @@ class DriftClient {
|
|
|
4688
4688
|
const config = await this.program.account.highLeverageModeConfig.fetch((0, pda_1.getHighLeverageModeConfigPublicKey)(this.program.programId));
|
|
4689
4689
|
return config;
|
|
4690
4690
|
}
|
|
4691
|
+
async updateUserProtectedMakerOrders(subAccountId, txParams) {
|
|
4692
|
+
const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getUpdateUserProtectedMakerOrdersIx(subAccountId), txParams), [], this.opts);
|
|
4693
|
+
return txSig;
|
|
4694
|
+
}
|
|
4695
|
+
async getUpdateUserProtectedMakerOrdersIx(subAccountId) {
|
|
4696
|
+
const ix = await this.program.instruction.updateUserProtectedMakerOrders(subAccountId, {
|
|
4697
|
+
accounts: {
|
|
4698
|
+
state: await this.getStatePublicKey(),
|
|
4699
|
+
user: (0, pda_1.getUserAccountPublicKeySync)(this.program.programId, this.wallet.publicKey, subAccountId),
|
|
4700
|
+
authority: this.wallet.publicKey,
|
|
4701
|
+
protectedMakerModeConfig: (0, pda_1.getProtectedMakerModeConfigPublicKey)(this.program.programId),
|
|
4702
|
+
},
|
|
4703
|
+
});
|
|
4704
|
+
return ix;
|
|
4705
|
+
}
|
|
4691
4706
|
handleSignedTransaction(signedTxs) {
|
|
4692
4707
|
if (this.enableMetricsEvents && this.metricsEventEmitter) {
|
|
4693
4708
|
this.metricsEventEmitter.emit('txSigned', signedTxs);
|
|
@@ -834,6 +834,8 @@ export declare class DriftClient {
|
|
|
834
834
|
disableUserHighLeverageMode(user: PublicKey, userAccount?: UserAccount, txParams?: TxParams): Promise<TransactionSignature>;
|
|
835
835
|
getDisableHighLeverageModeIx(user: PublicKey, userAccount?: UserAccount): Promise<TransactionInstruction>;
|
|
836
836
|
fetchHighLeverageModeConfig(): Promise<HighLeverageModeConfig>;
|
|
837
|
+
updateUserProtectedMakerOrders(subAccountId: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
838
|
+
getUpdateUserProtectedMakerOrdersIx(subAccountId: number): Promise<TransactionInstruction>;
|
|
837
839
|
private handleSignedTransaction;
|
|
838
840
|
private handlePreSignedTransaction;
|
|
839
841
|
private isVersionedTransaction;
|
package/lib/node/driftClient.js
CHANGED
|
@@ -4688,6 +4688,21 @@ class DriftClient {
|
|
|
4688
4688
|
const config = await this.program.account.highLeverageModeConfig.fetch((0, pda_1.getHighLeverageModeConfigPublicKey)(this.program.programId));
|
|
4689
4689
|
return config;
|
|
4690
4690
|
}
|
|
4691
|
+
async updateUserProtectedMakerOrders(subAccountId, txParams) {
|
|
4692
|
+
const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getUpdateUserProtectedMakerOrdersIx(subAccountId), txParams), [], this.opts);
|
|
4693
|
+
return txSig;
|
|
4694
|
+
}
|
|
4695
|
+
async getUpdateUserProtectedMakerOrdersIx(subAccountId) {
|
|
4696
|
+
const ix = await this.program.instruction.updateUserProtectedMakerOrders(subAccountId, {
|
|
4697
|
+
accounts: {
|
|
4698
|
+
state: await this.getStatePublicKey(),
|
|
4699
|
+
user: (0, pda_1.getUserAccountPublicKeySync)(this.program.programId, this.wallet.publicKey, subAccountId),
|
|
4700
|
+
authority: this.wallet.publicKey,
|
|
4701
|
+
protectedMakerModeConfig: (0, pda_1.getProtectedMakerModeConfigPublicKey)(this.program.programId),
|
|
4702
|
+
},
|
|
4703
|
+
});
|
|
4704
|
+
return ix;
|
|
4705
|
+
}
|
|
4691
4706
|
handleSignedTransaction(signedTxs) {
|
|
4692
4707
|
if (this.enableMetricsEvents && this.metricsEventEmitter) {
|
|
4693
4708
|
this.metricsEventEmitter.emit('txSigned', signedTxs);
|
package/package.json
CHANGED
package/src/driftClient.ts
CHANGED
|
@@ -93,6 +93,7 @@ import {
|
|
|
93
93
|
getOpenbookV2FulfillmentConfigPublicKey,
|
|
94
94
|
getPerpMarketPublicKey,
|
|
95
95
|
getPhoenixFulfillmentConfigPublicKey,
|
|
96
|
+
getProtectedMakerModeConfigPublicKey,
|
|
96
97
|
getPythLazerOraclePublicKey,
|
|
97
98
|
getPythPullOraclePublicKey,
|
|
98
99
|
getReferrerNamePublicKeySync,
|
|
@@ -8896,6 +8897,45 @@ export class DriftClient {
|
|
|
8896
8897
|
return config as HighLeverageModeConfig;
|
|
8897
8898
|
}
|
|
8898
8899
|
|
|
8900
|
+
public async updateUserProtectedMakerOrders(
|
|
8901
|
+
subAccountId: number,
|
|
8902
|
+
txParams?: TxParams
|
|
8903
|
+
): Promise<TransactionSignature> {
|
|
8904
|
+
const { txSig } = await this.sendTransaction(
|
|
8905
|
+
await this.buildTransaction(
|
|
8906
|
+
await this.getUpdateUserProtectedMakerOrdersIx(subAccountId),
|
|
8907
|
+
txParams
|
|
8908
|
+
),
|
|
8909
|
+
[],
|
|
8910
|
+
this.opts
|
|
8911
|
+
);
|
|
8912
|
+
return txSig;
|
|
8913
|
+
}
|
|
8914
|
+
|
|
8915
|
+
public async getUpdateUserProtectedMakerOrdersIx(
|
|
8916
|
+
subAccountId: number
|
|
8917
|
+
): Promise<TransactionInstruction> {
|
|
8918
|
+
const ix = await this.program.instruction.updateUserProtectedMakerOrders(
|
|
8919
|
+
subAccountId,
|
|
8920
|
+
{
|
|
8921
|
+
accounts: {
|
|
8922
|
+
state: await this.getStatePublicKey(),
|
|
8923
|
+
user: getUserAccountPublicKeySync(
|
|
8924
|
+
this.program.programId,
|
|
8925
|
+
this.wallet.publicKey,
|
|
8926
|
+
subAccountId
|
|
8927
|
+
),
|
|
8928
|
+
authority: this.wallet.publicKey,
|
|
8929
|
+
protectedMakerModeConfig: getProtectedMakerModeConfigPublicKey(
|
|
8930
|
+
this.program.programId
|
|
8931
|
+
),
|
|
8932
|
+
},
|
|
8933
|
+
}
|
|
8934
|
+
);
|
|
8935
|
+
|
|
8936
|
+
return ix;
|
|
8937
|
+
}
|
|
8938
|
+
|
|
8899
8939
|
private handleSignedTransaction(signedTxs: SignedTxData[]) {
|
|
8900
8940
|
if (this.enableMetricsEvents && this.metricsEventEmitter) {
|
|
8901
8941
|
this.metricsEventEmitter.emit('txSigned', signedTxs);
|