@drift-labs/sdk 0.2.0-temp.1 → 0.2.0-temp.2
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/lib/events/eventList.js
CHANGED
|
@@ -40,6 +40,9 @@ class EventList {
|
|
|
40
40
|
if (currentNode.next !== undefined) {
|
|
41
41
|
newNode.next.prev = newNode;
|
|
42
42
|
}
|
|
43
|
+
else {
|
|
44
|
+
this.tail = newNode;
|
|
45
|
+
}
|
|
43
46
|
currentNode.next = newNode;
|
|
44
47
|
newNode.prev = currentNode;
|
|
45
48
|
}
|
|
@@ -66,6 +69,13 @@ class EventList {
|
|
|
66
69
|
toArray() {
|
|
67
70
|
return Array.from(this);
|
|
68
71
|
}
|
|
72
|
+
countNode() {
|
|
73
|
+
let count = 0;
|
|
74
|
+
for (const _node of this) {
|
|
75
|
+
count++;
|
|
76
|
+
}
|
|
77
|
+
return count;
|
|
78
|
+
}
|
|
69
79
|
*[Symbol.iterator]() {
|
|
70
80
|
let node = this.head;
|
|
71
81
|
while (node) {
|
|
@@ -19,6 +19,8 @@ export declare class TxEventCache {
|
|
|
19
19
|
has(key: string): boolean;
|
|
20
20
|
get(key: string): WrappedEvent<EventType>[] | undefined;
|
|
21
21
|
detach(node: Node): void;
|
|
22
|
+
countNode(): number;
|
|
23
|
+
[Symbol.iterator](): Generator<WrappedEvent<keyof import("./types").EventMap>[], void, unknown>;
|
|
22
24
|
clear(): void;
|
|
23
25
|
}
|
|
24
26
|
export {};
|
|
@@ -61,6 +61,20 @@ class TxEventCache {
|
|
|
61
61
|
this.tail = node.prev;
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
|
+
countNode() {
|
|
65
|
+
let count = 0;
|
|
66
|
+
for (const _node of this) {
|
|
67
|
+
count++;
|
|
68
|
+
}
|
|
69
|
+
return count;
|
|
70
|
+
}
|
|
71
|
+
*[Symbol.iterator]() {
|
|
72
|
+
let node = this.head;
|
|
73
|
+
while (node) {
|
|
74
|
+
yield node.value;
|
|
75
|
+
node = node.next;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
64
78
|
clear() {
|
|
65
79
|
this.head = undefined;
|
|
66
80
|
this.tail = undefined;
|
package/package.json
CHANGED
package/src/events/eventList.ts
CHANGED
|
@@ -53,6 +53,8 @@ export class EventList<Type extends EventType> {
|
|
|
53
53
|
newNode.next = currentNode.next;
|
|
54
54
|
if (currentNode.next !== undefined) {
|
|
55
55
|
newNode.next.prev = newNode;
|
|
56
|
+
} else {
|
|
57
|
+
this.tail = newNode;
|
|
56
58
|
}
|
|
57
59
|
currentNode.next = newNode;
|
|
58
60
|
newNode.prev = currentNode;
|
|
@@ -84,6 +86,14 @@ export class EventList<Type extends EventType> {
|
|
|
84
86
|
return Array.from(this);
|
|
85
87
|
}
|
|
86
88
|
|
|
89
|
+
public countNode(): number {
|
|
90
|
+
let count = 0;
|
|
91
|
+
for (const _node of this) {
|
|
92
|
+
count++;
|
|
93
|
+
}
|
|
94
|
+
return count;
|
|
95
|
+
}
|
|
96
|
+
|
|
87
97
|
*[Symbol.iterator]() {
|
|
88
98
|
let node = this.head;
|
|
89
99
|
while (node) {
|
|
@@ -65,6 +65,22 @@ export class TxEventCache {
|
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
public countNode(): number {
|
|
69
|
+
let count = 0;
|
|
70
|
+
for (const _node of this) {
|
|
71
|
+
count++;
|
|
72
|
+
}
|
|
73
|
+
return count;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
*[Symbol.iterator]() {
|
|
77
|
+
let node = this.head;
|
|
78
|
+
while (node) {
|
|
79
|
+
yield node.value;
|
|
80
|
+
node = node.next;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
68
84
|
public clear(): void {
|
|
69
85
|
this.head = undefined;
|
|
70
86
|
this.tail = undefined;
|