Closed anhcao142 closed 3 years ago
I noticed that if I upgrade txWrapper to version 4 or 5, the function works fine but that also requires me to upgrade my node version to 14.
In theory you could get the polkadot-js compatible type definitions for the ones causing breakage and pass them into the registry, but you would need to not use getRegistry
and instead create the registry yourself.
Something like
const registry = new TypeRegistry();
// Register types specific to chain/runtimeVersion
registry.register({
PalletId: 'LockIdentifier',
...getSpecTypes(registry, 'Kusama', 'kusama', 9010)
})
registry.setMetadata(createMetadata(registry, metadataRpc));
I won't be able to try myself until the work week, but should be the right direction.
Here is some more about extending types (although it focuses on the api, type definitions still apply): https://polkadot.js.org/docs/api/start/types.extend
Note: I would highly recommend switching to txwrapper-polkadot and bumping your node version asap so you are not left behind if there is a breaking change to tx construction.
Thanks for the heads up. Just curious, why does the tx construction changing every now and then? My only use-case at the moment with txwrapper is just to create transferKeepAlive
.
Just curious, why does the tx construction changing every now and then?
It varies: increasing compatibility etc. I suspect changes will become increasingly less common, but I recommend staying up to date with whatever latest requirements polkadot-js has so if there is some update you need on super short notice the changes you need to make in your environment would only be small, incremental ones.
Where you able to get the above example code to work?
Yeah, I managed to run the latest txwrapper version in node 10 using esm
Something like this:
yarn add txwrapper --ignore-engines
yarn add esm
node -r esm index.js
Hi, currently, I'm using version 3.10.12 since it supports node v10. But today while trying to
getRegistry
to build tx I encountered this error:Here is the code to reproduce:
I noticed that if I upgrade txWrapper to version 4 or 5, the function works fine but that also requires me to upgrade my node version to 14. Is there a way to solve the error without upgrading Node version?