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

rpc: implement DecodeAssetInvoice #1253

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Roasbeef
Copy link
Member

@Roasbeef Roasbeef commented 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 #1238

Fixes #1166

@Roasbeef Roasbeef added enhancement New feature or request gRPC tap-channels labels Dec 13, 2024
@Roasbeef Roasbeef requested review from a team, ffranr and GeorgeTsagk and removed request for a team December 13, 2024 12:22
@coveralls
Copy link

coveralls commented Dec 13, 2024

Pull Request Test Coverage Report for Build 12398373932

Details

  • 0 of 112 (0.0%) changed or added relevant lines in 2 files are covered.
  • 30 unchanged lines in 5 files lost coverage.
  • Overall coverage decreased (-0.09%) to 40.607%

Changes Missing Coverage Covered Lines Changed/Added Lines %
tapcfg/server.go 0 1 0.0%
rpcserver.go 0 111 0.0%
Files with Coverage Reduction New Missed Lines %
tappsbt/create.go 2 53.22%
tapgarden/planter.go 2 74.12%
commitment/tap.go 5 84.17%
tapdb/multiverse.go 6 68.21%
universe/interface.go 15 50.65%
Totals Coverage Status
Change from base Build 12379489363: -0.09%
Covered Lines: 25841
Relevant Lines: 63637

💛 - Coveralls

taprpc/tapchannelrpc/tapchannel.proto Outdated Show resolved Hide resolved
rpcserver.go Outdated Show resolved Hide resolved
rpcserver.go Outdated Show resolved Hide resolved
Copy link
Member

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice feature!

taprpc/tapchannelrpc/tapchannel.proto Outdated Show resolved Hide resolved
taprpc/tapchannelrpc/tapchannel.proto Outdated Show resolved Hide resolved
taprpc/tapchannelrpc/tapchannel.proto Show resolved Hide resolved
rpcserver.go Outdated Show resolved Hide resolved
rpcserver.go Outdated Show resolved Hide resolved
rpcserver.go Outdated Show resolved Hide resolved
rpcserver.go Show resolved Hide resolved
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 Roasbeef force-pushed the decode-asset-invoice branch from 57c2454 to 610300a Compare December 18, 2024 17:40
Copy link
Member

@guggero guggero left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 🎉


// assetInvoiceAmt calculates the amount of asset units to pay for an invoice
// which is expressed in sats.
func (r *rpcServer) assetInvoiceAmt(ctx context.Context, targetAsset asset.Specifier,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: line too long (linter error is somewhat cryptic).

return 0, fmt.Errorf("error querying ask price: %w", err)
}
if oracleResp.Err != nil {
return 0, fmt.Errorf("error querying ask price: %w", err)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: use oracleResp.Err in the error message?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: 👀 In review
6 participants