refactor: stuff

This commit is contained in:
Vlad Stan 2023-07-19 14:34:37 +03:00
parent f41a502d3b
commit e1fd62400d

View file

@ -441,21 +441,20 @@ const market = async () => {
await this.updateData(events) await this.updateData(events)
const lastEvent = events.sort((a, b) => b.created_at - a.created_at)[0] const lastEvent = events.sort((a, b) => b.created_at - a.created_at)[0]
console.log('### since', lastEvent.created_at) // 1685456534, 1689758074
this.poolSubscribe(lastEvent.created_at) this.poolSubscribe(lastEvent.created_at)
this.isLoading = false this.isLoading = false
}, },
async poolSubscribe(since) { async poolSubscribe(since) {
const authors = this.merchants.map(m => m.publicKey) const authors = this.merchants.map(m => m.publicKey)
this.poolSub = this.pool.sub(Array.from(this.relays), [{ kinds: [0, 5, 30017, 30018], authors, since }]) this.pool
this.poolSub.on( .sub(Array.from(this.relays), [{ kinds: [0, 5, 30017, 30018], authors, since }])
'event', .on(
event => { 'event',
console.log('####### new event', event) event => {
this.updateData([event]) this.updateData([event])
}, },
{ id: 'masterSub' } //pass ID to cancel previous sub { id: 'masterSub' } //pass ID to cancel previous sub
) )
}, },
async checkMarketNaddr(naddr) { async checkMarketNaddr(naddr) {