@graphprotocol/graph-cli 0.25.3 → 0.28.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 (37) hide show
  1. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/chain/ethereum.ts +1 -1
  2. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/chain/tendermint.ts +554 -0
  3. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/common/collections.ts +52 -2
  4. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/common/numbers.ts +11 -0
  5. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/common/value.ts +47 -0
  6. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/global/global.ts +150 -1
  7. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/index.ts +2 -0
  8. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/package.json +2 -1
  9. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/test/test.js +2 -0
  10. package/examples/basic-event-handlers/package.json +5 -5
  11. package/examples/basic-event-handlers/yarn.lock +12 -12
  12. package/examples/example-subgraph/package.json +1 -1
  13. package/examples/example-subgraph/yarn.lock +4 -4
  14. package/package.json +27 -24
  15. package/src/codegen/schema.js +104 -25
  16. package/src/codegen/schema.test.js +3 -7
  17. package/src/commands/deploy.js +3 -1
  18. package/src/commands/init.js +2 -0
  19. package/src/commands/test.js +82 -59
  20. package/src/protocols/ethereum/codegen/abi.js +72 -2
  21. package/src/protocols/ethereum/manifest.graphql +92 -0
  22. package/src/protocols/index.js +41 -7
  23. package/src/protocols/near/manifest.graphql +57 -0
  24. package/src/protocols/tendermint/contract.js +12 -0
  25. package/src/protocols/tendermint/manifest.graphql +64 -0
  26. package/src/protocols/tendermint/subgraph.js +20 -0
  27. package/src/scaffold/index.js +1 -1
  28. package/src/subgraph.js +18 -13
  29. package/src/validation/manifest.js +29 -8
  30. package/src/validation/schema.js +120 -119
  31. package/tests/cli/validation/example-values-found.stderr +2 -2
  32. package/tests/cli/validation/invalid-manifest/subgraph.yaml +2 -1
  33. package/tests/cli/validation/invalid-manifest-cannot-infer-protocol/subgraph.yaml +12 -0
  34. package/tests/cli/validation/invalid-manifest-cannot-infer-protocol.stderr +5 -0
  35. package/tests/cli/validation/invalid-manifest.stderr +0 -3
  36. package/tests/cli/validation.test.js +8 -0
  37. package/manifest-schema.graphql +0 -122
@@ -0,0 +1,12 @@
1
+ schema:
2
+ file: ./non-existent.grapqhl
3
+ dataSources:
4
+ - name: 5
5
+ abis:
6
+ name: Foo
7
+ mapping:
8
+ - 12
9
+ - 13
10
+ - 14
11
+ templates:
12
+ field: foo
@@ -0,0 +1,5 @@
1
+ - Load subgraph from subgraph.yaml
2
+ ✖ Failed to load subgraph from subgraph.yaml: Error in subgraph.yaml:
3
+
4
+ Path: /
5
+ Unable to determine for which protocol manifest file is built for. Ensure you have at least one 'dataSources' and/or 'templates' elements defined in your subgraph.
@@ -7,9 +7,6 @@
7
7
  Path: schema > file
8
8
  File does not exist: non-existent.grapqhl
9
9
 
10
- Path: dataSources > 0 > kind
11
- No value provided
12
-
13
10
  Path: dataSources > 0 > name
14
11
  Expected string, found number:
15
12
  5
@@ -9,6 +9,14 @@ describe('Validation', () => {
9
9
  exitCode: 1,
10
10
  },
11
11
  )
12
+ cliTest(
13
+ 'Invalid subgraph manifest (cannot infer protocol)',
14
+ ['codegen', '--skip-migrations'],
15
+ 'validation/invalid-manifest-cannot-infer-protocol',
16
+ {
17
+ exitCode: 1,
18
+ },
19
+ )
12
20
  cliTest(
13
21
  'ABI not found in data source',
14
22
  ['codegen', '--skip-migrations'],
@@ -1,122 +0,0 @@
1
- scalar String
2
- scalar File
3
- scalar BigInt
4
-
5
- type Schema {
6
- file: File!
7
- }
8
-
9
- union DataSource =
10
- EthereumContractDataSource |
11
- NearContractDataSource
12
-
13
- union DataSourceTemplate = EthereumContractDataSourceTemplate
14
-
15
- type EthereumContractDataSource {
16
- kind: String!
17
- name: String!
18
- network: String
19
- source: EthereumContractSource!
20
- mapping: EthereumContractMapping!
21
- }
22
-
23
- type NearContractDataSource {
24
- kind: String!
25
- name: String!
26
- network: String
27
- source: NearContractSource!
28
- mapping: NearContractMapping!
29
- }
30
-
31
- type EthereumContractSource {
32
- address: String
33
- abi: String!
34
- startBlock: BigInt
35
- }
36
-
37
- type NearContractSource {
38
- account: String
39
- startBlock: BigInt
40
- }
41
-
42
- type EthereumContractMapping {
43
- kind: String
44
- apiVersion: String!
45
- language: String!
46
- file: File!
47
- entities: [String!]!
48
- abis: [EthereumContractAbi!]!
49
- blockHandlers: [EthereumBlockHandler!]
50
- callHandlers: [EthereumCallHandler!]
51
- eventHandlers: [EthereumContractEventHandler!]
52
- }
53
-
54
- type NearContractMapping {
55
- apiVersion: String!
56
- language: String!
57
- file: File!
58
- entities: [String!]!
59
- blockHandlers: [NearBlockHandler!]
60
- receiptHandlers: [NearReceiptHandler!]
61
- }
62
-
63
- type EthereumContractAbi {
64
- name: String!
65
- file: File!
66
- }
67
-
68
- type EthereumBlockHandler {
69
- handler: String!
70
- filter: EthereumBlockFilter
71
- }
72
-
73
- type EthereumBlockFilter {
74
- kind: String!
75
- }
76
-
77
- type NearBlockHandler {
78
- handler: String!
79
- }
80
-
81
- type EthereumCallHandler {
82
- function: String!
83
- handler: String!
84
- }
85
-
86
- type NearReceiptHandler {
87
- handler: String!
88
- }
89
-
90
- type EthereumContractEventHandler {
91
- event: String!
92
- topic0: String
93
- handler: String!
94
- }
95
-
96
- type Graft {
97
- base: String!
98
- block: BigInt!
99
- }
100
-
101
- type SubgraphManifest {
102
- specVersion: String!
103
- features: [String!]
104
- schema: Schema!
105
- description: String
106
- repository: String
107
- graft: Graft
108
- dataSources: [DataSource!]!
109
- templates: [DataSourceTemplate!]
110
- }
111
-
112
- type EthereumContractDataSourceTemplate {
113
- kind: String!
114
- name: String!
115
- network: String
116
- source: EthereumContractSourceTemplate!
117
- mapping: EthereumContractMapping!
118
- }
119
-
120
- type EthereumContractSourceTemplate {
121
- abi: String!
122
- }