# Nwc

high level

# Example

connect, get balance
// You need an NWC_URI env var or to replace with your NWC uri connection
final nwcUri = Platform.environment['NWC_URI']!;
final connection = await ndk.nwc.connect(nwcUri);

GetBalanceResponse balanceResponse = await ndk.nwc.getBalance(connection);

print("Balance: ${balanceResponse.balanceSats} sats");
pay invoice
final payInvoice = await ndk.nwc.payInvoice(connection, invoice: invoice);
notifications
final connection = await ndk.nwc.connect(nwcUri);

print(
    "waiting for ${connection.isLegacyNotifications() ? "legacy " : ""}notifications");
await for (final notification in connection.notificationStream.stream) {
  print('notification ${notification.type} amount: ${notification.amount}');
}

# How to use

You need a nostr+walletconnect://... uri from your NWC wallet service provider.

see https://github.com/getAlby/awesome-nwc for more info how to get a wallet supporting NWC