-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschema.graphql
More file actions
125 lines (96 loc) · 3.12 KB
/
schema.graphql
File metadata and controls
125 lines (96 loc) · 3.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# An address that holds or did hold names.
type Address @entity (immutable: true) {
# The ID is the address itself as bytes.
id: Bytes!
# All names held at the moment by the address.
names: [Name!]! @derivedFrom (field: "owner")
}
# A transaction in the underlying blockchain.
type Transaction @entity (immutable: true) {
# The ID is the transaction ID as bytes.
id: Bytes!
# Block height and timestamp of the transaction.
height: BigInt!
timestamp: BigInt!
}
# A namespace that has been seen on the blockchain.
type Namespace @entity (immutable: true) {
# The ID is the namespace string as Bytes.
id: Bytes!
# The namespace as string.
ns: String!
names: [Name!]! @derivedFrom (field: "ns")
}
# A game ID that has been seen on the blockchain.
type Game @entity (immutable: true) {
# The ID is the game ID as Bytes.
id: Bytes!
# The game ID as string.
game: String!
moves: [GameMove!]! @derivedFrom (field: "game")
}
# A Xaya name (of any namespace) that has been seen on the blockchain.
type Name @entity (immutable: false) {
# The ID is the token ID encoded as Bytes.
id: Bytes!
# The namespace this name belongs to.
ns: Namespace!
# The account name as string.
name: String!
# Address currently holding the name.
owner: Address!
registration: Registration! @derivedFrom (field: "name")
moves: [Move!]! @derivedFrom (field: "name")
}
# A single Registration event detected.
type Registration @entity (immutable: true) {
# The ID is generated from txhash and log index and is just a unique value.
id: Bytes!
# The transaction that did the registration.
tx: Transaction!
# The name that was registered.
name: Name!
}
# A single Move that was done, independent of the data stored.
type Move @entity (immutable: true) {
# The ID is generated from txhash and log index and is just a unique value.
id: Bytes!
# The transaction that did the move.
tx: Transaction!
# The name that sent the move.
name: Name!
# The move data.
move: String!
# Optionally a payment associated to this move.
payment: Payment @derivedFrom (field: "move")
# Game moves sent with this.
games: [GameMove!]! @derivedFrom (field: "move")
}
# A single WCHI payment attached to a move.
type Payment @entity (immutable: true) {
# The ID is generated from txhash and log index and is just a unique value.
id: Bytes!
# The move that sent this payment.
move: Move!
# The receiver address as bytes.
receiver: Bytes!
# Amount in WCHI sats.
amount: BigInt!
}
# A move for a particular game (i.e. p/ name, and contains that key
# inside the "g" key in its JSON).
type GameMove @entity (immutable: true) {
# The ID is generated from txhash, log index and game ID and is just a
# unique value.
id: Bytes!
# The overall move that contains this game move.
move: Move!
# We replicate the transaction reference here from move, so that
# we can sort by transaction timestamp. GraphQL on The Graph supports
# sorting by nested fields only one level deep.
tx: Transaction!
# The Game instance this is for.
game: Game!
# The game-specific part of the move JSON.
gamemove: String!
}