@drift-labs/sdk 2.88.0-beta.1 → 2.88.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/constants/spotMarkets.js +10 -0
- package/lib/driftClient.js +4 -2
- package/package.json +1 -1
- package/src/constants/spotMarkets.ts +11 -0
- package/src/driftClient.ts +8 -2
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.88.0-beta.
|
|
1
|
+
2.88.0-beta.2
|
|
@@ -301,6 +301,16 @@ exports.MainnetSpotMarkets = [
|
|
|
301
301
|
precisionExp: numericConstants_1.NINE,
|
|
302
302
|
launchTs: 1721316817000,
|
|
303
303
|
},
|
|
304
|
+
{
|
|
305
|
+
symbol: 'PYUSD',
|
|
306
|
+
marketIndex: 22,
|
|
307
|
+
oracle: new web3_js_1.PublicKey('HpMoKp3TCd3QT4MWYUKk2zCBwmhr5Df45fB6wdxYqEeh'),
|
|
308
|
+
oracleSource: __1.OracleSource.PYTH_STABLE_COIN_PULL,
|
|
309
|
+
mint: new web3_js_1.PublicKey('2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo'),
|
|
310
|
+
precision: new __1.BN(10).pow(numericConstants_1.SIX),
|
|
311
|
+
precisionExp: numericConstants_1.SIX,
|
|
312
|
+
pythFeedId: '0xc1da1b73d7f01e7ddd54b3766cf7fcd644395ad14f70aa706ec5384c59e76692',
|
|
313
|
+
},
|
|
304
314
|
];
|
|
305
315
|
exports.SpotMarkets = {
|
|
306
316
|
devnet: exports.DevnetSpotMarkets,
|
package/lib/driftClient.js
CHANGED
|
@@ -2443,14 +2443,16 @@ class DriftClient {
|
|
|
2443
2443
|
outAssociatedTokenAccount = await this.getAssociatedTokenAccount(outMarket.marketIndex, false);
|
|
2444
2444
|
const accountInfo = await this.connection.getAccountInfo(outAssociatedTokenAccount);
|
|
2445
2445
|
if (!accountInfo) {
|
|
2446
|
-
|
|
2446
|
+
const tokenProgram = this.getTokenProgramForSpotMarket(outMarket);
|
|
2447
|
+
preInstructions.push(this.createAssociatedTokenAccountIdempotentInstruction(outAssociatedTokenAccount, this.provider.wallet.publicKey, this.provider.wallet.publicKey, outMarket.mint, tokenProgram));
|
|
2447
2448
|
}
|
|
2448
2449
|
}
|
|
2449
2450
|
if (!inAssociatedTokenAccount) {
|
|
2450
2451
|
inAssociatedTokenAccount = await this.getAssociatedTokenAccount(inMarket.marketIndex, false);
|
|
2451
2452
|
const accountInfo = await this.connection.getAccountInfo(inAssociatedTokenAccount);
|
|
2452
2453
|
if (!accountInfo) {
|
|
2453
|
-
|
|
2454
|
+
const tokenProgram = this.getTokenProgramForSpotMarket(inMarket);
|
|
2455
|
+
preInstructions.push(this.createAssociatedTokenAccountIdempotentInstruction(inAssociatedTokenAccount, this.provider.wallet.publicKey, this.provider.wallet.publicKey, inMarket.mint, tokenProgram));
|
|
2454
2456
|
}
|
|
2455
2457
|
}
|
|
2456
2458
|
const { beginSwapIx, endSwapIx } = await this.getSwapIx({
|
package/package.json
CHANGED
|
@@ -373,6 +373,17 @@ export const MainnetSpotMarkets: SpotMarketConfig[] = [
|
|
|
373
373
|
precisionExp: NINE,
|
|
374
374
|
launchTs: 1721316817000,
|
|
375
375
|
},
|
|
376
|
+
{
|
|
377
|
+
symbol: 'PYUSD',
|
|
378
|
+
marketIndex: 22,
|
|
379
|
+
oracle: new PublicKey('HpMoKp3TCd3QT4MWYUKk2zCBwmhr5Df45fB6wdxYqEeh'),
|
|
380
|
+
oracleSource: OracleSource.PYTH_STABLE_COIN_PULL,
|
|
381
|
+
mint: new PublicKey('2b1kV6DkPAnxd5ixfnxCpjxmKwqjjaYmCZfHsFu24GXo'),
|
|
382
|
+
precision: new BN(10).pow(SIX),
|
|
383
|
+
precisionExp: SIX,
|
|
384
|
+
pythFeedId:
|
|
385
|
+
'0xc1da1b73d7f01e7ddd54b3766cf7fcd644395ad14f70aa706ec5384c59e76692',
|
|
386
|
+
},
|
|
376
387
|
];
|
|
377
388
|
|
|
378
389
|
export const SpotMarkets: { [key in DriftEnv]: SpotMarketConfig[] } = {
|
package/src/driftClient.ts
CHANGED
|
@@ -4399,12 +4399,15 @@ export class DriftClient {
|
|
|
4399
4399
|
outAssociatedTokenAccount
|
|
4400
4400
|
);
|
|
4401
4401
|
if (!accountInfo) {
|
|
4402
|
+
const tokenProgram = this.getTokenProgramForSpotMarket(outMarket);
|
|
4403
|
+
|
|
4402
4404
|
preInstructions.push(
|
|
4403
4405
|
this.createAssociatedTokenAccountIdempotentInstruction(
|
|
4404
4406
|
outAssociatedTokenAccount,
|
|
4405
4407
|
this.provider.wallet.publicKey,
|
|
4406
4408
|
this.provider.wallet.publicKey,
|
|
4407
|
-
outMarket.mint
|
|
4409
|
+
outMarket.mint,
|
|
4410
|
+
tokenProgram
|
|
4408
4411
|
)
|
|
4409
4412
|
);
|
|
4410
4413
|
}
|
|
@@ -4420,12 +4423,15 @@ export class DriftClient {
|
|
|
4420
4423
|
inAssociatedTokenAccount
|
|
4421
4424
|
);
|
|
4422
4425
|
if (!accountInfo) {
|
|
4426
|
+
const tokenProgram = this.getTokenProgramForSpotMarket(inMarket);
|
|
4427
|
+
|
|
4423
4428
|
preInstructions.push(
|
|
4424
4429
|
this.createAssociatedTokenAccountIdempotentInstruction(
|
|
4425
4430
|
inAssociatedTokenAccount,
|
|
4426
4431
|
this.provider.wallet.publicKey,
|
|
4427
4432
|
this.provider.wallet.publicKey,
|
|
4428
|
-
inMarket.mint
|
|
4433
|
+
inMarket.mint,
|
|
4434
|
+
tokenProgram
|
|
4429
4435
|
)
|
|
4430
4436
|
);
|
|
4431
4437
|
}
|