Skip to content

Latest commit

 

History

History
99 lines (73 loc) · 1.04 KB

custom_type.md

File metadata and controls

99 lines (73 loc) · 1.04 KB

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