broadcast method
NdkBroadcastResponse
broadcast({
- required Nip01Event nostrEvent,
- Iterable<
String> ? specificRelays, - EventSigner? customSigner,
low level nostr broadcast using inbox/outbox (gossip)
specificRelays
disables inbox/outbox (gossip) and broadcasts to the relays specified. Useful for NostrWalletConnect
customSigner
if you want to use a different signer than the default specified in NdkConfig
returns
a NdkBroadcastResponse object containing the result => success per relay
Implementation
NdkBroadcastResponse broadcast({
required Nip01Event nostrEvent,
Iterable<String>? specificRelays,
EventSigner? customSigner,
}) {
final broadcastState = BroadcastState();
// register broadcast state
_globalState.inFlightBroadcasts[nostrEvent.id] = broadcastState;
final signer =
nostrEvent.sig == '' ? _checkSinger(customSigner: customSigner) : null;
return _engine.handleEventBroadcast(
nostrEvent: nostrEvent,
signer: signer,
specificRelays: specificRelays,
doneStream: broadcastState.stateUpdates
.map((state) => state.broadcasts.values.toList()),
);
}