Skip to content

Commit a74630c

Browse files
committed
Refactor NDKNutzapMonitor to simplify nutzap processing and add logging
1 parent d87d886 commit a74630c

File tree

1 file changed

+0
-17
lines changed

1 file changed

+0
-17
lines changed

ndk-wallet/src/nutzap-monitor/index.ts

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,6 @@ export class NDKNutzapMonitor extends EventEmitter<{
8080
*
8181
*/
8282
public async start(
83-
mintList?: NDKCashuMintList,
8483
initialSyncOpts: {
8584
knownNutzaps: Set<NDKEventId>,
8685
pageSize: number,
@@ -89,7 +88,6 @@ export class NDKNutzapMonitor extends EventEmitter<{
8988
pageSize: 5,
9089
}
9190
) {
92-
const authors = [this.user.pubkey];
9391
// if we are already running, stop the current subscription
9492
if (this.sub) this.sub.stop();
9593

@@ -98,19 +96,6 @@ export class NDKNutzapMonitor extends EventEmitter<{
9896
this.knownTokens.set(id, PROCESSING_STATUS.seen);
9997
}
10098
}
101-
102-
// if we don't have a mint list, we need to get one
103-
if (!mintList) {
104-
const list = await this.ndk.fetchEvent([
105-
{ kinds: [NDKKind.CashuMintList], authors },
106-
], { groupable: false, closeOnEose: true });
107-
if (!list) return false;
108-
109-
mintList = NDKCashuMintList.from(list);
110-
}
111-
112-
// set the relay set
113-
this.relaySet = mintList.relaySet;
11499

115100
await this.processNutzaps(initialSyncOpts.knownNutzaps, initialSyncOpts.pageSize);
116101
this.sub = this.ndk.subscribe(
@@ -164,7 +149,6 @@ export class NDKNutzapMonitor extends EventEmitter<{
164149
processedCount++;
165150
spentTokenCount = 0;
166151
} else if (result === false) {
167-
this.emit("spent", nutzap);
168152
spentTokenCount++;
169153
}
170154

@@ -211,7 +195,6 @@ export class NDKNutzapMonitor extends EventEmitter<{
211195
const amount = res.reduce((acc, proof) => acc + proof.amount, 0);
212196
this.emit("redeem", nutzap, amount);
213197
},
214-
215198
}
216199
);
217200

0 commit comments

Comments
 (0)