@drift-labs/sdk 2.59.0-beta.3 → 2.59.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/accounts/webSocketDriftClientAccountSubscriber.js +1 -1
- package/lib/priorityFee/priorityFeeSubscriber.d.ts +1 -0
- package/lib/priorityFee/priorityFeeSubscriber.js +7 -4
- package/package.json +1 -1
- package/src/accounts/webSocketDriftClientAccountSubscriber.ts +1 -1
- package/src/priorityFee/priorityFeeSubscriber.ts +8 -4
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.59.0-beta.
|
|
1
|
+
2.59.0-beta.5
|
|
@@ -45,7 +45,7 @@ class WebSocketDriftClientAccountSubscriber {
|
|
|
45
45
|
}
|
|
46
46
|
const statePublicKey = await (0, pda_1.getDriftStateAccountPublicKey)(this.program.programId);
|
|
47
47
|
// create and activate main state account subscription
|
|
48
|
-
this.stateAccountSubscriber = new webSocketAccountSubscriber_1.WebSocketAccountSubscriber('state', this.program, statePublicKey, undefined,
|
|
48
|
+
this.stateAccountSubscriber = new webSocketAccountSubscriber_1.WebSocketAccountSubscriber('state', this.program, statePublicKey, undefined, undefined, this.commitment);
|
|
49
49
|
await this.stateAccountSubscriber.subscribe((data) => {
|
|
50
50
|
this.eventEmitter.emit('stateAccountUpdate', data);
|
|
51
51
|
this.eventEmitter.emit('update');
|
|
@@ -25,6 +25,7 @@ export declare class PriorityFeeSubscriber {
|
|
|
25
25
|
subscribe(): Promise<void>;
|
|
26
26
|
private loadForSolana;
|
|
27
27
|
private loadForHelius;
|
|
28
|
+
getMaxPriorityFee(): number | undefined;
|
|
28
29
|
getHeliusPriorityFeeLevel(level?: HeliusPriorityLevel): number;
|
|
29
30
|
getCustomStrategyResult(): number;
|
|
30
31
|
getAvgStrategyResult(): number;
|
|
@@ -81,30 +81,33 @@ class PriorityFeeSubscriber {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
+
getMaxPriorityFee() {
|
|
85
|
+
return this.maxFeeMicroLamports;
|
|
86
|
+
}
|
|
84
87
|
getHeliusPriorityFeeLevel(level = heliusPriorityFeeMethod_1.HeliusPriorityLevel.MEDIUM) {
|
|
85
88
|
if (this.lastHeliusSample === undefined) {
|
|
86
89
|
return 0;
|
|
87
90
|
}
|
|
88
91
|
if (this.maxFeeMicroLamports !== undefined) {
|
|
89
|
-
return Math.
|
|
92
|
+
return Math.min(this.maxFeeMicroLamports, this.lastHeliusSample[level]);
|
|
90
93
|
}
|
|
91
94
|
return this.lastHeliusSample[level];
|
|
92
95
|
}
|
|
93
96
|
getCustomStrategyResult() {
|
|
94
97
|
if (this.maxFeeMicroLamports !== undefined) {
|
|
95
|
-
return Math.
|
|
98
|
+
return Math.min(this.maxFeeMicroLamports, this.lastCustomStrategyResult);
|
|
96
99
|
}
|
|
97
100
|
return this.lastCustomStrategyResult;
|
|
98
101
|
}
|
|
99
102
|
getAvgStrategyResult() {
|
|
100
103
|
if (this.maxFeeMicroLamports !== undefined) {
|
|
101
|
-
return Math.
|
|
104
|
+
return Math.min(this.maxFeeMicroLamports, this.lastAvgStrategyResult);
|
|
102
105
|
}
|
|
103
106
|
return this.lastAvgStrategyResult;
|
|
104
107
|
}
|
|
105
108
|
getMaxStrategyResult() {
|
|
106
109
|
if (this.maxFeeMicroLamports !== undefined) {
|
|
107
|
-
return Math.
|
|
110
|
+
return Math.min(this.maxFeeMicroLamports, this.lastMaxStrategyResult);
|
|
108
111
|
}
|
|
109
112
|
return this.lastMaxStrategyResult;
|
|
110
113
|
}
|
package/package.json
CHANGED
|
@@ -118,6 +118,10 @@ export class PriorityFeeSubscriber {
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
+
public getMaxPriorityFee(): number | undefined {
|
|
122
|
+
return this.maxFeeMicroLamports;
|
|
123
|
+
}
|
|
124
|
+
|
|
121
125
|
public getHeliusPriorityFeeLevel(
|
|
122
126
|
level: HeliusPriorityLevel = HeliusPriorityLevel.MEDIUM
|
|
123
127
|
): number {
|
|
@@ -125,28 +129,28 @@ export class PriorityFeeSubscriber {
|
|
|
125
129
|
return 0;
|
|
126
130
|
}
|
|
127
131
|
if (this.maxFeeMicroLamports !== undefined) {
|
|
128
|
-
return Math.
|
|
132
|
+
return Math.min(this.maxFeeMicroLamports, this.lastHeliusSample[level]);
|
|
129
133
|
}
|
|
130
134
|
return this.lastHeliusSample[level];
|
|
131
135
|
}
|
|
132
136
|
|
|
133
137
|
public getCustomStrategyResult(): number {
|
|
134
138
|
if (this.maxFeeMicroLamports !== undefined) {
|
|
135
|
-
return Math.
|
|
139
|
+
return Math.min(this.maxFeeMicroLamports, this.lastCustomStrategyResult);
|
|
136
140
|
}
|
|
137
141
|
return this.lastCustomStrategyResult;
|
|
138
142
|
}
|
|
139
143
|
|
|
140
144
|
public getAvgStrategyResult(): number {
|
|
141
145
|
if (this.maxFeeMicroLamports !== undefined) {
|
|
142
|
-
return Math.
|
|
146
|
+
return Math.min(this.maxFeeMicroLamports, this.lastAvgStrategyResult);
|
|
143
147
|
}
|
|
144
148
|
return this.lastAvgStrategyResult;
|
|
145
149
|
}
|
|
146
150
|
|
|
147
151
|
public getMaxStrategyResult(): number {
|
|
148
152
|
if (this.maxFeeMicroLamports !== undefined) {
|
|
149
|
-
return Math.
|
|
153
|
+
return Math.min(this.maxFeeMicroLamports, this.lastMaxStrategyResult);
|
|
150
154
|
}
|
|
151
155
|
return this.lastMaxStrategyResult;
|
|
152
156
|
}
|