# Type 'WalletUnlocked' is not assignable to type 'Account'

**URL:** <https://forum.fuel.network/t/type-walletunlocked-is-not-assignable-to-type-account/6543>\
**Category:** TypeScript SDK\
**Created:** [August 28, 2024, 10:58pm UTC](https://forum.fuel.network/t/type-walletunlocked-is-not-assignable-to-type-account/6543 "2024-08-28T22:58:50Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![xpluscal](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/xpluscal/32/3337_2.png) [@xpluscal](https://forum.fuel.network/u/xpluscal)\
**Post date:** [August 28, 2024, 10:58pm UTC](https://forum.fuel.network/t/type-walletunlocked-is-not-assignable-to-type-account/6543/1 "2024-08-28T22:58:51Z")

</div>

With the lastest fuel 0.94.0 when trying to deploy a contract with this:

```auto
// Create a wallet instance from the address
const wallet = Wallet.fromPrivateKey(process.env.WALLET_PRIVATE_KEY as string);
  
// Connect to the testnet provider
const provider = await Provider.create('https://testnet.fuel.network/v1/graphql');
  
// Set the provider for the wallet
wallet.connect(provider);

const myContract = new MyContract(
  process.env.CONTRACT_ID as string,
  wallet
);

```

Errors with TS error:  
Argument of type ‘WalletUnlocked’ is not assignable to parameter of type ‘Account | Provider’.

According to docs WalletUnlocked is a child of BaseUnlocked is a child of Account

This is copying from the latest docs.  
Help appreciated.

---

<div class="post-metadata">

**Author:** ![naz3eh](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/naz3eh/32/2025_2.png) [@naz3eh](https://forum.fuel.network/u/naz3eh)\
**Post date:** [August 29, 2024, 3:53am UTC](https://forum.fuel.network/t/type-walletunlocked-is-not-assignable-to-type-account/6543/2 "2024-08-29T03:53:54Z")

</div>

Thanks for reporting this, will look into it and get back to you

---

<div class="post-metadata">

**Author:** ![naz3eh](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/naz3eh/32/2025_2.png) [@naz3eh](https://forum.fuel.network/u/naz3eh)\
**Post date:** [August 29, 2024, 4:04am UTC](https://forum.fuel.network/t/type-walletunlocked-is-not-assignable-to-type-account/6543/3 "2024-08-29T04:04:48Z")

</div>

hey @xpluscal, I think to use the wallet with a contract, you need to connect it to a provider. Can you please try this code?

```auto
import { Wallet, Provider } from 'fuels';

// Create a provider, with the Latest Testnet URL.
const provider = await Provider.create('https://testnet.fuel.network/v1/graphql');

// Create a wallet instance from the private key and connect it to the provider
const wallet = Wallet.fromPrivateKey(process.env.WALLET_PRIVATE_KEY as string, provider);

// Instantiate the contract with the wallet
const myContract = new MyContract(
  process.env.CONTRACT_ID as string,
  wallet
);

```

---

<div class="post-metadata">

**Author:** ![xpluscal](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/xpluscal/32/3337_2.png) [@xpluscal](https://forum.fuel.network/u/xpluscal)\
**Post date:** [August 29, 2024, 6:14am UTC](https://forum.fuel.network/t/type-walletunlocked-is-not-assignable-to-type-account/6543/4 "2024-08-29T06:14:54Z")

</div>

I’ve tried that too, same result @naz3eh

---

<div class="post-metadata">

**Author:** ![p.s](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/p.s/32/2491_2.png) [@p.s](https://forum.fuel.network/u/p.s)\
**Post date:** [August 29, 2024, 7:23am UTC](https://forum.fuel.network/t/type-walletunlocked-is-not-assignable-to-type-account/6543/5 "2024-08-29T07:23:44Z")

</div>

Hey @xpluscal 👋

I can’t see anything wrong with the code extract you’ve provided, would it be possible to share the generated types for the contract?

Also, how does this error manifest itself: is it via your IDE, or with a type checking command such as `tsc`?

---

<div class="post-metadata">

**Author:** ![xpluscal](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/xpluscal/32/3337_2.png) [@xpluscal](https://forum.fuel.network/u/xpluscal)\
**Post date:** [August 29, 2024, 8:24am UTC](https://forum.fuel.network/t/type-walletunlocked-is-not-assignable-to-type-account/6543/6 "2024-08-29T08:24:51Z")

</div>

Hey @p.s the issue is both a ts issue in the IDE as well as when compiling the script with TS node, I’ll run it with a ts-ignore once home.

---

<div class="post-metadata">

**Author:** ![xpluscal](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/xpluscal/32/3337_2.png) [@xpluscal](https://forum.fuel.network/u/xpluscal)\
**Post date:** [August 29, 2024, 8:26am UTC](https://forum.fuel.network/t/type-walletunlocked-is-not-assignable-to-type-account/6543/7 "2024-08-29T08:26:33Z")

</div>

Ps: not having the issue in our tests with launchTestNode, all tests passing there.

---

<div class="post-metadata">

**Author:** ![danielbate](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/danielbate/32/1617_2.png) [@danielbate](https://forum.fuel.network/u/danielbate)\
**Post date:** [August 30, 2024, 1:40pm UTC](https://forum.fuel.network/t/type-walletunlocked-is-not-assignable-to-type-account/6543/8 "2024-08-30T13:40:26Z")

</div>

I do not have the same error for [local or testnet](https://gist.github.com/danielbate/92147b211fb5c22131ecc62156bad460).

You could try upgrading to `0.94.2` but that type inheritance from `Wallet` → `Account` has been around for many versions.

Could you try creating a reproduction?

---

<div class="post-metadata">

**Author:** ![xpluscal](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/xpluscal/32/3337_2.png) [@xpluscal](https://forum.fuel.network/u/xpluscal)\
**Post date:** [September 3, 2024, 3:46am UTC](https://forum.fuel.network/t/type-walletunlocked-is-not-assignable-to-type-account/6543/9 "2024-09-03T03:46:08Z")

</div>

Yeah hence the confusion, as this has worked smoothly ever since (until last week that is). I’ll dig
