sway
December 19, 2022, 1:22pm
1
after team added npm package for wallet https://www.npmjs.com/package/@fuel-wallet/sdk
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
6 Likes
sarah
December 19, 2022, 3:43pm
2
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?
3 Likes
sway
December 19, 2022, 3:50pm
3
I don’t use next.js, just usual react app
sarah
December 19, 2022, 4:00pm
4
ok, thanks for letting me know. What does the error say?
stacio
December 19, 2022, 8:37pm
5
@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
sway
December 19, 2022, 10:23pm
6
stacio:
fuel-ts/wallet
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
sway
December 19, 2022, 10:24pm
7
error is saying that this is not function
stacio
December 20, 2022, 10:01am
8
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
sway
December 20, 2022, 12:37pm
9
but I do use it after i call connect function and it returned me true as a proof it connected.
sway
December 20, 2022, 12:46pm
10
@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);
stacio
December 20, 2022, 6:16pm
11
Have you also updated the fuel wallet? Install | Fuel Wallet
sway
December 20, 2022, 11:53pm
12
yay, it works with updated wallet version, thanks!
2 Likes