We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
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);
${balance.frozen}
${balance.free}
${now}: balance of ${balance.free} and a nonce of ${nonce}
// 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 }
Submitted with hash ${txHash}
Version:
Environment:
Language:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
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
}
Version:
Environment:
Language:
The text was updated successfully, but these errors were encountered: