sway
December 24, 2022, 12:23am
1
I have tried to call simulate function and faced error “Error: not enough resources to fit the target:” when I have attached just generated seed phrase
import { Provider, Wallet } from "fuels";
const mn = Mnemonic.generate();
const seed = Mnemonic.mnemonicToSeed(mn);
const wallet = Wallet.fromSeed(seed, "", new Provider(NODE_URL));
const tokenContract = TokenAbi__factory.connect(b.assetId, wallet);
tokenContract.functions.already_minted(b256Address).simulate()
But after I have minted some ETH for new address this error disappeared.
Is there any way to check contract state without providing any signature ?
22 Likes
stacio
January 9, 2023, 6:20pm
3
You can call a contract method without adding signatures by calling .get()
method. This method executes a dryRun transaction without adding signatures.
import { Provider, Wallet } from "fuels";
const mn = Mnemonic.generate();
const seed = Mnemonic.mnemonicToSeed(mn);
const wallet = Wallet.fromSeed(seed, "", new Provider(NODE_URL));
const tokenContract = TokenAbi__factory.connect(b.assetId, wallet);
tokenContract.functions.already_minted(b256Address).get()
2 Likes
sway
January 17, 2023, 1:52pm
4
but anyway I need to create new wallet instance?
system
Closed
February 20, 2023, 6:59am
5
This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.