@graphprotocol/graph-cli 0.30.0-alpha.1 → 0.30.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (69) hide show
  1. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/chain/arweave.ts +76 -0
  2. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/chain/cosmos.ts +341 -0
  3. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/chain/ethereum.ts +39 -0
  4. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/global/global.ts +286 -142
  5. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/index.ts +4 -2
  6. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/package.json +2 -1
  7. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/test/test.js +4 -2
  8. package/examples/basic-event-handlers/node_modules/keccak/build/config.gypi +300 -125
  9. package/examples/basic-event-handlers/node_modules/websocket/build/config.gypi +292 -15
  10. package/examples/basic-event-handlers/package.json +1 -1
  11. package/examples/basic-event-handlers/yarn.lock +4 -4
  12. package/examples/example-subgraph/package.json +1 -1
  13. package/examples/example-subgraph/yarn.lock +4 -4
  14. package/package.json +1 -1
  15. package/src/codegen/schema.js +5 -1
  16. package/src/codegen/schema.test.js +102 -0
  17. package/src/command-helpers/abi.js +69 -0
  18. package/src/command-helpers/scaffold.js +67 -0
  19. package/src/commands/add.js +198 -0
  20. package/src/commands/init.js +25 -72
  21. package/src/protocols/arweave/manifest.graphql +57 -0
  22. package/src/protocols/arweave/scaffold/manifest.js +19 -0
  23. package/src/protocols/arweave/scaffold/mapping.js +53 -0
  24. package/src/protocols/arweave/subgraph.js +20 -0
  25. package/src/protocols/{tendermint → cosmos}/manifest.graphql +6 -0
  26. package/src/protocols/cosmos/scaffold/manifest.js +16 -0
  27. package/src/protocols/cosmos/scaffold/mapping.js +39 -0
  28. package/src/protocols/{tendermint → cosmos}/subgraph.js +2 -1
  29. package/src/protocols/ethereum/codegen/abi.js +21 -4
  30. package/src/protocols/ethereum/scaffold/manifest.js +2 -1
  31. package/src/protocols/index.js +51 -18
  32. package/src/protocols/near/manifest.graphql +1 -0
  33. package/src/protocols/near/scaffold/manifest.js +4 -2
  34. package/src/scaffold/cosmos.test.js +86 -0
  35. package/src/scaffold/ethereum.test.js +2 -1
  36. package/src/scaffold/index.js +5 -3
  37. package/src/scaffold/near.test.js +2 -1
  38. package/src/validation/schema.js +2 -0
  39. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/chain/tendermint.ts +0 -554
  40. package/examples/basic-event-handlers/node_modules/keccak/build/Makefile +0 -342
  41. package/examples/basic-event-handlers/node_modules/keccak/build/Release/.deps/Release/obj.target/keccak/src/addon.o.d.raw +0 -27
  42. package/examples/basic-event-handlers/node_modules/keccak/build/binding.Makefile +0 -6
  43. package/examples/basic-event-handlers/node_modules/keccak/build/gyp-mac-tool +0 -615
  44. package/examples/basic-event-handlers/node_modules/keccak/build/keccak.target.mk +0 -209
  45. package/examples/basic-event-handlers/node_modules/websocket/build/Makefile +0 -347
  46. package/examples/basic-event-handlers/node_modules/websocket/build/Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d.raw +0 -25
  47. package/examples/basic-event-handlers/node_modules/websocket/build/binding.Makefile +0 -6
  48. package/examples/basic-event-handlers/node_modules/websocket/build/bufferutil.target.mk +0 -192
  49. package/examples/basic-event-handlers/node_modules/websocket/build/gyp-mac-tool +0 -615
  50. package/examples/basic-event-handlers/node_modules/websocket/build/validation.target.mk +0 -192
  51. package/src/codegen/types/defaults.js +0 -34
  52. package/tests/cli/init/ethereum/from-example/.gitattributes +0 -1
  53. package/tests/cli/init/ethereum/from-example/LICENSE +0 -21
  54. package/tests/cli/init/ethereum/from-example/README.md +0 -3
  55. package/tests/cli/init/ethereum/from-example/abis/Gravity.json +0 -1
  56. package/tests/cli/init/ethereum/from-example/bin/Counter.bin +0 -1
  57. package/tests/cli/init/ethereum/from-example/contracts/Gravity.sol +0 -63
  58. package/tests/cli/init/ethereum/from-example/contracts/Migrations.sol +0 -23
  59. package/tests/cli/init/ethereum/from-example/docker-compose.yml +0 -39
  60. package/tests/cli/init/ethereum/from-example/migrations/1_initial_migration.js +0 -5
  61. package/tests/cli/init/ethereum/from-example/migrations/2_deploy_contract.js +0 -5
  62. package/tests/cli/init/ethereum/from-example/migrations/3_create_gravatars.js +0 -15
  63. package/tests/cli/init/ethereum/from-example/networks.json +0 -7
  64. package/tests/cli/init/ethereum/from-example/package.json +0 -23
  65. package/tests/cli/init/ethereum/from-example/schema.graphql +0 -6
  66. package/tests/cli/init/ethereum/from-example/src/mapping.ts +0 -22
  67. package/tests/cli/init/ethereum/from-example/subgraph.yaml +0 -27
  68. package/tests/cli/init/ethereum/from-example/truffle.js +0 -27
  69. package/tests/cli/init/ethereum/from-example/yarn.lock +0 -5977
