mirror of
https://github.com/nbd-wtf/nostr-tools.git
synced 2025-12-11 01:28:51 +00:00
finish removing ramda.
This commit is contained in:
8
pool.js
8
pool.js
@@ -1,8 +1,6 @@
|
|||||||
import {getEventHash, signEvent} from './event'
|
import {getEventHash, signEvent} from './event'
|
||||||
import {relayConnect, normalizeRelayURL} from './relay'
|
import {relayConnect, normalizeRelayURL} from './relay'
|
||||||
|
|
||||||
const R = require('ramda')
|
|
||||||
|
|
||||||
export function relayPool(globalPrivateKey) {
|
export function relayPool(globalPrivateKey) {
|
||||||
const relays = {}
|
const relays = {}
|
||||||
const globalSub = []
|
const globalSub = []
|
||||||
@@ -101,7 +99,9 @@ export function relayPool(globalPrivateKey) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
await R.map(async relay => {
|
Object.values(relays)
|
||||||
|
.filter(({policy}) => policy.write)
|
||||||
|
.map(async ({relay}) => {
|
||||||
try {
|
try {
|
||||||
await relay.publish(event)
|
await relay.publish(event)
|
||||||
statusCallback(0, relay.url)
|
statusCallback(0, relay.url)
|
||||||
@@ -115,7 +115,7 @@ export function relayPool(globalPrivateKey) {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
statusCallback(-1, relay.url)
|
statusCallback(-1, relay.url)
|
||||||
}
|
}
|
||||||
}, R.filter(R.pipe(R.prop('policy'), R.prop('write'), R.equals(true)), relays))
|
})
|
||||||
|
|
||||||
return event
|
return event
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user