getAlby / nostr-wallet-connect

Nostr Wallet Connect (NIP-47) application to allow apps to connect to your node
https://nwc.getalby.com
Apache License 2.0
103 stars 31 forks source link

How to read balance and transactions through NWC? #182

Open AleksandarIlic opened 9 months ago

AleksandarIlic commented 9 months ago

Hey there,

How to read the balance once a 3rd-party app gets authorised through NWC pairing secret? How to achieve this?

Screenshot 2023-12-01 at 21 25 43

This is what I see when I do Alby NWC, but I'm not sure how to read the balance.

What about reading transactions history through NWC? Could this be possible?

Thanks, Alex

rolznz commented 9 months ago

Hi Alex,

You have ticked the "Read balance" permission so third-party apps can use that connection string to read the balance. Are you developing an app that supports NWC? you could have a look at the Alby JS SDK as it makes it really easy to integrate NWC into a web application.

transaction history is coming soon - we're actually working on that right now.

AleksandarIlic commented 9 months ago

Hi Roland,

Unfortunately I can not use Alby JS SDK because I would like to read the balance from mobile app and I'm not sure how to make an HTTP call to get the balance using the NWC pairing secret.

I can open the NWC link in the app and do zaps afterwards (they are working). Can you give me some examples or point me in the right direction in the documentation on how to read the balance without SDK?

It's awesome that you are working on transactions. Do you plan to support pagination? Pagination using transaction timestamps with since and until params would be super great!

rolznz commented 9 months ago

Hi @AleksandarIlic we are working on a possible HTTP service with an API that you can use for NWC which might be useful to you. It's not ready yet however. I will let you know when we have updates.

What programming language do you use for your mobile app? are websockets difficult to implement there, or would you benefit from a Nostr Wallet Connect SDK in that language?

It's awesome that you are working on transactions. Do you plan to support pagination? Pagination using transaction timestamps with since and until params would be super great!

Yes, the NWC extension for listing transactions (invoices and payments) will support pagination. You can see the planned API here: https://github.com/nostr-protocol/nips/pull/685

We are currently implementing it in this repository and reviewing whether or not the API has everything needed (e.g. to add a NWC connector to the Alby browser extension) - we'll probably request some changes.

Can you give me some examples or point me in the right direction in the documentation on how to read the balance without SDK?

If you already have zaps and NWC working, it should be easy to add support for getting the balance. The API is also listed in this PR: https://github.com/nostr-protocol/nips/pull/685

Please let me know if you need any more help.