@drift-labs/sdk 2.59.0-beta.3 → 2.59.0-beta.4

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 CHANGED
@@ -1 +1 @@
1
- 2.59.0-beta.3
1
+ 2.59.0-beta.4
@@ -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.max(this.maxFeeMicroLamports, this.lastHeliusSample[level]);
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.max(this.maxFeeMicroLamports, this.lastCustomStrategyResult);
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.max(this.maxFeeMicroLamports, this.lastAvgStrategyResult);
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.max(this.maxFeeMicroLamports, this.lastMaxStrategyResult);
110
+ return Math.min(this.maxFeeMicroLamports, this.lastMaxStrategyResult);
108
111
  }
109
112
  return this.lastMaxStrategyResult;
110
113
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drift-labs/sdk",
3
- "version": "2.59.0-beta.3",
3
+ "version": "2.59.0-beta.4",
4
4
  "main": "lib/index.js",
5
5
  "types": "lib/index.d.ts",
6
6
  "author": "crispheaney",
@@ -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.max(this.maxFeeMicroLamports, this.lastHeliusSample[level]);
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.max(this.maxFeeMicroLamports, this.lastCustomStrategyResult);
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.max(this.maxFeeMicroLamports, this.lastAvgStrategyResult);
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.max(this.maxFeeMicroLamports, this.lastMaxStrategyResult);
153
+ return Math.min(this.maxFeeMicroLamports, this.lastMaxStrategyResult);
150
154
  }
151
155
  return this.lastMaxStrategyResult;
152
156
  }