@drift-labs/sdk 2.90.0-beta.4 → 2.91.0-beta.0
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/driftClient.d.ts +1 -1
- package/lib/driftClient.js +3 -3
- package/lib/idl/drift.json +1 -1
- package/package.json +1 -1
- package/src/driftClient.ts +6 -3
- package/src/idl/drift.json +1 -1
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.
|
|
1
|
+
2.91.0-beta.0
|
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/lib/idl/drift.json
CHANGED
package/package.json
CHANGED
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);
|
package/src/idl/drift.json
CHANGED