@drift-labs/sdk 2.82.0-beta.1 → 2.82.0-beta.10
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/README.md +65 -47
- package/VERSION +1 -1
- package/lib/accounts/types.d.ts +4 -0
- package/lib/accounts/webSocketAccountSubscriber.d.ts +3 -3
- package/lib/accounts/webSocketAccountSubscriber.js +15 -8
- package/lib/accounts/webSocketDriftClientAccountSubscriber.d.ts +3 -3
- package/lib/accounts/webSocketDriftClientAccountSubscriber.js +5 -5
- package/lib/accounts/webSocketInsuranceFundStakeAccountSubscriber.d.ts +2 -2
- package/lib/accounts/webSocketInsuranceFundStakeAccountSubscriber.js +5 -3
- package/lib/accounts/webSocketProgramAccountSubscriber.d.ts +3 -3
- package/lib/accounts/webSocketProgramAccountSubscriber.js +15 -9
- package/lib/accounts/webSocketUserAccountSubscriber.d.ts +3 -3
- package/lib/accounts/webSocketUserAccountSubscriber.js +3 -3
- package/lib/accounts/webSocketUserStatsAccountSubsriber.d.ts +3 -3
- package/lib/accounts/webSocketUserStatsAccountSubsriber.js +3 -3
- package/lib/auctionSubscriber/auctionSubscriber.d.ts +2 -2
- package/lib/auctionSubscriber/auctionSubscriber.js +3 -3
- package/lib/auctionSubscriber/types.d.ts +1 -0
- package/lib/constants/perpMarkets.js +2 -2
- package/lib/driftClient.d.ts +12 -1
- package/lib/driftClient.js +59 -16
- package/lib/driftClientConfig.d.ts +1 -0
- package/lib/orderSubscriber/OrderSubscriber.js +6 -3
- package/lib/orderSubscriber/WebsocketSubscription.d.ts +4 -3
- package/lib/orderSubscriber/WebsocketSubscription.js +3 -3
- package/lib/orderSubscriber/types.d.ts +1 -0
- package/lib/priorityFee/driftPriorityFeeMethod.d.ts +13 -3
- package/lib/priorityFee/driftPriorityFeeMethod.js +2 -2
- package/lib/priorityFee/index.d.ts +2 -0
- package/lib/priorityFee/index.js +2 -0
- package/lib/priorityFee/priorityFeeSubscriber.d.ts +1 -4
- package/lib/priorityFee/priorityFeeSubscriber.js +5 -4
- package/lib/priorityFee/priorityFeeSubscriberMap.d.ts +48 -0
- package/lib/priorityFee/priorityFeeSubscriberMap.js +88 -0
- package/lib/priorityFee/types.d.ts +8 -3
- package/lib/priorityFee/types.js +2 -1
- package/lib/tx/baseTxSender.js +3 -2
- package/lib/tx/types.d.ts +5 -0
- package/lib/tx/types.js +12 -1
- package/lib/tx/utils.js +5 -1
- package/lib/user.d.ts +0 -10
- package/lib/user.js +6 -29
- package/lib/userConfig.d.ts +1 -0
- package/lib/userMap/WebsocketSubscription.d.ts +4 -3
- package/lib/userMap/WebsocketSubscription.js +3 -3
- package/lib/userMap/userMap.js +4 -1
- package/lib/userMap/userMapConfig.d.ts +1 -0
- package/lib/userStats.js +6 -3
- package/lib/userStatsConfig.d.ts +1 -0
- package/package.json +3 -3
- package/src/accounts/types.ts +5 -0
- package/src/accounts/webSocketAccountSubscriber.ts +34 -22
- package/src/accounts/webSocketDriftClientAccountSubscriber.ts +7 -6
- package/src/accounts/webSocketInsuranceFundStakeAccountSubscriber.ts +6 -4
- package/src/accounts/webSocketProgramAccountSubscriber.ts +32 -22
- package/src/accounts/webSocketUserAccountSubscriber.ts +5 -4
- package/src/accounts/webSocketUserStatsAccountSubsriber.ts +5 -4
- package/src/auctionSubscriber/auctionSubscriber.ts +10 -4
- package/src/auctionSubscriber/types.ts +1 -0
- package/src/blockhashSubscriber/types.ts +4 -0
- package/src/constants/perpMarkets.ts +2 -2
- package/src/driftClient.ts +70 -12
- package/src/driftClientConfig.ts +1 -0
- package/src/orderSubscriber/OrderSubscriber.ts +4 -1
- package/src/orderSubscriber/WebsocketSubscription.ts +6 -5
- package/src/orderSubscriber/types.ts +1 -0
- package/src/priorityFee/driftPriorityFeeMethod.ts +16 -4
- package/src/priorityFee/index.ts +2 -0
- package/src/priorityFee/priorityFeeSubscriber.ts +7 -7
- package/src/priorityFee/priorityFeeSubscriberMap.ts +112 -0
- package/src/priorityFee/types.ts +16 -3
- package/src/tx/baseTxSender.ts +8 -4
- package/src/tx/types.ts +12 -0
- package/src/tx/utils.ts +5 -1
- package/src/user.ts +7 -32
- package/src/userConfig.ts +1 -0
- package/src/userMap/WebsocketSubscription.ts +6 -5
- package/src/userMap/userMap.ts +4 -1
- package/src/userMap/userMapConfig.ts +1 -0
- package/src/userStats.ts +4 -1
- package/src/userStatsConfig.ts +1 -0
- package/tests/dlob/helpers.ts +4 -0
|
@@ -3,12 +3,13 @@ import { getNonIdleUserFilter, getUserFilter } from '../memcmp';
|
|
|
3
3
|
import { WebSocketProgramAccountSubscriber } from '../accounts/webSocketProgramAccountSubscriber';
|
|
4
4
|
import { UserAccount } from '../types';
|
|
5
5
|
import { Commitment, Context, PublicKey } from '@solana/web3.js';
|
|
6
|
+
import { ResubOpts } from '../accounts/types';
|
|
6
7
|
|
|
7
8
|
export class WebsocketSubscription {
|
|
8
9
|
private userMap: UserMap;
|
|
9
10
|
private commitment: Commitment;
|
|
10
11
|
private skipInitialLoad: boolean;
|
|
11
|
-
private
|
|
12
|
+
private resubOpts?: ResubOpts;
|
|
12
13
|
private includeIdle?: boolean;
|
|
13
14
|
private decodeFn: (name: string, data: Buffer) => UserAccount;
|
|
14
15
|
|
|
@@ -18,21 +19,21 @@ export class WebsocketSubscription {
|
|
|
18
19
|
userMap,
|
|
19
20
|
commitment,
|
|
20
21
|
skipInitialLoad = false,
|
|
21
|
-
|
|
22
|
+
resubOpts,
|
|
22
23
|
includeIdle = false,
|
|
23
24
|
decodeFn,
|
|
24
25
|
}: {
|
|
25
26
|
userMap: UserMap;
|
|
26
27
|
commitment: Commitment;
|
|
27
28
|
skipInitialLoad?: boolean;
|
|
28
|
-
|
|
29
|
+
resubOpts?: ResubOpts;
|
|
29
30
|
includeIdle?: boolean;
|
|
30
31
|
decodeFn: (name: string, data: Buffer) => UserAccount;
|
|
31
32
|
}) {
|
|
32
33
|
this.userMap = userMap;
|
|
33
34
|
this.commitment = commitment;
|
|
34
35
|
this.skipInitialLoad = skipInitialLoad;
|
|
35
|
-
this.
|
|
36
|
+
this.resubOpts = resubOpts;
|
|
36
37
|
this.includeIdle = includeIdle || false;
|
|
37
38
|
this.decodeFn = decodeFn;
|
|
38
39
|
}
|
|
@@ -52,7 +53,7 @@ export class WebsocketSubscription {
|
|
|
52
53
|
filters,
|
|
53
54
|
commitment: this.commitment,
|
|
54
55
|
},
|
|
55
|
-
this.
|
|
56
|
+
this.resubOpts
|
|
56
57
|
);
|
|
57
58
|
}
|
|
58
59
|
|
package/src/userMap/userMap.ts
CHANGED
|
@@ -124,7 +124,10 @@ export class UserMap implements UserMapInterface {
|
|
|
124
124
|
this.subscription = new WebsocketSubscription({
|
|
125
125
|
userMap: this,
|
|
126
126
|
commitment: this.commitment,
|
|
127
|
-
|
|
127
|
+
resubOpts: {
|
|
128
|
+
resubTimeoutMs: config.subscriptionConfig.resubTimeoutMs,
|
|
129
|
+
logResubMessages: config.subscriptionConfig.logResubMessages,
|
|
130
|
+
},
|
|
128
131
|
skipInitialLoad: config.skipInitialLoad,
|
|
129
132
|
decodeFn,
|
|
130
133
|
});
|
package/src/userStats.ts
CHANGED
|
@@ -29,7 +29,10 @@ export class UserStats {
|
|
|
29
29
|
this.accountSubscriber = new WebSocketUserStatsAccountSubscriber(
|
|
30
30
|
config.driftClient.program,
|
|
31
31
|
config.userStatsAccountPublicKey,
|
|
32
|
-
|
|
32
|
+
{
|
|
33
|
+
resubTimeoutMs: config.accountSubscription?.resubTimeoutMs,
|
|
34
|
+
logResubMessages: config.accountSubscription?.logResubMessages,
|
|
35
|
+
},
|
|
33
36
|
config.accountSubscription.commitment
|
|
34
37
|
);
|
|
35
38
|
} else {
|
package/src/userStatsConfig.ts
CHANGED
package/tests/dlob/helpers.ts
CHANGED
|
@@ -142,6 +142,10 @@ export const mockAMM: AMM = {
|
|
|
142
142
|
bidQuoteAssetReserve: new BN(0),
|
|
143
143
|
askBaseAssetReserve: new BN(0),
|
|
144
144
|
askQuoteAssetReserve: new BN(0),
|
|
145
|
+
|
|
146
|
+
netUnsettledFundingPnl: new BN(0),
|
|
147
|
+
quoteAssetAmountWithUnsettledLp: new BN(0),
|
|
148
|
+
referencePriceOffset: 0,
|
|
145
149
|
};
|
|
146
150
|
|
|
147
151
|
export const mockPerpMarkets: Array<PerpMarketAccount> = [
|