Update addresses.js
This commit is contained in:
parent
582727f6de
commit
b93d9d99cc
1 changed files with 3 additions and 0 deletions
|
@ -19,6 +19,7 @@ function rng () { return Buffer.from('zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz') }
|
||||||
|
|
||||||
describe('bitcoinjs-lib (addresses)', function () {
|
describe('bitcoinjs-lib (addresses)', function () {
|
||||||
it('can generate a random address', function () {
|
it('can generate a random address', function () {
|
||||||
|
// in production: const keyPair = bitcoin.ECPair.makeRandom({})
|
||||||
const keyPair = bitcoin.ECPair.makeRandom({ rng: rng })
|
const keyPair = bitcoin.ECPair.makeRandom({ rng: rng })
|
||||||
const { address } = bitcoin.payments.p2pkh({ pubkey: keyPair.publicKey })
|
const { address } = bitcoin.payments.p2pkh({ pubkey: keyPair.publicKey })
|
||||||
|
|
||||||
|
@ -121,6 +122,7 @@ describe('bitcoinjs-lib (addresses)', function () {
|
||||||
// other networks
|
// other networks
|
||||||
it('can generate a Testnet address', function () {
|
it('can generate a Testnet address', function () {
|
||||||
const testnet = bitcoin.networks.testnet
|
const testnet = bitcoin.networks.testnet
|
||||||
|
// in production: const keyPair = bitcoin.ECPair.makeRandom({ network: testnet })
|
||||||
const keyPair = bitcoin.ECPair.makeRandom({ network: testnet, rng: rng })
|
const keyPair = bitcoin.ECPair.makeRandom({ network: testnet, rng: rng })
|
||||||
const wif = keyPair.toWIF()
|
const wif = keyPair.toWIF()
|
||||||
const { address } = bitcoin.payments.p2pkh({ pubkey: keyPair.publicKey, network: testnet })
|
const { address } = bitcoin.payments.p2pkh({ pubkey: keyPair.publicKey, network: testnet })
|
||||||
|
@ -130,6 +132,7 @@ describe('bitcoinjs-lib (addresses)', function () {
|
||||||
})
|
})
|
||||||
|
|
||||||
it('can generate a Litecoin address', function () {
|
it('can generate a Litecoin address', function () {
|
||||||
|
// in production: const keyPair = bitcoin.ECPair.makeRandom({ network: LITECOIN })
|
||||||
const keyPair = bitcoin.ECPair.makeRandom({ network: LITECOIN, rng: rng })
|
const keyPair = bitcoin.ECPair.makeRandom({ network: LITECOIN, rng: rng })
|
||||||
const wif = keyPair.toWIF()
|
const wif = keyPair.toWIF()
|
||||||
const { address } = bitcoin.payments.p2pkh({ pubkey: keyPair.publicKey, network: LITECOIN })
|
const { address } = bitcoin.payments.p2pkh({ pubkey: keyPair.publicKey, network: LITECOIN })
|
||||||
|
|
Loading…
Reference in a new issue