Browse Source

Merge pull request #6 from clarkmoody/fix-buffer-deprecation

Remove deprecated "new Buffer" in favor of "Buffer.from"
umbrel
kenshin samourai 6 years ago
committed by GitHub
parent
commit
70ed5287ae
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
  1. 2
      accounts/api-helper.js
  2. 6
      test/lib/bitcoin/addresses-helper-test.js

2
accounts/api-helper.js

@ -47,7 +47,7 @@ class ApiHelper {
} else if (addrHelper.isSupportedPubKey(item) && !ret.hasPubKey(item)) {
// Derive pubkey as 3 addresses (P1PKH, P2WPKH/P2SH, BECH32)
const bufItem = new Buffer(item, 'hex')
const bufItem = Buffer.from(item, 'hex')
const funcs = [
addrHelper.p2pkhAddress,

6
test/lib/bitcoin/addresses-helper-test.js

@ -84,7 +84,7 @@ describe('AddressesHelper', function() {
describe('p2pkhAddress()', function() {
it('should successfully derive P2PKH addresses from pubkeys', function() {
for (const v of VECTOR_1) {
const pkb = new Buffer(v[0], 'hex')
const pkb = Buffer.from(v[0], 'hex')
const addr = addrHelper.p2pkhAddress(pkb)
assert(addr == v[1])
}
@ -94,7 +94,7 @@ describe('AddressesHelper', function() {
describe('p2wpkhP2shAddress()', function() {
it('should successfully derive P2WPKH-P2SH addresses from pubkeys', function() {
for (const v of VECTOR_1) {
const pkb = new Buffer(v[0], 'hex')
const pkb = Buffer.from(v[0], 'hex')
const addr = addrHelper.p2wpkhP2shAddress(pkb)
assert(addr == v[2])
}
@ -104,7 +104,7 @@ describe('AddressesHelper', function() {
describe('p2wpkhAddress()', function() {
it('should successfully derive bech32 addresses from pubkeys', function() {
for (const v of VECTOR_1) {
const pkb = new Buffer(v[0], 'hex')
const pkb = Buffer.from(v[0], 'hex')
const addr = addrHelper.p2wpkhAddress(pkb)
assert(addr == v[3])
}

Loading…
Cancel
Save