@graphprotocol/graph-cli 0.33.1 → 0.34.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 (33) hide show
  1. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/README.md +1 -1
  2. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/chain/ethereum.ts +200 -0
  3. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/global/global.ts +28 -28
  4. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/methods.txt +18 -0
  5. package/examples/basic-event-handlers/node_modules/@graphprotocol/graph-ts/package.json +1 -1
  6. package/examples/basic-event-handlers/node_modules/keccak/build/Makefile +342 -0
  7. package/examples/basic-event-handlers/node_modules/keccak/build/Release/.deps/Release/obj.target/keccak/src/addon.o.d.raw +69 -0
  8. package/examples/basic-event-handlers/node_modules/keccak/build/binding.Makefile +6 -0
  9. package/examples/basic-event-handlers/node_modules/keccak/build/config.gypi +27 -11
  10. package/examples/basic-event-handlers/node_modules/keccak/build/gyp-mac-tool +772 -0
  11. package/examples/basic-event-handlers/node_modules/keccak/build/keccak.target.mk +207 -0
  12. package/examples/basic-event-handlers/node_modules/websocket/build/Makefile +347 -0
  13. package/examples/basic-event-handlers/node_modules/websocket/build/Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d.raw +67 -0
  14. package/examples/basic-event-handlers/node_modules/websocket/build/binding.Makefile +6 -0
  15. package/examples/basic-event-handlers/node_modules/websocket/build/bufferutil.target.mk +190 -0
  16. package/examples/basic-event-handlers/node_modules/websocket/build/config.gypi +23 -7
  17. package/examples/basic-event-handlers/node_modules/websocket/build/gyp-mac-tool +772 -0
  18. package/examples/basic-event-handlers/node_modules/websocket/build/validation.target.mk +190 -0
  19. package/examples/basic-event-handlers/package.json +1 -1
  20. package/examples/basic-event-handlers/yarn.lock +4 -4
  21. package/examples/example-subgraph/package.json +1 -1
  22. package/examples/example-subgraph/yarn.lock +4 -4
  23. package/package.json +1 -1
  24. package/src/codegen/types/conversions.js +100 -0
  25. package/src/codegen/types/index.test.js +347 -0
  26. package/src/codegen/util.js +6 -1
  27. package/src/command-helpers/spinner.js +6 -0
  28. package/src/commands/init.js +33 -12
  29. package/src/protocols/ethereum/abi.js +8 -0
  30. package/src/protocols/ethereum/codegen/abi.js +12 -1
  31. package/src/scaffold/index.js +1 -1
  32. package/src/subgraph.js +6 -5
  33. package/tests/cli/init.test.js +1 -0
