mirror of
https://github.com/mempool/mempool.git
synced 2025-02-25 15:10:12 +01:00
Merge pull request #5252 from mempool/natsoni/fix-bech32
Fix bech32 regex and adapt tests
This commit is contained in:
commit
e5d23e8076
2 changed files with 18 additions and 18 deletions
|
@ -144,13 +144,13 @@ describe('Mainnet', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
['BC1PQYQSZQ', 'bc1PqYqSzQ'].forEach((searchTerm) => {
|
['BC1PQYQS', 'bc1PqYqS'].forEach((searchTerm) => {
|
||||||
it(`allows searching for partial case insensitive bech32m addresses: ${searchTerm}`, () => {
|
it(`allows searching for partial case insensitive bech32m addresses: ${searchTerm}`, () => {
|
||||||
cy.visit('/');
|
cy.visit('/');
|
||||||
cy.get('.search-box-container > .form-control').type(searchTerm).then(() => {
|
cy.get('.search-box-container > .form-control').type(searchTerm).then(() => {
|
||||||
cy.get('app-search-results button.dropdown-item').should('have.length', 1);
|
cy.get('app-search-results button.dropdown-item').should('have.length', 10);
|
||||||
cy.get('app-search-results button.dropdown-item.active').click().then(() => {
|
cy.get('app-search-results button.dropdown-item.active').click().then(() => {
|
||||||
cy.url().should('include', '/address/bc1pqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqszqgpqyqsyjer9e');
|
cy.url().should('include', '/address/bc1pqyqs26fs4gnyw4aqttyjqa5ta7075zzfjftyz98qa8vdr49dh7fqm2zkv3');
|
||||||
cy.waitForSkeletonGone();
|
cy.waitForSkeletonGone();
|
||||||
cy.get('.text-center').should('not.have.text', 'Invalid Bitcoin address');
|
cy.get('.text-center').should('not.have.text', 'Invalid Bitcoin address');
|
||||||
});
|
});
|
||||||
|
@ -158,13 +158,13 @@ describe('Mainnet', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
['BC1Q000375VXCU', 'bC1q000375vXcU'].forEach((searchTerm) => {
|
['BC1Q0003', 'bC1q0003'].forEach((searchTerm) => {
|
||||||
it(`allows searching for partial case insensitive bech32 addresses: ${searchTerm}`, () => {
|
it(`allows searching for partial case insensitive bech32 addresses: ${searchTerm}`, () => {
|
||||||
cy.visit('/');
|
cy.visit('/');
|
||||||
cy.get('.search-box-container > .form-control').type(searchTerm).then(() => {
|
cy.get('.search-box-container > .form-control').type(searchTerm).then(() => {
|
||||||
cy.get('app-search-results button.dropdown-item').should('have.length', 1);
|
cy.get('app-search-results button.dropdown-item').should('have.length', 10);
|
||||||
cy.get('app-search-results button.dropdown-item.active').click().then(() => {
|
cy.get('app-search-results button.dropdown-item.active').click().then(() => {
|
||||||
cy.url().should('include', '/address/bc1q000375vxcuf5v04lmwy22vy2thvhqkxghgq7dy');
|
cy.url().should('include', '/address/bc1q000303cgr9zazthut63kdktwtatfe206um8nyh');
|
||||||
cy.waitForSkeletonGone();
|
cy.waitForSkeletonGone();
|
||||||
cy.get('.text-center').should('not.have.text', 'Invalid Bitcoin address');
|
cy.get('.text-center').should('not.have.text', 'Invalid Bitcoin address');
|
||||||
});
|
});
|
||||||
|
|
|
@ -41,11 +41,11 @@ const ADDRESS_CHARS: {
|
||||||
bech32: `(?:`
|
bech32: `(?:`
|
||||||
+ `bc1` // Starts with bc1
|
+ `bc1` // Starts with bc1
|
||||||
+ BECH32_CHARS_LW
|
+ BECH32_CHARS_LW
|
||||||
+ `{20,100}` // As per bech32, 6 char checksum is minimum
|
+ `{6,100}` // As per bech32, 6 char checksum is minimum
|
||||||
+ `|`
|
+ `|`
|
||||||
+ `BC1` // All upper case version
|
+ `BC1` // All upper case version
|
||||||
+ BECH32_CHARS_UP
|
+ BECH32_CHARS_UP
|
||||||
+ `{20,100}`
|
+ `{6,100}`
|
||||||
+ `)`,
|
+ `)`,
|
||||||
},
|
},
|
||||||
testnet: {
|
testnet: {
|
||||||
|
@ -55,11 +55,11 @@ const ADDRESS_CHARS: {
|
||||||
bech32: `(?:`
|
bech32: `(?:`
|
||||||
+ `tb1` // Starts with tb1
|
+ `tb1` // Starts with tb1
|
||||||
+ BECH32_CHARS_LW
|
+ BECH32_CHARS_LW
|
||||||
+ `{20,100}` // As per bech32, 6 char checksum is minimum
|
+ `{6,100}` // As per bech32, 6 char checksum is minimum
|
||||||
+ `|`
|
+ `|`
|
||||||
+ `TB1` // All upper case version
|
+ `TB1` // All upper case version
|
||||||
+ BECH32_CHARS_UP
|
+ BECH32_CHARS_UP
|
||||||
+ `{20,100}`
|
+ `{6,100}`
|
||||||
+ `)`,
|
+ `)`,
|
||||||
},
|
},
|
||||||
testnet4: {
|
testnet4: {
|
||||||
|
@ -69,11 +69,11 @@ const ADDRESS_CHARS: {
|
||||||
bech32: `(?:`
|
bech32: `(?:`
|
||||||
+ `tb1` // Starts with tb1
|
+ `tb1` // Starts with tb1
|
||||||
+ BECH32_CHARS_LW
|
+ BECH32_CHARS_LW
|
||||||
+ `{20,100}` // As per bech32, 6 char checksum is minimum
|
+ `{6,100}` // As per bech32, 6 char checksum is minimum
|
||||||
+ `|`
|
+ `|`
|
||||||
+ `TB1` // All upper case version
|
+ `TB1` // All upper case version
|
||||||
+ BECH32_CHARS_UP
|
+ BECH32_CHARS_UP
|
||||||
+ `{20,100}`
|
+ `{6,100}`
|
||||||
+ `)`,
|
+ `)`,
|
||||||
},
|
},
|
||||||
signet: {
|
signet: {
|
||||||
|
@ -83,11 +83,11 @@ const ADDRESS_CHARS: {
|
||||||
bech32: `(?:`
|
bech32: `(?:`
|
||||||
+ `tb1` // Starts with tb1
|
+ `tb1` // Starts with tb1
|
||||||
+ BECH32_CHARS_LW
|
+ BECH32_CHARS_LW
|
||||||
+ `{20,100}`
|
+ `{6,100}`
|
||||||
+ `|`
|
+ `|`
|
||||||
+ `TB1` // All upper case version
|
+ `TB1` // All upper case version
|
||||||
+ BECH32_CHARS_UP
|
+ BECH32_CHARS_UP
|
||||||
+ `{20,100}`
|
+ `{6,100}`
|
||||||
+ `)`,
|
+ `)`,
|
||||||
},
|
},
|
||||||
liquid: {
|
liquid: {
|
||||||
|
@ -105,7 +105,7 @@ const ADDRESS_CHARS: {
|
||||||
+ `lq1`
|
+ `lq1`
|
||||||
+ `)`
|
+ `)`
|
||||||
+ BECH32_CHARS_LW // blech32 and bech32 are the same alphabet and protocol, different checksums.
|
+ BECH32_CHARS_LW // blech32 and bech32 are the same alphabet and protocol, different checksums.
|
||||||
+ `{20,100}`
|
+ `{6,100}`
|
||||||
+ `|`
|
+ `|`
|
||||||
+ `(?:` // Same as above but all upper case
|
+ `(?:` // Same as above but all upper case
|
||||||
+ `EX1`
|
+ `EX1`
|
||||||
|
@ -113,7 +113,7 @@ const ADDRESS_CHARS: {
|
||||||
+ `LQ1`
|
+ `LQ1`
|
||||||
+ `)`
|
+ `)`
|
||||||
+ BECH32_CHARS_UP
|
+ BECH32_CHARS_UP
|
||||||
+ `{20,100}`
|
+ `{6,100}`
|
||||||
+ `)`,
|
+ `)`,
|
||||||
},
|
},
|
||||||
liquidtestnet: {
|
liquidtestnet: {
|
||||||
|
@ -127,7 +127,7 @@ const ADDRESS_CHARS: {
|
||||||
+ `tlq1` // TODO: does this exist?
|
+ `tlq1` // TODO: does this exist?
|
||||||
+ `)`
|
+ `)`
|
||||||
+ BECH32_CHARS_LW // blech32 and bech32 are the same alphabet and protocol, different checksums.
|
+ BECH32_CHARS_LW // blech32 and bech32 are the same alphabet and protocol, different checksums.
|
||||||
+ `{20,100}`
|
+ `{6,100}`
|
||||||
+ `|`
|
+ `|`
|
||||||
+ `(?:` // Same as above but all upper case
|
+ `(?:` // Same as above but all upper case
|
||||||
+ `TEX1`
|
+ `TEX1`
|
||||||
|
@ -135,7 +135,7 @@ const ADDRESS_CHARS: {
|
||||||
+ `TLQ1`
|
+ `TLQ1`
|
||||||
+ `)`
|
+ `)`
|
||||||
+ BECH32_CHARS_UP
|
+ BECH32_CHARS_UP
|
||||||
+ `{20,100}`
|
+ `{6,100}`
|
||||||
+ `)`,
|
+ `)`,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue