Skip to content

DSL, Fragments and unions #450

@FrankC01

Description

@FrankC01

This works in an online query tool:

  transactionBlock(digest:"CypToNgx6jN2V6vDZGtgpeEv1zSs4VGJcANJi85w9Ypm") {
    digest
    kind {
      __typename
      ... on ProgrammableTransaction {
        value
      }
      ... on GenesisTransaction {
        objects 
      }
    }
}

However I can't figure out the DSL Fragment for handling the union. If I have one of the union types it works fine:

STANDARD_TRANSACTION_KIND: DSLFragment = (
    DSLFragment("TransactionUnion")
    .on(SUI_GRAPHQL_SCHEMA.ProgrammableTransaction)
    .select(SUI_GRAPHQL_SCHEMA.ProgrammableTransaction.value)
)

However; not sure how to handle all cases. Do I need to declare a fragment for all union types? And, if so, do I just comma separate them in the query?

Also, sorry if this is not the place for questions... please direct me otherwise.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions