I am getting “The script reverted with reason Unknown error” when trying to call the contract function. What can be the reason?
Following is the contract function I am trying to access
#[storage(read)]
fn get_item(item_id: u64) -> Item{
return storage.lease_map.get(item_id).try_read().unwrap();
}
This is how my javascript looks like:
async getItem(itemId: string) {
if (this.contractO != null) {
let value = await this.contractO.functions
.get_item(itemId)
.callParams({
gasLimit: 1,
})
.txParams({
gasPrice: 1,
gasLimit: 100_000,
}).call();
console.log(value)
return value
} else {
return null
}
}
fuelup shows
installed toolchains
latest-x86_64-unknown-linux-gnu (default)
active toolchain
latest-x86_64-unknown-linux-gnu (default)
forc : 0.49.3
- forc-client
- forc-deploy : 0.49.3
- forc-run : 0.49.3
- forc-crypto : 0.49.3
- forc-doc : 0.49.3
- forc-explore : 0.28.1
- forc-fmt : 0.49.3
- forc-lsp : 0.49.3
- forc-tx : 0.49.3
- forc-wallet : 0.4.3
fuel-core : 0.22.1
fuel-core-keygen : 0.22.1
fuels versions
forc : 0.54.0
forc-wallet : 0.54.0
