|
|
@ -56,6 +56,11 @@ describe('Transaction', function() { |
|
|
|
transaction.serialize().should.equal(tx_1_hex); |
|
|
|
}); |
|
|
|
|
|
|
|
it('should input/output json', function() { |
|
|
|
var transaction = JSON.parse(Transaction().fromJSON(tx_1_json).toJSON()); |
|
|
|
transaction.should.deep.equal(JSON.parse(tx_1_json)); |
|
|
|
}); |
|
|
|
|
|
|
|
it('should create a sample transaction from an utxo', function() { |
|
|
|
var transaction = new Transaction() |
|
|
|
.from(utxo_1a) |
|
|
@ -82,6 +87,20 @@ var tx_1_hex = '01000000015884e5db9de218238671572340b207ee85b628074e7e467096c267 |
|
|
|
var tx_1_id = '779a3e5b3c2c452c85333d8521f804c1a52800e60f4b7c3bbe36f4bab350b72c'; |
|
|
|
var tx_2_hex = ''; |
|
|
|
|
|
|
|
var tx_1_json = JSON.stringify({ |
|
|
|
version:1, |
|
|
|
inputs:[{ |
|
|
|
prevTxId:"a477af6b2667c29670467e4e0728b685ee07b240235771862318e29ddbe58458", |
|
|
|
outputIndex:0, |
|
|
|
sequenceNumber:4294967295, |
|
|
|
script:'71 0x3044022013fa3089327b50263029265572ae1b022a91d10ac80eb4f32f291c914533670b02200d8a5ed5f62634a7e1a0dc9188a3cc460a986267ae4d58faf50c79105431327501 33 0x0223078d2942df62c45621d209fab84ea9a7a23346201b7727b9b45a29c4e76f5e'}], |
|
|
|
outputs:[{ |
|
|
|
satoshis:1010000, |
|
|
|
script:'OP_DUP OP_HASH160 20 0x7821c0a3768aa9d1a37e16cf76002aef5373f1a8 OP_EQUALVERIFY OP_CHECKSIG' |
|
|
|
}], |
|
|
|
nLockTime:0 |
|
|
|
}); |
|
|
|
|
|
|
|
var utxo_1a_address = 'mszYqVnqKoQx4jcTdJXxwKAissE3Jbrrc1'; |
|
|
|
|
|
|
|
var utxo_2a_address = 'mrU9pEmAx26HcbKVrABvgL7AwA5fjNFoDc'; |
|
|
|