Beefed up TransactionIn constructor
This commit is contained in:
parent
f53a4e3ffa
commit
274112005f
2 changed files with 24 additions and 17 deletions
2
bitcoinjs-min.js
vendored
2
bitcoinjs-min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -52,20 +52,27 @@ Transaction.objectify = function (txs) {
|
|||
/**
|
||||
* Create a new txin.
|
||||
*
|
||||
* Can be called with an existing TransactionIn object to add it to the
|
||||
* transaction. Or it can be called with a Transaction object and an integer
|
||||
* output index, in which case a new TransactionIn object pointing to the
|
||||
* referenced output will be created.
|
||||
* Can be called with any of:
|
||||
*
|
||||
* - An existing TransactionOut object
|
||||
* - A transaction and an index
|
||||
* - A transaction hash and an index
|
||||
* - A single string argument of the form txhash:index
|
||||
*
|
||||
* Note that this method does not sign the created input.
|
||||
*/
|
||||
Transaction.prototype.addInput = function (tx, outIndex) {
|
||||
if (arguments[0] instanceof TransactionIn) {
|
||||
this.ins.push(arguments[0]);
|
||||
} else {
|
||||
}
|
||||
else if (arguments[0].length > 65) {
|
||||
var args = arguments[0].split(':');
|
||||
return this.addInput(args[0], args[1]);
|
||||
}
|
||||
else {
|
||||
this.ins.push(new TransactionIn({
|
||||
outpoint: {
|
||||
hash: tx.hash,
|
||||
hash: tx.hash || tx,
|
||||
index: outIndex
|
||||
},
|
||||
script: new Script(),
|
||||
|
|
Loading…
Reference in a new issue