Closed 0oM4R closed 2 months ago
Issue update:
Currently, we are going to enhance decoding chain errors, to get the write section of the errror
while implementing this logic as mentioned on polkadot.js docs
i couldn't access registry this.api.registry.findMetaError
but i was able to do the same logic on another script using our client
import { Keyring } from "@polkadot/api";
import { DispatchError } from "@polkadot/types/interfaces";
import { Client } from "./client";
async function main() {
const client = new Client({
url: "wss://tfchain.dev.grid.tf",
mnemonicOrSecret: "",
});
await client.connect();
await client.loadKeyPairOrSigner();
const nonce = await client.api.rpc.system.accountNextIndex(client.address);
const x = await client.api.tx.smartContractModule
.cancelContract(119696)
.signAndSend(client.keypair, { nonce }, ({ status, events }) => {
if (status.isInBlock || status.isFinalized) {
events
.filter(({ event }) => client.api.events.system.ExtrinsicFailed.is(event))
.forEach(
({
event: {
data: [error, info],
},
}) => {
if ((error as DispatchError).isModule) {
const decoded = client.api.registry.findMetaError((error as DispatchError).asModule);
const { docs, method, section } = decoded;
console.log(`${section}.${method}: ${docs.join(" ")}`);
} else {
console.log(error.toString());
}
},
);
}
});
}
main();
issue update : still facing the same error in dashboard, but tfchain client works fine
will check if we can generate the types and use it
still investigating about that error
we found that we can work around this by using markRaw, or toRaw to unwrap this.api
but this solution will be in the client and we should found the fix on playground,
still investigating about that error we found that we can work around this by using markRaw, or toRaw to unwrap
this.api
but this solution will be in the client and we should found the fix on playground,
this issue solved by mark gird in dashboard as raw, Using markRaw, this solution is one place and not affect the client
Is there an existing issue for this?
which package/s did you face the problem with?
types
What happened?
the client mismatch the chain errors
this is because of the tfchain errors module in types package is outdated with tfchain errors and the client is getting the error by its index from types package https://github.com/threefoldtech/tfgrid-sdk-ts/blob/c642cb74c789859577dd4455e0cd99594943d261/packages/tfchain_client/src/client.ts#L379
Steps To Reproduce
No response
which network/s did you face the problem on?
Dev
version
b72ee05
Twin ID/s
No response
Node ID/s
No response
Farm ID/s
No response
Contract ID/s
No response
Relevant screenshots/screen records
Relevant log output