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

Why did all my tansfer dot transaction fail, thank you #6059

Open
7 tasks
shihuajin111 opened this issue Jan 8, 2025 · 0 comments
Open
7 tasks

Why did all my tansfer dot transaction fail, thank you #6059

shihuajin111 opened this issue Jan 8, 2025 · 0 comments

Comments

@shihuajin111
Copy link

const {ApiPromise, WsProvider} = require("@polkadot/api");
const {Keyring} = require("@polkadot/keyring");

async function main() {
const url_data = "wss://rpc.polkadot.io"
const provider = new WsProvider(url_data);
const api = await ApiPromise.create({provider});
const mnemonic = "my owner phrase "
const keyring = new Keyring();
const pair = keyring.createFromUri(mnemonic);

keyring.setSS58Format(0);
console.log('Polkadot', pair.address);
const now = await api.query.timestamp.now();

// Retrieve the account balance & nonce via the system module
const { nonce, data: balance } = await api.query.system.account(pair.address);
console.log(${balance.frozen})
available=${balance.free} -${balance.frozen}
console.log(available)
console.log(${now}: balance of ${balance.free} and a nonce of ${nonce});
if (available > 3204355237){
try {
const txHash = await api.tx.balances
.transferKeepAlive("1FEG5Yni2RQMbccXHsZAEX9X5ZxZhpekNqEjurm9oQ49FvT", 12345)
.signAndSend(pair);

// Show the hash
console.log(Submitted with hash ${txHash});
return
} catch (e) {
console.log(e); // Logs the error
return
}
}
setTimeout(main, 1000);
}
try {
main().catch(console.error);
} catch (e) {
console.log(e); // Logs the error
}

  • I'm submitting a ...
  • Bug report
  • Feature request
  • [1] Support request
  • Other
  • What is the current behavior and expected behavior?
  • What is the motivation for changing the behavior?
  • Please tell us about your environment:
  • Version:

  • Environment:

    • Node.js
    • Browser
    • [ 1] Other (limited support for other environments)
  • Language:

    • [ 1] JavaScript
    • TypeScript (include tsc --version)
    • Other
@shihuajin111 shihuajin111 changed the title Why did all my transaction fail, thank you Why did all my tansfer dot transaction fail, thank you Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant