How to import wallet using private key?
importByPrivateKey
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));Parameters:
The parameters to import the wallet using private key.
"YOUR_PRIVATE_KEY"Returns:
A promise that resolves with import wallet by private key.
Last updated