This new async version of getRuntimeVersion will ensure that the runtime upgrade process is done (download metadata, setup registry, caching ...) before returning the value. Helpful when we want to prepare for runtime upgrades.
So the process of preparing for new runtime upgrades would look like this:
const client = await DedotClient<OldApi>.new(...)
const runtimeVersion = await client.getRuntimeVersion();
if (runtimeVersion.specVersion === NEW_SPEC_VERSION) {
// casting the client to using the NewApi interface, generated from the new metadata
const newClient: DedotClient<NewApi> = api as any;
newClient.tx.pallet.new_tx_call(...)
} else {
client.tx.pallet.old_tx_call(...)
}
Closes #196
This new async version of
getRuntimeVersion
will ensure that the runtime upgrade process is done (download metadata, setup registry, caching ...) before returning the value. Helpful when we want to prepare for runtime upgrades.So the process of preparing for new runtime upgrades would look like this:
Pending some specs to verify the logics