forked from subquery/cosmos-subql-starter
-
Notifications
You must be signed in to change notification settings - Fork 10
/
schema.graphql
323 lines (291 loc) · 6.4 KB
/
schema.graphql
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
enum GovProposalVoteOption {
EMPTY,
YES,
ABSTAIN,
NO,
NO_WITH_VETO,
}
enum TxStatus {
Success
Error
}
type EventAttribute @entity {
id: ID!
key: String!
value: String!
event: Event!
}
type Block @entity {
id: ID! # The block header hash
chainId: String! @index
height: BigInt! @index
timestamp: Date!
transactions: [Transaction] @derivedFrom(field: "block")
messages: [Message] @derivedFrom(field: "block")
events: [Event] @derivedFrom(field: "block")
}
type Transaction @entity {
id: ID!
block: Block!
gasUsed: BigInt!
gasWanted: BigInt!
fees: [Coin]!
memo: String
status: TxStatus!
log: String!
timeline: BigInt! @index
timeoutHeight: BigInt @index
# NB: only the first signer!
signerAddress: String @index
messages: [Message] @derivedFrom(field: "transaction")
}
type Message @entity {
id: ID!
typeUrl: String! @index
json: String!
timeline: BigInt! @index
transaction: Transaction!
block: Block!
}
type Event @entity {
id: ID!
type: String! @index
attributes: [EventAttribute]! @derivedFrom(field: "event")
log: String!
transaction: Transaction!
block: Block!
}
type ExecuteContractMessage @entity {
id: ID!
contract: Contract!
method: String! @index
funds: [Coin]!
timeline: BigInt! @index # block height * 1000000 + message_idx * 10000 + transaction_idx * 1000
message: Message!
transaction: Transaction!
block: Block!
}
type GovProposalVote @entity {
id: ID!
proposalId: String! @index
voterAddress: String! @index
option: GovProposalVoteOption!
timeline: BigInt! @index
message: Message!
transaction: Transaction!
block: Block!
# TODO:
# weightedOptions: []
}
type DistDelegatorClaim @entity {
id: ID!
delegatorAddress: String!
validatorAddress: String!
timeline: BigInt! @index
message: Message!
transaction: Transaction!
block: Block!
# TODO:
# validator: Validator!
# TODO: also available via msg in cosmos-sdk (baseline) v0.46
amount: BigInt!
denom: String!
}
type Contract @entity {
id: ID!
interface: Interface!
storeMessage: StoreContractMessage
instantiateMessage: InstantiateContractMessage
codeId: Int! @index
}
type LegacyBridgeSwap @entity {
id: ID! # id field is always required and must look like this
destination: String!
contract: Contract!
amount: BigInt!
denom: String!
executeContractMessage: ExecuteContractMessage!
timeline: BigInt! @index
message: Message!
transaction: Transaction!
block: Block!
}
type Coin @jsonField {
denom: String!
amount: String!
}
type NativeTransfer @entity {
id: ID!
toAddress: String! @index
fromAddress: String! @index
amounts: [Coin]!
denom: String! @index
timeline: BigInt! @index
message: Message!
transaction: Transaction!
block: Block!
}
type Cw20Transfer @entity {
id: ID!
toAddress: String! @index
fromAddress: String! @index
contract: Contract!
amount: BigInt!
timeline: BigInt! @index
message: Message!
transaction: Transaction!
block: Block!
}
type Account @entity {
# id is the address
id: ID!
chainId: String! @index
nativeBalanceChanges: [NativeBalanceChange]! @derivedFrom(field: "account")
cw20BalanceChanges: [Cw20BalanceChange]! @derivedFrom(field: "account")
genesisBalances: [GenesisBalance] @derivedFrom(field: "account")
}
type GenesisBalance @entity {
id: ID!
amount: BigInt!
denom: String! @index
account: Account!
}
type AuthzExec @entity {
id: ID!
grantee: String! @index
subMessages: [AuthzExecMessage]! @derivedFrom(field: "authzExec")
timeline: BigInt! @index
message: Message!
transaction: Transaction!
block: Block!
}
type Endpoint @jsonField {
url: String!
weight: Int!
}
type Agent @entity {
# id is the agent's address
id: ID!
almanacRegistrations: [AlmanacRegistration] @derivedFrom(field: "agent")
}
type AlmanacService @jsonField {
protocols: [String!]
endpoints: [Endpoint!]!
}
type AlmanacRecord @entity {
id: ID!
service: AlmanacService
# registration: AlmanacRegistration! @derivedFrom(field: "record")
# event: Event!
transaction: Transaction!
block: Block!
}
type AlmanacRegistration @entity {
id: ID!
expiryHeight: BigInt! @index
agent: Agent!
signature: String!
sequence: Int!
contract: Contract!
record: AlmanacRecord!
# TODO(workaround): consider relating to message
# event: Event!
transaction: Transaction!
block: Block!
}
# NB: AuthzExec --|{ Message join table
type AuthzExecMessage @entity {
id: ID!
authzExec: AuthzExec!
message: Message!
}
type NativeBalanceChange @entity {
id: ID!
balanceOffset: BigInt!
denom: String! @index
account: Account!
timeline: BigInt! @index
event: Event!
transaction: Transaction!
block: Block!
}
type IbcTransfer @entity {
id: ID!
toAddress: String! @index
fromAddress: String! @index
amount: Coin!
denom: String! @index
sourceChannel: String!
sourcePort: String!
event: Event!
timeline: BigInt! @index
message: Message!
transaction: Transaction!
block: Block!
}
type Cw20BalanceChange @entity {
id: ID!
balanceOffset: BigInt!
contract: Contract!
account: Account!
executeContractMessage: ExecuteContractMessage!
event: Event!
timeline: BigInt! @index
message: Message!
transaction: Transaction!
block: Block!
}
enum Interface {
Uncertain,
CW20,
LegacyBridgeSwap,
}
enum AccessType {
# // AccessTypeUnspecified placeholder for empty value
Unspecified,
# // AccessTypeNobody forbidden
AccessTypeNobody,
# // AccessTypeOnlyAddress restricted to a single address
# // Deprecated: use AccessTypeAnyOfAddresses instead
AccessTypeOnlyAddress,
# // AccessTypeEverybody unrestricted
AccessTypeEverybody,
# // AccessTypeAnyOfAddresses allow any of the addresses
AccessTypeAnyOfAddresses,
}
type CW20Contract @entity {
id: ID!
contract: Contract!
}
type StoreContractMessage @entity {
id: ID!
sender: String!
permission: AccessType
contracts: [Contract] @derivedFrom(field: "storeMessage")
codeId: Int! @index
timeline: BigInt! @index
message: Message!
transaction: Transaction!
block: Block!
}
type InstantiateContractMessage @entity {
id: ID!
sender: String! @index
admin: String
codeId: Int!
label: String
payload: String!
funds: [Coin]
timeline: BigInt! @index
message: Message!
transaction: Transaction!
block: Block!
}
type UnprocessedEntity @entity {
id: ID!
error: String!
event: Event
message: Message
transaction: Transaction
block: Block
}