Skip to content

Commit

Permalink
fix: update bitcoin-address-validation + include taproot address vali…
Browse files Browse the repository at this point in the history
…date in tests
  • Loading branch information
nk1tz committed Nov 16, 2023
1 parent 0e1ca4d commit 7793e23
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 17 deletions.
61 changes: 48 additions & 13 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
"bignumber.js": "^8.1.1",
"bip32": "^2.0.5",
"bip66": "^1.1.5",
"bitcoin-address-validation": "^0.2.9",
"bitcoin-address-validation": "^2.2.3",
"bitcoinjs-lib": "^5.1.10",
"bs58check": "^2.1.2",
"bufio": "^1.2.0",
Expand Down
16 changes: 14 additions & 2 deletions src/addresses.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import * as multisig from "./multisig";
import { Network } from "./networks";

const P2PKH = "P2PKH";
const P2TR = "P2TR";

let ADDRESSES = {};
ADDRESSES[Network.MAINNET] = {};
Expand All @@ -12,7 +13,10 @@ ADDRESSES[Network.MAINNET][(multisig as any).P2SH] = [
];
ADDRESSES[Network.MAINNET][(multisig as any).P2WSH] = [
"bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4",
"bc1pw508d6qejxtdg4y5r3zarvary0c5xw7kw508d6qejxtdg4y5r3zarvary0c5xw7k7grplx",
"bc1qng72v5ceptk07htel0wcv6k27fkg6tmmd8887jr2l2yz5a5lnawqqeceya",
];
ADDRESSES[Network.MAINNET][P2TR] = [
"bc1pap0ck84srwp6my97h250ws73z3mq765nm2382gzcqcarx9lxjzrq4eqyp8",
];

ADDRESSES[Network.TESTNET] = {};
Expand All @@ -23,8 +27,16 @@ ADDRESSES[Network.TESTNET][(multisig as any).P2SH] = [
ADDRESSES[Network.TESTNET][(multisig as any).P2WSH] = [
"tb1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3q0sl5k7",
];
ADDRESSES[Network.TESTNET][P2TR] = [
"tb1p94dllzzcax4hs4zljaygq5trzzy79486uy72uqus24zzpkrkaeuqgfw9fy",
];

const ADDRESS_TYPES = [P2PKH, (multisig as any).P2SH, (multisig as any).P2WSH];
const ADDRESS_TYPES = [
P2PKH,
(multisig as any).P2SH,
(multisig as any).P2WSH,
P2TR,
];

describe("addresses", () => {
describe("validateAddress", () => {
Expand Down
2 changes: 1 addition & 1 deletion src/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* This module provides validation messages related to addresses.
*/

import bitcoinAddressValidation from "bitcoin-address-validation";
import { validate as bitcoinAddressValidation } from "bitcoin-address-validation";

import { Network } from "./networks";

Expand Down

0 comments on commit 7793e23

Please sign in to comment.