code: function signatureForm(txObj, i, script, hashcode) {
    // Copy object so we don't rewrite it
    var newTx = JSON.parse(JSON.stringify(txObj));
  
    for (var j = 0; j < newTx.ins.length; j++) {
      newTx.ins[j].script = '';
    }
    newTx.ins[i].script = script;
  
    if (hashcode === zconstants.SIGHASH_NONE) {
      newTx.outs = [];
    } else if (hashcode === zconstants.SIGHASH_SINGLE) {
      newTx.outs = newTx.outs.slice(0, newTx.ins.length);
      for (var j = 0; j < newTx.ins.length - 1; ++j) {
        newTx.outs[j].satoshis = Math.pow(2, 64) - 1;
        newTx.outs[j].script = '';
      }
    } else if (hashcode === zconstants.SIGHASH_ANYONECANPAY) {
      newTx.ins = [newTx.ins[i]];
    }
  
    return newTx;
  }
docs: /*
  Signature hashing for TXOBJ
  @param {String} address
  @param {Number} i, which transaction input to sign
  @param {String} hex string of script
  @param {String} hash code (SIGHASH_ALL, SIGHASH_NONE...)
  return {String} output script