@drift-labs/sdk 2.112.0-beta.4 → 2.112.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/browser/driftClient.d.ts +2 -1
- package/lib/browser/driftClient.js +4 -0
- package/lib/browser/types.d.ts +5 -0
- package/lib/node/driftClient.d.ts +2 -1
- package/lib/node/driftClient.js +4 -0
- package/lib/node/types.d.ts +5 -0
- package/package.json +1 -1
- package/src/driftClient.ts +8 -0
- package/src/types.ts +6 -0
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.112.0-beta.
|
|
1
|
+
2.112.0-beta.5
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as anchor from '@coral-xyz/anchor';
|
|
6
6
|
import { AnchorProvider, BN, Program, ProgramAccount } from '@coral-xyz/anchor';
|
|
7
7
|
import { Idl as Idl30, Program as Program30 } from '@coral-xyz/anchor-30';
|
|
8
|
-
import { DriftClientMetricsEvents, HighLeverageModeConfig, IWallet, MakerInfo, MappedRecord, MarketType, ModifyOrderPolicy, OpenbookV2FulfillmentConfigAccount, OptionalOrderParams, OracleSource, Order, OrderParams, OrderTriggerCondition, PerpMarketAccount, PerpMarketExtendedInfo, PhoenixV1FulfillmentConfigAccount, PlaceAndTakeOrderSuccessCondition, PositionDirection, ReferrerInfo, ReferrerNameAccount, SerumV3FulfillmentConfigAccount, SettlePnlMode, SignedTxData, SpotMarketAccount, SpotPosition, StateAccount, SwapReduceOnly, SignedMsgOrderParamsMessage, TakerInfo, TxParams, UserAccount, UserStatsAccount } from './types';
|
|
8
|
+
import { DriftClientMetricsEvents, HighLeverageModeConfig, IWallet, MakerInfo, MappedRecord, MarketType, ModifyOrderPolicy, OpenbookV2FulfillmentConfigAccount, OptionalOrderParams, OracleSource, Order, OrderParams, OrderTriggerCondition, PerpMarketAccount, PerpMarketExtendedInfo, PhoenixV1FulfillmentConfigAccount, PlaceAndTakeOrderSuccessCondition, PositionDirection, ReferrerInfo, ReferrerNameAccount, SerumV3FulfillmentConfigAccount, SettlePnlMode, SignedTxData, SpotMarketAccount, SpotPosition, StateAccount, SwapReduceOnly, SignedMsgOrderParamsMessage, TakerInfo, TxParams, UserAccount, UserStatsAccount, ProtectedMakerModeConfig } from './types';
|
|
9
9
|
import { AccountMeta, AddressLookupTableAccount, BlockhashWithExpiryBlockHeight, ConfirmOptions, Connection, Keypair, PublicKey, Signer, Transaction, TransactionInstruction, TransactionSignature, TransactionVersion, VersionedTransaction } from '@solana/web3.js';
|
|
10
10
|
import { TokenFaucet } from './tokenFaucet';
|
|
11
11
|
import { EventEmitter } from 'events';
|
|
@@ -915,6 +915,7 @@ export declare class DriftClient {
|
|
|
915
915
|
disableUserHighLeverageMode(user: PublicKey, userAccount?: UserAccount, txParams?: TxParams): Promise<TransactionSignature>;
|
|
916
916
|
getDisableHighLeverageModeIx(user: PublicKey, userAccount?: UserAccount): Promise<TransactionInstruction>;
|
|
917
917
|
fetchHighLeverageModeConfig(): Promise<HighLeverageModeConfig>;
|
|
918
|
+
fetchProtectedMakerModeConfig(): Promise<ProtectedMakerModeConfig>;
|
|
918
919
|
updateUserProtectedMakerOrders(subAccountId: number, protectedOrders: boolean, authority?: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
|
|
919
920
|
getUpdateUserProtectedMakerOrdersIx(subAccountId: number, protectedOrders: boolean, authority?: PublicKey): Promise<TransactionInstruction>;
|
|
920
921
|
getPauseSpotMarketDepositWithdrawIx(spotMarketIndex: number): Promise<TransactionInstruction>;
|
|
@@ -4898,6 +4898,10 @@ class DriftClient {
|
|
|
4898
4898
|
const config = await this.program.account.highLeverageModeConfig.fetch((0, pda_1.getHighLeverageModeConfigPublicKey)(this.program.programId));
|
|
4899
4899
|
return config;
|
|
4900
4900
|
}
|
|
4901
|
+
async fetchProtectedMakerModeConfig() {
|
|
4902
|
+
const config = await this.program.account.protectedMakerModeConfig.fetch((0, pda_1.getProtectedMakerModeConfigPublicKey)(this.program.programId));
|
|
4903
|
+
return config;
|
|
4904
|
+
}
|
|
4901
4905
|
async updateUserProtectedMakerOrders(subAccountId, protectedOrders, authority, txParams) {
|
|
4902
4906
|
const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getUpdateUserProtectedMakerOrdersIx(subAccountId, protectedOrders, authority), txParams), [], this.opts);
|
|
4903
4907
|
return txSig;
|
package/lib/browser/types.d.ts
CHANGED
|
@@ -1417,6 +1417,11 @@ export type HighLeverageModeConfig = {
|
|
|
1417
1417
|
currentUsers: number;
|
|
1418
1418
|
reduceOnly: boolean;
|
|
1419
1419
|
};
|
|
1420
|
+
export type ProtectedMakerModeConfig = {
|
|
1421
|
+
maxUsers: number;
|
|
1422
|
+
currentUsers: number;
|
|
1423
|
+
reduceOnly: boolean;
|
|
1424
|
+
};
|
|
1420
1425
|
export interface SignedMsgOrderParams {
|
|
1421
1426
|
/**
|
|
1422
1427
|
* The encoded order params that were signed (borsh encoded then hexified).
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
import * as anchor from '@coral-xyz/anchor';
|
|
6
6
|
import { AnchorProvider, BN, Program, ProgramAccount } from '@coral-xyz/anchor';
|
|
7
7
|
import { Idl as Idl30, Program as Program30 } from '@coral-xyz/anchor-30';
|
|
8
|
-
import { DriftClientMetricsEvents, HighLeverageModeConfig, IWallet, MakerInfo, MappedRecord, MarketType, ModifyOrderPolicy, OpenbookV2FulfillmentConfigAccount, OptionalOrderParams, OracleSource, Order, OrderParams, OrderTriggerCondition, PerpMarketAccount, PerpMarketExtendedInfo, PhoenixV1FulfillmentConfigAccount, PlaceAndTakeOrderSuccessCondition, PositionDirection, ReferrerInfo, ReferrerNameAccount, SerumV3FulfillmentConfigAccount, SettlePnlMode, SignedTxData, SpotMarketAccount, SpotPosition, StateAccount, SwapReduceOnly, SignedMsgOrderParamsMessage, TakerInfo, TxParams, UserAccount, UserStatsAccount } from './types';
|
|
8
|
+
import { DriftClientMetricsEvents, HighLeverageModeConfig, IWallet, MakerInfo, MappedRecord, MarketType, ModifyOrderPolicy, OpenbookV2FulfillmentConfigAccount, OptionalOrderParams, OracleSource, Order, OrderParams, OrderTriggerCondition, PerpMarketAccount, PerpMarketExtendedInfo, PhoenixV1FulfillmentConfigAccount, PlaceAndTakeOrderSuccessCondition, PositionDirection, ReferrerInfo, ReferrerNameAccount, SerumV3FulfillmentConfigAccount, SettlePnlMode, SignedTxData, SpotMarketAccount, SpotPosition, StateAccount, SwapReduceOnly, SignedMsgOrderParamsMessage, TakerInfo, TxParams, UserAccount, UserStatsAccount, ProtectedMakerModeConfig } from './types';
|
|
9
9
|
import { AccountMeta, AddressLookupTableAccount, BlockhashWithExpiryBlockHeight, ConfirmOptions, Connection, Keypair, PublicKey, Signer, Transaction, TransactionInstruction, TransactionSignature, TransactionVersion, VersionedTransaction } from '@solana/web3.js';
|
|
10
10
|
import { TokenFaucet } from './tokenFaucet';
|
|
11
11
|
import { EventEmitter } from 'events';
|
|
@@ -915,6 +915,7 @@ export declare class DriftClient {
|
|
|
915
915
|
disableUserHighLeverageMode(user: PublicKey, userAccount?: UserAccount, txParams?: TxParams): Promise<TransactionSignature>;
|
|
916
916
|
getDisableHighLeverageModeIx(user: PublicKey, userAccount?: UserAccount): Promise<TransactionInstruction>;
|
|
917
917
|
fetchHighLeverageModeConfig(): Promise<HighLeverageModeConfig>;
|
|
918
|
+
fetchProtectedMakerModeConfig(): Promise<ProtectedMakerModeConfig>;
|
|
918
919
|
updateUserProtectedMakerOrders(subAccountId: number, protectedOrders: boolean, authority?: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
|
|
919
920
|
getUpdateUserProtectedMakerOrdersIx(subAccountId: number, protectedOrders: boolean, authority?: PublicKey): Promise<TransactionInstruction>;
|
|
920
921
|
getPauseSpotMarketDepositWithdrawIx(spotMarketIndex: number): Promise<TransactionInstruction>;
|
package/lib/node/driftClient.js
CHANGED
|
@@ -4898,6 +4898,10 @@ class DriftClient {
|
|
|
4898
4898
|
const config = await this.program.account.highLeverageModeConfig.fetch((0, pda_1.getHighLeverageModeConfigPublicKey)(this.program.programId));
|
|
4899
4899
|
return config;
|
|
4900
4900
|
}
|
|
4901
|
+
async fetchProtectedMakerModeConfig() {
|
|
4902
|
+
const config = await this.program.account.protectedMakerModeConfig.fetch((0, pda_1.getProtectedMakerModeConfigPublicKey)(this.program.programId));
|
|
4903
|
+
return config;
|
|
4904
|
+
}
|
|
4901
4905
|
async updateUserProtectedMakerOrders(subAccountId, protectedOrders, authority, txParams) {
|
|
4902
4906
|
const { txSig } = await this.sendTransaction(await this.buildTransaction(await this.getUpdateUserProtectedMakerOrdersIx(subAccountId, protectedOrders, authority), txParams), [], this.opts);
|
|
4903
4907
|
return txSig;
|
package/lib/node/types.d.ts
CHANGED
|
@@ -1417,6 +1417,11 @@ export type HighLeverageModeConfig = {
|
|
|
1417
1417
|
currentUsers: number;
|
|
1418
1418
|
reduceOnly: boolean;
|
|
1419
1419
|
};
|
|
1420
|
+
export type ProtectedMakerModeConfig = {
|
|
1421
|
+
maxUsers: number;
|
|
1422
|
+
currentUsers: number;
|
|
1423
|
+
reduceOnly: boolean;
|
|
1424
|
+
};
|
|
1420
1425
|
export interface SignedMsgOrderParams {
|
|
1421
1426
|
/**
|
|
1422
1427
|
* The encoded order params that were signed (borsh encoded then hexified).
|
package/package.json
CHANGED
package/src/driftClient.ts
CHANGED
|
@@ -56,6 +56,7 @@ import {
|
|
|
56
56
|
TxParams,
|
|
57
57
|
UserAccount,
|
|
58
58
|
UserStatsAccount,
|
|
59
|
+
ProtectedMakerModeConfig,
|
|
59
60
|
} from './types';
|
|
60
61
|
import driftIDL from './idl/drift.json';
|
|
61
62
|
|
|
@@ -9339,6 +9340,13 @@ export class DriftClient {
|
|
|
9339
9340
|
return config as HighLeverageModeConfig;
|
|
9340
9341
|
}
|
|
9341
9342
|
|
|
9343
|
+
public async fetchProtectedMakerModeConfig(): Promise<ProtectedMakerModeConfig> {
|
|
9344
|
+
const config = await this.program.account.protectedMakerModeConfig.fetch(
|
|
9345
|
+
getProtectedMakerModeConfigPublicKey(this.program.programId)
|
|
9346
|
+
);
|
|
9347
|
+
return config as ProtectedMakerModeConfig;
|
|
9348
|
+
}
|
|
9349
|
+
|
|
9342
9350
|
public async updateUserProtectedMakerOrders(
|
|
9343
9351
|
subAccountId: number,
|
|
9344
9352
|
protectedOrders: boolean,
|
package/src/types.ts
CHANGED
|
@@ -1413,6 +1413,12 @@ export type HighLeverageModeConfig = {
|
|
|
1413
1413
|
reduceOnly: boolean;
|
|
1414
1414
|
};
|
|
1415
1415
|
|
|
1416
|
+
export type ProtectedMakerModeConfig = {
|
|
1417
|
+
maxUsers: number;
|
|
1418
|
+
currentUsers: number;
|
|
1419
|
+
reduceOnly: boolean;
|
|
1420
|
+
};
|
|
1421
|
+
|
|
1416
1422
|
/* Represents proof of a signed msg taker order
|
|
1417
1423
|
* It can be provided to drift program to fill a signed msg order
|
|
1418
1424
|
*/
|