@@ -1,554 +0,0 @@
1
- import '../common/eager_offset'
2
- import { Bytes } from '../common/collections'
3
-
4
- export namespace tendermint {
5
- export enum SignedMsgType {
6
- SIGNED_MSG_TYPE_UNKNOWN = 0,
7
- SIGNED_MSG_TYPE_PREVOTE = 1,
8
- SIGNED_MSG_TYPE_PRECOMMIT = 2,
9
- SIGNED_MSG_TYPE_PROPOSAL = 32,
10
- }
11
-
12
- export enum BlockIDFlag {
13
- BLOCK_ID_FLAG_UNKNOWN = 0,
14
- BLOCK_ID_FLAG_ABSENT = 1,
15
- BLOCK_ID_FLAG_COMMIT = 2,
16
- BLOCK_ID_FLAG_NIL = 3,
17
- }
18
-
19
- export class EventList {
20
- public newBlock: EventBlock
21
- public transaction: Array<EventTx>
22
- public validatorSetUpdates: EventValidatorSetUpdates
23
-
24
- constructor(
25
- newBlock: EventBlock,
26
- transaction: Array<EventTx>,
27
- validatorSetUpdates: EventValidatorSetUpdates,
28
- ) {
29
- this.newBlock = newBlock
30
- this.transaction = transaction
31
- this.validatorSetUpdates = validatorSetUpdates
32
- }
33
- }
34
-
35
- export class EventData {
36
- public event: Event
37
- public block: EventBlock
38
-
39
- constructor(event: Event, block: EventBlock) {
40
- this.event = event
41
- this.block = block
42
- }
43
- }
44
-
45
- export class Block {
46
- public header: Header
47
- public data: Data
48
- public evidence: EvidenceList
49
- public lastCommit: Commit
50
-
51
- constructor(header: Header, data: Data, evidence: EvidenceList, lastCommit: Commit) {
52
- this.header = header
53
- this.data = data
54
- this.evidence = evidence
55
- this.lastCommit = lastCommit
56
- }
57
- }
58
-
59
- export class BlockID {
60
- public hash: Bytes
61
- public partSetHeader: PartSetHeader
62
-
63
- constructor(hash: Bytes, partSetHeader: PartSetHeader) {
64
- this.hash = hash
65
- this.partSetHeader = partSetHeader
66
- }
67
- }
68
-
69
- export class BlockParams {
70
- public maxBytes: i64
71
- public maxGas: i64
72
-
73
- constructor(maxBytes: i64, maxGas: i64) {
74
- this.maxBytes = maxBytes
75
- this.maxGas = maxGas
76
- }
77
- }
78
-
79
- export class Commit {
80
- public height: i64
81
- public round: i32
82
- public blockId: BlockID
83
- public signatures: Array<CommitSig>
84
-
85
- constructor(height: i64, round: i32, blockId: BlockID, signatures: Array<CommitSig>) {
86
- this.height = height
87
- this.round = round
88
- this.blockId = blockId
89
- this.signatures = signatures
90
- }
91
- }
92
-
93
- export class CommitSig {
94
- public blockIdFlag: BlockIDFlag
95
- public validatorAddress: Bytes
96
- public timestamp: Timestamp
97
- public signature: Bytes
98
-
99
- constructor(
100
- blockIdFlag: BlockIDFlag,
101
- validatorAddress: Bytes,
102
- timestamp: Timestamp,
103
- signature: Bytes,
104
- ) {
105
- this.blockIdFlag = blockIdFlag
106
- this.validatorAddress = validatorAddress
107
- this.timestamp = timestamp
108
- this.signature = signature
109
- }
110
- }
111
-
112
- export class Consensus {
113
- public block: u64
114
- public app: u64
115
-
116
- constructor(block: u64, app: u64) {
117
- this.block = block
118
- this.app = app
119
- }
120
- }
121
-
122
- export class ConsensusParams {
123
- public block: BlockParams
124
- public evidence: EvidenceParams
125
- public validator: ValidatorParams
126
- public version: VersionParams
127
-
128
- constructor(
129
- block: BlockParams,
130
- evidence: EvidenceParams,
131
- validator: ValidatorParams,
132
- version: VersionParams,
133
- ) {
134
- this.block = block
135
- this.evidence = evidence
136
- this.validator = validator
137
- this.version = version
138
- }
139
- }
140
-
141
- export class Data {
142
- public txs: Array<Bytes>
143
-
144
- constructor(txs: Array<Bytes>) {
145
- this.txs = txs
146
- }
147
- }
148
-
149
- export class Duration {
150
- public seconds: i64
151
- public nanos: i32
152
-
153
- constructor(seconds: i64, nanos: i32) {
154
- this.seconds = seconds
155
- this.nanos = nanos
156
- }
157
- }
158
-
159
- export class DuplicateVoteEvidence {
160
- public voteA: EventVote
161
- public voteB: EventVote
162
- public totalVotingPower: i64
163
- public validatorPower: i64
164
- public timestamp: Timestamp
165
-
166
- constructor(
167
- voteA: EventVote,
168
- voteB: EventVote,
169
- totalVotingPower: i64,
170
- validatorPower: i64,
171
- timestamp: Timestamp,
172
- ) {
173
- this.voteA = voteA
174
- this.voteB = voteB
175
- this.totalVotingPower = totalVotingPower
176
- this.validatorPower = validatorPower
177
- this.timestamp = timestamp
178
- }
179
- }
180
-
181
- export class Event {
182
- public eventType: string
183
- public attributes: Array<EventAttribute>
184
-
185
- constructor(eventType: string, attributes: Array<EventAttribute>) {
186
- this.eventType = eventType
187
- this.attributes = attributes
188
- }
189
- }
190
-
191
- export class EventAttribute {
192
- public key: string
193
- public value: string
194
- public index: bool
195
-
196
- constructor(key: string, value: string, index: bool) {
197
- this.key = key
198
- this.value = value
199
- this.index = index
200
- }
201
- }
202
-
203
- export class EventBlock {
204
- public block: Block
205
- public blockId: BlockID
206
- public resultBeginBlock: ResponseBeginBlock
207
- public resultEndBlock: ResponseEndBlock
208
-
209
- constructor(
210
- block: Block,
211
- blockId: BlockID,
212
- resultBeginBlock: ResponseBeginBlock,
213
- resultEndBlock: ResponseEndBlock,
214
- ) {
215
- this.block = block
216
- this.blockId = blockId
217
- this.resultBeginBlock = resultBeginBlock
218
- this.resultEndBlock = resultEndBlock
219
- }
220
- }
221
-
222
- export class EventTx {
223
- public txResult: TxResult
224
-
225
- constructor(txResult: TxResult) {
226
- this.txResult = txResult
227
- }
228
- }
229
-
230
- export class EventValidatorSetUpdates {
231
- public validatorUpdates: Array<Validator>
232
-
233
- constructor(validatorUpdates: Array<Validator>) {
234
- this.validatorUpdates = validatorUpdates
235
- }
236
- }
237
-
238
- export class EventVote {
239
- public eventVoteType: SignedMsgType
240
- public height: u64
241
- public round: i32
242
- public blockId: BlockID
243
- public timestamp: Timestamp
244
- public validatorAddress: Bytes
245
- public validatorIndex: i32
246
- public signature: Bytes
247
-
248
- constructor(
249
- eventVoteType: SignedMsgType,
250
- height: u64,
251
- round: i32,
252
- blockId: BlockID,
253
- timestamp: Timestamp,
254
- validatorAddress: Bytes,
255
- validatorIndex: i32,
256
- signature: Bytes,
257
- ) {
258
- this.eventVoteType = eventVoteType
259
- this.height = height
260
- this.round = round
261
- this.blockId = blockId
262
- this.timestamp = timestamp
263
- this.validatorAddress = validatorAddress
264
- this.validatorIndex = validatorIndex
265
- this.signature = signature
266
- }
267
- }
268
-
269
- export class Evidence {
270
- public duplicateVoteEvidence: DuplicateVoteEvidence
271
- public lightClientAttackEvidence: LightClientAttackEvidence
272
-
273
- constructor(
274
- duplicateVoteEvidence: DuplicateVoteEvidence,
275
- lightClientAttackEvidence: LightClientAttackEvidence,
276
- ) {
277
- this.duplicateVoteEvidence = duplicateVoteEvidence
278
- this.lightClientAttackEvidence = lightClientAttackEvidence
279
- }
280
- }
281
-
282
- export class EvidenceList {
283
- public evidence: Array<Evidence>
284
-
285
- constructor(evidence: Array<Evidence>) {
286
- this.evidence = evidence
287
- }
288
- }
289
-
290
- export class EvidenceParams {
291
- public maxAgeNumBlocks: i64
292
- public maxAgeDuration: Duration
293
- public maxBytes: i64
294
-
295
- constructor(maxAgeNumBlocks: i64, maxAgeDuration: Duration, maxBytes: i64) {
296
- this.maxAgeNumBlocks = maxAgeNumBlocks
297
- this.maxAgeDuration = maxAgeDuration
298
- this.maxBytes = maxBytes
299
- }
300
- }
301
-
302
- export class Header {
303
- public version: Consensus
304
- public chainId: string
305
- public height: u64
306
- public time: Timestamp
307
- public lastBlockId: BlockID
308
- public lastCommitHash: Bytes
309
- public dataHash: Bytes
310
- public validatorsHash: Bytes
311
- public nextValidatorsHash: Bytes
312
- public consensusHash: Bytes
313
- public appHash: Bytes
314
- public lastResultsHash: Bytes
315
- public evidenceHash: Bytes
316
- public proposerAddress: Bytes
317
-
318
- constructor(
319
- version: Consensus,
320
- chainId: string,
321
- height: u64,
322
- time: Timestamp,
323
- lastBlockId: BlockID,
324
- lastCommitHash: Bytes,
325
- dataHash: Bytes,
326
- validatorsHash: Bytes,
327
- nextValidatorsHash: Bytes,
328
- consensusHash: Bytes,
329
- appHash: Bytes,
330
- lastResultsHash: Bytes,
331
- evidenceHash: Bytes,
332
- proposerAddress: Bytes,
333
- ) {
334
- this.version = version
335
- this.chainId = chainId
336
- this.height = height
337
- this.time = time
338
- this.lastBlockId = lastBlockId
339
- this.lastCommitHash = lastCommitHash
340
- this.dataHash = dataHash
341
- this.validatorsHash = validatorsHash
342
- this.nextValidatorsHash = nextValidatorsHash
343
- this.consensusHash = consensusHash
344
- this.appHash = appHash
345
- this.lastResultsHash = lastResultsHash
346
- this.evidenceHash = evidenceHash
347
- this.proposerAddress = proposerAddress
348
- }
349
- }
350
-
351
- export class LightBlock {
352
- public signedHeader: SignedHeader
353
- public validatorSet: ValidatorSet
354
-
355
- constructor(signedHeader: SignedHeader, validatorSet: ValidatorSet) {
356
- this.signedHeader = signedHeader
357
- this.validatorSet = validatorSet
358
- }
359
- }
360
-
361
- export class LightClientAttackEvidence {
362
- public conflictingBlock: LightBlock
363
- public commonHeight: i64
364
- public byzantineValidators: Array<Validator>
365
- public totalVotingPower: i64
366
- public timestamp: Timestamp
367
-
368
- constructor(
369
- conflictingBlock: LightBlock,
370
- commonHeight: i64,
371
- byzantineValidators: Array<Validator>,
372
- totalVotingPower: i64,
373
- timestamp: Timestamp,
374
- ) {
375
- this.conflictingBlock = conflictingBlock
376
- this.commonHeight = commonHeight
377
- this.byzantineValidators = byzantineValidators
378
- this.totalVotingPower = totalVotingPower
379
- this.timestamp = timestamp
380
- }
381
- }
382
-
383
- export class PublicKey {
384
- public ed25519: Bytes
385
- public secp256k1: Bytes
386
-
387
- constructor(ed25519: Bytes, secp256k1: Bytes) {
388
- this.ed25519 = ed25519
389
- this.secp256k1 = secp256k1
390
- }
391
- }
392
-
393
- export class PartSetHeader {
394
- public total: u32
395
- public hash: Bytes
396
-
397
- constructor(total: u32, hash: Bytes) {
398
- this.total = total
399
- this.hash = hash
400
- }
401
- }
402
-
403
- export class ResponseBeginBlock {
404
- public events: Array<Event>
405
-
406
- constructor(events: Array<Event>) {
407
- this.events = events
408
- }
409
- }
410
-
411
- export class ResponseEndBlock {
412
- public validatorUpdates: Array<ValidatorUpdate>
413
- public consensusParamUpdates: ConsensusParams
414
- public events: Array<Event>
415
-
416
- constructor(
417
- validatorUpdates: Array<ValidatorUpdate>,
418
- consensusParamUpdates: ConsensusParams,
419
- events: Array<Event>,
420
- ) {
421
- this.validatorUpdates = validatorUpdates
422
- this.consensusParamUpdates = consensusParamUpdates
423
- this.events = events
424
- }
425
- }
426
-
427
- export class ResponseDeliverTx {
428
- public code: u32
429
- public data: Bytes
430
- public log: string
431
- public info: string
432
- public gasWanted: i64
433
- public gasUsed: i64
434
- public events: Array<Event>
435
- public codespace: string
436
-
437
- constructor(
438
- code: u32,
439
- data: Bytes,
440
- log: string,
441
- info: string,
442
- gasWanted: i64,
443
- gasUsed: i64,
444
- events: Array<Event>,
445
- codespace: string,
446
- ) {
447
- this.code = code
448
- this.data = data
449
- this.log = log
450
- this.info = info
451
- this.gasWanted = gasWanted
452
- this.gasUsed = gasUsed
453
- this.events = events
454
- this.codespace = codespace
455
- }
456
- }
457
-
458
- export class SignedHeader {
459
- public header: Header
460
- public commit: Commit
461
-
462
- constructor(header: Header, commit: Commit) {
463
- this.header = header
464
- this.commit = commit
465
- }
466
- }
467
-
468
- export class Timestamp {
469
- public seconds: i64
470
- public nanos: i32
471
-
472
- constructor(seconds: i64, nanos: i32) {
473
- this.seconds = seconds
474
- this.nanos = nanos
475
- }
476
- }
477
-
478
- export class TxResult {
479
- public height: u64
480
- public index: u32
481
- public tx: Bytes
482
- public result: ResponseDeliverTx
483
-
484
- constructor(height: u64, index: u32, tx: Bytes, result: ResponseDeliverTx) {
485
- this.height = height
486
- this.index = index
487
- this.tx = tx
488
- this.result = result
489
- }
490
- }
491
-
492
- export class Validator {
493
- public address: Bytes
494
- public pubKey: PublicKey
495
- public votingPower: i64
496
- public proposerPriority: i64
497
-
498
- constructor(
499
- address: Bytes,
500
- pubKey: PublicKey,
501
- votingPower: i64,
502
- proposerPriority: i64,
503
- ) {
504
- this.address = address
505
- this.pubKey = pubKey
506
- this.votingPower = votingPower
507
- this.proposerPriority = proposerPriority
508
- }
509
- }
510
-
511
- export class ValidatorParams {
512
- public pubKeyTypes: Array<string>
513
-
514
- constructor(pubKeyTypes: Array<string>) {
515
- this.pubKeyTypes = pubKeyTypes
516
- }
517
- }
518
-
519
- export class ValidatorSet {
520
- public validators: Array<Validator>
521
- public proposer: Validator
522
- public totalVotingPower: i64
523
-
524
- constructor(
525
- validators: Array<Validator>,
526
- proposer: Validator,
527
- totalVotingPower: i64,
528
- ) {
529
- this.validators = validators
530
- this.proposer = proposer
531
- this.totalVotingPower = totalVotingPower
532
- }
533
- }
534
-
535
- export class ValidatorUpdate {
536
- public address: Bytes
537
- public pubKey: PublicKey
538
- public power: i64
539
-
540
- constructor(address: Bytes, pubKey: PublicKey, power: i64) {
541
- this.address = address
542
- this.pubKey = pubKey
543
- this.power = power
544
- }
545
- }
546
-
547
- export class VersionParams {
548
- public appVersion: u64
549
-
550
- constructor(appVersion: u64) {
551
- this.appVersion = appVersion
552
- }
553
- }
554
- }