Skip to content

Commit

Permalink
add support for address only
Browse files Browse the repository at this point in the history
  • Loading branch information
mariofriz committed Mar 19, 2023
1 parent 4960745 commit 3ea1963
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,12 +314,12 @@ const routes: RouteConfig[] = [{
if (from.fullPath === '/' && to.hash.startsWith('#_request/')) {
// old safe links are in this format: /#_request/NQ208P9L3YMDGQYT1TAA8D0GMC125HBQ1Q8A/100_
// new wallet links are in this format: /nimiq:NQ208P9L3YMDGQYT1TAA8D0GMC125HBQ1Q8A?amount=100
const results = to.hash.match(/^#_request\/(.+)\/(\d+)_$/);
const results = to.hash.match(/^#_request\/([A-Z0-9]+)\/?(\d+)?_$/);
const address = results?.[1];
const amount = results?.[2];
const amount = results?.[2] ? `?amount=${results?.[2]}` : '';
next({
name: 'send-via-uri',
hash: `nimiq:${address}?amount=${amount}`,
hash: `nimiq:${address}${amount}`,
replace: true,
});
} else {
Expand Down

0 comments on commit 3ea1963

Please sign in to comment.