2
votes

In the Substrate ecosystem, it is common to begin writing a new blockchain node by forking the Substrate Node Template. There are a few options for user interfaces (such as Apps and front-end-template) both of which are based on the same underlying Polkadot-JS API.

Some versions of the API work with some versions of the node template without any custom configuration, but in general the API must be supplied with information about which types the node uses. The process of supplying types is documented https://polkadot.js.org/api/start/types.extend.html#impact-on-extrinsics but which types do I need to supply?

1

1 Answers

5
votes

There was a type-incompatible change introduced to the Substrate node template here on March 10th 2020. I'll use the terms "old" and "new" to refer to before and after this date.

Using the API Directly

If you're using an new node template with the polkadot-js API, you will need to use the following types as documented here

{
  "Address": "AccountId",
  "LookupSource": "AccountId"
}

Using a Front End Package

The frontends mentioned in the question have both been updated in an attempt to ease the life of users. The Apps UI here and the front-end-template here. However if you're trying to use an old node-template with anew front-end or vice versa, you will need to do some custom type injection.

Old node template, Old front end

No custom types necessary

New node template, New front end

No custom types necessary

Old node template, New front end

{
  "Address": "GenericAddress",
  "LookupSource": "Address"
}

New node template, Old front end

{
  "Address": "AccountId",
  "LookupSource": "AccountId"
}

How to Inject Types

In Apps

Go to the Settings tab on the left and the Developer tab on the top. Paste the types in.

In Front End Template

Modify this file https://github.com/substrate-developer-hub/substrate-front-end-template/blob/dff9783e29123f49a19cbc43f5df7ae010c92775/src/config/common.json#L4