Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to read balance and transactions through NWC? #182

Open
AleksandarIlic opened this issue Dec 1, 2023 · 3 comments
Open

How to read balance and transactions through NWC? #182

AleksandarIlic opened this issue Dec 1, 2023 · 3 comments

Comments

@AleksandarIlic
Copy link

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
Copy link
Contributor

rolznz commented Dec 4, 2023

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
Copy link
Author

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
Copy link
Contributor

rolznz commented Dec 5, 2023

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: nostr-protocol/nips#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: nostr-protocol/nips#685

Please let me know if you need any more help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants