Skip to content
This repository has been archived by the owner on May 21, 2021. It is now read-only.

Latest commit

 

History

History
98 lines (72 loc) · 1.04 KB

custom_type.md

File metadata and controls

98 lines (72 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/social-network/scale.go/tree/master/source