refactor: stuff

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

View file

@ -441,17 +441,16 @@ const market = async () => {
await this.updateData(events)
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.isLoading = false
},
async poolSubscribe(since) {
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.poolSub.on(
this.pool
.sub(Array.from(this.relays), [{ kinds: [0, 5, 30017, 30018], authors, since }])
.on(
'event',
event => {
console.log('####### new event', event)
this.updateData([event])
},
{ id: 'masterSub' } //pass ID to cancel previous sub