Open
Description
Motivation / Rationale
We currently don't support inline objects: GraphQL types that are not entities and that be embedded in parent objects instead of referencing them via their IDs.
This feature is necessary to better support Ethereum tuples and arrays of Ethereum tuples in the GraphQL schema and particularly in graph init --from-contract
scaffolding.
Imagine a contract has an event like the following
struct Receiver {
address account,
string name,
}
struct Details {
uint256 amount,
address token,
}
event MultiTransfer(
address from,
Receiver[] receivers,
Details details,
)
We currently can't represent Receiver[]
in the GraphQL schema and we represent Details
by unrolling the fields into a flat list of fields:
type MultiTransfer @entity {
id: ID!
from: Bytes!
// Receivers[] cannot be represented
details_amount: BigInt!
details_token: Bytes!
}
What we really want is this:
type Receiver {
id: ID!
account: Bytes!
name: String!
}
type Details {
amount: BigInt!
token: Bytes!
}
type MultiTransfer @entity {
from: Bytes!
receivers: [Receiver!]!
details: Details!
}