* bump address parsing library

* add moneybadger refund address
This commit is contained in:
Blake Kaufman
2026-06-24 19:02:47 -04:00
committed by GitHub
parent 61214a4431
commit 1010ecedfc
6 changed files with 33 additions and 6 deletions
@@ -183,9 +183,11 @@ export default async function decodeSendAddress(props) {
if (isSupportedPNPQR(btcAdress)) {
crashlyticsLogReport('Handling crypto qr code');
const myUniqueName = globalContactsInformation?.myProfile?.uniqueName;
btcAdress = await handleCryptoQRAddress(
btcAdress,
getLNAddressForLiquidPayment,
myUniqueName ? `${myUniqueName}@blitzwalletapp.com` : undefined,
);
}
@@ -23,6 +23,15 @@ export async function getLNAddressForLiquidPayment(
url += `&comment=${comment}`;
}
// LUD-18: when the service advertises a payerData record requesting an
// `identifier`, attach the user's Lightning Address as a refund destination
// (used by MoneyBadger / cryptoqr.net merchants to return failed/over-payments).
const refundLightningAddress = paymentInfo?.data?.refundLightningAddress;
if (paymentInfo?.data?.payerData?.identifier && refundLightningAddress) {
const payerData = { identifier: refundLightningAddress };
url += `&payerdata=${encodeURIComponent(JSON.stringify(payerData))}`;
}
console.log('Generated URL:', url);
if (!isHTTPS(url)) throw new Error('LNURL must use HTTPS');
@@ -64,6 +64,15 @@ export default async function processLNUrlPay(input, context) {
);
}
// LUD-18: stamp the user's own Lightning Address onto the parsed data so the eventual
// callback fetch can pass it as a refund address when the service advertises payerData.
// This rides on `...input.data` in the return value, reaching the send screen / send-max
// invoice fetches without threading it through every call site.
const myUniqueName = globalContactsInformation?.myProfile?.uniqueName;
if (myUniqueName) {
input.data.refundLightningAddress = `${myUniqueName}@blitzwalletapp.com`;
}
const enteredAmount = enteredPaymentInfo.amount
? enteredPaymentInfo.amount * 1000
: convertedSendAmount * 1000;
@@ -175,6 +175,7 @@ export const convertMerchantQRToLightningAddress = ({ qrContent, network }) => {
export const handleCryptoQRAddress = async (
btcAddress,
getLNAddressForLiquidPayment,
refundLightningAddress,
) => {
console.log('Handling crypto qr code');
@@ -217,6 +218,12 @@ export const handleCryptoQRAddress = async (
throw new Error('Invalid Lightning Address response format');
}
// LUD-18: forward the user's Lightning Address as a refund destination when the
// merchant's payerData record requests an `identifier`.
if (refundLightningAddress) {
data.refundLightningAddress = refundLightningAddress;
}
const bolt11 = await getLNAddressForLiquidPayment(
{ data, type: InputTypes.LNURL_PAY },
data.minSendable / 1000,
+1 -1
View File
@@ -42,7 +42,7 @@
"@scure/bip39": "^1.6.0",
"bech32": "^2.0.0",
"bip21": "^3.0.0",
"bitcoin-address-parser": "^1.0.7",
"bitcoin-address-parser": "^1.0.8",
"bolt11": "^1.4.1",
"boltz-core": "^5.0.0",
"crypto-es": "^3.1.2",
+5 -5
View File
@@ -4972,7 +4972,7 @@ __metadata:
babel-preset-expo: ~54.0.0
bech32: ^2.0.0
bip21: ^3.0.0
bitcoin-address-parser: ^1.0.7
bitcoin-address-parser: ^1.0.8
bolt11: ^1.4.1
boltz-core: ^5.0.0
crypto-es: ^3.1.2
@@ -6032,9 +6032,9 @@ __metadata:
languageName: node
linkType: hard
"bitcoin-address-parser@npm:^1.0.7":
version: 1.0.7
resolution: "bitcoin-address-parser@npm:1.0.7"
"bitcoin-address-parser@npm:^1.0.8":
version: 1.0.8
resolution: "bitcoin-address-parser@npm:1.0.8"
dependencies:
base58-js: ^3.0.2
bech32: ^2.0.0
@@ -6042,7 +6042,7 @@ __metadata:
bolt11: ^1.4.1
js-lnurl: ^0.6.0
sha256-uint8array: ^0.10.7
checksum: 7220882f0781c9574f6635b0e7f9347751c52cae7e57fabdd1939a76a6c9178d3d0cd466f635834acb83fbf3a77037fd318750df7d2ecb0c8bbb40322634e5f0
checksum: 0d37e825c082534f1c23777ceab9a8cd1cb3fcb0866011585f62dab5125d5869c85e2fc5a9b81f7a376b0cbc48c8af5ae76030cf1b1b12d21af57a762fca6afc
languageName: node
linkType: hard