I'm trying to create an LTC wallet in Node.js, but I keep getting the error 'Missing inputs' when I try to broadcast.
I'm trying to create a Litecoin wallet in Node.js using the 'litecoinjs' library. I can create the hex, but when I try to broadcast it on the 'https://tltc.bitaps.com/broadcast' site, it returns an error 'Missing inputs.' The UTXO I'm passing is as follows:
[
{
txid: '40b77ce9e96f0e85e4b026c1624c53b45a64c8a813df9a08ccde78c7a1b1d011',
index: 1,
amount: 95426081,
script: 'a9141f652a42c312a2c4aee837672ce5c84a0b0455a087'
}
]
And the code I'm using is this:
async function newTxExample(wallet, addressToSend, amount) {
try {
amount = await toLitoshi(amount);
let utxo = await getUX(wallet.address);
utxo = await converterUTXO(utxo);
const transaction = await litecoinjs.newTransaction({
network: 'testnet',
wif: wallet.wif,
utxo: utxo,
output: [{
address: addressToSend,
amount: amount
}],
fee: 1000,
});
} catch (error) {
console.error(`ERROR: ${error}`);
}
}