@@ -0,0 +1,190 @@
1
+ # This file is generated by gyp; do not edit.
2
+
3
+ TOOLSET := target
4
+ TARGET := validation
5
+ DEFS_Debug := \
6
+ '-DNODE_GYP_MODULE_NAME=validation' \
7
+ '-DUSING_UV_SHARED=1' \
8
+ '-DUSING_V8_SHARED=1' \
9
+ '-DV8_DEPRECATION_WARNINGS=1' \
10
+ '-DV8_DEPRECATION_WARNINGS' \
11
+ '-DV8_IMMINENT_DEPRECATION_WARNINGS' \
12
+ '-D_GLIBCXX_USE_CXX11_ABI=1' \
13
+ '-D_DARWIN_USE_64_BIT_INODE=1' \
14
+ '-D_LARGEFILE_SOURCE' \
15
+ '-D_FILE_OFFSET_BITS=64' \
16
+ '-DOPENSSL_NO_PINSHARED' \
17
+ '-DOPENSSL_THREADS' \
18
+ '-DBUILDING_NODE_EXTENSION' \
19
+ '-DDEBUG' \
20
+ '-D_DEBUG' \
21
+ '-DV8_ENABLE_CHECKS'
22
+
23
+ # Flags passed to all source files.
24
+ CFLAGS_Debug := \
25
+ -O0 \
26
+ -gdwarf-2 \
27
+ -mmacosx-version-min=10.15 \
28
+ -arch arm64 \
29
+ -Wall \
30
+ -Wendif-labels \
31
+ -W \
32
+ -Wno-unused-parameter
33
+
34
+ # Flags passed to only C files.
35
+ CFLAGS_C_Debug := \
36
+ -fno-strict-aliasing
37
+
38
+ # Flags passed to only C++ files.
39
+ CFLAGS_CC_Debug := \
40
+ -std=gnu++17 \
41
+ -stdlib=libc++ \
42
+ -fno-rtti \
43
+ -fno-exceptions \
44
+ -fno-strict-aliasing
45
+
46
+ # Flags passed to only ObjC files.
47
+ CFLAGS_OBJC_Debug :=
48
+
49
+ # Flags passed to only ObjC++ files.
50
+ CFLAGS_OBJCC_Debug :=
51
+
52
+ INCS_Debug := \
53
+ -I/Users/eva/Library/Caches/node-gyp/18.2.0/include/node \
54
+ -I/Users/eva/Library/Caches/node-gyp/18.2.0/src \
55
+ -I/Users/eva/Library/Caches/node-gyp/18.2.0/deps/openssl/config \
56
+ -I/Users/eva/Library/Caches/node-gyp/18.2.0/deps/openssl/openssl/include \
57
+ -I/Users/eva/Library/Caches/node-gyp/18.2.0/deps/uv/include \
58
+ -I/Users/eva/Library/Caches/node-gyp/18.2.0/deps/zlib \
59
+ -I/Users/eva/Library/Caches/node-gyp/18.2.0/deps/v8/include \
60
+ -I$(srcdir)/../nan
61
+
62
+ DEFS_Release := \
63
+ '-DNODE_GYP_MODULE_NAME=validation' \
64
+ '-DUSING_UV_SHARED=1' \
65
+ '-DUSING_V8_SHARED=1' \
66
+ '-DV8_DEPRECATION_WARNINGS=1' \
67
+ '-DV8_DEPRECATION_WARNINGS' \
68
+ '-DV8_IMMINENT_DEPRECATION_WARNINGS' \
69
+ '-D_GLIBCXX_USE_CXX11_ABI=1' \
70
+ '-D_DARWIN_USE_64_BIT_INODE=1' \
71
+ '-D_LARGEFILE_SOURCE' \
72
+ '-D_FILE_OFFSET_BITS=64' \
73
+ '-DOPENSSL_NO_PINSHARED' \
74
+ '-DOPENSSL_THREADS' \
75
+ '-DBUILDING_NODE_EXTENSION'
76
+
77
+ # Flags passed to all source files.
78
+ CFLAGS_Release := \
79
+ -O3 \
80
+ -gdwarf-2 \
81
+ -mmacosx-version-min=10.15 \
82
+ -arch arm64 \
83
+ -Wall \
84
+ -Wendif-labels \
85
+ -W \
86
+ -Wno-unused-parameter
87
+
88
+ # Flags passed to only C files.
89
+ CFLAGS_C_Release := \
90
+ -fno-strict-aliasing
91
+
92
+ # Flags passed to only C++ files.
93
+ CFLAGS_CC_Release := \
94
+ -std=gnu++17 \
95
+ -stdlib=libc++ \
96
+ -fno-rtti \
97
+ -fno-exceptions \
98
+ -fno-strict-aliasing
99
+
100
+ # Flags passed to only ObjC files.
101
+ CFLAGS_OBJC_Release :=
102
+
103
+ # Flags passed to only ObjC++ files.
104
+ CFLAGS_OBJCC_Release :=
105
+
106
+ INCS_Release := \
107
+ -I/Users/eva/Library/Caches/node-gyp/18.2.0/include/node \
108
+ -I/Users/eva/Library/Caches/node-gyp/18.2.0/src \
109
+ -I/Users/eva/Library/Caches/node-gyp/18.2.0/deps/openssl/config \
110
+ -I/Users/eva/Library/Caches/node-gyp/18.2.0/deps/openssl/openssl/include \
111
+ -I/Users/eva/Library/Caches/node-gyp/18.2.0/deps/uv/include \
112
+ -I/Users/eva/Library/Caches/node-gyp/18.2.0/deps/zlib \
113
+ -I/Users/eva/Library/Caches/node-gyp/18.2.0/deps/v8/include \
114
+ -I$(srcdir)/../nan
115
+
116
+ OBJS := \
117
+ $(obj).target/$(TARGET)/src/validation.o
118
+
119
+ # Add to the list of files we specially track dependencies for.
120
+ all_deps += $(OBJS)
121
+
122
+ # CFLAGS et al overrides must be target-local.
123
+ # See "Target-specific Variable Values" in the GNU Make manual.
124
+ $(OBJS): TOOLSET := $(TOOLSET)
125
+ $(OBJS): GYP_CFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE))
126
+ $(OBJS): GYP_CXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE))
127
+ $(OBJS): GYP_OBJCFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_C_$(BUILDTYPE)) $(CFLAGS_OBJC_$(BUILDTYPE))
128
+ $(OBJS): GYP_OBJCXXFLAGS := $(DEFS_$(BUILDTYPE)) $(INCS_$(BUILDTYPE)) $(CFLAGS_$(BUILDTYPE)) $(CFLAGS_CC_$(BUILDTYPE)) $(CFLAGS_OBJCC_$(BUILDTYPE))
129
+
130
+ # Suffix rules, putting all outputs into $(obj).
131
+
132
+ $(obj).$(TOOLSET)/$(TARGET)/%.o: $(srcdir)/%.cc FORCE_DO_CMD
133
+ @$(call do_cmd,cxx,1)
134
+
135
+ # Try building from generated source, too.
136
+
137
+ $(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj).$(TOOLSET)/%.cc FORCE_DO_CMD
138
+ @$(call do_cmd,cxx,1)
139
+
140
+ $(obj).$(TOOLSET)/$(TARGET)/%.o: $(obj)/%.cc FORCE_DO_CMD
141
+ @$(call do_cmd,cxx,1)
142
+
143
+ # End of this set of suffix rules
144
+ ### Rules for final target.
145
+ LDFLAGS_Debug := \
146
+ -undefined dynamic_lookup \
147
+ -Wl,-search_paths_first \
148
+ -mmacosx-version-min=10.15 \
149
+ -arch arm64 \
150
+ -L$(builddir) \
151
+ -stdlib=libc++
152
+
153
+ LIBTOOLFLAGS_Debug := \
154
+ -undefined dynamic_lookup \
155
+ -Wl,-search_paths_first
156
+
157
+ LDFLAGS_Release := \
158
+ -undefined dynamic_lookup \
159
+ -Wl,-search_paths_first \
160
+ -mmacosx-version-min=10.15 \
161
+ -arch arm64 \
162
+ -L$(builddir) \
163
+ -stdlib=libc++
164
+
165
+ LIBTOOLFLAGS_Release := \
166
+ -undefined dynamic_lookup \
167
+ -Wl,-search_paths_first
168
+
169
+ LIBS :=
170
+
171
+ $(builddir)/validation.node: GYP_LDFLAGS := $(LDFLAGS_$(BUILDTYPE))
172
+ $(builddir)/validation.node: LIBS := $(LIBS)
173
+ $(builddir)/validation.node: GYP_LIBTOOLFLAGS := $(LIBTOOLFLAGS_$(BUILDTYPE))
174
+ $(builddir)/validation.node: TOOLSET := $(TOOLSET)
175
+ $(builddir)/validation.node: $(OBJS) FORCE_DO_CMD
176
+ $(call do_cmd,solink_module)
177
+
178
+ all_deps += $(builddir)/validation.node
179
+ # Add target alias
180
+ .PHONY: validation
181
+ validation: $(builddir)/validation.node
182
+
183
+ # Short alias for building this executable.
184
+ .PHONY: validation.node
185
+ validation.node: $(builddir)/validation.node
186
+
187
+ # Add executable to "all" target.
188
+ .PHONY: all
189
+ all: $(builddir)/validation.node
190
+
@@ -9,7 +9,7 @@
9
9
  "deploy-test": "../../bin/graph deploy test/basic-event-handlers --version-label v0.0.1 --ipfs http://localhost:15001 --node http://127.0.0.1:18020"
