@drift-labs/sdk 2.53.0-beta.8 → 2.53.0-beta.9

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.
@@ -6,92 +6,90 @@ import { MaxOverSlotsStrategy } from '../../src/priorityFee/maxOverSlotsStrategy
6
6
  import { AverageOverSlotsStrategy } from '../../src/priorityFee/averageOverSlotsStrategy';
7
7
 
8
8
  describe('PriorityFeeStrategy', () => {
9
- it('AverageStrategy should calculate the average prioritization fee', () => {
10
- const averageStrategy = new AverageStrategy();
11
- const samples = [
12
- { slot: 3, prioritizationFee: 300 },
13
- { slot: 2, prioritizationFee: 200 },
14
- { slot: 1, prioritizationFee: 100 },
15
- ];
16
- const average = averageStrategy.calculate(samples);
17
- expect(average).to.equal(200);
18
- });
9
+ it('AverageStrategy should calculate the average prioritization fee', () => {
10
+ const averageStrategy = new AverageStrategy();
11
+ const samples = [
12
+ { slot: 3, prioritizationFee: 300 },
13
+ { slot: 2, prioritizationFee: 200 },
14
+ { slot: 1, prioritizationFee: 100 },
15
+ ];
16
+ const average = averageStrategy.calculate(samples);
17
+ expect(average).to.equal(200);
18
+ });
19
19
 
20
- it('MaxStrategy should calculate the maximum prioritization fee', () => {
21
- const maxStrategy = new MaxStrategy();
22
- const samples = [
23
- { slot: 3, prioritizationFee: 300 },
24
- { slot: 2, prioritizationFee: 200 },
25
- { slot: 1, prioritizationFee: 100 },
26
- ];
27
- const max = maxStrategy.calculate(samples);
28
- expect(max).to.equal(300);
29
- });
20
+ it('MaxStrategy should calculate the maximum prioritization fee', () => {
21
+ const maxStrategy = new MaxStrategy();
22
+ const samples = [
23
+ { slot: 3, prioritizationFee: 300 },
24
+ { slot: 2, prioritizationFee: 200 },
25
+ { slot: 1, prioritizationFee: 100 },
26
+ ];
27
+ const max = maxStrategy.calculate(samples);
28
+ expect(max).to.equal(300);
29
+ });
30
30
 
31
- it('EwmaStrategy should calculate the ewma prioritization fee', () => {
32
- // halflife of 5 alots
33
- const ewmaStrategy = new EwmaStrategy(5);
34
- const samples = [
35
- { slot: 6, prioritizationFee: 0 },
36
- { slot: 2, prioritizationFee: 0 },
37
- { slot: 2, prioritizationFee: 0 },
38
- { slot: 2, prioritizationFee: 0 },
39
- { slot: 2, prioritizationFee: 0 },
40
- { slot: 1, prioritizationFee: 1000 },
41
- ];
42
- const ewma = ewmaStrategy.calculate(samples);
43
- expect(ewma).to.be.approximately(500, 0.00001);
44
- });
31
+ it('EwmaStrategy should calculate the ewma prioritization fee', () => {
32
+ // halflife of 5 alots
33
+ const ewmaStrategy = new EwmaStrategy(5);
34
+ const samples = [
35
+ { slot: 6, prioritizationFee: 0 },
36
+ { slot: 2, prioritizationFee: 0 },
37
+ { slot: 2, prioritizationFee: 0 },
38
+ { slot: 2, prioritizationFee: 0 },
39
+ { slot: 2, prioritizationFee: 0 },
40
+ { slot: 1, prioritizationFee: 1000 },
41
+ ];
42
+ const ewma = ewmaStrategy.calculate(samples);
43
+ expect(ewma).to.be.approximately(500, 0.00001);
44
+ });
45
45
 
46
- it('EwmaStrategy should calculate the ewma prioritization fee, length 1', () => {
47
- // halflife of 5 alots
48
- const ewmaStrategy = new EwmaStrategy(5);
49
- const samples = [
50
- { slot: 6, prioritizationFee: 1000 },
51
- ];
52
- const ewma = ewmaStrategy.calculate(samples);
53
- expect(ewma).to.be.approximately(1000, 0.00001);
54
- });
46
+ it('EwmaStrategy should calculate the ewma prioritization fee, length 1', () => {
47
+ // halflife of 5 alots
48
+ const ewmaStrategy = new EwmaStrategy(5);
49
+ const samples = [{ slot: 6, prioritizationFee: 1000 }];
50
+ const ewma = ewmaStrategy.calculate(samples);
51
+ expect(ewma).to.be.approximately(1000, 0.00001);
52
+ });
55
53
 
56
- it('EwmaStrategy should calculate the ewma prioritization fee, length 6', () => {
57
- const ewmaStrategy = new EwmaStrategy(5);
58
- const samples = [
59
- { slot: 6, prioritizationFee: 1000 },
60
- { slot: 5, prioritizationFee: 570 },
61
- { slot: 4, prioritizationFee: 860 },
62
- { slot: 3, prioritizationFee: 530 },
63
- { slot: 2, prioritizationFee: 701 },
64
- { slot: 1, prioritizationFee: 230 },
65
- ];
66
- const ewma = ewmaStrategy.calculate(samples);
67
- expect(ewma).to.be.approximately(490.43706, 0.00001);
68
- });
54
+ it('EwmaStrategy should calculate the ewma prioritization fee, length 6', () => {
55
+ const ewmaStrategy = new EwmaStrategy(5);
56
+ const samples = [
57
+ { slot: 6, prioritizationFee: 1000 },
58
+ { slot: 5, prioritizationFee: 570 },
59
+ { slot: 4, prioritizationFee: 860 },
60
+ { slot: 3, prioritizationFee: 530 },
61
+ { slot: 2, prioritizationFee: 701 },
62
+ { slot: 1, prioritizationFee: 230 },
63
+ ];
64
+ const ewma = ewmaStrategy.calculate(samples);
65
+ expect(ewma).to.be.approximately(490.43706, 0.00001);
66
+ });
69
67
 
70
- it('MaxOverSlotsStrategy should calculate the max prioritization fee over slots', () => {
71
- const maxOverSlotsStrategy = new MaxOverSlotsStrategy(5);
72
- const samples = [
73
- { slot: 6, prioritizationFee: 432 },
74
- { slot: 3, prioritizationFee: 543 },
75
- { slot: 3, prioritizationFee: 342 },
76
- { slot: 3, prioritizationFee: 832 },
77
- { slot: 2, prioritizationFee: 123 },
78
- { slot: 1, prioritizationFee: 1000 },
79
- ];
80
- const maxOverSlots = maxOverSlotsStrategy.calculate(samples);
81
- expect(maxOverSlots).to.equal(832);
82
- });
68
+ it('MaxOverSlotsStrategy should calculate the max prioritization fee over slots', () => {
69
+ const maxOverSlotsStrategy = new MaxOverSlotsStrategy(5);
70
+ const samples = [
71
+ { slot: 6, prioritizationFee: 432 },
72
+ { slot: 3, prioritizationFee: 543 },
73
+ { slot: 3, prioritizationFee: 342 },
74
+ { slot: 3, prioritizationFee: 832 },
75
+ { slot: 2, prioritizationFee: 123 },
76
+ { slot: 1, prioritizationFee: 1000 },
77
+ ];
78
+ const maxOverSlots = maxOverSlotsStrategy.calculate(samples);
79
+ expect(maxOverSlots).to.equal(832);
80
+ });
83
81
 
84
- it('AverageOverSlotsStrategy should calculate the average prioritization fee over slots', () => {
85
- const averageOverSlotsStrategy = new AverageOverSlotsStrategy(5);
86
- const samples = [
87
- { slot: 6, prioritizationFee: 432 },
88
- { slot: 3, prioritizationFee: 543 },
89
- { slot: 3, prioritizationFee: 342 },
90
- { slot: 3, prioritizationFee: 832 },
91
- { slot: 2, prioritizationFee: 123 },
92
- { slot: 1, prioritizationFee: 1000 },
93
- ];
94
- const averageOverSlots = averageOverSlotsStrategy.calculate(samples);
95
- expect(averageOverSlots).to.equal(454.4);
96
- });
82
+ it('AverageOverSlotsStrategy should calculate the average prioritization fee over slots', () => {
83
+ const averageOverSlotsStrategy = new AverageOverSlotsStrategy(5);
84
+ const samples = [
85
+ { slot: 6, prioritizationFee: 432 },
86
+ { slot: 3, prioritizationFee: 543 },
87
+ { slot: 3, prioritizationFee: 342 },
88
+ { slot: 3, prioritizationFee: 832 },
89
+ { slot: 2, prioritizationFee: 123 },
90
+ { slot: 1, prioritizationFee: 1000 },
91
+ ];
92
+ const averageOverSlots = averageOverSlotsStrategy.calculate(samples);
93
+ expect(averageOverSlots).to.equal(454.4);
94
+ });
97
95
  });