custom_type.md
July 7, 2020 ยท View on GitHub
Substrate Custom Type format
Subscan custom type most cases are consistent with polkadot.js type.json, due to language characteristics, there are some inconsistencies between struct and enum
String
{
"typeName": "inheritTypeName"
}
Example
{
"address": "H256"
}
Struct
{
"typeName": {
"type": "struct",
"type_mapping": [
[
"field1",
"inheritTypeName"
]
]
}
}
Example
{
"BalanceLock<Balance>": {
"type": "struct",
"type_mapping": [
[
"id",
"LockIdentifier"
]
]
}
}
Enum
{
"typeName": {
"type": "enum",
"type_mapping": [
[
"field1",
"inheritTypeName"
]
]
}
}
Example
{
"RedeemStrategy": {
"type": "enum",
"type_mapping": [
[
"Immediately",
"Null"
]
]
}
}
Resource
[scale.go] https://github.com/itering/scale.go/tree/master/source