bitcore-lib-doge Unhandled Rejection (Error): Assertion failed
try to use the doge package in browser:
try to sign a transaction, var fromAddress = 'DSw2NHz2YfTeFogjeGJvZVVZkjkxSSX3zx'; var toAddress = 'DE1wEbm9D6JqEhqGtyD52BkHQmQ5N18J84'; var changeAddress = 'DAPkqFzgrXVsUU7WkSf1GYMmFzEGvuK4SK'; var privateKey = 'dd7bdefb163b31eb706ec43589c24cd27fc7878216836468bf216845c7c4aa1c'; var private1 = 'ba9bb7f48969e94301025313c298916b2913fb7eecefe98b9128ef4d87e40ea40'; var private2 = '6403e70451390134f2bddbe5ecb33c5b264af292fcbf2cdd97deaac7e1e8f7ba0';
// console.log(new doge.PrivateKey(privateKey, "mainnet").toAddress().toString())
var simpleUtxoWith10DOGE = {
address: fromAddress,
txId: 'a477af6b2667c29670467e4e0728b685ee07b240235771862318e29ddbe58458',
outputIndex: 0,
script: doge.Script.buildPublicKeyHashOut(fromAddress).toString(),
satoshis: 10e8
};
var transaction = new doge.Transaction()
.from(simpleUtxoWith10DOGE)
.to(toAddress, 50000)
// .change(changeAddress)
.sign(privateKey);
console.log(transaction.toString())
i got this error:
doge.js:1 Uncaught (in promise) Error: Assertion failed
at n (:8000/js/doge.js:1)
at s.toBuffer (:8000/js/doge.js:1)
at e.f.toBuffer.f.toDER (:8000/js/doge.js:1)
at b.addSignature (:8000/js/doge.js:1)
at x.applySignature (:8000/js/doge.js:1)
at :8000/js/doge.js:1
at Wt (:8000/js/doge.js:1)
at Function.Go (:8000/js/doge.js:1)
at x.sign (:8000/js/doge.js:1)
at _callee2$ (:8000/p__transaction.js:501)
at tryCatch (:8000/mf-dep_vendors-node_modules_umijs_preset-built-in_node_modules_regenerator-runtime_runtime_js.08045b18.async.js:53)
at Generator.invoke [as _invoke] (:8000/mf-dep_vendors-node_modules_umijs_preset-built-in_node_modules_regenerator-runtime_runtime_js.08045b18.async.js:282)
at Generator.prototype.
can any one work this out? thanks
all method in the browser works fine except transaction sign method
@aliray have you found a problem?