replace ECKey/ECPubKey with ECPair
This commit is contained in:
parent
31832293dd
commit
4c8b0f38ea
20 changed files with 266 additions and 670 deletions
test/integration
|
@ -6,10 +6,10 @@ var blockchain = new (require('cb-helloblock'))('testnet')
|
|||
|
||||
describe('bitcoinjs-lib (advanced)', function () {
|
||||
it('can sign a Bitcoin message', function () {
|
||||
var key = bitcoin.ECKey.fromWIF('5KYZdUEo39z3FPrtuX2QbbwGnNP5zTd7yyr2SC1j299sBCnWjss')
|
||||
var keyPair = bitcoin.ECPair.fromWIF('5KYZdUEo39z3FPrtuX2QbbwGnNP5zTd7yyr2SC1j299sBCnWjss')
|
||||
var message = 'This is an example of a signed message.'
|
||||
|
||||
var signature = bitcoin.message.sign(key, message)
|
||||
var signature = bitcoin.message.sign(keyPair, message)
|
||||
assert.equal(signature.toString('base64'), 'G9L5yLFjti0QTHhPyFrZCT1V/MMnBtXKmoiKDZ78NDBjERki6ZTQZdSMCtkgoNmp17By9ItJr8o7ChX0XxY91nk=')
|
||||
})
|
||||
|
||||
|
@ -24,8 +24,10 @@ describe('bitcoinjs-lib (advanced)', function () {
|
|||
it('can create an OP_RETURN transaction', function (done) {
|
||||
this.timeout(20000)
|
||||
|
||||
var key = bitcoin.ECKey.fromWIF('L1uyy5qTuGrVXrmrsvHWHgVzW9kKdrp27wBC7Vs6nZDTF2BRUVwy')
|
||||
var address = key.pub.getAddress(bitcoin.networks.testnet).toString()
|
||||
var keyPair = bitcoin.ECPair.makeRandom({
|
||||
network: bitcoin.networks.testnet
|
||||
})
|
||||
var address = keyPair.getAddress().toString()
|
||||
|
||||
blockchain.addresses.__faucetWithdraw(address, 2e4, function (err) {
|
||||
if (err) return done(err)
|
||||
|
@ -41,7 +43,7 @@ describe('bitcoinjs-lib (advanced)', function () {
|
|||
|
||||
tx.addInput(unspent.txId, unspent.vout)
|
||||
tx.addOutput(dataScript, 1000)
|
||||
tx.sign(0, key)
|
||||
tx.sign(0, keyPair)
|
||||
|
||||
var txBuilt = tx.build()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue