Can't call functions getWallet and getProvider

after team added npm package for wallet
I am trying to call function in my frontend app and here is the problem that I get

const contract = TokenContractAbi__factory.connect(assetId, wallet);

To pass wallet object I was thinking to create instance from my account address, but I keep i keep getting error for calling functions signMessage, getWallet, getProvider and etc.

Same error appears on wallet tutorial page here How to Use | Fuel Wallet


If you’re using Next.js, try setting esmExternals to false in your next config. You can see an example here: fuels-wallet/next.config.js at master · FuelLabs/fuels-wallet · GitHub

If that doesn’t help, can you share the error you are seeing?


I don’t use next.js, just usual react app

ok, thanks for letting me know. What does the error say?

@sway can you make sure you are using the latest version of fuels@0.26.0 the issue with the type compatibility was fixed on this one before it was not possible to pass the wallet on the connect. Also make sure you are using @fuel-ts/wallet@0.2.0

yes, All versions are the lates ones.
for more code context here is the repo where I am trying to create connections

this is the place where I tried to call these functions here
and this is the place where I connect with wallet here

error is saying that this is not function

This can happen because the FuelWeb3 is not injected yet. You need to wait for it to be loaded, before using it.

You can look at some temporary implementation examples here: fuels-wallet/useFuelWeb3.tsx at master · FuelLabs/fuels-wallet · GitHub
and here:
fuels-wallet/useIsConnected.tsx at master · FuelLabs/fuels-wallet · GitHub

We are looking to improve this track for when the script is injected. You can keep track of it here: Improve the code injection of FuelWeb3 on window · Issue #308 · FuelLabs/fuels-wallet · GitHub

1 Like

but I do use it after i call connect function and it returned me true as a proof it connected.

@stacio so how can I get it fixed?

i need same lines of code as in tutorial and its not working

const provider = new FuelWeb3Provider(window.FuelWeb3);
4const wallet = Wallet.fromAddress(account, provider);

Have you also updated the fuel wallet? Install | Fuel Wallet

yay, it works with updated wallet version, thanks!