Transaction "in_ledger" but balance not changed

HI,

I’m playing with cardano-wallet-js and I am not able to transfer ADAs between wallets created by me.

i’m running testnet and I’ve created this transaction:

  • 70ba6326de63c76c51dbfdf931f7159451684ba298c4ed4a4fbc5322a8d2f224

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();

hi,

the node is 100% synced?

This is my /network/information output:

{
  "network_tip": {
    "time": "2021-11-28T14:06:16Z",
    "epoch_number": 171,
    "absolute_slot_number": 43739160,
    "slot_number": 236760
  },
  "node_era": "alonzo",
  "node_tip": {
    "height": {
      "quantity": 3109927,
      "unit": "block"
    },
    "time": "2021-11-28T14:06:12Z",
    "epoch_number": 171,
    "absolute_slot_number": 43739156,
    "slot_number": 236756
  },
  "sync_progress": {
    "status": "ready"
  },
  "next_epoch": {
    "epoch_start_time": "2021-11-30T20:20:16Z",
    "epoch_number": 172
  }
}

Not synced, we are in epoch 305, wait for the node to sync before to submit transactions… or u are on tesnet?

I’m on testnet.

This is your transaction?

https://explorer.cardano-testnet.iohkdev.io/en/transaction?id=70ba6326de63c76c51dbfdf931f7159451684ba298c4ed4a4fbc5322a8d2f224

2 addresses

https://explorer.cardano-testnet.iohkdev.io/en/address?address=addr_test1qzxmlag3xyujhlpka543wx86zfpys3duwlegehm2qg02gvlgrpmdqazdf0j5rver74m86hrxunte6fvrflwy7wde6hzq0qxsnd

and

https://explorer.cardano-testnet.iohkdev.io/en/address?address=addr_test1qp0vsq7wyehlanhuu2gd298mm7v42dglxyf4hzqshtua9v09anm3ktlq69wzekpclawj82cfghct7m3c2gtvhqhaczvsq6q88a

Yes, this is the transaction that I want to use to transfer 10 ADAs between accounts.

The origin wallet is is:

989f115d454222052deb72d8f3a65413c7fcba78

while the destination wallet and address are:

d6c1908fadf6fbb686d706cc257715774f776c66

addr_test1qp0vsq7wyehlanhuu2gd298mm7v42dglxyf4hzqshtua9v09anm3ktlq69wzekpclawj82cfghct7m3c2gtvhqhaczvsq6q88a

This was the code I used:

  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?

Yes, that is my transaction.

Follow this guide, step 18.9 Send a simple transaction example

replace mainnet with testnet


--testnet-magic 1097911063

Thank you @Alexd1985 .

Does anyone else has used cardano-wallet-js and knows what I am doing wrong?