Problem
I upgraded my project to ink4.0.0, and upgrate @polkadot/api-contract to the latest version, then I encountered an error when sending transaction.
Error: createType(Call):: Call: failed decoding contracts.call:: Struct: failed on args: {"dest":"MultiAddress","value":"Lookup78","gas_limit":"Lookup93","storage_deposit_limit":"Option<Compact<u128>>","data":"Bytes"}:: Struct: failed on gas_limit: Compact<Weight>:: u64: Negative number passed to unsigned type
Code
My code is like this
let value = 0;
let gasLimit = -1;
await contract.tx[methodName]({ value, gasLimit }, ...arguments).signAndSend(sender, (result) => {
if (result.status.isInBlock) {
console.log('in a block');
} else if (result.status.isFinalized) {
console.log('finalized');
}
});
It worked well for ink3.0.
I wonder if I have to estimate gas in ink4.0.0, or I can set gaslimit 10**12?