examples
This commit is contained in:
parent
b0bda2e3f2
commit
b27b72d775
@ -38,10 +38,16 @@ txb.addOutput(myaddress, txOut.value - 5000)
|
||||
var unsigned = txb.buildIncomplete()
|
||||
var signer = new TxSigner(unsigned)
|
||||
|
||||
signer.sign(0, root.keyPair, {
|
||||
var opts = {
|
||||
scriptPubKey: txOut.script,
|
||||
redeemScript: toSegwitPubkey,
|
||||
value: txOut.value
|
||||
})
|
||||
}
|
||||
signer.sign(0, root.keyPair, opts)
|
||||
var txd = signer.done()
|
||||
console.log(txd.toBuffer().toString('hex'))
|
||||
|
||||
var testSigner = new TxSigner(txd)
|
||||
|
||||
console.log(testSigner.signer(0, opts).isFullySigned());
|
||||
console.log(testSigner.done().toBuffer().equals(txd.toBuffer()))
|
||||
@ -28,12 +28,17 @@ builder.addOutput('2N6stcWuMpLgt4nkiaEFXP6p9J9VKRHCwDJ', 10000)
|
||||
|
||||
var unsigned = builder.buildIncomplete()
|
||||
var signer = new TxSigner(unsigned)
|
||||
signer.sign(0, root.keyPair, {
|
||||
var opts = {
|
||||
scriptPubKey: txOut.script,
|
||||
redeemScript: p2shScript,
|
||||
witnessScript: witnessScript,
|
||||
value: txOut.value
|
||||
})
|
||||
}
|
||||
signer.sign(0, root.keyPair, opts)
|
||||
|
||||
var txd = signer.done()
|
||||
console.log(txd.toBuffer().toString('hex'))
|
||||
var testSigner = new TxSigner(txd)
|
||||
|
||||
console.log(testSigner.signer(0, opts).isFullySigned());
|
||||
console.log(testSigner.done().toBuffer().equals(txd.toBuffer()))
|
||||
@ -33,15 +33,19 @@ builder.addOutput('2N6stcWuMpLgt4nkiaEFXP6p9J9VKRHCwDJ', 10000)
|
||||
var unsigned = builder.buildIncomplete()
|
||||
var signer = new TxSigner(unsigned)
|
||||
|
||||
var data = {
|
||||
var opts = {
|
||||
scriptPubKey: txOut.script,
|
||||
value: txOut.value,
|
||||
redeemScript: p2shScript,
|
||||
witnessScript: multisig
|
||||
}
|
||||
|
||||
signer.sign(0, root.keyPair, data)
|
||||
signer.sign(0, root2.keyPair, data)
|
||||
signer.sign(0, root.keyPair, opts)
|
||||
signer.sign(0, root2.keyPair, opts)
|
||||
|
||||
var txd = signer.done()
|
||||
console.log(txd.toBuffer().toString('hex'))
|
||||
var testSigner = new TxSigner(txd)
|
||||
|
||||
console.log(testSigner.signer(0, opts).isFullySigned())
|
||||
console.log(testSigner.done().toBuffer().equals(txd.toBuffer()))
|
||||
@ -28,11 +28,16 @@ builder.addOutput('2N6stcWuMpLgt4nkiaEFXP6p9J9VKRHCwDJ', txOut.value - 5000)
|
||||
|
||||
var unsigned = builder.buildIncomplete()
|
||||
var signer = new TxSigner(unsigned)
|
||||
signer.sign(0, root.keyPair, {
|
||||
var opts = {
|
||||
scriptPubKey: txOut.script,
|
||||
value: txOut.value
|
||||
})
|
||||
}
|
||||
signer.sign(0, root.keyPair, opts)
|
||||
|
||||
var txd = signer.done()
|
||||
|
||||
console.log(txd.toBuffer().toString('hex'))
|
||||
var testSigner = new TxSigner(txd)
|
||||
|
||||
console.log(testSigner.signer(0, opts).isFullySigned());
|
||||
console.log(testSigner.done().toBuffer().equals(txd.toBuffer()))
|
||||
@ -31,12 +31,17 @@ builder.addOutput('2N6stcWuMpLgt4nkiaEFXP6p9J9VKRHCwDJ', 10000)
|
||||
|
||||
var unsigned = builder.buildIncomplete()
|
||||
var signer = new TxSigner(unsigned)
|
||||
signer.sign(0, root.keyPair, {
|
||||
var opts = {
|
||||
scriptPubKey: scriptPubKey,
|
||||
witnessScript: witnessScript,
|
||||
value: txOut.value
|
||||
})
|
||||
}
|
||||
signer.sign(0, root.keyPair, opts)
|
||||
|
||||
var txd = signer.done()
|
||||
console.log(txd.toBuffer().toString('hex'))
|
||||
|
||||
var testSigner = new TxSigner(txd)
|
||||
|
||||
console.log(testSigner.signer(0, opts).isFullySigned())
|
||||
console.log(testSigner.done().toBuffer().equals(txd.toBuffer()))
|
||||
Loading…
Reference in New Issue
Block a user