@drift-labs/sdk 2.104.0-beta.33 → 2.104.0-beta.35
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/constants/spotMarkets.js +11 -0
- package/lib/browser/driftClient.d.ts +2 -2
- package/lib/browser/driftClient.js +4 -4
- package/lib/browser/util/TransactionConfirmationManager.d.ts +1 -1
- package/lib/browser/util/TransactionConfirmationManager.js +1 -1
- package/lib/node/constants/spotMarkets.js +11 -0
- package/lib/node/driftClient.d.ts +2 -2
- package/lib/node/driftClient.js +4 -4
- package/lib/node/util/TransactionConfirmationManager.d.ts +1 -1
- package/lib/node/util/TransactionConfirmationManager.js +1 -1
- package/package.json +1 -1
- package/src/constants/spotMarkets.ts +12 -0
- package/src/driftClient.ts +8 -2
- package/src/util/TransactionConfirmationManager.ts +1 -1
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.104.0-beta.
|
|
1
|
+
2.104.0-beta.35
|
|
@@ -475,6 +475,17 @@ exports.MainnetSpotMarkets = [
|
|
|
475
475
|
precisionExp: numericConstants_1.SIX,
|
|
476
476
|
pythFeedId: '0xbed3097008b9b5e3c93bec20be79cb43986b85a996475589351a21e67bae9b61',
|
|
477
477
|
},
|
|
478
|
+
{
|
|
479
|
+
symbol: 'BONK',
|
|
480
|
+
marketIndex: 32,
|
|
481
|
+
poolId: 0,
|
|
482
|
+
oracle: new web3_js_1.PublicKey('GojbSnJuPdKDT1ZuHuAM5t9oz6bxTo1xhUKpTua2F72p'),
|
|
483
|
+
oracleSource: __1.OracleSource.PYTH_PULL,
|
|
484
|
+
mint: new web3_js_1.PublicKey('DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263'),
|
|
485
|
+
precision: new __1.BN(10).pow(numericConstants_1.FIVE),
|
|
486
|
+
precisionExp: numericConstants_1.FIVE,
|
|
487
|
+
pythFeedId: '0x72b021217ca3fe68922a19aaf990109cb9d84e9ad004b4d2025ad6f529314419',
|
|
488
|
+
},
|
|
478
489
|
];
|
|
479
490
|
exports.SpotMarkets = {
|
|
480
491
|
devnet: exports.DevnetSpotMarkets,
|
|
@@ -831,8 +831,8 @@ export declare class DriftClient {
|
|
|
831
831
|
disableUserHighLeverageMode(user: PublicKey, userAccount?: UserAccount, txParams?: TxParams): Promise<TransactionSignature>;
|
|
832
832
|
getDisableHighLeverageModeIx(user: PublicKey, userAccount?: UserAccount): Promise<TransactionInstruction>;
|
|
833
833
|
fetchHighLeverageModeConfig(): Promise<HighLeverageModeConfig>;
|
|
834
|
-
updateUserProtectedMakerOrders(subAccountId: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
835
|
-
getUpdateUserProtectedMakerOrdersIx(subAccountId: number): Promise<TransactionInstruction>;
|
|
834
|
+
updateUserProtectedMakerOrders(subAccountId: number, protectedOrders: boolean, txParams?: TxParams): Promise<TransactionSignature>;
|
|
835
|
+
getUpdateUserProtectedMakerOrdersIx(subAccountId: number, protectedOrders: boolean): Promise<TransactionInstruction>;
|
|
836
836
|
private handleSignedTransaction;
|
|
837
837
|
private handlePreSignedTransaction;
|
|
838
838
|
private isVersionedTransaction;
|
|
@@ -4662,12 +4662,12 @@ class DriftClient {
|
|
|
4662
4662
|
const config = await this.program.account.highLeverageModeConfig.fetch((0, pda_1.getHighLeverageModeConfigPublicKey)(this.program.programId));
|
|
4663
4663
|
return config;
|
|
4664
4664
|
}
|
|
4665
|
-
async updateUserProtectedMakerOrders(subAccountId, txParams) {
|
|
4666
|
-
const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getUpdateUserProtectedMakerOrdersIx(subAccountId), txParams), [], this.opts);
|
|
4665
|
+
async updateUserProtectedMakerOrders(subAccountId, protectedOrders, txParams) {
|
|
4666
|
+
const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getUpdateUserProtectedMakerOrdersIx(subAccountId, protectedOrders), txParams), [], this.opts);
|
|
4667
4667
|
return txSig;
|
|
4668
4668
|
}
|
|
4669
|
-
async getUpdateUserProtectedMakerOrdersIx(subAccountId) {
|
|
4670
|
-
const ix = await this.program.instruction.updateUserProtectedMakerOrders(subAccountId, {
|
|
4669
|
+
async getUpdateUserProtectedMakerOrdersIx(subAccountId, protectedOrders) {
|
|
4670
|
+
const ix = await this.program.instruction.updateUserProtectedMakerOrders(subAccountId, protectedOrders, {
|
|
4671
4671
|
accounts: {
|
|
4672
4672
|
state: await this.getStatePublicKey(),
|
|
4673
4673
|
user: (0, pda_1.getUserAccountPublicKeySync)(this.program.programId, this.wallet.publicKey, subAccountId),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Connection, RpcResponseAndContext, SignatureResult, SignatureStatus, TransactionConfirmationStatus } from '@solana/web3.js';
|
|
2
2
|
/**
|
|
3
|
-
* Class to await for transaction confirmations in an optimised manner. It tracks a shared list of all pending transactions and fetches them in bulk in a shared RPC request whenever they have an "overlapping" polling interval. E.g. tx1 with an interval of 200ms and tx2 with an interval of 300ms (if sent at the same time) will be fetched together at
|
|
3
|
+
* Class to await for transaction confirmations in an optimised manner. It tracks a shared list of all pending transactions and fetches them in bulk in a shared RPC request whenever they have an "overlapping" polling interval. E.g. tx1 with an interval of 200ms and tx2 with an interval of 300ms (if sent at the same time) will be fetched together at 600ms, 1200ms, 1800ms, etc.
|
|
4
4
|
*/
|
|
5
5
|
export declare class TransactionConfirmationManager {
|
|
6
6
|
private connection;
|
|
@@ -12,7 +12,7 @@ const confirmationStatusValues = {
|
|
|
12
12
|
finalized: 2,
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
|
-
* Class to await for transaction confirmations in an optimised manner. It tracks a shared list of all pending transactions and fetches them in bulk in a shared RPC request whenever they have an "overlapping" polling interval. E.g. tx1 with an interval of 200ms and tx2 with an interval of 300ms (if sent at the same time) will be fetched together at
|
|
15
|
+
* Class to await for transaction confirmations in an optimised manner. It tracks a shared list of all pending transactions and fetches them in bulk in a shared RPC request whenever they have an "overlapping" polling interval. E.g. tx1 with an interval of 200ms and tx2 with an interval of 300ms (if sent at the same time) will be fetched together at 600ms, 1200ms, 1800ms, etc.
|
|
16
16
|
*/
|
|
17
17
|
class TransactionConfirmationManager {
|
|
18
18
|
constructor(connection) {
|
|
@@ -475,6 +475,17 @@ exports.MainnetSpotMarkets = [
|
|
|
475
475
|
precisionExp: numericConstants_1.SIX,
|
|
476
476
|
pythFeedId: '0xbed3097008b9b5e3c93bec20be79cb43986b85a996475589351a21e67bae9b61',
|
|
477
477
|
},
|
|
478
|
+
{
|
|
479
|
+
symbol: 'BONK',
|
|
480
|
+
marketIndex: 32,
|
|
481
|
+
poolId: 0,
|
|
482
|
+
oracle: new web3_js_1.PublicKey('GojbSnJuPdKDT1ZuHuAM5t9oz6bxTo1xhUKpTua2F72p'),
|
|
483
|
+
oracleSource: __1.OracleSource.PYTH_PULL,
|
|
484
|
+
mint: new web3_js_1.PublicKey('DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263'),
|
|
485
|
+
precision: new __1.BN(10).pow(numericConstants_1.FIVE),
|
|
486
|
+
precisionExp: numericConstants_1.FIVE,
|
|
487
|
+
pythFeedId: '0x72b021217ca3fe68922a19aaf990109cb9d84e9ad004b4d2025ad6f529314419',
|
|
488
|
+
},
|
|
478
489
|
];
|
|
479
490
|
exports.SpotMarkets = {
|
|
480
491
|
devnet: exports.DevnetSpotMarkets,
|
|
@@ -831,8 +831,8 @@ export declare class DriftClient {
|
|
|
831
831
|
disableUserHighLeverageMode(user: PublicKey, userAccount?: UserAccount, txParams?: TxParams): Promise<TransactionSignature>;
|
|
832
832
|
getDisableHighLeverageModeIx(user: PublicKey, userAccount?: UserAccount): Promise<TransactionInstruction>;
|
|
833
833
|
fetchHighLeverageModeConfig(): Promise<HighLeverageModeConfig>;
|
|
834
|
-
updateUserProtectedMakerOrders(subAccountId: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
835
|
-
getUpdateUserProtectedMakerOrdersIx(subAccountId: number): Promise<TransactionInstruction>;
|
|
834
|
+
updateUserProtectedMakerOrders(subAccountId: number, protectedOrders: boolean, txParams?: TxParams): Promise<TransactionSignature>;
|
|
835
|
+
getUpdateUserProtectedMakerOrdersIx(subAccountId: number, protectedOrders: boolean): Promise<TransactionInstruction>;
|
|
836
836
|
private handleSignedTransaction;
|
|
837
837
|
private handlePreSignedTransaction;
|
|
838
838
|
private isVersionedTransaction;
|
package/lib/node/driftClient.js
CHANGED
|
@@ -4662,12 +4662,12 @@ class DriftClient {
|
|
|
4662
4662
|
const config = await this.program.account.highLeverageModeConfig.fetch((0, pda_1.getHighLeverageModeConfigPublicKey)(this.program.programId));
|
|
4663
4663
|
return config;
|
|
4664
4664
|
}
|
|
4665
|
-
async updateUserProtectedMakerOrders(subAccountId, txParams) {
|
|
4666
|
-
const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getUpdateUserProtectedMakerOrdersIx(subAccountId), txParams), [], this.opts);
|
|
4665
|
+
async updateUserProtectedMakerOrders(subAccountId, protectedOrders, txParams) {
|
|
4666
|
+
const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getUpdateUserProtectedMakerOrdersIx(subAccountId, protectedOrders), txParams), [], this.opts);
|
|
4667
4667
|
return txSig;
|
|
4668
4668
|
}
|
|
4669
|
-
async getUpdateUserProtectedMakerOrdersIx(subAccountId) {
|
|
4670
|
-
const ix = await this.program.instruction.updateUserProtectedMakerOrders(subAccountId, {
|
|
4669
|
+
async getUpdateUserProtectedMakerOrdersIx(subAccountId, protectedOrders) {
|
|
4670
|
+
const ix = await this.program.instruction.updateUserProtectedMakerOrders(subAccountId, protectedOrders, {
|
|
4671
4671
|
accounts: {
|
|
4672
4672
|
state: await this.getStatePublicKey(),
|
|
4673
4673
|
user: (0, pda_1.getUserAccountPublicKeySync)(this.program.programId, this.wallet.publicKey, subAccountId),
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Connection, RpcResponseAndContext, SignatureResult, SignatureStatus, TransactionConfirmationStatus } from '@solana/web3.js';
|
|
2
2
|
/**
|
|
3
|
-
* Class to await for transaction confirmations in an optimised manner. It tracks a shared list of all pending transactions and fetches them in bulk in a shared RPC request whenever they have an "overlapping" polling interval. E.g. tx1 with an interval of 200ms and tx2 with an interval of 300ms (if sent at the same time) will be fetched together at
|
|
3
|
+
* Class to await for transaction confirmations in an optimised manner. It tracks a shared list of all pending transactions and fetches them in bulk in a shared RPC request whenever they have an "overlapping" polling interval. E.g. tx1 with an interval of 200ms and tx2 with an interval of 300ms (if sent at the same time) will be fetched together at 600ms, 1200ms, 1800ms, etc.
|
|
4
4
|
*/
|
|
5
5
|
export declare class TransactionConfirmationManager {
|
|
6
6
|
private connection;
|
|
@@ -12,7 +12,7 @@ const confirmationStatusValues = {
|
|
|
12
12
|
finalized: 2,
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
|
-
* Class to await for transaction confirmations in an optimised manner. It tracks a shared list of all pending transactions and fetches them in bulk in a shared RPC request whenever they have an "overlapping" polling interval. E.g. tx1 with an interval of 200ms and tx2 with an interval of 300ms (if sent at the same time) will be fetched together at
|
|
15
|
+
* Class to await for transaction confirmations in an optimised manner. It tracks a shared list of all pending transactions and fetches them in bulk in a shared RPC request whenever they have an "overlapping" polling interval. E.g. tx1 with an interval of 200ms and tx2 with an interval of 300ms (if sent at the same time) will be fetched together at 600ms, 1200ms, 1800ms, etc.
|
|
16
16
|
*/
|
|
17
17
|
class TransactionConfirmationManager {
|
|
18
18
|
constructor(connection) {
|
package/package.json
CHANGED
|
@@ -571,6 +571,18 @@ export const MainnetSpotMarkets: SpotMarketConfig[] = [
|
|
|
571
571
|
pythFeedId:
|
|
572
572
|
'0xbed3097008b9b5e3c93bec20be79cb43986b85a996475589351a21e67bae9b61',
|
|
573
573
|
},
|
|
574
|
+
{
|
|
575
|
+
symbol: 'BONK',
|
|
576
|
+
marketIndex: 32,
|
|
577
|
+
poolId: 0,
|
|
578
|
+
oracle: new PublicKey('GojbSnJuPdKDT1ZuHuAM5t9oz6bxTo1xhUKpTua2F72p'),
|
|
579
|
+
oracleSource: OracleSource.PYTH_PULL,
|
|
580
|
+
mint: new PublicKey('DezXAZ8z7PnrnRJjz3wXBoRgixCa6xjnB7YaB1pPB263'),
|
|
581
|
+
precision: new BN(10).pow(FIVE),
|
|
582
|
+
precisionExp: FIVE,
|
|
583
|
+
pythFeedId:
|
|
584
|
+
'0x72b021217ca3fe68922a19aaf990109cb9d84e9ad004b4d2025ad6f529314419',
|
|
585
|
+
},
|
|
574
586
|
];
|
|
575
587
|
|
|
576
588
|
export const SpotMarkets: { [key in DriftEnv]: SpotMarketConfig[] } = {
|
package/src/driftClient.ts
CHANGED
|
@@ -8850,11 +8850,15 @@ export class DriftClient {
|
|
|
8850
8850
|
|
|
8851
8851
|
public async updateUserProtectedMakerOrders(
|
|
8852
8852
|
subAccountId: number,
|
|
8853
|
+
protectedOrders: boolean,
|
|
8853
8854
|
txParams?: TxParams
|
|
8854
8855
|
): Promise<TransactionSignature> {
|
|
8855
8856
|
const { txSig } = await this.sendTransaction(
|
|
8856
8857
|
await this.buildTransaction(
|
|
8857
|
-
await this.getUpdateUserProtectedMakerOrdersIx(
|
|
8858
|
+
await this.getUpdateUserProtectedMakerOrdersIx(
|
|
8859
|
+
subAccountId,
|
|
8860
|
+
protectedOrders
|
|
8861
|
+
),
|
|
8858
8862
|
txParams
|
|
8859
8863
|
),
|
|
8860
8864
|
[],
|
|
@@ -8864,10 +8868,12 @@ export class DriftClient {
|
|
|
8864
8868
|
}
|
|
8865
8869
|
|
|
8866
8870
|
public async getUpdateUserProtectedMakerOrdersIx(
|
|
8867
|
-
subAccountId: number
|
|
8871
|
+
subAccountId: number,
|
|
8872
|
+
protectedOrders: boolean
|
|
8868
8873
|
): Promise<TransactionInstruction> {
|
|
8869
8874
|
const ix = await this.program.instruction.updateUserProtectedMakerOrders(
|
|
8870
8875
|
subAccountId,
|
|
8876
|
+
protectedOrders,
|
|
8871
8877
|
{
|
|
8872
8878
|
accounts: {
|
|
8873
8879
|
state: await this.getStatePublicKey(),
|
|
@@ -39,7 +39,7 @@ interface TransactionConfirmationRequest {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
/**
|
|
42
|
-
* Class to await for transaction confirmations in an optimised manner. It tracks a shared list of all pending transactions and fetches them in bulk in a shared RPC request whenever they have an "overlapping" polling interval. E.g. tx1 with an interval of 200ms and tx2 with an interval of 300ms (if sent at the same time) will be fetched together at
|
|
42
|
+
* Class to await for transaction confirmations in an optimised manner. It tracks a shared list of all pending transactions and fetches them in bulk in a shared RPC request whenever they have an "overlapping" polling interval. E.g. tx1 with an interval of 200ms and tx2 with an interval of 300ms (if sent at the same time) will be fetched together at 600ms, 1200ms, 1800ms, etc.
|
|
43
43
|
*/
|
|
44
44
|
export class TransactionConfirmationManager {
|
|
45
45
|
private connection: Connection;
|