mirror of
https://github.com/dergigi/boris.git
synced 2026-01-02 06:24:20 +01:00
debug: log NIP-46 subscribe/publish traffic
- Wrap subscriptionMethod/publishMethod to log relays, filters, responses - Helps confirm decrypt/sign requests are actually sent and on which relays - Continue using applesauce-recommended binding pattern
This commit is contained in:
17
src/App.tsx
17
src/App.tsx
@@ -194,8 +194,21 @@ function App() {
|
||||
const pool = new RelayPool()
|
||||
|
||||
// Setup NostrConnectSigner to use the pool's methods (per applesauce examples)
|
||||
NostrConnectSigner.subscriptionMethod = pool.subscription.bind(pool)
|
||||
NostrConnectSigner.publishMethod = pool.publish.bind(pool)
|
||||
// Wrap with [bunker] logs for debugging NIP-46 traffic
|
||||
NostrConnectSigner.subscriptionMethod = (relays, filters) => {
|
||||
console.log('[bunker] NIP-46 subscribe', { relays, filters })
|
||||
return pool.subscription(relays, filters)
|
||||
}
|
||||
NostrConnectSigner.publishMethod = (relays, event) => {
|
||||
try {
|
||||
const size = JSON.stringify(event).length
|
||||
console.log('[bunker] NIP-46 publish', { relays, kind: event.kind, size })
|
||||
} catch {}
|
||||
return pool.publish(relays, event).then((resp) => {
|
||||
console.log('[bunker] NIP-46 publish responses', resp)
|
||||
return resp
|
||||
})
|
||||
}
|
||||
|
||||
pool.group(RELAYS)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user