Transaction status is “in_ledger” but the balance of the destination wallet is still zero. Is this the final state or it should change to “confirmed” or something else? Am I missing to do something?
My node (´/network/information`) is in sync:
"sync_progress": {
"status": "ready"
},
And the wallet is ready too (/wallets/d6c1908fadf6fbb686d706cc257715774f776c66). I am not sure whether this piece is relevant or not though.
"state": {
"status": "ready"
},
The code below is the script I am running to obtain wallets’ balances.
Thanks in advance.
const { WalletServer, AddressWallet } = require('cardano-wallet-js');
let main = async () => {
let walletServer = WalletServer.init('http://localhost:8090/v2');
let information = await walletServer.getNetworkInformation();
console.log('Network Information');
console.log(information);
let wallet1 = await walletServer.getShelleyWallet('989f115d454222052deb72d8f3a65413c7fcba78');
let wallet2 = await walletServer.getShelleyWallet('d6c1908fadf6fbb686d706cc257715774f776c66');
let balance1 = await wallet1.getTotalBalance();
console.log('Wallet 1 Next Addres Total Balance', balance1);
let address1 = await wallet1.getNextAddress();
console.log('Wallet 1 Next Addres', address1.id);
let balance2 = await wallet2.getTotalBalance();
console.log('Wallet 2 Next Addres Total Balance', balance2);
let address2 = await wallet2.getNextAddress();
console.log('Wallet 2 Next Addres', address2.id);
let transactions = await wallet1.getTransactions();
console.log('\nLast transactions:', transactions[0])
}
main();
let walletServer = WalletServer.init('http://localhost:8090/v2');
let wallet1 = await walletServer.getShelleyWallet('989f115d454222052deb72d8f3a65413c7fcba78');
let wallet2 = await walletServer.getShelleyWallet('d6c1908fadf6fbb686d706cc257715774f776c66');
let balance1 = await wallet1.getTotalBalance();
console.log('Wallet 1 Total Balance', balance1);
let address1 = await wallet1.getNextAddress();
console.log('Wallet 1 Next Addres', address1.id);
let balance2 = await wallet2.getTotalBalance();
console.log('Wallet 2 Total Balance', balance2);
let address2 = await wallet2.getNextAddress();
console.log('Wallet 2 Next Addres', address2.id);
let receiverAddress = await wallet2.getNextAddress();
let amount = 10000000; // 10 ADA
let estimatedFees = await wallet1.estimateFee([receiverAddress], [amount]);
console.log('Estimated fees', estimatedFees);
let passphrase = '.........';
let metadata = {0: 'testing 3!'};
let transaction = await wallet1.sendPayment(passphrase, [receiverAddress], [amount], metadata);
console.log('Transaction', transaction);
This is my first interaction with cardano and I don’t know why it has created two outputs. Seems like the second output is pointing to another address in the origin wallet and serves as a kind of change, but it is only a guess that I have.
Let me make a question. Do I have to move the ADA received from the address to the wallet?