aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/lib/bip21.ts8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/lib/bip21.ts b/src/lib/bip21.ts
index 2642afab..4689246e 100644
--- a/src/lib/bip21.ts
+++ b/src/lib/bip21.ts
@@ -19,9 +19,11 @@ export function decode(uri, allowedSchemes = ["bitcoin", "liquidnetwork"]) {
const query = queryStart === -1 ? "" : uri.slice(queryStart + 1);
const options = Object.fromEntries(new URLSearchParams(query));
- const n = Number(options?.amount);
- if (!Number.isFinite(n)) throw new Error("Invalid amount");
- if (n < 0) throw new Error("Invalid amount");
+ if (options.amount) {
+ const n = Number(options.amount);
+ if (!Number.isFinite(n)) throw new Error("Invalid amount");
+ if (n < 0) throw new Error("Invalid amount");
+ }
return { scheme: urnScheme, address, options };
}