Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Balance discrepancies on development chain #3345

Closed
billtlee opened this issue Mar 22, 2021 · 2 comments
Closed

Balance discrepancies on development chain #3345

billtlee opened this issue Mar 22, 2021 · 2 comments
Labels

Comments

@billtlee
Copy link

Hi, I am just playing around with the api. I have started a canvas chain with canvas --dev --tmp. I am attaching to it using canvas ui and am able to make calls to get the balances for Alice, Bob, and Charlie. However, the balance I get from canvas ui is different from the balances I am getting with the api. Does anyone know what might be causing this? Here is a snip-bit of my code and the output. Seems like I am connected to the development chain since the block number matches.

  const ALICE = '5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY';
  const BOB = '5FHneW46xGXgs5mUiveU4sbTyGBzmstUspZC92UhjJM694ty';
  const CHARLIE = '5FLSigC9HGRKVhB9FiEo4Y3koPsNmBmLJbpXg2mp1hXcS59Y';

  const wsProvider = new WsProvider('ws://127.0.0.1:9944');
  const api = await ApiPromise.create({ provider: wsProvider });

  const [chain, nodeName, nodeVersion] = await Promise.all([
    api.rpc.system.chain(),
    api.rpc.system.name(),
    api.rpc.system.version()
  ]);
  console.log(`You are connected to chain ${chain} using ${nodeName} v${nodeVersion}`);
  const balances = await api.query.system.account.multi([ALICE, BOB, CHARLIE]);

Here are the outputs:
Screen Shot 2021-03-22 at 9 24 57 PM
Screen Shot 2021-03-22 at 9 25 37 PM
Screen Shot 2021-03-22 at 9 25 17 PM

@jacogr
Copy link
Member

jacogr commented Mar 22, 2021

It seems in the one case you are querying the contract balance and in the other the on-chain balance?

@jacogr jacogr added the support label Mar 22, 2021
@jacogr jacogr closed this as completed Apr 14, 2021
@polkadot-js-bot
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue if you think you have a related problem or query.

@polkadot-js polkadot-js locked as resolved and limited conversation to collaborators May 31, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants