joule-labs / webln

Spec and client library for WebLN apps and providers
244 stars 28 forks source link

Add `GetBalance` Method #39

Open kwuenscher opened 2 years ago

kwuenscher commented 2 years ago

It would be great if the client could retrieve the balance of the lightning wallet so it can be shown as part of the native interface.

If that is given then you can pretty much recreate a full web3 experience. We have this concrete problem at kollider.xyz where we would like to render the users available balance (their wallet balance) as part of our interface rather than separating the on / off platform balances. However, beside us I think any Lapp's UX would greatly benefit from that.

wbobeirne commented 2 years ago

I think this is a really tricky thing to get right, because what is a "balance" in Lightning? Is it all sats you have a particular channel? Is it all sats currently in open channels? Is it all sats routable to a particular node? Is it the total of channel sats, or should you only show the largest channel since (pre AMP) you can only send that amount maximum?

Open to the idea, but it definitely needs a lot of thought.

kwuenscher commented 2 years ago

Good point, I haven't put much thought into this. My naive me would simply expect it to return the channelbalance as well as onchainbalance as this is what you see in most lightning wallets to be your balance.. I'd also think that this is something left to the wallet / node-cli to figure out. I'd expect it to be slightly different for custodial vs non-custodial wallets. Nevertheless there is always a notion of spendable lightning balance even though its just an approximation. If payments fail because there is no route then that just means we haven't made it yet.

That's all I got right now. I wanna find out how channelbalance does in practice and how much of a UX issue it is. I'll be back.