@drift-labs/sdk 2.82.0-beta.19 → 2.82.0-beta.20
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/accounts/types.d.ts +0 -3
- package/lib/dlob/orderBookLevels.js +1 -0
- package/lib/driftClient.d.ts +11 -14
- package/lib/driftClient.js +157 -260
- package/lib/driftClientConfig.d.ts +2 -0
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/tx/baseTxSender.d.ts +8 -6
- package/lib/tx/baseTxSender.js +6 -49
- package/lib/tx/fastSingleTxSender.d.ts +6 -6
- package/lib/tx/fastSingleTxSender.js +3 -31
- package/lib/tx/forwardOnlyTxSender.d.ts +4 -2
- package/lib/tx/forwardOnlyTxSender.js +2 -1
- package/lib/tx/retryTxSender.d.ts +4 -2
- package/lib/tx/retryTxSender.js +2 -1
- package/lib/tx/txHandler.d.ts +138 -0
- package/lib/tx/txHandler.js +396 -0
- package/lib/tx/txParamProcessor.d.ts +6 -10
- package/lib/tx/txParamProcessor.js +13 -17
- package/lib/tx/types.d.ts +3 -7
- package/lib/tx/whileValidTxSender.d.ts +7 -6
- package/lib/tx/whileValidTxSender.js +7 -28
- package/lib/types.d.ts +13 -2
- package/lib/util/chainClock.d.ts +17 -0
- package/lib/util/chainClock.js +29 -0
- package/package.json +1 -1
- package/src/accounts/types.ts +0 -4
- package/src/dlob/orderBookLevels.ts +2 -0
- package/src/driftClient.ts +247 -385
- package/src/driftClientConfig.ts +2 -0
- package/src/index.ts +1 -0
- package/src/tx/baseTxSender.ts +21 -75
- package/src/tx/fastSingleTxSender.ts +10 -55
- package/src/tx/forwardOnlyTxSender.ts +5 -1
- package/src/tx/retryTxSender.ts +5 -1
- package/src/tx/txHandler.ts +625 -0
- package/src/tx/txParamProcessor.ts +16 -28
- package/src/tx/types.ts +2 -18
- package/src/tx/whileValidTxSender.ts +24 -48
- package/src/types.ts +15 -2
- package/src/util/chainClock.ts +41 -0
- package/lib/tx/utils.d.ts +0 -6
- package/lib/tx/utils.js +0 -43
- package/src/tx/utils.ts +0 -68
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.82.0-beta.
|
|
1
|
+
2.82.0-beta.20
|
package/lib/accounts/types.d.ts
CHANGED
|
@@ -29,9 +29,6 @@ export interface DriftClientAccountEvents {
|
|
|
29
29
|
update: void;
|
|
30
30
|
error: (e: Error) => void;
|
|
31
31
|
}
|
|
32
|
-
export interface DriftClientMetricsEvents {
|
|
33
|
-
txSigned: void;
|
|
34
|
-
}
|
|
35
32
|
export interface DriftClientAccountSubscriber {
|
|
36
33
|
eventEmitter: StrictEventEmitter<EventEmitter, DriftClientAccountEvents>;
|
|
37
34
|
isSubscribed: boolean;
|
package/lib/driftClient.d.ts
CHANGED
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
import { AnchorProvider, BN, Program, ProgramAccount } from '@coral-xyz/anchor';
|
|
4
4
|
import { StateAccount, IWallet, PositionDirection, UserAccount, PerpMarketAccount, OrderParams, Order, SpotMarketAccount, SpotPosition, MakerInfo, TakerInfo, OptionalOrderParams, ReferrerInfo, MarketType, TxParams, SerumV3FulfillmentConfigAccount, ReferrerNameAccount, OrderTriggerCondition, PerpMarketExtendedInfo, UserStatsAccount, PhoenixV1FulfillmentConfigAccount, ModifyOrderPolicy, SwapReduceOnly } from './types';
|
|
5
5
|
import * as anchor from '@coral-xyz/anchor';
|
|
6
|
-
import { Connection, PublicKey, TransactionSignature, ConfirmOptions, Transaction, TransactionInstruction, AccountMeta, Signer, AddressLookupTableAccount, TransactionVersion, VersionedTransaction } from '@solana/web3.js';
|
|
6
|
+
import { Connection, PublicKey, TransactionSignature, ConfirmOptions, Transaction, TransactionInstruction, AccountMeta, Signer, AddressLookupTableAccount, TransactionVersion, VersionedTransaction, BlockhashWithExpiryBlockHeight } from '@solana/web3.js';
|
|
7
7
|
import { TokenFaucet } from './tokenFaucet';
|
|
8
8
|
import { EventEmitter } from 'events';
|
|
9
9
|
import StrictEventEmitter from 'strict-event-emitter-types';
|
|
10
|
-
import { DriftClientAccountSubscriber, DriftClientAccountEvents, DataAndSlot
|
|
10
|
+
import { DriftClientAccountSubscriber, DriftClientAccountEvents, DataAndSlot } from './accounts/types';
|
|
11
|
+
import { DriftClientMetricsEvents } from './types';
|
|
11
12
|
import { TxSender, TxSigAndSlot } from './tx/types';
|
|
12
13
|
import { OraclePriceData } from './oracles/types';
|
|
13
14
|
import { DriftClientConfig } from './driftClientConfig';
|
|
@@ -16,6 +17,7 @@ import { UserSubscriptionConfig } from './userConfig';
|
|
|
16
17
|
import { UserStats } from './userStats';
|
|
17
18
|
import { JupiterClient, QuoteResponse, Route, SwapMode } from './jupiter/jupiterClient';
|
|
18
19
|
import { UserStatsSubscriptionConfig } from './userStatsConfig';
|
|
20
|
+
import { TxHandler } from './tx/txHandler';
|
|
19
21
|
type RemainingAccountParams = {
|
|
20
22
|
userAccounts: UserAccount[];
|
|
21
23
|
writablePerpMarketIndexes?: number[];
|
|
@@ -57,6 +59,7 @@ export declare class DriftClient {
|
|
|
57
59
|
txVersion: TransactionVersion;
|
|
58
60
|
txParams: TxParams;
|
|
59
61
|
enableMetricsEvents?: boolean;
|
|
62
|
+
txHandler: TxHandler;
|
|
60
63
|
get isSubscribed(): boolean;
|
|
61
64
|
set isSubscribed(val: boolean);
|
|
62
65
|
constructor(config: DriftClientConfig);
|
|
@@ -112,7 +115,6 @@ export declare class DriftClient {
|
|
|
112
115
|
* Adds and subscribes to users based on params set by the constructor or by updateWallet.
|
|
113
116
|
*/
|
|
114
117
|
addAndSubscribeToUsers(): Promise<boolean>;
|
|
115
|
-
private getProcessedTransactionParams;
|
|
116
118
|
initializeUserAccount(subAccountId?: number, name?: string, referrerInfo?: ReferrerInfo, txParams?: TxParams): Promise<[TransactionSignature, PublicKey]>;
|
|
117
119
|
getInitializeUserInstructions(subAccountId?: number, name?: string, referrerInfo?: ReferrerInfo): Promise<[PublicKey, TransactionInstruction]>;
|
|
118
120
|
getInitializeUserStatsIx(): Promise<TransactionInstruction>;
|
|
@@ -289,7 +291,7 @@ export declare class DriftClient {
|
|
|
289
291
|
* @deprecated use {@link placePerpOrder} or {@link placeAndTakePerpOrder} instead
|
|
290
292
|
*/
|
|
291
293
|
openPosition(direction: PositionDirection, amount: BN, marketIndex: number, limitPrice?: BN, subAccountId?: number): Promise<TransactionSignature>;
|
|
292
|
-
sendSignedTx(tx: Transaction): Promise<TransactionSignature>;
|
|
294
|
+
sendSignedTx(tx: Transaction, opts?: ConfirmOptions): Promise<TransactionSignature>;
|
|
293
295
|
/**
|
|
294
296
|
* Sends a market order and returns a signed tx which can fill the order against the vamm, which the caller can use to fill their own order if required.
|
|
295
297
|
* @param orderParams
|
|
@@ -680,15 +682,10 @@ export declare class DriftClient {
|
|
|
680
682
|
private handleSignedTransaction;
|
|
681
683
|
private isVersionedTransaction;
|
|
682
684
|
sendTransaction(tx: Transaction | VersionedTransaction, additionalSigners?: Array<Signer>, opts?: ConfirmOptions, preSigned?: boolean): Promise<TxSigAndSlot>;
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
* @param lookupTables
|
|
689
|
-
* @param forceVersionedTransaction Return a VersionedTransaction instance even if the version of the transaction is Legacy
|
|
690
|
-
* @returns
|
|
691
|
-
*/
|
|
692
|
-
buildTransaction(instructions: TransactionInstruction | TransactionInstruction[], txParams?: TxParams, txVersion?: TransactionVersion, lookupTables?: AddressLookupTableAccount[], forceVersionedTransaction?: boolean): Promise<Transaction | VersionedTransaction>;
|
|
685
|
+
buildTransaction(instructions: TransactionInstruction | TransactionInstruction[], txParams?: TxParams, txVersion?: TransactionVersion, lookupTables?: AddressLookupTableAccount[], forceVersionedTransaction?: boolean, recentBlockHash?: BlockhashWithExpiryBlockHeight): Promise<Transaction | VersionedTransaction>;
|
|
686
|
+
buildBulkTransactions(instructions: (TransactionInstruction | TransactionInstruction[])[], txParams?: TxParams, txVersion?: TransactionVersion, lookupTables?: AddressLookupTableAccount[], forceVersionedTransaction?: boolean): Promise<(Transaction | VersionedTransaction)[]>;
|
|
687
|
+
buildAndSignBulkTransactions(instructions: (TransactionInstruction | TransactionInstruction[])[], keys: string[], txParams?: TxParams, txVersion?: TransactionVersion, lookupTables?: AddressLookupTableAccount[], forceVersionedTransaction?: boolean): Promise<{
|
|
688
|
+
[key: string]: anchor.web3.Transaction | anchor.web3.VersionedTransaction;
|
|
689
|
+
}>;
|
|
693
690
|
}
|
|
694
691
|
export {};
|