@drift-labs/sdk 2.86.0-beta.33 → 2.86.0-beta.34
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.js +3 -0
- package/package.json +1 -1
- package/src/driftClient.ts +6 -0
- package/tests/ci/verifyConstants.ts +9 -9
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.86.0-beta.
|
|
1
|
+
2.86.0-beta.34
|
package/lib/driftClient.js
CHANGED
|
@@ -3476,6 +3476,9 @@ class DriftClient {
|
|
|
3476
3476
|
const isSolMarket = spotMarketAccount.mint.equals(spotMarkets_1.WRAPPED_SOL_MINT);
|
|
3477
3477
|
const createWSOLTokenAccount = isSolMarket && collateralAccountPublicKey.equals(this.wallet.publicKey);
|
|
3478
3478
|
let tokenAccount;
|
|
3479
|
+
if (!(await this.checkIfAccountExists(this.getUserStatsAccountPublicKey()))) {
|
|
3480
|
+
addIfStakeIxs.push(await this.getInitializeUserStatsIx());
|
|
3481
|
+
}
|
|
3479
3482
|
if (createWSOLTokenAccount) {
|
|
3480
3483
|
const { ixs, pubkey } = await this.getWrappedSolAccountCreationIxs(amount, true);
|
|
3481
3484
|
tokenAccount = pubkey;
|
package/package.json
CHANGED
package/src/driftClient.ts
CHANGED
|
@@ -6587,6 +6587,12 @@ export class DriftClient {
|
|
|
6587
6587
|
|
|
6588
6588
|
let tokenAccount;
|
|
6589
6589
|
|
|
6590
|
+
if (
|
|
6591
|
+
!(await this.checkIfAccountExists(this.getUserStatsAccountPublicKey()))
|
|
6592
|
+
) {
|
|
6593
|
+
addIfStakeIxs.push(await this.getInitializeUserStatsIx());
|
|
6594
|
+
}
|
|
6595
|
+
|
|
6590
6596
|
if (createWSOLTokenAccount) {
|
|
6591
6597
|
const { ixs, pubkey } = await this.getWrappedSolAccountCreationIxs(
|
|
6592
6598
|
amount,
|
|
@@ -17,19 +17,19 @@ dotenv.config();
|
|
|
17
17
|
describe('Verify Constants', function () {
|
|
18
18
|
this.timeout(100_000);
|
|
19
19
|
const MAINNET_RPC_ENDPOINT = process.env.MAINNET_RPC_ENDPOINT;
|
|
20
|
-
|
|
20
|
+
const DEVNET_RPC_ENDPOINT = process.env.DEVNET_RPC_ENDPOINT;
|
|
21
21
|
|
|
22
22
|
if (MAINNET_RPC_ENDPOINT === undefined) {
|
|
23
|
-
|
|
23
|
+
throw new Error('MAINNET_RPC_ENDPOINT not found in .env');
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
-
|
|
27
|
-
|
|
26
|
+
if (DEVNET_RPC_ENDPOINT === undefined) {
|
|
27
|
+
throw new Error('DEVNET_RPC_ENDPOINT not found in .env');
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
const wallet = new Wallet(Keypair.generate());
|
|
31
31
|
|
|
32
|
-
|
|
32
|
+
const devnetConnection = new Connection(DEVNET_RPC_ENDPOINT);
|
|
33
33
|
const mainnetConnection = new Connection(MAINNET_RPC_ENDPOINT);
|
|
34
34
|
|
|
35
35
|
const devnetBulkAccountLoader = new BulkAccountLoader(
|
|
@@ -76,7 +76,7 @@ describe('Verify Constants', function () {
|
|
|
76
76
|
|
|
77
77
|
it('has all mainnet markets', async () => {
|
|
78
78
|
const spotMarkets = mainnetDriftClient.getSpotMarketAccounts();
|
|
79
|
-
|
|
79
|
+
spotMarkets.sort((a, b) => a.marketIndex - b.marketIndex);
|
|
80
80
|
|
|
81
81
|
for (const market of spotMarkets) {
|
|
82
82
|
const correspondingConfigMarket = MainnetSpotMarkets.find(
|
|
@@ -112,7 +112,7 @@ describe('Verify Constants', function () {
|
|
|
112
112
|
}
|
|
113
113
|
|
|
114
114
|
const perpMarkets = mainnetDriftClient.getPerpMarketAccounts();
|
|
115
|
-
|
|
115
|
+
perpMarkets.sort((a, b) => a.marketIndex - b.marketIndex);
|
|
116
116
|
|
|
117
117
|
for (const market of perpMarkets) {
|
|
118
118
|
const correspondingConfigMarket = MainnetPerpMarkets.find(
|
|
@@ -145,7 +145,7 @@ describe('Verify Constants', function () {
|
|
|
145
145
|
|
|
146
146
|
it('has all devnet markets', async () => {
|
|
147
147
|
const spotMarkets = devnetDriftClient.getSpotMarketAccounts();
|
|
148
|
-
|
|
148
|
+
spotMarkets.sort((a, b) => a.marketIndex - b.marketIndex);
|
|
149
149
|
|
|
150
150
|
for (const market of spotMarkets) {
|
|
151
151
|
const correspondingConfigMarket = DevnetSpotMarkets.find(
|
|
@@ -181,7 +181,7 @@ describe('Verify Constants', function () {
|
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
const perpMarkets = devnetDriftClient.getPerpMarketAccounts();
|
|
184
|
-
|
|
184
|
+
perpMarkets.sort((a, b) => a.marketIndex - b.marketIndex);
|
|
185
185
|
|
|
186
186
|
for (const market of perpMarkets) {
|
|
187
187
|
const correspondingConfigMarket = DevnetPerpMarkets.find(
|