βοΈfetchWalletFromPrivateKey
Last updated
// import Nest25 Casper library
const { Casper } = require('@nest25/casper-lib');
// create a new Casper instance
const casper = new Casper();
// set testnet variables
const privateKey = 'your-private-key';
const RPC_API = 'https://rpc.testnet.casperlabs.io/rpc';
async function main() {
// fetch wallet from private key
let { keyPair } = await casper.fetchWalletfromPrivateKey(privateKey, RPC_API);
console.log(keyPair);
}
// call main function
main();
``` {
keyPair: t {
publicKey: t { isCLValue: true, data: [Uint8Array], tag: 1 },
privateKey: Uint8Array(64) [
136, 103, 79, 12, 53, 66, 163, 104, 97, 238, 253,
201, 63, 217, 28, 226, 8, 28, 163, 193, 111, 158,
233, 203, 206, 234, 204, 112, 91, 196, 214, 176, 58,
21, 106, 80, 252, 98, 132, 186, 67, 106, 237, 234,
249, 107, 85, 172, 26, 12, 87, 238, 159, 138, 70,
191, 28, 101, 24, 175, 233, 178, 245, 108
],
signatureAlgorithm: 'ed25519'
}
}