-
Notifications
You must be signed in to change notification settings - Fork 3.4k
initial support bolt12 offers #10110
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
Draft
accumulator
wants to merge
45
commits into
spesmilo:master
Choose a base branch
from
accumulator:bolt12
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
45 commits
Select commit
Hold shift + click to select a range
d23fe87
segwit_addr: bech32 decode without checksum option
accumulator e56aa89
lnwire: add bolt12 types to onion_wire
accumulator 17b82eb
lnmsg: add new primitive type `bip340sig`, add tlv merkle root calcul…
accumulator fdd5ce1
bolt12: add encode/decode functions and tests, request_invoice, invoi…
accumulator c0b5a3c
payment_identifier: initial support for bolt12 offers
accumulator 5eb7e49
bolt12: route blinding test
accumulator 9119dd8
wip: temporarily piggy-back bolt12 invoices in Invoice.lightning_invo…
accumulator 58f20ff
onion_message: factor out get_blinded_paths_to_me from get_blinded_re…
accumulator 9613135
bolt12: pass bolt12_invoice along lnworker, lnpeer,
accumulator 7ccd2f5
add unit test: blinded payment onion
ecdsa e89bd3b
move blinding_privkey from onion_message to lnonion
accumulator 4af21bd
lnmsg: fix parsing of nested complex types where the leaf objects
accumulator c2e77fd
bolt12: add initial cli commands add_offer, get_offer and list_offers
accumulator 6d66062
bolt12: handle 'invoice_request' onion message payloads,
accumulator a06ec4f
lnutil: add blinded path feature flag
accumulator 972dd99
lnpeer: update_add_htlc: take blinding into account for HTLCs arrivin…
accumulator 774bb0e
wallet: return bech32 encoded bolt12 invoice in export_invoice()
accumulator c80926d
lnutil: define LN_FEATURES_ASSUMED according to BOLT9 and add LnFeatu…
accumulator cca9578
bolt12: check invoice features
accumulator 95f54f7
onion_message: verify LNPeerAddr returned as hint in NoRouteFound
accumulator 59c9748
onion_message: let caller specify considered channels for blinded paths.
accumulator dbea3c5
bolt12: create invoices with blinded paths suitable to receive paymen…
accumulator e955a8c
onion_message: iterate blinded paths for onion message requests
accumulator c09fafe
bolt12: pass invoice_expiry to verify_request_and_create_invoice(),
accumulator eace956
commands: add issuer option to offer
accumulator 33cc28c
bolt12: validate constraint offer in invreq
accumulator e0fa80d
bolt12: send invoice_error reply when Bolt12InvoiceError is raised
accumulator 9c97da4
bolt12: tests verify_request_and_create_invoice()
accumulator 12c3b23
bolt12: use specific exception for invreq validation,
accumulator 12bc4c4
onion_message: perform a direct peer connection for sending request, …
accumulator 33a24fd
payment_identifier: bolt12 request_invoice exceptions other than Time…
accumulator 1066546
onion_message: raise specific exceptions if blinded path could not be…
accumulator ca0cfdf
qt: initial support for bolt12 offers
accumulator 637cdee
qml: initial support for bolt12 offers
accumulator 0945395
remove is_onionmessage from process_onion_message, make it implicit o…
accumulator 2901ecd
commands: add decode_bolt12 command
accumulator ff39002
payment_identifier: properly lock amount once resolved to invoice,
accumulator ff2cf3d
qml: reset _key in QEInvoice on clear(), validate bolt12 recipients
accumulator 7994821
bolt12: persist offers
accumulator 8be3cb6
lnutil: add to_tlv_bytes() to LnFeatures
accumulator 09bb5fb
bolt12: generate unique path_id for each blinded path,
accumulator d2af0a5
lnworker: add ONION_MESSAGE and ROUTE_BLINDING features to LNWALLET_F…
accumulator e9dff74
add regtest: tests.regtest.TestLightningABC.test_bolt12
ecdsa d5359f3
lnworker: don't raise on non-existing id when delete_offer
accumulator 7d60511
lnonion: support payment path blinding
accumulator File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,146 @@ | ||
| import QtQuick | ||
| import QtQuick.Layouts | ||
| import QtQuick.Controls | ||
| import QtQuick.Controls.Material | ||
|
|
||
| import org.electrum 1.0 | ||
|
|
||
| import "controls" | ||
|
|
||
| ElDialog { | ||
| id: dialog | ||
|
|
||
| title: qsTr('BOLT12 Offer') | ||
| iconSource: '../../../icons/bolt12.png' | ||
|
|
||
| property InvoiceParser invoiceParser | ||
|
|
||
| padding: 0 | ||
|
|
||
| property bool commentValid: true // TODO? | ||
| property bool amountValid: amountBtc.textAsSats.satsInt > 0 | ||
| property bool valid: commentValid && amountValid | ||
|
|
||
| ColumnLayout { | ||
| width: parent.width | ||
|
|
||
| spacing: 0 | ||
|
|
||
| GridLayout { | ||
| id: rootLayout | ||
| columns: 2 | ||
|
|
||
| Layout.fillWidth: true | ||
| Layout.leftMargin: constants.paddingLarge | ||
| Layout.rightMargin: constants.paddingLarge | ||
| Layout.bottomMargin: constants.paddingLarge | ||
|
|
||
| // qml quirk; first cells cannot colspan without messing up the grid width | ||
| Item { Layout.fillWidth: true; Layout.preferredWidth: 1; Layout.preferredHeight: 1 } | ||
| Item { Layout.fillWidth: true; Layout.preferredWidth: 1; Layout.preferredHeight: 1 } | ||
|
|
||
| Label { | ||
| Layout.columnSpan: 2 | ||
| text: qsTr('Issuer') | ||
| color: Material.accentColor | ||
| visible: 'issuer' in invoiceParser.offerData | ||
| } | ||
| TextHighlightPane { | ||
| Layout.columnSpan: 2 | ||
| Layout.fillWidth: true | ||
| visible: 'issuer' in invoiceParser.offerData | ||
| Label { | ||
| width: parent.width | ||
| wrapMode: Text.Wrap | ||
| text: invoiceParser.offerData['issuer'] | ||
| } | ||
| } | ||
| Label { | ||
| Layout.columnSpan: 2 | ||
| Layout.fillWidth: true | ||
| text: qsTr('Description') | ||
| color: Material.accentColor | ||
| } | ||
| TextHighlightPane { | ||
| Layout.columnSpan: 2 | ||
| Layout.fillWidth: true | ||
| Label { | ||
| width: parent.width | ||
| text: invoiceParser.offerData['description'] | ||
| wrapMode: Text.Wrap | ||
| } | ||
| } | ||
| Label { | ||
| Layout.columnSpan: 2 | ||
| text: qsTr('Amount') | ||
| color: Material.accentColor | ||
| } | ||
|
|
||
| RowLayout { | ||
| Layout.columnSpan: 2 | ||
| Layout.fillWidth: true | ||
| BtcField { | ||
| id: amountBtc | ||
| Layout.preferredWidth: rootLayout.width /3 | ||
| text: 'amount' in invoiceParser.offerData | ||
| ? Config.formatSatsForEditing(invoiceParser.offerData['amount']/1000) | ||
| : '' | ||
| readOnly: 'amount' in invoiceParser.offerData | ||
| color: Material.foreground // override gray-out on disabled | ||
| fiatfield: amountFiat | ||
| onTextAsSatsChanged: { | ||
| invoiceParser.amountOverride = textAsSats | ||
| } | ||
| } | ||
| Label { | ||
| text: Config.baseUnit | ||
| color: Material.accentColor | ||
| } | ||
| } | ||
|
|
||
| RowLayout { | ||
| Layout.columnSpan: 2 | ||
| visible: Daemon.fx.enabled | ||
| FiatField { | ||
| id: amountFiat | ||
| Layout.preferredWidth: rootLayout.width / 3 | ||
| btcfield: amountBtc | ||
| readOnly: btcfield.readOnly | ||
| } | ||
| Label { | ||
| text: Daemon.fx.fiatCurrency | ||
| color: Material.accentColor | ||
| } | ||
| } | ||
|
|
||
| Label { | ||
| Layout.columnSpan: 2 | ||
| text: qsTr('Note') | ||
| color: Material.accentColor | ||
| } | ||
| ElTextArea { | ||
| id: note | ||
| Layout.columnSpan: 2 | ||
| Layout.fillWidth: true | ||
| Layout.minimumHeight: 100 | ||
| wrapMode: TextEdit.Wrap | ||
| placeholderText: qsTr('Enter an (optional) message for the receiver') | ||
| // TODO: max 100 chars is arbitrary, not sure what the max size is | ||
| color: text.length > 100 ? constants.colorError : Material.foreground | ||
| } | ||
| } | ||
|
|
||
| FlatButton { | ||
| Layout.topMargin: constants.paddingLarge | ||
| Layout.fillWidth: true | ||
| text: qsTr('Pay') | ||
| icon.source: '../../icons/confirmed.png' | ||
| enabled: valid | ||
| onClicked: { | ||
| invoiceParser.requestInvoiceFromOffer(note.text) | ||
| dialog.close() | ||
| } | ||
| } | ||
| } | ||
|
|
||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.