I have a problem when trying to sign transactions in monero, using the monerojs
library.
This is my code:
async function signAndSendTransaction(toAddress, amount) {
let wallet = await monerojs.createWalletFull({
networkType: MoneroNetworkType.TESTNET,
password: "MoneroRoot",
mnemonic: "after laptop autumn fixate plus boxes eavesdrop acumen bogeys hectare asylum mammal memoir addicted rebel austere bite lifestyle adapt morsel cousin tinted weekday awesome bite",
serverUri: "http://127.0.0.1:28081",
});
const syncResult = await wallet.sync();
console.log('Sync progress:', syncResult)
const txConfig = new monerojs.MoneroTxConfig();
txConfig.setAccountIndex(0); // Indice dell'account da cui inviare la transazione
txConfig.setAddress(toAddress); // Indirizzo di destinazione
txConfig.setAmount((ATOMICUNIT_PER_XMR*amount).toString());
const txSet = await wallet.createTx(txConfig);
await wallet.signTxs(txSet.getHash());
let daemon = await monerojs.connectToDaemonRpc({
uri: "http://127.0.0.1:28081",
});
const txHashes = await daemon.submitTxSet(txSet);
console.log("Transazione inviata con hash:", txHashes[0]);
}
it gives me this error when signing the transaction (signTxs()
):
MoneroError: cannot load unsigned_txset
Is there some process I'm skipping? Online errors of this type with the monerojs
library I can't find them.