GraphQL: Look up the id of the discountCode of an Order

Using GraphQL to query orders given the discount_code (sample query below) is able to download a list of orders with the discount_code field in the return payload.

query {
 orders(first: 1, query: "discount_code:XXXXX") {
   pageInfo {
        hasNextPage
        hasPreviousPage
    }
    edges {
        cursor
        node {
            id
            discountCode
        }
    }
  }
}

Likewise, the lines below are able to download a list of different types of discount codes.

query($id: ID!) {
    codeDiscountNode (id: $id) {
        codeDiscount {
            __typename
            ... on DiscountCodeBasic {
                createdAt
                codes(first: 10) {
                    pageInfo {
                        hasNextPage
                        hasPreviousPage
                    }
                    edges {
                        cursor
                        node {
                            code
                            id
                        }
                    }
                }
            }
            __typename
            ... on DiscountCodeBxgy {
                createdAt
                codes(first: 10) {
                    pageInfo {
                        hasNextPage
                        hasPreviousPage
                    }
                    edges {
                        cursor
                        node {
                            code
                            id
                        }
                    }
                }
            }
            __typename
            ... on DiscountCodeFreeShipping {
                createdAt
                codes(first: 10) {
                    pageInfo {
                        hasNextPage
                        hasPreviousPage
                    }
                    edges {
                        cursor
                        node {
                            code
                            id
                        }
                    }
                }
            }
        }
        parentId: id
    }
}

I’m reading docs to try to find out the id of a discountCode of an order and then use that id to query the detail of a discountCode by looking up the codeDiscountNodeByCode?