From 13c8faa65dc75a14a6eb6b4dc8cfc677c3cb5c47 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 6 Mar 2026 15:11:53 -0800 Subject: drop abstract pool use --- bun.lock | 4 ++-- lib/nostr.ts | 16 ++-------------- package.json | 4 ++-- routes/nostr.ts | 4 +--- 4 files changed, 7 insertions(+), 21 deletions(-) diff --git a/bun.lock b/bun.lock index 3767c3e4..2ce179b9 100644 --- a/bun.lock +++ b/bun.lock @@ -27,7 +27,7 @@ "lnurl": "^0.27.0", "mqtt": "^5.15.0", "nostr": "^0.2.8", - "nostr-tools": "^2.23.1", + "nostr-tools": "^2.23.3", "otplib": "^12.0.1", "pino": "^10.3.1", "pino-pretty": "^13.1.3", @@ -838,7 +838,7 @@ "nostr": ["nostr@0.2.8", "", { "dependencies": { "noble-secp256k1": "^1.2.14", "ws": "^8.8.1" } }, "sha512-p25OQiEB5x8rWWoWLRRbxtxQiaQgypaQQakSKw5+cp/SW0DXea/soMzqmTXei1I6HrcARuyfvedGTdoEU471Ow=="], - "nostr-tools": ["nostr-tools@2.23.1", "", { "dependencies": { "@noble/ciphers": "2.1.1", "@noble/curves": "2.0.1", "@noble/hashes": "2.0.1", "@scure/base": "2.0.0", "@scure/bip32": "2.0.1", "@scure/bip39": "2.0.1", "nostr-wasm": "0.1.0" }, "peerDependencies": { "typescript": ">=5.0.0" }, "optionalPeers": ["typescript"] }, "sha512-Q5SJ1omrseBFXtLwqDhufpFLA6vX3rS/IuBCc974qaYX6YKGwEPxa/ZsyxruUOr+b+5EpWL2hFmCB5AueYrfBw=="], + "nostr-tools": ["nostr-tools@2.23.3", "", { "dependencies": { "@noble/ciphers": "2.1.1", "@noble/curves": "2.0.1", "@noble/hashes": "2.0.1", "@scure/base": "2.0.0", "@scure/bip32": "2.0.1", "@scure/bip39": "2.0.1", "nostr-wasm": "0.1.0" }, "peerDependencies": { "typescript": ">=5.0.0" }, "optionalPeers": ["typescript"] }, "sha512-AALyt9k8xPdF4UV2mlLJ2mgCn4kpTB0DZ8t2r6wjdUh6anfx2cTVBsHUlo9U0EY/cKC5wcNyiMAmRJV5OVEalA=="], "nostr-wasm": ["nostr-wasm@0.1.0", "", {}, "sha512-78BTryCLcLYv96ONU8Ws3Q1JzjlAt+43pWQhIl86xZmWeegYCNLPml7yQ+gG3vR6V5h4XGj+TxO+SS5dsThQIA=="], diff --git a/lib/nostr.ts b/lib/nostr.ts index e98e56a8..a2aee59b 100644 --- a/lib/nostr.ts +++ b/lib/nostr.ts @@ -6,7 +6,6 @@ import { fail, fields, getUser, pick } from "$lib/utils"; import { bytesToHex, hexToBytes } from "@noble/hashes/utils.js"; import { finalizeEvent, getPublicKey, nip19, verifyEvent } from "nostr-tools"; import type { Event } from "nostr-tools"; -import { AbstractSimplePool } from "nostr-tools/abstract-pool"; import { Relay } from "nostr-tools/relay"; export const EX = 60 * 60 * 24; @@ -19,12 +18,6 @@ export const serverSecret2 = bytesToHex(nip19.decode(config.nostrKey2).data as U export const serverPubkey = getPublicKey(hexToBytes(serverSecret)); export const serverPubkey2 = getPublicKey(hexToBytes(serverSecret2)); -const alwaysTrue: any = (t: Event) => { - t[Symbol("verified")] = true; - return true; -}; -export const pool = new (AbstractSimplePool as any)({ verifyEvent: alwaysTrue }); - export const anon = (pubkey) => ({ username: pubkey.substr(0, 6), pubkey, @@ -108,7 +101,7 @@ export async function handleZap(invoice, sender = undefined) { export const getRelays = async (pubkey): Promise => { const { relays } = config; const filter = { authors: [pubkey], kinds: [10002] }; - const result = await scan(filter); + const result = await q(filter); let read = relays; let write = relays; @@ -122,12 +115,7 @@ export const getRelays = async (pubkey): Promise => { if (!r[2] || r[2] === "write") write.push(r[1]); if (!r[2] || r[2] === "read") read.push(r[1]); } - } else - (pool as any) - .get(relays, filter) - // @ts-ignore - .then(send as any) - .catch(() => {}); + } return { read, write }; }; diff --git a/package.json b/package.json index d3e7dff2..7216f20a 100644 --- a/package.json +++ b/package.json @@ -24,16 +24,16 @@ "bech32": "^2.0.0", "clightning-client": "github:asoltys/lightning-client-js#master", "eventsource": "^4.1.0", - "hono": "^4.7.0", "file-type": "^21.3.0", "fluent-ffmpeg": "^2.1.3", "got": "^14.6.6", "handlebars": "^4.7.8", + "hono": "^4.7.0", "jsonwebtoken": "^9.0.3", "lnurl": "^0.27.0", "mqtt": "^5.15.0", "nostr": "^0.2.8", - "nostr-tools": "^2.23.1", + "nostr-tools": "^2.23.3", "otplib": "^12.0.1", "pino": "^10.3.1", "pino-pretty": "^13.1.3", diff --git a/routes/nostr.ts b/routes/nostr.ts index de6dac13..8e189f3d 100644 --- a/routes/nostr.ts +++ b/routes/nostr.ts @@ -1,4 +1,3 @@ -import config from "$config"; import { db, g } from "$lib/db"; import ln from "$lib/ln"; import { @@ -7,7 +6,6 @@ import { getCount, getNostrUser, getProfile, - pool, publish, q, serverPubkey, @@ -66,7 +64,7 @@ export default { const missing = pubkeys.filter((p) => !found.includes(p)); const missingProfiles = ( - await pool.querySync(config.relays, { + await q({ kinds: [0], authors: missing, }) -- cgit v1.2.3