10
10
  },
11
11
  "devDependencies": {
12
- "@graphprotocol/graph-ts": "0.27.0",
12
+ "@graphprotocol/graph-ts": "0.28.0",
13
13
  "apollo-fetch": "^0.7.0"
14
14
  },
15
15
  "dependencies": {
@@ -2,10 +2,10 @@
2
2
  # yarn lockfile v1
3
3
 
4
4
 
5
- "@graphprotocol/graph-ts@0.27.0":
6
- version "0.27.0"
7
- resolved "https://registry.yarnpkg.com/@graphprotocol/graph-ts/-/graph-ts-0.27.0.tgz#948fe1716f6082964a01a63a19bcbf9ac44e06ff"
8
- integrity sha512-r1SPDIZVQiGMxcY8rhFSM0y7d/xAbQf5vHMWUf59js1KgoyWpM6P3tczZqmQd7JTmeyNsDGIPzd9FeaxllsU4w==
5
+ "@graphprotocol/graph-ts@0.28.0":
6
+ version "0.28.0"
7
+ resolved "https://registry.yarnpkg.com/@graphprotocol/graph-ts/-/graph-ts-0.28.0.tgz#4229ad10b9a956c76f126bb08a856c556eedef22"
8
+ integrity sha512-Qug3KpmqZ/KOg3FFBOtD74GAK/9AkR7lTxoEYMdx3jZ/+fi9oOSDod2vEkLOjUxsE7yZOseNqiXOxeU0XGqJWw==
9
9
  dependencies:
10
10
  assemblyscript "0.19.10"
11
11
 
@@ -7,7 +7,7 @@
7
7
  "build-wast": "../../bin/graph build -t wast subgraph.yaml"
8
8
  },
