@drift-labs/sdk 2.90.0-beta.3 → 2.90.0-beta.5
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/adminClient.js +2 -3
- package/lib/driftClient.d.ts +1 -1
- package/lib/driftClient.js +3 -3
- package/package.json +1 -1
- package/src/adminClient.ts +2 -3
- package/src/driftClient.ts +6 -3
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.90.0-beta.
|
|
1
|
+
2.90.0-beta.5
|
package/lib/adminClient.js
CHANGED
|
@@ -446,15 +446,14 @@ class AdminClient extends driftClient_1.DriftClient {
|
|
|
446
446
|
const tokenProgram = this.getTokenProgramForSpotMarket(spotMarket);
|
|
447
447
|
return await this.program.instruction.depositIntoSpotMarketVault(amount, {
|
|
448
448
|
accounts: {
|
|
449
|
-
admin: this.
|
|
450
|
-
? this.getStateAccount().admin
|
|
451
|
-
: this.wallet.publicKey,
|
|
449
|
+
admin: this.wallet.publicKey,
|
|
452
450
|
state: await this.getStatePublicKey(),
|
|
453
451
|
sourceVault,
|
|
454
452
|
spotMarket: spotMarket.pubkey,
|
|
455
453
|
spotMarketVault: spotMarket.vault,
|
|
456
454
|
tokenProgram,
|
|
457
455
|
},
|
|
456
|
+
remainingAccounts,
|
|
458
457
|
});
|
|
459
458
|
}
|
|
460
459
|
async updateAdmin(admin) {
|
package/lib/driftClient.d.ts
CHANGED
|
@@ -253,7 +253,7 @@ export declare class DriftClient {
|
|
|
253
253
|
}>;
|
|
254
254
|
getTokenProgramForSpotMarket(spotMarketAccount: SpotMarketAccount): PublicKey;
|
|
255
255
|
addTokenMintToRemainingAccounts(spotMarketAccount: SpotMarketAccount, remainingAccounts: AccountMeta[]): void;
|
|
256
|
-
getAssociatedTokenAccountCreationIx(tokenMintAddress: PublicKey, associatedTokenAddress: PublicKey): anchor.web3.TransactionInstruction;
|
|
256
|
+
getAssociatedTokenAccountCreationIx(tokenMintAddress: PublicKey, associatedTokenAddress: PublicKey, tokenProgram: PublicKey): anchor.web3.TransactionInstruction;
|
|
257
257
|
createInitializeUserAccountAndDepositCollateral(amount: BN, userTokenAccount: PublicKey, marketIndex?: number, subAccountId?: number, name?: string, fromSubAccountId?: number, referrerInfo?: ReferrerInfo, donateAmount?: BN, txParams?: TxParams, customMaxMarginRatio?: number): Promise<[Transaction | VersionedTransaction, PublicKey]>;
|
|
258
258
|
/**
|
|
259
259
|
* Creates the User account for a user, and deposits some initial collateral
|
package/lib/driftClient.js
CHANGED
|
@@ -1202,8 +1202,8 @@ class DriftClient {
|
|
|
1202
1202
|
});
|
|
1203
1203
|
}
|
|
1204
1204
|
}
|
|
1205
|
-
getAssociatedTokenAccountCreationIx(tokenMintAddress, associatedTokenAddress) {
|
|
1206
|
-
return (0, spl_token_1.createAssociatedTokenAccountInstruction)(this.wallet.publicKey, associatedTokenAddress, this.wallet.publicKey, tokenMintAddress);
|
|
1205
|
+
getAssociatedTokenAccountCreationIx(tokenMintAddress, associatedTokenAddress, tokenProgram) {
|
|
1206
|
+
return (0, spl_token_1.createAssociatedTokenAccountInstruction)(this.wallet.publicKey, associatedTokenAddress, this.wallet.publicKey, tokenMintAddress, tokenProgram);
|
|
1207
1207
|
}
|
|
1208
1208
|
async createInitializeUserAccountAndDepositCollateral(amount, userTokenAccount, marketIndex = 0, subAccountId = 0, name, fromSubAccountId, referrerInfo, donateAmount, txParams, customMaxMarginRatio) {
|
|
1209
1209
|
const ixs = [];
|
|
@@ -1306,7 +1306,7 @@ class DriftClient {
|
|
|
1306
1306
|
else {
|
|
1307
1307
|
const accountExists = await this.checkIfAccountExists(associatedTokenAddress);
|
|
1308
1308
|
if (!accountExists) {
|
|
1309
|
-
const createAssociatedTokenAccountIx = this.getAssociatedTokenAccountCreationIx(spotMarketAccount.mint, associatedTokenAddress);
|
|
1309
|
+
const createAssociatedTokenAccountIx = this.getAssociatedTokenAccountCreationIx(spotMarketAccount.mint, associatedTokenAddress, this.getTokenProgramForSpotMarket(spotMarketAccount));
|
|
1310
1310
|
withdrawIxs.push(createAssociatedTokenAccountIx);
|
|
1311
1311
|
}
|
|
1312
1312
|
}
|
package/package.json
CHANGED
package/src/adminClient.ts
CHANGED
|
@@ -1030,15 +1030,14 @@ export class AdminClient extends DriftClient {
|
|
|
1030
1030
|
const tokenProgram = this.getTokenProgramForSpotMarket(spotMarket);
|
|
1031
1031
|
return await this.program.instruction.depositIntoSpotMarketVault(amount, {
|
|
1032
1032
|
accounts: {
|
|
1033
|
-
admin: this.
|
|
1034
|
-
? this.getStateAccount().admin
|
|
1035
|
-
: this.wallet.publicKey,
|
|
1033
|
+
admin: this.wallet.publicKey,
|
|
1036
1034
|
state: await this.getStatePublicKey(),
|
|
1037
1035
|
sourceVault,
|
|
1038
1036
|
spotMarket: spotMarket.pubkey,
|
|
1039
1037
|
spotMarketVault: spotMarket.vault,
|
|
1040
1038
|
tokenProgram,
|
|
1041
1039
|
},
|
|
1040
|
+
remainingAccounts,
|
|
1042
1041
|
});
|
|
1043
1042
|
}
|
|
1044
1043
|
|
package/src/driftClient.ts
CHANGED
|
@@ -2091,13 +2091,15 @@ export class DriftClient {
|
|
|
2091
2091
|
|
|
2092
2092
|
public getAssociatedTokenAccountCreationIx(
|
|
2093
2093
|
tokenMintAddress: PublicKey,
|
|
2094
|
-
associatedTokenAddress: PublicKey
|
|
2094
|
+
associatedTokenAddress: PublicKey,
|
|
2095
|
+
tokenProgram: PublicKey
|
|
2095
2096
|
): anchor.web3.TransactionInstruction {
|
|
2096
2097
|
return createAssociatedTokenAccountInstruction(
|
|
2097
2098
|
this.wallet.publicKey,
|
|
2098
2099
|
associatedTokenAddress,
|
|
2099
2100
|
this.wallet.publicKey,
|
|
2100
|
-
tokenMintAddress
|
|
2101
|
+
tokenMintAddress,
|
|
2102
|
+
tokenProgram
|
|
2101
2103
|
);
|
|
2102
2104
|
}
|
|
2103
2105
|
|
|
@@ -2359,7 +2361,8 @@ export class DriftClient {
|
|
|
2359
2361
|
const createAssociatedTokenAccountIx =
|
|
2360
2362
|
this.getAssociatedTokenAccountCreationIx(
|
|
2361
2363
|
spotMarketAccount.mint,
|
|
2362
|
-
associatedTokenAddress
|
|
2364
|
+
associatedTokenAddress,
|
|
2365
|
+
this.getTokenProgramForSpotMarket(spotMarketAccount)
|
|
2363
2366
|
);
|
|
2364
2367
|
|
|
2365
2368
|
withdrawIxs.push(createAssociatedTokenAccountIx);
|