getAlby / lightning-browser-extension

The Bitcoin Lightning Browser Extension that brings deep Lightning & Nostr integration to the web. Wallet interface to multiple lightning nodes and key signer for Nostr, Liquid and onchain use.
https://getalby.com/#extension
MIT License
529 stars 193 forks source link

💵 Explore fiat-denominated accounts #1742

Closed reneaaron closed 1 year ago

reneaaron commented 1 year ago

Feature description

More and more services are offering fiat denominated accounts via synthetic assets:

image

Those services often offer multiple balances to their users. In Kollider's case it's:

We want to explore how this can be integrated into Alby by creating a connector for Kollider. (see WIP branch linked to this issue)

Context

When connecting a Kollider account () a user would need to choose which balance should be used within Alby, it's currently out of scope to support multiple balances.

A connector would need to signal the current currency to the extension.

Questions

Useful links

Out of scope

ToDo

bumi commented 1 year ago

In the first step what we imo need to look at is how we can let the connector decide what currency the return amounts have. E.g. when we show the account balance we have a hard coded "sats" there. this would need to be the currency of the connector. Same in the incoming invoices. I'd also say if the currency is not btc/sats then we do not show any other fiat amount (or we show the sats amount, whatever is easier)

in the outgoing payments list I'd still try to store sats amounts.

related code; https://github.com/getAlby/lightning-browser-extension/blob/master/src/app/components/AccountMenu/index.tsx#L92-L102

https://github.com/getAlby/lightning-browser-extension/blob/16dff6ac525ceaa83b224392d8fab38197c088e2/src/app/context/AccountContext.tsx#L84-L100

lisabaut commented 1 year ago

First Implementation

=> relevant PR https://github.com/getAlby/lightning-browser-extension/pull/1774


Updated according to @bumi comment below

bumi commented 1 year ago

just for completeness: Here is the code where I explored Kollider: https://github.com/getAlby/lightning-browser-extension/pull/1770

there does not need to be a special prompt, just like other connectors need some information this needs a "currency":

image

I would also call it just getCurrency - because those accounts will only have one currency I guess.

and in the first step I'd only do all this in the account menu thing. The outgoing payments are stored locally and are not per connector, there we only have the sats amounts (we don't even know the actual fiat amount that was paid from that account then)

And then we also can show the sats amount in the incoming invoices I guess.

All inputs an webln calls stay in sats.

lisabaut commented 1 year ago

UPDATE

Changed the Todos of the first implementation above according to the comments of Bumi here.