From my research of how to generate and sign transactions offline I found docs:

https://wiki.polkadot.network/docs/build-transaction-construction citing txwrapper-core: https://github.com/paritytech/txwrapper-core

But I want to create offline transactions for multiple different parachains that have chain specific requirements like crust that needs things like:

import { typesBundleForPolkadot } from '@crustio/type-definitions';

I do cannot find any documentation on how to include/use typeBundles with txwrapper to generate offline transactions.

Any examples/best practices for this?

1 Answer 1


Great question,

So txwrapper-core was developed with the idea that we would expose all the tools necessary for individuals to build their own offline tx construction libraries.

In your case the best way to include type-bundles is to leverage txwrapper-registry. Currently the only way the registry accepts them is through an environment variable called TX_TYPES_BUNDLES which is the path to the types-bundle file. The code can be found here, and the readme here.

If it is a use case where you would like the ability to pass in a types-bundle directly into createRegistry, I would be happy to add the ability in for you.

For building offline libraries using txwrapper-core though, I would look through the txwrapper-polkadot index.ts file which shows how we expose a lot of the functionality for users for parity based chains specifically. I would then look at txwrapper-substrate. This is where we actually construct methods using the tools from txwrapper-core for offline construction. So if you wanted to build transactions offline using txwrapper-core for specific parachains you would need to construct each method you would like to use to build these transactions. I always use balances transfer as an example. It's pretty straightforward, you just need to know the args its accepting and everything else is template like. As an extra note as well, I would look into the txwrapper-examples we provide for what the workflow looks like for constructing transactions.

The only thing I ask is if you would like the ability to pass in a a types-bundle directly into createRegistry from the txwrapper-registry library, please file an issue here, and I can add that in pretty quick.

  • createRegistry sounds quite good since otherwise I would need to do manually add types for each parachain. This would mean I could directly use the type definitions from each parachain right? Commented Mar 12, 2023 at 16:28
  • @TadejVengust Yes, exactly. Injecting the TypeRegistry with a types-bundle for a specific chain will allow you to build any of the types available in that given metadata.
    – Tarik Gul
    Commented Mar 13, 2023 at 1:04
  • 1
    Issue oppened github.com/paritytech/txwrapper-core/issues/286 Commented Mar 13, 2023 at 14:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.