NostrWalletConnectUri class

Represents a parsed Nostr Wallet Connect URI with support for multiple relays

Supported URI Formats:

Single Relay (backward compatible):

nostr+walletconnect://pubkey?relay=wss://relay.example.com&secret=secret123

Multiple Relays (comma-separated):

nostr+walletconnect://pubkey?relays=wss://relay1.com,wss://relay2.com&secret=secret123

Mixed Format (relay + relays parameters):

nostr+walletconnect://pubkey?relay=wss://relay1.com&relays=wss://relay2.com,wss://relay3.com&secret=secret123

Usage Examples:

// Parse existing URI
final connection = await nwc.connect('nostr+walletconnect://pubkey?relays=wss://relay1.com,wss://relay2.com&secret=secret123');

// Create new multi-relay URI
final uri = NostrWalletConnectUri.createMultiRelay(
  walletPubkey: 'pubkey123',
  relays: ['wss://relay1.example.com', 'wss://relay2.example.com'],
  secret: 'secret123'
);
final uriString = uri.toUri();

Constructors

NostrWalletConnectUri({required String walletPubkey, required List<String> relays, required String secret, String? lud16})
const
NostrWalletConnectUri.createMultiRelay({required String walletPubkey, required List<String> relays, required String secret, String? lud16})
Creates a NWC URI with multiple relays Example: NostrWalletConnectUri.createMultiRelay( walletPubkey: 'pubkey123', relays: 'wss://relay1.com', 'wss://relay2.com', secret: 'secret123' )
factory
NostrWalletConnectUri.legacy({required String walletPubkey, required String relay, required String secret, String? lud16})
Legacy constructor for backward compatibility with single relay
factory
NostrWalletConnectUri.parseConnectionUri(String uri)
factory

Properties

hashCode int
The hash code for this object.
no setterinherited
lud16 String?
final
props List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setter
relay String
Legacy getter for backward compatibility
no setter
relays List<String>
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
secret String
final
stringify bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited
walletPubkey String
final

Methods

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited
toUri() String
Creates a NWC URI string from the components Supports both single and multiple relays

Operators

operator ==(Object other) bool
The equality operator.
inherited