-
-
Save PrathamRawat/9519c172a009b6511c2b8c673c1bac78 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let f = async function() { | |
// Conseil Storage | |
const conseilServer = { | |
url: 'https://conseil-dev.cryptonomic-infra.tech:443', | |
apiKey: "82be0ebc-f4b5-454b-962c-d50996e91a91", //Replace this with your own key from Nautilus Cloud | |
network: 'carthagenet' | |
}; | |
// URL of the Cryptonomic Hosted Tezos Node | |
const tezosNode = "https://tezos-dev.cryptonomic-infra.tech:443"; | |
// This is downloaded from the testnet faucet, you should replace this with your downloaded file! | |
const faucetAccount = { | |
"mnemonic": [ | |
"oxygen", | |
"number", | |
"control", | |
"carpet", | |
"primary", | |
"fiber", | |
"live", | |
"update", | |
"soon", | |
"panic", | |
"mobile", | |
"company", | |
"motion", | |
"bitter", | |
"wine" | |
], | |
"secret": "dadfae79cb26afe18e0b56c7257728cc5c4f2775", | |
"amount": "15444107288", | |
"pkh": "tz1MFr1SGEf42gGnsPHEP6EZ7McfNE2PLnYS", | |
"password": "I2rQel6sA7", | |
"email": "lhuaydks.darobazo@tezos.example.org" | |
} | |
console.log("bruh") | |
// This construct stores the keys for our downloaded account | |
const keystore = await conseiljs.TezosWalletUtil.unlockFundraiserIdentity( | |
faucetAccount.mnemonic.join(' '), | |
faucetAccount.email, | |
faucetAccount.password, | |
faucetAccount.pkh | |
); | |
console.log(`public key: ${keystore.publicKey}`); | |
console.log(`secret key: ${keystore.privateKey}`); | |
// This sends an account activation operation to the Tezos Node | |
let activationResult = await conseiljs.TezosNodeWriter.sendIdentityActivationOperation( | |
tezosNode, | |
keystore, | |
faucetAccount.secret | |
); | |
console.log(activationResult) | |
// This reveals the account's public key on the chain to be used to send and receive operations | |
let revelationResult = await conseiljs.TezosNodeWriter.sendIdentityActivationOperation( | |
tezosNode, | |
keystore, | |
faucetAccount.secret | |
); | |
console.log(revelationResult) | |
// Function to parse through the returned operation ID and return the actual ID without any "artifacts" | |
function clearRPCOperationGroupHash(hash) { | |
return hash.replace(/\"/g, '').replace(/\n/, ''); | |
} | |
// Send the transaction operation to the tezos node | |
const transactionResult = await conseiljs.TezosNodeWriter.sendTransactionOperation( | |
tezosNode, | |
keystore, | |
"tz1T8UYSbVuRm6CdhjvwCfXsKXb4yL9ai9Q3", //This is a random testnet account address, feel free to change it to whatever you want | |
10000000, | |
100000, | |
"" | |
); | |
console.log(`Injected operation group id ${clearRPCOperationGroupHash(transactionResult.operationGroupID)}`); | |
} | |
f() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment