This PR addresses a task in #110 which modifies how nested results are handled during a query call via Contract or contract deployment via ContractDeployer.
Now Contract and ContractDeployer will directly return the inner data (the result of the message) and will throw DispatchError or LangError based on the error encountered when unwrapping the result. So users don't have to unwrap 2 nested results before getting into the decoded data.
Before:
import { Contract } from 'dedot/contracts';
const contract = new Contract<FlipperContractApi>(api, flipper, contractAddress);
const result = await contract.query.get({ caller });
// Unwrap 2 nested results for handling `DispatchError` & `LangError`
if (state.isOk && state.data.isOk) {
const state: boolean = state.data.value;
console.log(`Flipper boolean value`, state);
}
This PR addresses a task in #110 which modifies how nested results are handled during a query call via
Contract
or contract deployment viaContractDeployer
.Now
Contract
andContractDeployer
will directly return the inner data (the result of the message) and will throwDispatchError
orLangError
based on the error encountered when unwrapping the result. So users don't have to unwrap 2 nested results before getting into the decoded data.Before:
After: