aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-03-06 15:11:53 -0800
committerAdam Soltys <[email protected]>2026-03-06 15:11:53 -0800
commit13c8faa65dc75a14a6eb6b4dc8cfc677c3cb5c47 (patch)
treea9e5e3b36fa4a9b869e9b4458be44c1d9a5b78e8
parent770d3412e87e0ab981d61f2551ce0bd931b198f5 (diff)
downloadcoinos-server-13c8faa65dc75a14a6eb6b4dc8cfc677c3cb5c47.tar.gz
coinos-server-13c8faa65dc75a14a6eb6b4dc8cfc677c3cb5c47.zip
drop abstract pool use
-rw-r--r--bun.lock4
-rw-r--r--lib/nostr.ts16
-rw-r--r--package.json4
-rw-r--r--routes/nostr.ts4
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": ["[email protected]", "", { "dependencies": { "noble-secp256k1": "^1.2.14", "ws": "^8.8.1" } }, "sha512-p25OQiEB5x8rWWoWLRRbxtxQiaQgypaQQakSKw5+cp/SW0DXea/soMzqmTXei1I6HrcARuyfvedGTdoEU471Ow=="],
- "nostr-tools": ["[email protected]", "", { "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": ["[email protected]", "", { "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": ["[email protected]", "", {}, "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<any> => {
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<any> => {
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,
})