Balance problem in token transfer
See original GitHub issueHello, 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:
- Created 3 years ago
- Comments:9 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The issue was closed since the intent of issues is to -
This is neither, this is a local support issue for your specific setup. I suggest reading this -
You are running a master branch - https://polkadot.js.org/api/start/FAQ.html#i-am-getting-a-unknown-types-found-no-types-for-error
You were running node-template - https://polkadot.js.org/api/start/FAQ.html#i-cannot-send-transactions-from-my-node-template-based-chain
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.
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.