Skip to content

Commit 4bf8a84

Browse files
committed
Remove wif. Use new bs58check
1 parent 7be0c0b commit 4bf8a84

File tree

8 files changed

+42
-36
lines changed

8 files changed

+42
-36
lines changed

package-lock.json

Lines changed: 33 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,7 @@
5454
"bip174": "^2.1.0",
5555
"bs58check": "^3.0.1",
5656
"typeforce": "^1.11.3",
57-
"varuint-bitcoin": "^1.1.2",
58-
"wif": "^2.0.1"
57+
"varuint-bitcoin": "^1.1.2"
5958
},
6059
"devDependencies": {
6160
"@types/bs58": "^4.0.0",
@@ -64,7 +63,6 @@
6463
"@types/node": "^16.11.7",
6564
"@types/proxyquire": "^1.3.28",
6665
"@types/randombytes": "^2.0.0",
67-
"@types/wif": "^2.0.2",
6866
"@typescript-eslint/eslint-plugin": "^5.45.0",
6967
"@typescript-eslint/parser": "^5.45.0",
7068
"better-npm-audit": "^3.7.3",

src/address.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ function _toFutureSegwitAddress(output, network) {
4242
return toBech32(data, version, network.bech32);
4343
}
4444
function fromBase58Check(address) {
45-
const payload = bs58check.decode(address);
45+
const payload = Buffer.from(bs58check.decode(address));
4646
// TODO: 4.0.0, move to "toOutputScript"
4747
if (payload.length < 21) throw new TypeError(address + ' is too short');
4848
if (payload.length > 21) throw new TypeError(address + ' is too long');
49-
const version = payload.readUInt8(0);
49+
const version = payload.readUint8(0);
5050
const hash = payload.slice(1);
5151
return { version, hash };
5252
}

src/payments/p2pkh.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ function p2pkh(a, opts) {
2727
a,
2828
);
2929
const _address = lazy.value(() => {
30-
const payload = bs58check.decode(a.address);
30+
const payload = Buffer.from(bs58check.decode(a.address));
3131
const version = payload.readUInt8(0);
3232
const hash = payload.slice(1);
3333
return { version, hash };

src/payments/p2sh.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ function p2sh(a, opts) {
4848
}
4949
const o = { network };
5050
const _address = lazy.value(() => {
51-
const payload = bs58check.decode(a.address);
51+
const payload = Buffer.from(bs58check.decode(a.address));
5252
const version = payload.readUInt8(0);
5353
const hash = payload.slice(1);
5454
return { version, hash };

ts_src/address.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,13 +53,13 @@ function _toFutureSegwitAddress(output: Buffer, network: Network): string {
5353
}
5454

5555
export function fromBase58Check(address: string): Base58CheckResult {
56-
const payload = bs58check.decode(address);
56+
const payload = Buffer.from(bs58check.decode(address));
5757

5858
// TODO: 4.0.0, move to "toOutputScript"
5959
if (payload.length < 21) throw new TypeError(address + ' is too short');
6060
if (payload.length > 21) throw new TypeError(address + ' is too long');
6161

62-
const version = payload.readUInt8(0);
62+
const version = payload.readUint8(0);
6363
const hash = payload.slice(1);
6464

6565
return { version, hash };

ts_src/payments/p2pkh.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ export function p2pkh(a: Payment, opts?: PaymentOpts): Payment {
2929
);
3030

3131
const _address = lazy.value(() => {
32-
const payload = bs58check.decode(a.address!);
32+
const payload = Buffer.from(bs58check.decode(a.address!));
3333
const version = payload.readUInt8(0);
3434
const hash = payload.slice(1);
3535
return { version, hash };

ts_src/payments/p2sh.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ export function p2sh(a: Payment, opts?: PaymentOpts): Payment {
5757
const o: Payment = { network };
5858

5959
const _address = lazy.value(() => {
60-
const payload = bs58check.decode(a.address!);
60+
const payload = Buffer.from(bs58check.decode(a.address!));
6161
const version = payload.readUInt8(0);
6262
const hash = payload.slice(1);
6363
return { version, hash };

0 commit comments

Comments
 (0)