@galoymoney/client
Advanced tools
Comparing version 0.0.16 to 0.0.17
@@ -35,7 +35,6 @@ "use strict"; | ||
// input might start with 'lightning:', 'bitcoin:' | ||
var _e = destination | ||
.split(":") | ||
.map(function (value) { return value.toLocaleLowerCase(); }), protocol = _e[0], data = _e[1]; | ||
var destinationText = data !== null && data !== void 0 ? data : protocol; | ||
if (destinationText.startsWith("lnurl")) { | ||
var split = destination.split(":"); | ||
var protocol = split[0].toLocaleLowerCase(); | ||
var destinationText = (_b = split[1]) !== null && _b !== void 0 ? _b : split[0]; | ||
if (destinationText.match(/^lnurl/iu)) { | ||
return { | ||
@@ -47,6 +46,6 @@ valid: true, | ||
} | ||
if (protocol === "lightning" || destinationText.match(/^ln(bc|tb)/iu)) { | ||
if ((network === "mainnet" && !protocol.startsWith("lnbc")) || | ||
(network === "testnet" && !protocol.startsWith("lntb")) || | ||
(network === "regtest" && !protocol.startsWith("lnbcrt"))) { | ||
if (protocol === "lightning" || destinationText.match(/^ln(bc|tb).{50,}/iu)) { | ||
if ((network === "mainnet" && !destinationText.match(/^lnbc/iu)) || | ||
(network === "testnet" && !destinationText.match(/^lntb/iu)) || | ||
(network === "regtest" && !destinationText.match(/^lnbcrt/iu))) { | ||
return { | ||
@@ -74,3 +73,3 @@ valid: false, | ||
var amount = payReq.satoshis || payReq.millisatoshis | ||
? (_b = payReq.satoshis) !== null && _b !== void 0 ? _b : Number(payReq.millisatoshis) / 1000 | ||
? (_c = payReq.satoshis) !== null && _c !== void 0 ? _c : Number(payReq.millisatoshis) / 1000 | ||
: undefined; | ||
@@ -101,3 +100,3 @@ if ((0, exports.lightningInvoiceHasExpired)(payReq)) { | ||
// some apps encode addresses in UPPERCASE | ||
var path = (_c = decodedData === null || decodedData === void 0 ? void 0 : decodedData.pathname) === null || _c === void 0 ? void 0 : _c.toLocaleLowerCase(); | ||
var path = decodedData === null || decodedData === void 0 ? void 0 : decodedData.pathname; | ||
if (!path) { | ||
@@ -138,3 +137,5 @@ throw new Error("No address detected in decoded destination"); | ||
// No payment type detected, assume intraledger | ||
var handle = protocol.match(/^(http|\/\/)/iu) ? data.split("/").at(-1) : protocol; | ||
var handle = protocol.match(/^(http|\/\/)/iu) | ||
? destinationText.split("/").at(-1) | ||
: destinationText; | ||
if (handle === null || handle === void 0 ? void 0 : handle.match(/(?!^(1|3|bc1|lnbc1))^[0-9a-z_]{3,50}$/iu)) { | ||
@@ -141,0 +142,0 @@ return { |
@@ -8,4 +8,4 @@ module.exports = { | ||
setupFilesAfterEnv: ["<rootDir>/src/setupTests.ts"], | ||
testEnvironment: "jsdom", | ||
testPathIgnorePatterns: ["/node_modules/"], | ||
timers: "fake", | ||
} |
{ | ||
"name": "@galoymoney/client", | ||
"main": "dist/index.js", | ||
"version": "0.0.16", | ||
"version": "0.0.17", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "repository": "https://github.com/galoymoney/galoy-client", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
3555
183192