Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ export const isLnUri = str => {
* @return {boolean} If the uri is valid
*/
export const isAddress = str => {
return /^[a-km-zA-HJ-NP-Z0-9]{26,35}$/.test(str);
return /^[a-km-zA-HJ-NP-Z0-9]{26,90}$/.test(str);
};

/**
Expand Down
10 changes: 8 additions & 2 deletions test/unit/helper.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -721,12 +721,18 @@ describe('Helpers Unit Tests', () => {
});

describe('isAddress()', () => {
it('should accept bitcoin uri', () => {
it('should accept bitcoin address', () => {
const address = 'rfu4i1Mo2NF7TQsN9bMVLFSojSzcyQCEH5';
expect(helpers.isAddress(address), 'to be', true);
});

it('should reject invalid bitcoin uri', () => {
it('should accept bech32 address', () => {
const address =
'bc1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3qccfmv3';
expect(helpers.isAddress(address), 'to be', true);
});

it('should reject invalid bitcoin address', () => {
const address = '/INVALID/rfu4i1Mo2NF7TQsN9bMVLFSoj';
expect(helpers.isAddress(address), 'to be', false);
});
Expand Down