@drift-labs/sdk 2.152.0-beta.2 → 2.153.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/build-browser.js +58 -0
- package/bun.lock +182 -1
- package/esbuild-shims.js +12 -0
- package/lib/browser/constants/perpMarkets.js +12 -0
- package/lib/browser/constants/txConstants.d.ts +1 -0
- package/lib/browser/constants/txConstants.js +2 -1
- package/lib/browser/driftClient.d.ts +13 -6
- package/lib/browser/driftClient.js +280 -36
- package/lib/browser/idl/drift.json +207 -18
- package/lib/browser/markets.d.ts +5 -0
- package/lib/browser/markets.js +16 -0
- package/lib/browser/swap/UnifiedSwapClient.js +2 -0
- package/lib/browser/titan/titanClient.d.ts +3 -0
- package/lib/browser/titan/titanClient.js +58 -60
- package/lib/browser/user.d.ts +1 -1
- package/lib/node/constants/perpMarkets.d.ts.map +1 -1
- package/lib/node/constants/perpMarkets.js +12 -0
- package/lib/node/constants/txConstants.d.ts +1 -0
- package/lib/node/constants/txConstants.d.ts.map +1 -1
- package/lib/node/constants/txConstants.js +2 -1
- package/lib/node/driftClient.d.ts +13 -6
- package/lib/node/driftClient.d.ts.map +1 -1
- package/lib/node/driftClient.js +280 -36
- package/lib/node/idl/drift.json +207 -18
- package/lib/node/markets.d.ts +6 -0
- package/lib/node/markets.d.ts.map +1 -0
- package/lib/node/markets.js +16 -0
- package/lib/node/swap/UnifiedSwapClient.d.ts.map +1 -1
- package/lib/node/swap/UnifiedSwapClient.js +2 -0
- package/lib/node/titan/titanClient.d.ts +3 -0
- package/lib/node/titan/titanClient.d.ts.map +1 -1
- package/lib/node/titan/titanClient.js +58 -60
- package/lib/node/user.d.ts +1 -1
- package/lib/node/user.d.ts.map +1 -1
- package/package.json +10 -2
- package/src/constants/perpMarkets.ts +13 -0
- package/src/constants/txConstants.ts +2 -0
- package/src/driftClient.ts +477 -52
- package/src/idl/drift.json +207 -18
- package/src/markets.ts +24 -0
- package/src/swap/UnifiedSwapClient.ts +2 -0
- package/src/titan/titanClient.ts +88 -72
- package/src/user.ts +1 -1
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.FUEL_RESET_LOG_ACCOUNT = exports.NOT_CONFIRMED_ERROR_CODE = void 0;
|
|
3
|
+
exports.DEFAULT_COMMITMENT_LEVEL = exports.FUEL_RESET_LOG_ACCOUNT = exports.NOT_CONFIRMED_ERROR_CODE = void 0;
|
|
4
4
|
const web3_js_1 = require("@solana/web3.js");
|
|
5
5
|
exports.NOT_CONFIRMED_ERROR_CODE = -1001;
|
|
6
6
|
exports.FUEL_RESET_LOG_ACCOUNT = new web3_js_1.PublicKey('FuE1gqp2fzw2sDNLrbZqKsqpphJcoSW6HPaSJjGd4RZ4');
|
|
7
|
+
exports.DEFAULT_COMMITMENT_LEVEL = 'confirmed';
|
|
@@ -306,6 +306,7 @@ export declare class DriftClient {
|
|
|
306
306
|
getUserAccountAndSlot(subAccountId?: number, authority?: PublicKey): DataAndSlot<UserAccount> | undefined;
|
|
307
307
|
getSpotPosition(marketIndex: number, subAccountId?: number): SpotPosition | undefined;
|
|
308
308
|
getQuoteAssetTokenAmount(): BN;
|
|
309
|
+
getIsolatedPerpPositionTokenAmount(perpMarketIndex: number, subAccountId?: number): BN;
|
|
309
310
|
/**
|
|
310
311
|
* Returns the token amount for a given market. The spot market precision is based on the token mint decimals.
|
|
311
312
|
* Positive if it is a deposit, negative if it is a borrow.
|
|
@@ -450,6 +451,12 @@ export declare class DriftClient {
|
|
|
450
451
|
getTransferPoolsIx(depositFromMarketIndex: number, depositToMarketIndex: number, borrowFromMarketIndex: number, borrowToMarketIndex: number, depositAmount: BN | undefined, borrowAmount: BN | undefined, fromSubAccountId: number, toSubAccountId: number, isToNewSubAccount?: boolean): Promise<TransactionInstruction>;
|
|
451
452
|
transferPerpPosition(fromSubAccountId: number, toSubAccountId: number, marketIndex: number, amount: BN, txParams?: TxParams): Promise<TransactionSignature>;
|
|
452
453
|
getTransferPerpPositionIx(fromSubAccountId: number, toSubAccountId: number, marketIndex: number, amount: BN): Promise<TransactionInstruction>;
|
|
454
|
+
depositIntoIsolatedPerpPosition(amount: BN, perpMarketIndex: number, userTokenAccount: PublicKey, subAccountId?: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
455
|
+
getDepositIntoIsolatedPerpPositionIx(amount: BN, perpMarketIndex: number, userTokenAccount: PublicKey, subAccountId?: number): Promise<TransactionInstruction>;
|
|
456
|
+
transferIsolatedPerpPositionDeposit(amount: BN, perpMarketIndex: number, subAccountId?: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
457
|
+
getTransferIsolatedPerpPositionDepositIx(amount: BN, perpMarketIndex: number, subAccountId?: number): Promise<TransactionInstruction>;
|
|
458
|
+
withdrawFromIsolatedPerpPosition(amount: BN, perpMarketIndex: number, userTokenAccount: PublicKey, subAccountId?: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
459
|
+
getWithdrawFromIsolatedPerpPositionIx(amount: BN, perpMarketIndex: number, userTokenAccount: PublicKey, subAccountId?: number): Promise<TransactionInstruction>;
|
|
453
460
|
updateSpotMarketCumulativeInterest(marketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
454
461
|
updateSpotMarketCumulativeInterestIx(marketIndex: number): Promise<TransactionInstruction>;
|
|
455
462
|
settleLP(settleeUserAccountPublicKey: PublicKey, marketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
@@ -991,9 +998,9 @@ export declare class DriftClient {
|
|
|
991
998
|
settleFundingPayment(userAccountPublicKey: PublicKey, txParams?: TxParams): Promise<TransactionSignature>;
|
|
992
999
|
getSettleFundingPaymentIx(userAccountPublicKey: PublicKey): Promise<TransactionInstruction>;
|
|
993
1000
|
triggerEvent(eventName: keyof DriftClientAccountEvents, data?: any): void;
|
|
994
|
-
getOracleDataForPerpMarket(marketIndex: number): OraclePriceData;
|
|
995
|
-
getMMOracleDataForPerpMarket(marketIndex: number): MMOraclePriceData;
|
|
996
|
-
getOracleDataForSpotMarket(marketIndex: number): OraclePriceData;
|
|
1001
|
+
getOracleDataForPerpMarket(marketIndex: number): OraclePriceData | undefined;
|
|
1002
|
+
getMMOracleDataForPerpMarket(marketIndex: number): MMOraclePriceData | undefined;
|
|
1003
|
+
getOracleDataForSpotMarket(marketIndex: number): OraclePriceData | undefined;
|
|
997
1004
|
initializeInsuranceFundStake(marketIndex: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
998
1005
|
getInitializeInsuranceFundStakeIx(marketIndex: number): Promise<TransactionInstruction>;
|
|
999
1006
|
getAddInsuranceFundStakeIx(marketIndex: number, amount: BN, collateralAccountPublicKey: PublicKey): Promise<TransactionInstruction>;
|
|
@@ -1062,7 +1069,7 @@ export declare class DriftClient {
|
|
|
1062
1069
|
* @returns
|
|
1063
1070
|
*/
|
|
1064
1071
|
depositIntoSpotMarketRevenuePool(marketIndex: number, amount: BN, userTokenAccountPublicKey: PublicKey): Promise<TransactionSignature>;
|
|
1065
|
-
getPerpMarketExtendedInfo(marketIndex: number): PerpMarketExtendedInfo;
|
|
1072
|
+
getPerpMarketExtendedInfo(marketIndex: number): PerpMarketExtendedInfo | undefined;
|
|
1066
1073
|
/**
|
|
1067
1074
|
* Calculates taker / maker fee (as a percentage, e.g. .001 = 10 basis points) for particular marketType
|
|
1068
1075
|
* @param marketType
|
|
@@ -1084,7 +1091,7 @@ export declare class DriftClient {
|
|
|
1084
1091
|
marketType: MarketType;
|
|
1085
1092
|
} | undefined;
|
|
1086
1093
|
getReceiverProgram(): Program<PythSolanaReceiver>;
|
|
1087
|
-
getSwitchboardOnDemandProgram(): Promise<Program30<Idl30
|
|
1094
|
+
getSwitchboardOnDemandProgram(): Promise<Program30<Idl30> | undefined>;
|
|
1088
1095
|
postPythPullOracleUpdateAtomic(vaaString: string, feedId: string): Promise<TransactionSignature>;
|
|
1089
1096
|
postMultiPythPullOracleUpdatesAtomic(vaaString: string, feedIds: string[]): Promise<TransactionSignature>;
|
|
1090
1097
|
getPostPythPullOracleUpdateAtomicIxs(vaaString: string, feedIds: string | string[], numSignatures?: number): Promise<TransactionInstruction[]>;
|
|
@@ -1100,7 +1107,7 @@ export declare class DriftClient {
|
|
|
1100
1107
|
getPostPythLazerOracleUpdateIxs(feedIds: number[], pythMessageHex: string, precedingIxs?: TransactionInstruction[], overrideCustomIxIndex?: number): Promise<TransactionInstruction[]>;
|
|
1101
1108
|
getPostManySwitchboardOnDemandUpdatesAtomicIxs(feeds: PublicKey[], recentSlothash?: Slothash, numSignatures?: number): Promise<TransactionInstruction[] | undefined>;
|
|
1102
1109
|
getPostSwitchboardOnDemandUpdateAtomicIx(feed: PublicKey, recentSlothash?: Slothash, numSignatures?: number): Promise<TransactionInstruction | undefined>;
|
|
1103
|
-
postSwitchboardOnDemandUpdate(feed: PublicKey, recentSlothash?: Slothash, numSignatures?: number): Promise<TransactionSignature>;
|
|
1110
|
+
postSwitchboardOnDemandUpdate(feed: PublicKey, recentSlothash?: Slothash, numSignatures?: number): Promise<TransactionSignature | undefined>;
|
|
1104
1111
|
private getBuildEncodedVaaIxs;
|
|
1105
1112
|
enableUserHighLeverageMode(subAccountId: number, txParams?: TxParams): Promise<TransactionSignature>;
|
|
1106
1113
|
getEnableHighLeverageModeIx(subAccountId: number, depositToTradeArgs?: {
|