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

[feature]: add RPC for determining the amount of an asset that will be sent if an invoice is paid #1238

Open
ZZiigguurraatt opened this issue Dec 4, 2024 · 1 comment · May be fixed by #1253
Assignees
Labels
APIs enhancement New feature or request
Milestone

Comments

@ZZiigguurraatt
Copy link

Is your feature request related to a problem? Please describe.

If I try to pay an invoice in sat using an asset, I currently have no idea how many assets will be sent, so I don't know if I want to make the payment or not.

Describe the solution you'd like

Add an RPC that will read an invoice and make an RFQ and see what the exchange rate is with the channel peer and let the user know how many assets that is equivalent to.

Actually there should be two RFQ queries that should be made. First we should query for the sats amount as if we are only paying our direct channel peer. Next, a second RFQ query should be made for the total amount to send, including routing fees to the final destination. We should then present the difference between the two as the routing fees that must be paid in the asset units. This way the user can see if they have a high or low exchange rate and also high or low routing fees.

Describe alternatives you've considered

Not any good alternatives.

Additional context

This also helps with troubleshooting in test networks, in addition to real world uses where a user wants to make sure they aren't getting ripped off with their exchange rate before sending. Also, if the asset is not very divisible and routing fees are low, do we have to round up the asset a considerable amount to pay routing fees? I have no idea right now because I can't see the exchange rate before sending.

@ZZiigguurraatt ZZiigguurraatt added the enhancement New feature or request label Dec 4, 2024
@ZZiigguurraatt ZZiigguurraatt changed the title [feature]: add RPC for determining the amount of an assets that will be sent if an invoice is paid [feature]: add RPC for determining the amount of an asset that will be sent if an invoice is paid Dec 4, 2024
@ffranr
Copy link
Contributor

ffranr commented Dec 4, 2024

FYI

RPC endpoints AddAssetBuyOrder and AddAssetSellOrder will kickoff RFQ. And RPC endpoint QueryPeerAcceptedQuotes will report on quotes that have been accepted by our peer.

@Roasbeef Roasbeef self-assigned this Dec 9, 2024
@dstadulis dstadulis added the APIs label Dec 12, 2024
Roasbeef added a commit to Roasbeef/taproot-assets that referenced this issue Dec 13, 2024
In this commit, we implement the `DecodeAssetInvoice` command. This
command allows a caller to decode a normal LN invoice, adding the asset
specific information along the way. This includes the corresponding
asset unit amount, asset group information, and also the decimal display
information.

Fixes lightninglabs#1238
@Roasbeef Roasbeef linked a pull request Dec 13, 2024 that will close this issue
Roasbeef added a commit to Roasbeef/taproot-assets that referenced this issue Dec 13, 2024
In this commit, we implement the `DecodeAssetPayReq` command. This
command allows a caller to decode a normal LN invoice, adding the asset
specific information along the way. This includes the corresponding
asset unit amount, asset group information, and also the decimal display

information.
Fixes lightninglabs#1238
@dstadulis dstadulis moved this from 🆕 New to 👀 In review in Taproot-Assets Project Board Dec 13, 2024
@dstadulis dstadulis added this to the v0.5 milestone Dec 14, 2024
Roasbeef added a commit to Roasbeef/taproot-assets that referenced this issue Dec 15, 2024
In this commit, we implement the `DecodeAssetPayReq` command. This
command allows a caller to decode a normal LN invoice, adding the asset
specific information along the way. This includes the corresponding
asset unit amount, asset group information, and also the decimal display

information.
Fixes lightninglabs#1238
Roasbeef added a commit that referenced this issue Dec 17, 2024
In this commit, we implement the `DecodeAssetPayReq` command. This
command allows a caller to decode a normal LN invoice, adding the asset
specific information along the way. This includes the corresponding
asset unit amount, asset group information, and also the decimal display

information.
Fixes #1238
Roasbeef added a commit to Roasbeef/taproot-assets that referenced this issue Dec 18, 2024
In this commit, we implement the `DecodeAssetPayReq` command. This
command allows a caller to decode a normal LN invoice, adding the asset
specific information along the way. This includes the corresponding
asset unit amount, asset group information, and also the decimal display

information.
Fixes lightninglabs#1238
Roasbeef added a commit to Roasbeef/taproot-assets that referenced this issue Dec 18, 2024
In this commit, we implement the `DecodeAssetPayReq` command. This
command allows a caller to decode a normal LN invoice, adding the asset
specific information along the way. This includes the corresponding
asset unit amount, asset group information, and also the decimal display
information.

Fixes lightninglabs#1238
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
APIs enhancement New feature or request
Projects
Status: 👀 In review
Development

Successfully merging a pull request may close this issue.

4 participants