I downloaded my local node on the Monero testnet, specifically I used:
monerod --testnet --db-sync-mode fast --prune-blockchain
After successfully launching the node, I mined some XMR. My intention is to test Monero transactions with the monerojs Javascript library.
Currently on my Monero address I have about 1.5 XMR but when I try to view my balance from the local Javascript console, it always shows me a balance equal to zero.
This is the Javascript code I used:
let wallet = await monerojs.createWalletFull({
networkType: MoneroNetworkType.TESTNET,
password: "<MyPass>",
mnemonic: "<myMnemonic>",
server: new monerojs.MoneroRpcConnection("http://127.0.0.1:28081"),
});
const syncResult = await wallet.sync();
console.log('Sync progress:', syncResult);
let account= await wallet.getAccount(0)
const balance=account.getBalance() // or const balance=parseInt(account.getBalance().toString(), 10)
console.log("BALANCE:")
console.log(balance)
//RETURN ME THIS:
BALANCEE
BigInteger { _d: [], _s: 0 }
or
BALANCEE
0
Can someone explain to me if I'm doing the wrong connection to the daemon or some wallet configuration?