i am trying to write a javascript function for prepareunlockspentfrom
it is giving me undefined object instead of giving txid and vout as a output.
I am using npm bitcoin package for nodejs.
//////FUNCTION
function preparelockunspentfrom(hex,assettype,assetqty)
{
var myArray=[];
var key = assettype;
var obj = {};
obj[key] = assetqty;
myArray.push(hex);
myArray.push(obj);
console.log(myArray);
client.cmd('preparelockunspentfrom',myArray,function(err,assets)
{
console.log(assets);
});
}
preparelockunspentfrom("1Ebr8ExKnGQWhNukYwBqztMafZ1LvQZdCWQiHW","asset1",2);
////Output
root@kali:~/Desktop# nodejs blockchain.js
[ '1Ebr8ExKnGQWhNukYwBqztMafZ1LvQZdCWQiHW', { asset1: 2 } ]
undefined