# NodeModules:Unable to import 'generateTestWallet'

**URL:** <https://forum.fuel.network/t/nodemodules-unable-to-import-generatetestwallet/5859>\
**Category:** TypeScript SDK\
**Tags:** feedback\
**Created:** [June 17, 2024, 8:19am UTC](https://forum.fuel.network/t/nodemodules-unable-to-import-generatetestwallet/5859 "2024-06-17T08:19:56Z")\
**Posts on this page:** 15\
**Page:** 1

<div class="post-metadata">

**Author:** ![eesheng](https://avatars.discourse-cdn.com/v4/letter/e/2bfe46/32.png) [@eesheng](https://forum.fuel.network/u/eesheng)\
**Post date:** [June 17, 2024, 8:19am UTC](https://forum.fuel.network/t/nodemodules-unable-to-import-generatetestwallet/5859/1 "2024-06-17T08:19:56Z")

</div>

Hi, wanted to test out generateTestWallet, but it seems that it doesn’t work even if added into index.d.ts.

```auto
import { generateTestWallet } from '@fuel-ts/account/test-utils';
or 
import { generateTestWallet } from 'fuels';

```

Tried to fix it, but still doesn’t work:

```auto
node_modules/@fuel-ts/account/dist/index.d.ts
import './test-utils.js';
import './configs.js';
export * from './account';
export * from './wallet';
export * from './hdwallet';
export * from './mnemonic';
export * from './wordlists';
export * from './signer';
export * from './wallet-manager';
export * from './predicate';
export * from './providers';
export * from './connectors';
export * from './test-utils'; // added but doesn't work
//# sourceMappingURL=index.d.ts.map

```

Error Message:

```auto
Module '"fuels"' has no exported member 'generateTestWallet'.ts(2305)

```

---

<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:** [June 17, 2024, 8:23am UTC](https://forum.fuel.network/t/nodemodules-unable-to-import-generatetestwallet/5859/2 "2024-06-17T08:23:46Z")

</div>

> [@eesheng](#):
>
> `@fuel-ts/account`

Hi @eesheng 👋

Could you share your `package.json` file please?

---

<div class="post-metadata">

**Author:** ![eesheng](https://avatars.discourse-cdn.com/v4/letter/e/2bfe46/32.png) [@eesheng](https://forum.fuel.network/u/eesheng)\
**Post date:** [June 17, 2024, 8:25am UTC](https://forum.fuel.network/t/nodemodules-unable-to-import-generatetestwallet/5859/3 "2024-06-17T08:25:33Z")

</div>

```auto
{
  "name": "fuelswapv1",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@fuels/connectors": "^0.5.0",
    "@fuels/react": "^0.20.0",
    "@radix-ui/react-accordion": "^1.1.2",
    "@radix-ui/react-label": "^2.0.2",
    "@radix-ui/react-navigation-menu": "^1.1.4",
    "@tanstack/react-query": "^5.45.0",
    "class-variance-authority": "^0.7.0",
    "clsx": "^2.1.1",
    "flowbite": "^2.3.0",
    "flowbite-react": "^0.9.0",
    "fuels": "^0.89.2",
    "lucide-react": "^0.395.0",
    "next": "14.2.4",
    "next-themes": "^0.3.0",
    "radix-ui": "^1.0.1",
    "react": "^18",
    "react-dom": "^18",
    "react-hot-toast": "^2.4.1",
    "react-use": "^17.5.0"
  },
  "devDependencies": {
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "autoprefixer": "^10.4.19",
    "eslint": "^8",
    "eslint-config-next": "14.2.4",
    "postcss": "^8.4.38",
    "tailwindcss": "^3.4.4",
    "typescript": "^5"
  }
}

```

---

<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:** [June 17, 2024, 9:42am UTC](https://forum.fuel.network/t/nodemodules-unable-to-import-generatetestwallet/5859/4 "2024-06-17T09:42:54Z")

</div>

Thanks @eesheng.

You can access the `generateTestWallet` via the `fuels/test-utils` namespace.

```ts
import { generateTestWallet } from 'fuels/test-utils';

```

---

<div class="post-metadata">

**Author:** ![eesheng](https://avatars.discourse-cdn.com/v4/letter/e/2bfe46/32.png) [@eesheng](https://forum.fuel.network/u/eesheng)\
**Post date:** [June 18, 2024, 3:36am UTC](https://forum.fuel.network/t/nodemodules-unable-to-import-generatetestwallet/5859/5 "2024-06-18T03:36:05Z")

</div>

> [@p.s](#):
>
> `import { generateTestWallet } from 'fuels/test-utils';`

HI it doesn’t work

```auto
Cannot find module 'fuels/test-utils' or its corresponding type declarations.ts(2307

```

---

<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:** [June 18, 2024, 12:51pm UTC](https://forum.fuel.network/t/nodemodules-unable-to-import-generatetestwallet/5859/6 "2024-06-18T12:51:00Z")

</div>

Apologies, potentially that change is awaiting release.

Could you try using the following import:

```ts
import { generateTestWallet } from '@fuel-ts/account/test-utils';

```

You will need to install the `@fuel-ts/account` package.

---

<div class="post-metadata">

**Author:** ![eesheng](https://avatars.discourse-cdn.com/v4/letter/e/2bfe46/32.png) [@eesheng](https://forum.fuel.network/u/eesheng)\
**Post date:** [June 18, 2024, 1:58pm UTC](https://forum.fuel.network/t/nodemodules-unable-to-import-generatetestwallet/5859/7 "2024-06-18T13:58:28Z")

</div>

Still doesn’t work, `Could not find a declaration file for module '@fuel-ts/account/test-utils'. `

This is my package.json when I ran the command `pnpm install @fuel-ts/account`

```auto
{
  "name": "fuelswapv1",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint"
  },
  "dependencies": {
    "@fuel-ts/account": "^0.89.2",
    "@fuels/connectors": "^0.5.0",
    "@fuels/react": "^0.20.0",
    "@radix-ui/react-accordion": "^1.1.2",
    "@radix-ui/react-label": "^2.0.2",
    "@radix-ui/react-navigation-menu": "^1.1.4",
    "@tanstack/react-query": "^5.45.0",
    "class-variance-authority": "^0.7.0",
    "clsx": "^2.1.1",
    "flowbite": "^2.3.0",
    "flowbite-react": "^0.9.0",
    "fuels": "^0.89.2",
    "lucide-react": "^0.395.0",
    "next": "14.2.4",
    "next-themes": "^0.3.0",
    "radix-ui": "^1.0.1",
    "react": "^18",
    "react-dom": "^18",
    "react-hot-toast": "^2.4.1",
    "react-use": "^17.5.0"
  },
  "devDependencies": {
    "@types/node": "^20",
    "@types/react": "^18",
    "@types/react-dom": "^18",
    "autoprefixer": "^10.4.19",
    "eslint": "^8",
    "eslint-config-next": "14.2.4",
    "postcss": "^8.4.38",
    "tailwindcss": "^3.4.4",
    "typescript": "^5"
  }
}

```

When will the release be out?

---

<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:** [June 18, 2024, 5:51pm UTC](https://forum.fuel.network/t/nodemodules-unable-to-import-generatetestwallet/5859/8 "2024-06-18T17:51:59Z")

</div>

> [@eesheng](#):
>
> Still doesn’t work, `Could not find a declaration file for module '@fuel-ts/account/test-utils'. `
> 
> This is my package.json when I ran the command `pnpm install @fuel-ts/account`

This is my mistake - I created the following [issue](https://github.com/FuelLabs/fuels-ts/issues/2547), which has been resolve in [#2548](https://github.com/FuelLabs/fuels-ts/pull/2548). This has been released with v0.90.0.

---

<div class="post-metadata">

**Author:** ![eesheng](https://avatars.discourse-cdn.com/v4/letter/e/2bfe46/32.png) [@eesheng](https://forum.fuel.network/u/eesheng)\
**Post date:** [June 20, 2024, 1:09pm UTC](https://forum.fuel.network/t/nodemodules-unable-to-import-generatetestwallet/5859/9 "2024-06-20T13:09:03Z")

</div>

Hi, is there an update going on? Not sure why it doesn’t work and the documentation page is down [https://docs.fuel.network/docs/fuels-ts/wallets/test-wallets/#setting-up-test-wallets](https://docs.fuel.network/docs/fuels-ts/wallets/test-wallets/#setting-up-test-wallets)

This is the code and I am running the local fuel node.

```auto
import { NODE_URL } from "../../lib";
import { Provider, Wallet, WalletUnlocked, Signer, CoinQuantity, } from "fuels";
import { generateTestWallet } from '@fuel-ts/account/test-utils';
import { useState } from "react";
import useAsync from "react-use/lib/useAsync";
export const useFaucet = () => {
  const [faucetWallet, setFaucetWallet] = useState<WalletUnlocked>();

  useAsync(async () => {
    if (!faucetWallet) {
      const provider = await Provider.create(NODE_URL);
      const baseAssetId = provider.getBaseAssetId();
      const myWallet: WalletUnlocked = await generateTestWallet(provider, [[10, baseAssetId]]);
      const signer = new Signer("0x01");
      const balances: CoinQuantity[] = await myWallet.getBalances();
      console.log('Local Provider address', signer)
      console.log('Local Provider Balances', balances)

      setFaucetWallet(myWallet);
    }
  }, [faucetWallet]);

  return {
    faucetWallet,
  };
};

```

Error:

```auto
 Property '#private' in type 'Provider' refers to a different member that cannot be accessed from within type 'Provider'.ts(2345)

```

---

<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:** [June 24, 2024, 10:17am UTC](https://forum.fuel.network/t/nodemodules-unable-to-import-generatetestwallet/5859/10 "2024-06-24T10:17:42Z")

</div>

Hey @eesheng,

Apologies for the late reply, did you manage to resolve this issue?

If you have not, could you [add an issue](https://github.com/FuelLabs/fuels-ts/issues/new/choose) for this and we can triage it accordingly.

---

<div class="post-metadata">

**Author:** ![miguel](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/miguel/32/3064_2.png) [@miguel](https://forum.fuel.network/u/miguel)\
**Post date:** [June 25, 2024, 12:15pm UTC](https://forum.fuel.network/t/nodemodules-unable-to-import-generatetestwallet/5859/11 "2024-06-25T12:15:31Z")

</div>

Hey @eesheng! Where did you find that link to the docs?

---

<div class="post-metadata">

**Author:** ![eesheng](https://avatars.discourse-cdn.com/v4/letter/e/2bfe46/32.png) [@eesheng](https://forum.fuel.network/u/eesheng)\
**Post date:** [June 29, 2024, 6:27am UTC](https://forum.fuel.network/t/nodemodules-unable-to-import-generatetestwallet/5859/12 "2024-06-29T06:27:31Z")

</div>

Hi the docs page has been updated and removed.

---

<div class="post-metadata">

**Author:** ![maschad](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/maschad/32/2710_2.png) [@maschad](https://forum.fuel.network/u/maschad)\
**Post date:** [June 30, 2024, 11:04pm UTC](https://forum.fuel.network/t/nodemodules-unable-to-import-generatetestwallet/5859/13 "2024-06-30T23:04:54Z")

</div>

Hi @eesheng I’ve responded to the related issue you raised [here](https://github.com/FuelLabs/fuels-ts/issues/2617)

For the use case you have presented `generateTestWallet` would not be appropriate. We are moving away from `generateTestWallet` in favour of more explicit resource management through `launchTestNode` , you can read more [here](https://docs.fuel.network/docs/fuels-ts/testing/launching-a-test-node/#launching-a-test-node)

Given you want to instantiate a wallet in the browser though I recommend you follow this [guide](https://docs.fuel.network/docs/fuels-ts/wallets/instantiating-wallets/#instantiating-wallets)

Please let us know if this resolves your issue.

---

<div class="post-metadata">

**Author:** ![eesheng](https://avatars.discourse-cdn.com/v4/letter/e/2bfe46/32.png) [@eesheng](https://forum.fuel.network/u/eesheng)\
**Post date:** [August 12, 2024, 7:37am UTC](https://forum.fuel.network/t/nodemodules-unable-to-import-generatetestwallet/5859/14 "2024-08-12T07:37:28Z")

</div>

> [@p.s](#):
>
> `generateTestWallet `

1. Let say I generate a new wallet `const unlockedWallet: WalletUnlocked = Wallet.generate();`, do I still need to connect to a provider?

2. How do you add faucets to our locally instantiated wallets? Not the connected provider

---

<div class="post-metadata">

**Author:** ![maschad](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.fuel.network/maschad/32/2710_2.png) [@maschad](https://forum.fuel.network/u/maschad)\
**Post date:** [August 12, 2024, 10:50pm UTC](https://forum.fuel.network/t/nodemodules-unable-to-import-generatetestwallet/5859/15 "2024-08-12T22:50:31Z")

</div>

@eesheng I’d just like to [re-iterate](https://forum.fuel.network/t/nodemodules-unable-to-import-generatetestwallet/5859/13) that it seems for your use case `generateTestWallet` is not appropriate, as it primarily for unit tests. Also, we are going to be deprecating that utility in short order in favour of [`launchTestNode`](https://docs.fuel.network/docs/fuels-ts/testing/launching-a-test-node/#launching-a-test-node)

You should either [install a browser wallet](https://docs.fuel.network/guides/counter-dapp/building-a-frontend/#install-the-fuel-browser-wallet) or instantiate a browser wallet as shown [here](https://github.com/FuelLabs/fuels-ts/blob/master/apps/create-fuels-counter-guide/src/hooks/useBrowserWallet.tsx#L16) with `useBrowserWallet`

> 1. Let say I generate a new wallet `const unlockedWallet: WalletUnlocked = Wallet.generate();`, do I still need to connect to a provider?

More than likely any wallet you generate you will want to interact with the chain, and thus that would require connecting to a provider, which can be passed [in as a parameter](https://docs.fuel.network/docs/fuels-ts/wallets/private-keys/#creating-a-wallet-from-a-private-key) to the `generate` function.

> 1. How do you add faucets to our locally instantiated wallets? Not the connected provider

I’m not sure I understand the question, if you would like to send testnet assets to a generated wallet then you can send it to that wallet’s address.
