Merge pull request #1635 from RoboSats/remove-expired-orders-with-nostr

Dynamically remove expired orders with nostr
This commit is contained in:
KoalaSat 2024-11-26 11:49:34 +00:00 committed by GitHub
commit cf260113ee
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -103,7 +103,21 @@ class RoboPool {
.map((f) => f.nostrHexPubkey)
.filter((item) => item !== undefined);
const request = ['REQ', 'subscribeBook', { authors, kinds: [38383], '#s': ['pending'] }];
const requestPending = [
'REQ',
'subscribeBookPending',
{ authors, kinds: [38383], '#s': ['pending'] },
];
const requestSuccess = [
'REQ',
'subscribeBookSuccess',
{
authors,
kinds: [38383],
'#s': ['success', 'canceled', 'in-progress'],
since: Math.floor(new Date().getTime() / 1000),
},
];
this.messageHandlers.push((_url: string, messageEvent: MessageEvent) => {
const jsonMessage = JSON.parse(messageEvent.data);
@ -113,7 +127,8 @@ class RoboPool {
events.oneose();
}
});
this.sendMessage(JSON.stringify(request));
this.sendMessage(JSON.stringify(requestPending));
this.sendMessage(JSON.stringify(requestSuccess));
};
}