9
9
  "devDependencies": {
10
- "@graphprotocol/graph-ts": "0.27.0"
10
+ "@graphprotocol/graph-ts": "0.28.0"
11
11
  },
12
12
  "resolutions": {
13
13
  "assemblyscript": "0.19.10"
@@ -2,10 +2,10 @@
2
2
  # yarn lockfile v1
3
3
 
4
4
 
5
- "@graphprotocol/graph-ts@0.27.0":
6
- version "0.27.0"
7
- resolved "https://registry.yarnpkg.com/@graphprotocol/graph-ts/-/graph-ts-0.27.0.tgz#948fe1716f6082964a01a63a19bcbf9ac44e06ff"
8
- integrity sha512-r1SPDIZVQiGMxcY8rhFSM0y7d/xAbQf5vHMWUf59js1KgoyWpM6P3tczZqmQd7JTmeyNsDGIPzd9FeaxllsU4w==
5
+ "@graphprotocol/graph-ts@0.28.0":
6
+ version "0.28.0"
7
+ resolved "https://registry.yarnpkg.com/@graphprotocol/graph-ts/-/graph-ts-0.28.0.tgz#4229ad10b9a956c76f126bb08a856c556eedef22"
8
+ integrity sha512-Qug3KpmqZ/KOg3FFBOtD74GAK/9AkR7lTxoEYMdx3jZ/+fi9oOSDod2vEkLOjUxsE7yZOseNqiXOxeU0XGqJWw==
9
9
  dependencies:
10
10
  assemblyscript "0.19.10"
11
11
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphprotocol/graph-cli",
3
- "version": "0.33.1",
3
+ "version": "0.34.0",
4
4
  "license": "(Apache-2.0 OR MIT)",
5
5
  "description": "CLI for building for and deploying to The Graph",
6
6
  "dependencies": {
@@ -52,6 +52,32 @@ const ETHEREUM_VALUE_TO_ASSEMBLYSCRIPT = [
52
52
  'Array<ethereum.Tuple>',
53
53
  (code, type) => `${code}.toTupleArray<${type}>()`,
54
54
  ],
55
+
56
+ // Multi dimensional arrays
57
+
58
+ [/^address\[([0-9]+)?\]\[([0-9]+)?\]$/, 'Array<Array<Address>>', code => `${code}.toAddressMatrix()`],
59
+ [/^bool\[([0-9]+)?\]\[([0-9]+)?\]$/, 'Array<Array<boolean>>', code => `${code}.toBooleanMatrix()`],
60
+ [/^byte\[([0-9]+)?\]\[([0-9]+)?\]$/, 'Array<Array<Bytes>>', code => `${code}.toBytesMatrix()`],
61
+ [
62
+ /^bytes(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)?\[([0-9]+)?\]\[([0-9]+)?\]$/,
63
+ 'Array<Array<Bytes>>',
64
+ code => `${code}.toBytesMatrix()`,
65
+ ],
66
+ [/^int(8|16|24|32)\[([0-9]+)?\]\[([0-9]+)?\]$/, 'Array<Array<i32>>', code => `${code}.toI32Matrix()`],
67
+ [/^uint(8|16|24)\[([0-9]+)?\]\[([0-9]+)?\]$/, 'Array<Array<i32>>', code => `${code}.toI32Matrix()`],
68
+ [/^uint32\[([0-9]+)?\]\[([0-9]+)?\]$/, 'Array<Array<BigInt>>', code => `${code}.toBigIntMatrix()`],
69
+ [
70
+ /^u?int(40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)\[([0-9]+)?\]\[([0-9]+)?\]$/,
71
+ 'Array<Array<BigInt>>',
72
+ code => `${code}.toBigIntMatrix()`,
73
+ ],
74
+ [/^string\[([0-9]+)?\]\[([0-9]+)?\]$/, 'Array<Array<string>>', code => `${code}.toStringMatrix()`],
75
+ [
76
+ /^tuple\[([0-9]+)?\]\[([0-9]+)?\]$/,
77
+ 'Array<Array<ethereum.Tuple>>',
78
+ (code, type) => `${code}.toTupleMatrix<${type}>()`,
79
+ ],
80
+
55
81
  ]
56
82
 
57
83
  /**
@@ -143,12 +169,73 @@ const ASSEMBLYSCRIPT_TO_ETHEREUM_VALUE = [
143
169
  /^string\[([0-9]+)?\]$/,
144
170
  code => `ethereum.Value.fromStringArray(${code})`,
145
171
  ],
172
+
173
+ // Tuples
174
+
146
175
  ['ethereum.Tuple', 'tuple', code => `ethereum.Value.fromTuple(${code})`],
147
176
  [
148
177
  'Array<ethereum.Tuple>',
149
178
  /^tuple\[([0-9]+)?\]$/,
150
179
  code => `ethereum.Value.fromTupleArray(${code})`,
151
180
  ],
181
+
182
+ // Multi dimentional arrays
183
+
184
+ [
185
+ 'Array<Array<Address>>',
186
+ /^address\[([0-9]+)?\]\[([0-9]+)?\]$/,
187
+ code => `ethereum.Value.fromAddressMatrix(${code})`,
188
+ ],
189
+ [
190
+ 'Array<Array<boolean>>',
191
+ /^bool\[([0-9]+)?\]\[([0-9]+)?\]$/,
192
+ code => `ethereum.Value.fromBooleanMatrix(${code})`,
193
+ ],
194
+ [
195
+ 'Array<Array<Bytes>>',
196
+ /^byte\[([0-9]+)?\]\[([0-9]+)?\]$/,
197
+ code => `ethereum.Value.fromFixedBytesMatrix(${code})`,
198
+ ],
199
+ [
200
+ 'Array<Array<Bytes>>',
201
+ /bytes\[([0-9]+)?\]\[([0-9]+)?\]$/,
202
+ code => `ethereum.Value.fromBytesMatrix(${code})`,
203
+ ],
204
+ [
205
+ 'Array<Array<Bytes>>',
206
+ /^bytes(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)\[([0-9]+)?\]\[([0-9]+)?\]$/,
207
+ code => `ethereum.Value.fromFixedBytesMatrix(${code})`,
208
+ ],
209
+ [
210
+ 'Array<Array<i32>>',
211
+ /^int(8|16|24|32)\[([0-9]+)?\]\[([0-9]+)?\]$/,
212
+ code => `ethereum.Value.fromI32Matrix(${code})`,
213
+ ],
214
+ [
215
+ 'Array<Array<i32>>',
216
+ /^uint(8|16|24)\[([0-9]+)?\]\[([0-9]+)?\]$/,
217
+ code => `ethereum.Value.fromI32Matrix(${code})`,
218
+ ],
219
+ [
220
+ 'Array<Array<BigInt>>',
221
+ /^int(40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)\[([0-9]+)?\]\[([0-9]+)?\]$/,
222
+ code => `ethereum.Value.fromSignedBigIntMatrix(${code})`,
223
+ ],
224
+ [
225
+ 'Array<Array<BigInt>>',
226
+ /^uint(32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)\[([0-9]+)?\]\[([0-9]+)?\]$/,
227
+ code => `ethereum.Value.fromUnsignedBigIntMatrix(${code})`,
228
+ ],
229
+ [
230
+ 'Array<Array<string>>',
231
+ /^string\[([0-9]+)?\]\[([0-9]+)?\]$/,
232
+ code => `ethereum.Value.fromStringMatrix(${code})`,
233
+ ],
234
+ [
235
+ 'Array<Array<ethereum.Tuple>>',
236
+ /^tuple\[([0-9]+)?\]\[([0-9]+)?\]$/,
237
+ code => `ethereum.Value.fromTupleMatrix(${code})`,
238
+ ],
152
239
  ]
153
240
 
154
241
  /**
@@ -186,6 +273,19 @@ const VALUE_TO_ASSEMBLYSCRIPT = [
186
273
  * for them.
187
274
  */
188
275
  const ASSEMBLYSCRIPT_TO_VALUE = [
276
+ // Matrices
277
+
278
+ ['Array<Array<Address>>', '[[Bytes]]', code => `Value.fromBytesMatrix(${code})`],
279
+ ['Array<Array<Bytes>>', '[[Bytes]]', code => `Value.fromBytesMatrix(${code})`],
280
+ ['Array<Array<boolean>>', '[[Boolean]]', code => `Value.fromBooleanMatrix(${code})`],
281
+ ['Array<Array<i32>>', '[[Int]]', code => `Value.fromI32Matrix(${code})`],
282
+ ['Array<Array<BigInt>>', '[[BigInt]]', code => `Value.fromBigIntMatrix(${code})`],
283
+ ['Array<Array<string>>', '[[String]]', code => `Value.fromStringMatrix(${code})`],
284
+ ['Array<Array<string>>', '[[ID]]', code => `Value.fromStringMatrix(${code})`],
285
+ ['Array<Array<BigDecimal>>', '[[BigDecimal]]', code => `Value.fromBigDecimalMatrix(${code})`],
286
+ ['Array<Array<string>>', /\[\[.*\]\]/, code => `Value.fromStringMatrix(${code})`],
287
+ ['Array<Array<string | null>>', null, code => `Value.fromStringMatrix(${code})`],// is this overwriting the Array null below?
288
+
189
289
  // Arrays
190
290
 
191
291
  ['Array<Address>', '[Bytes]', code => `Value.fromBytesArray(${code})`],