question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Balance problem in token transfer

See original GitHub issue

Hello, I want to transfer tokens. I was able to send a transaction with the code I wrote. Balance in transaction was 0 in transaction. Token was not transferred and GAS received.

const { ApiPromise, WsProvider } = require('@polkadot/api');
const { Keyring } = require("@polkadot/keyring");
const { cryptoWaitReady } = require("@polkadot/util-crypto");
const { Balance } = require("@polkadot/types/interfaces");

async function main () {
    const wsProvider = new WsProvider('ws://127.0.0.1:9944');
    const api = await ApiPromise.create({ provider: wsProvider, types: {
        Address: 'AccountId',
        LookupSource: 'AccountId',
    }});
    
    cryptoWaitReady();
    const keyring = new Keyring({ type: 'sr25519' });
    const pk = keyring.addFromMnemonic('smoke indicate blush ancient return unfold matter bind fiscal tired catch safe');
    const {Nonce} = await api.query.system.account(pk.address);
    
    const txn = await api.tx.balances.transfer('5HGjWAeFDfFCWPsjFQdVV2Msvz2XtMktvgocEZcCj68kUMaw', 700).signAndSend(pk, { nonce: Nonce });
    console.log(txn.toJSON());
}
main().catch(console.error).finally(() => process.exit());

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
jacogrcommented, May 23, 2020

The issue was closed since the intent of issues is to -

  • log enhancements
  • log bugs

This is neither, this is a local support issue for your specific setup. I suggest reading this -

If you want specific support, I would suggest joining the support channels on Riot. If is not like I don’t want to help, but support really should be directed to the correct channels. For both issues detailed here there are FAQ links.

0reactions
polkadot-js-botcommented, Jun 4, 2021

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

What to do when your balance of tokens is incorrect
First of all, check the wallet address to which you are receiving tokens to see the current balance of your tokens. You do...
Read more >
Transfer function not changing custom token(ERC20) balance ...
The transaction is successfully performed but the amount of custom token in my wallet does not change after the transaction is completed. Why...
Read more >
ERC-20 Token Transfer Might Have Failed
The Token contract is locked or paused (tokens are not transferable yet). · The sending From address has an insufficient token balance. ·...
Read more >
ERC20 transferFrom fails "ERC20: transfer amount exceeds ...
The error is because the Owner contract has a 0 token balance. Replace the admin address on the Token contract with the address...
Read more >
Token transfers and balance updates
Source accounts are debited whenever new tokens are minted. A balance update refers to a source account if and only if the field...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found