This function is used to import wallet using private key.
import { L1XProvider, GetAccountStateArg } from "@l1x/l1x-wallet-sdk";
let l1xProvider = new L1XProvider({
clusterType: "mainnet",
endpoint: "https://v2-mainnet-rpc.l1x.foundation",
});
let _privateKey = "YOUR_PRIVATE_KEY";
l1xProvider.wallet.importByPrivateKey(_privateKey)
.then((response) => console.log(response)) // log response
.catch((err) => console.error(err));
The parameters to import the wallet using private key.
A promise that resolves with import wallet by private key.
{
"private_key": "YOUR_PRIVATE_KEY",
"public_key": "YOUR_PUBLIC_KEY",
"public_key_bytes": Uint8Array(33) [
2, 21, 237, 183, 233, 166, 79, 153,
112, 198, 13, 148, 184, 102, 183, 54,
134, 152, 13, 115, 72, 116, 56, 42,
209, 0, 39, 0, 229, 216, 112, 217,
69
],
"address": "75104938baa47c54a86004ef998cc76c2e616289",
"address_with_prefix": "0x75104938baa47c54a86004ef998cc76c2e616289"
}