Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

nostr-tools

Package Overview
Dependencies
Maintainers
1
Versions
151
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

nostr-tools - npm Package Compare versions

Comparing version 0.17.0 to 0.18.0

2

package.json
{
"name": "nostr-tools",
"version": "0.17.0",
"version": "0.18.0",
"description": "Tools for making a Nostr client.",

@@ -5,0 +5,0 @@ "repository": {

@@ -9,3 +9,7 @@ import {getEventHash, signEvent} from './event'

// set of relays only, instead of publishing to all relays all the time
randomChoice: null
randomChoice: null,
// setting this to true will cause .publish() calls to wait until the event has
// been published -- or at least attempted to be published -- to all relays
wait: false
}

@@ -115,3 +119,3 @@ const relays = {}

},
async publish(event, statusCallback = (status, relayURL) => {}) {
async publish(event, statusCallback) {
event.id = getEventHash(event)

@@ -141,24 +145,33 @@

for (let i = 0; i < writeable.length; i++) {
let {relay} = writeable[i]
if (poolPolicy.wait) {
for (let i = 0; i < writeable.length; i++) {
let {relay} = writeable[i]
try {
await new Promise(async (resolve, reject) => {
try {
await relay.publish(event, status => {
statusCallback(status, relay.url)
resolve()
})
} catch (err) {
statusCallback(-1, relay.url)
try {
await new Promise(async (resolve, reject) => {
try {
await relay.publish(event, status => {
if (statusCallback) statusCallback(status, relay.url)
resolve()
})
} catch (err) {
if (statusCallback) statusCallback(-1, relay.url)
}
})
successes++
if (successes >= maxTargets) {
break
}
})
successes++
if (successes >= maxTargets) {
break
} catch (err) {
/***/
}
} catch (err) {
/***/
}
} else {
writeable.forEach(async ({relay}) => {
let callback = statusCallback
? status => statusCallback(status, relay.url)
: null
relay.publish(event, callback)
})
}

@@ -165,0 +178,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc