I am trying to create a tuple. I know we can create an enum by defining the type as

   MyEnum: {
            _enum: {
                'account': String,
                'accountId': 'u128'


similarly how can i create a tuple type

(account, accountId)
  • For context, why? My impression is usually these should be defined by the node in metadata as opposed to manually crafted . but I admit, in don't use the js libs much 😅
    – Nuke
    Commented Jun 28, 2022 at 15:31

1 Answer 1


Tuple types are specified in the same way they are in Rust, i.e. (AccountId, u32) will yield a tuple with AccountId and u32. These are all string values, i.e.

MyTuple: "(AccountId, u32)",
MyEnum: {
  _enum: {
    Foo: "AccountId",
    Bar: "(AccountId, u64)",
    Baz: "String"

As indicated in a comment, with current Substrate nodes you should not need to define types, these are supplied in the metadata. (There is one caveat - when used over RPCs, these are not available and needs to be manually specified alongside the RPC definitions)

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.