> For the complete documentation index, see [llms.txt](https://l1x-sdk.gitbook.io/l1x-developer-interface/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://l1x-sdk.gitbook.io/l1x-developer-interface/interface-essentials/l1x-typescript-sdk/l1x-library/account-methods/how-to-import-wallet-using-private-key.md).

# How to import wallet using private key?

* **importByPrivateKey**

This function is used to import wallet using private key.

```typescript
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.

```javascript
"YOUR_PRIVATE_KEY"
```

**Returns:**

A promise that resolves with import wallet by private key.

```typescript
{
    "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"
}
```
