@graphprotocol/graph-cli 0.28.0 → 0.28.3
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.
- package/README.md +6 -6
- package/examples/basic-event-handlers/node_modules/keccak/build/Makefile +1 -1
- package/examples/basic-event-handlers/node_modules/keccak/build/Release/.deps/Release/obj.target/keccak/src/addon.o.d.raw +16 -16
- package/examples/basic-event-handlers/node_modules/keccak/build/config.gypi +4 -4
- package/examples/basic-event-handlers/node_modules/keccak/build/keccak.target.mk +14 -14
- package/examples/basic-event-handlers/node_modules/websocket/build/Makefile +1 -1
- package/examples/basic-event-handlers/node_modules/websocket/build/Release/.deps/Release/obj.target/bufferutil/src/bufferutil.o.d.raw +16 -16
- package/examples/basic-event-handlers/node_modules/websocket/build/bufferutil.target.mk +14 -14
- package/examples/basic-event-handlers/node_modules/websocket/build/config.gypi +1 -1
- package/examples/basic-event-handlers/node_modules/websocket/build/validation.target.mk +14 -14
- package/package.json +1 -1
- package/src/codegen/schema.js +3 -44
- package/src/codegen/schema.test.js +0 -6
- package/src/codegen/types/conversions.js +19 -19
- package/src/codegen/types/index.js +0 -25
- package/src/codegen/types/index.test.js +0 -22
- package/src/commands/codegen.js +1 -1
- package/src/commands/deploy.js +1 -1
- package/src/commands/init.js +1 -0
- package/src/protocols/ethereum/codegen/abi.js +9 -4
- package/src/protocols/index.js +12 -2
- package/src/subgraph.js +4 -0
- package/tests/cli/init/ethereum/from-example/.gitattributes +1 -0
- package/tests/cli/init/ethereum/from-example/LICENSE +21 -0
- package/tests/cli/init/ethereum/from-example/README.md +3 -0
- package/tests/cli/init/ethereum/from-example/abis/Gravity.json +1 -0
- package/tests/cli/init/ethereum/from-example/bin/Counter.bin +1 -0
- package/tests/cli/init/ethereum/from-example/contracts/Gravity.sol +63 -0
- package/tests/cli/init/ethereum/from-example/contracts/Migrations.sol +23 -0
- package/tests/cli/init/ethereum/from-example/docker-compose.yml +39 -0
- package/tests/cli/init/ethereum/from-example/migrations/1_initial_migration.js +5 -0
- package/tests/cli/init/ethereum/from-example/migrations/2_deploy_contract.js +5 -0
- package/tests/cli/init/ethereum/from-example/migrations/3_create_gravatars.js +15 -0
- package/tests/cli/init/ethereum/from-example/networks.json +7 -0
- package/tests/cli/init/ethereum/from-example/package.json +23 -0
- package/tests/cli/init/ethereum/from-example/schema.graphql +6 -0
- package/tests/cli/init/ethereum/from-example/src/mapping.ts +22 -0
- package/tests/cli/init/ethereum/from-example/subgraph.yaml +27 -0
- package/tests/cli/init/ethereum/from-example/truffle.js +27 -0
- package/tests/cli/init/ethereum/from-example/yarn.lock +5977 -0
- package/src/protocols/tendermint/contract.js +0 -12
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# The Graph CLI (graph-cli)
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.com/package/@graphprotocol/graph-cli)
|
|
4
|
-
[](https://travis-ci.org/graphprotocol/graph-cli)
|
|
5
5
|
|
|
6
6
|
## The Graph Command Line Interface
|
|
7
7
|
|
|
@@ -57,9 +57,9 @@ If you are ready to dive into the details of building a subgraph from scratch, t
|
|
|
57
57
|
|
|
58
58
|
The steps to create a new version of the `graph-cli` are:
|
|
59
59
|
|
|
60
|
-
1. Decide which version number you'll be rolling out. You can check the differences between the current `
|
|
60
|
+
1. Decide which version number you'll be rolling out. You can check the differences between the current `main` branch and the latest release.
|
|
61
61
|
2. Create a PR with the commit generated by `npm version <VERSION> [<PREID>]`.
|
|
62
|
-
3. Once that's approved and merged to `
|
|
62
|
+
3. Once that's approved and merged to `main`, you can publish it to `npm` and push the git tags as well.
|
|
63
63
|
4. Last but not least, create a Github Release refering to the pushed git tag, linking to the PRs involved.
|
|
64
64
|
|
|
65
65
|
Helpful links:
|
|
@@ -84,7 +84,7 @@ npm version minor
|
|
|
84
84
|
git push --set-upstream <REMOTE> <BRANCH>
|
|
85
85
|
```
|
|
86
86
|
|
|
87
|
-
Once that's approved and merged, you can update your local `
|
|
87
|
+
Once that's approved and merged, you can update your local `main` and:
|
|
88
88
|
|
|
89
89
|
```
|
|
90
90
|
npm publish
|
|
@@ -106,7 +106,7 @@ npm version preminor --preid alpha
|
|
|
106
106
|
git push --set-upstream <REMOTE> <BRANCH>
|
|
107
107
|
```
|
|
108
108
|
|
|
109
|
-
Once that's approved and merged, you can update your local `
|
|
109
|
+
Once that's approved and merged, you can update your local `main` and:
|
|
110
110
|
|
|
111
111
|
```
|
|
112
112
|
npm publish --tag alpha
|
|
@@ -128,7 +128,7 @@ npm version prerelease --preid alpha
|
|
|
128
128
|
git push --set-upstream <REMOTE> <BRANCH>
|
|
129
129
|
```
|
|
130
130
|
|
|
131
|
-
Once that's approved and merged, you can update your local `
|
|
131
|
+
Once that's approved and merged, you can update your local `main` and:
|
|
132
132
|
|
|
133
133
|
```
|
|
134
134
|
npm publish --tag alpha
|
|
@@ -326,7 +326,7 @@ ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
|
|
|
326
326
|
endif
|
|
327
327
|
|
|
328
328
|
quiet_cmd_regen_makefile = ACTION Regenerating $@
|
|
329
|
-
cmd_regen_makefile = cd $(srcdir); /usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "--toplevel-dir=." -I/Users/
|
|
329
|
+
cmd_regen_makefile = cd $(srcdir); /usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "--toplevel-dir=." -I/Users/eva/graph-cli/examples/basic-event-handlers/node_modules/keccak/build/config.gypi -I/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/common.gypi "--depth=." "-Goutput_dir=." "--generator-output=build" "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/Users/eva/Library/Caches/node-gyp/14.16.0" "-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp" "-Dnode_lib_file=/Users/eva/Library/Caches/node-gyp/14.16.0/<(target_arch)/node.lib" "-Dmodule_root_dir=/Users/eva/graph-cli/examples/basic-event-handlers/node_modules/keccak" "-Dnode_engine=v8" binding.gyp
|
|
330
330
|
Makefile: $(srcdir)/../../../../../../../usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi $(srcdir)/build/config.gypi $(srcdir)/binding.gyp $(srcdir)/../../../../../Library/Caches/node-gyp/14.16.0/include/node/common.gypi
|
|
331
331
|
$(call do_cmd,regen_makefile)
|
|
332
332
|
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
Release/obj.target/keccak/src/addon.o: ../src/addon.cc \
|
|
2
|
-
/Users/
|
|
3
|
-
/Users/
|
|
4
|
-
/Users/
|
|
5
|
-
/Users/
|
|
6
|
-
/Users/
|
|
7
|
-
/Users/
|
|
8
|
-
/Users/
|
|
9
|
-
/Users/
|
|
2
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/node.h \
|
|
3
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/v8.h \
|
|
4
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/cppgc/common.h \
|
|
5
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/v8config.h \
|
|
6
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/v8-internal.h \
|
|
7
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/v8-version.h \
|
|
8
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/v8-platform.h \
|
|
9
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/node_version.h \
|
|
10
10
|
../../nan/nan.h \
|
|
11
|
-
/Users/
|
|
12
|
-
/Users/
|
|
13
|
-
/Users/
|
|
14
|
-
/Users/
|
|
15
|
-
/Users/
|
|
16
|
-
/Users/
|
|
17
|
-
/Users/
|
|
18
|
-
/Users/
|
|
11
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/uv.h \
|
|
12
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/uv/errno.h \
|
|
13
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/uv/version.h \
|
|
14
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/uv/unix.h \
|
|
15
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/uv/threadpool.h \
|
|
16
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/uv/darwin.h \
|
|
17
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/node_buffer.h \
|
|
18
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/node_object_wrap.h \
|
|
19
19
|
../../nan/nan_callbacks.h ../../nan/nan_callbacks_12_inl.h \
|
|
20
20
|
../../nan/nan_maybe_43_inl.h ../../nan/nan_converters.h \
|
|
21
21
|
../../nan/nan_converters_43_inl.h ../../nan/nan_new.h \
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"v8_use_siphash": 1,
|
|
77
77
|
"want_separate_host_toolset": 0,
|
|
78
78
|
"xcode_version": "11.0",
|
|
79
|
-
"nodedir": "/Users/
|
|
79
|
+
"nodedir": "/Users/eva/Library/Caches/node-gyp/14.16.0",
|
|
80
80
|
"standalone_static_library": 1,
|
|
81
81
|
"save_dev": "",
|
|
82
82
|
"legacy_bundling": "",
|
|
@@ -133,8 +133,8 @@
|
|
|
133
133
|
"https_proxy": "",
|
|
134
134
|
"engine_strict": "",
|
|
135
135
|
"description": "true",
|
|
136
|
-
"userconfig": "/Users/
|
|
137
|
-
"init_module": "/Users/
|
|
136
|
+
"userconfig": "/Users/eva/.npmrc",
|
|
137
|
+
"init_module": "/Users/eva/.npm-init.js",
|
|
138
138
|
"cidr": "",
|
|
139
139
|
"user": "",
|
|
140
140
|
"node_version": "14.16.0",
|
|
@@ -178,7 +178,7 @@
|
|
|
178
178
|
"otp": "",
|
|
179
179
|
"cache_min": "10",
|
|
180
180
|
"searchexclude": "",
|
|
181
|
-
"cache": "/Users/
|
|
181
|
+
"cache": "/Users/eva/.npm",
|
|
182
182
|
"color": "true",
|
|
183
183
|
"package_lock": "true",
|
|
184
184
|
"package_lock_only": "",
|
|
@@ -52,13 +52,13 @@ CFLAGS_OBJC_Debug :=
|
|
|
52
52
|
CFLAGS_OBJCC_Debug :=
|
|
53
53
|
|
|
54
54
|
INCS_Debug := \
|
|
55
|
-
-I/Users/
|
|
56
|
-
-I/Users/
|
|
57
|
-
-I/Users/
|
|
58
|
-
-I/Users/
|
|
59
|
-
-I/Users/
|
|
60
|
-
-I/Users/
|
|
61
|
-
-I/Users/
|
|
55
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/include/node \
|
|
56
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/src \
|
|
57
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/openssl/config \
|
|
58
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/openssl/openssl/include \
|
|
59
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/uv/include \
|
|
60
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/zlib \
|
|
61
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/v8/include \
|
|
62
62
|
-I$(srcdir)/../nan
|
|
63
63
|
|
|
64
64
|
DEFS_Release := \
|
|
@@ -108,13 +108,13 @@ CFLAGS_OBJC_Release :=
|
|
|
108
108
|
CFLAGS_OBJCC_Release :=
|
|
109
109
|
|
|
110
110
|
INCS_Release := \
|
|
111
|
-
-I/Users/
|
|
112
|
-
-I/Users/
|
|
113
|
-
-I/Users/
|
|
114
|
-
-I/Users/
|
|
115
|
-
-I/Users/
|
|
116
|
-
-I/Users/
|
|
117
|
-
-I/Users/
|
|
111
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/include/node \
|
|
112
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/src \
|
|
113
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/openssl/config \
|
|
114
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/openssl/openssl/include \
|
|
115
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/uv/include \
|
|
116
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/zlib \
|
|
117
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/v8/include \
|
|
118
118
|
-I$(srcdir)/../nan
|
|
119
119
|
|
|
120
120
|
OBJS := \
|
|
@@ -331,7 +331,7 @@ ifeq ($(strip $(foreach prefix,$(NO_LOAD),\
|
|
|
331
331
|
endif
|
|
332
332
|
|
|
333
333
|
quiet_cmd_regen_makefile = ACTION Regenerating $@
|
|
334
|
-
cmd_regen_makefile = cd $(srcdir); /usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "--toplevel-dir=." -I/Users/
|
|
334
|
+
cmd_regen_makefile = cd $(srcdir); /usr/local/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py -fmake --ignore-environment "--toplevel-dir=." -I/Users/eva/graph-cli/examples/basic-event-handlers/node_modules/websocket/build/config.gypi -I/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi -I/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/common.gypi "--depth=." "-Goutput_dir=." "--generator-output=build" "-Dlibrary=shared_library" "-Dvisibility=default" "-Dnode_root_dir=/Users/eva/Library/Caches/node-gyp/14.16.0" "-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp" "-Dnode_lib_file=/Users/eva/Library/Caches/node-gyp/14.16.0/<(target_arch)/node.lib" "-Dmodule_root_dir=/Users/eva/graph-cli/examples/basic-event-handlers/node_modules/websocket" "-Dnode_engine=v8" binding.gyp
|
|
335
335
|
Makefile: $(srcdir)/../../../../../../../usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi $(srcdir)/build/config.gypi $(srcdir)/binding.gyp $(srcdir)/../../../../../Library/Caches/node-gyp/14.16.0/include/node/common.gypi
|
|
336
336
|
$(call do_cmd,regen_makefile)
|
|
337
337
|
|
|
@@ -1,21 +1,21 @@
|
|
|
1
1
|
Release/obj.target/bufferutil/src/bufferutil.o: ../src/bufferutil.cc \
|
|
2
|
-
/Users/
|
|
3
|
-
/Users/
|
|
4
|
-
/Users/
|
|
5
|
-
/Users/
|
|
6
|
-
/Users/
|
|
7
|
-
/Users/
|
|
8
|
-
/Users/
|
|
9
|
-
/Users/
|
|
10
|
-
/Users/
|
|
11
|
-
/Users/
|
|
2
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/v8.h \
|
|
3
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/cppgc/common.h \
|
|
4
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/v8config.h \
|
|
5
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/v8-internal.h \
|
|
6
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/v8-version.h \
|
|
7
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/node.h \
|
|
8
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/v8-platform.h \
|
|
9
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/node_version.h \
|
|
10
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/node_buffer.h \
|
|
11
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/node_object_wrap.h \
|
|
12
12
|
../../nan/nan.h \
|
|
13
|
-
/Users/
|
|
14
|
-
/Users/
|
|
15
|
-
/Users/
|
|
16
|
-
/Users/
|
|
17
|
-
/Users/
|
|
18
|
-
/Users/
|
|
13
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/uv.h \
|
|
14
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/uv/errno.h \
|
|
15
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/uv/version.h \
|
|
16
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/uv/unix.h \
|
|
17
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/uv/threadpool.h \
|
|
18
|
+
/Users/eva/Library/Caches/node-gyp/14.16.0/include/node/uv/darwin.h \
|
|
19
19
|
../../nan/nan_callbacks.h ../../nan/nan_callbacks_12_inl.h \
|
|
20
20
|
../../nan/nan_maybe_43_inl.h ../../nan/nan_converters.h \
|
|
21
21
|
../../nan/nan_converters_43_inl.h ../../nan/nan_new.h \
|
|
@@ -49,13 +49,13 @@ CFLAGS_OBJC_Debug :=
|
|
|
49
49
|
CFLAGS_OBJCC_Debug :=
|
|
50
50
|
|
|
51
51
|
INCS_Debug := \
|
|
52
|
-
-I/Users/
|
|
53
|
-
-I/Users/
|
|
54
|
-
-I/Users/
|
|
55
|
-
-I/Users/
|
|
56
|
-
-I/Users/
|
|
57
|
-
-I/Users/
|
|
58
|
-
-I/Users/
|
|
52
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/include/node \
|
|
53
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/src \
|
|
54
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/openssl/config \
|
|
55
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/openssl/openssl/include \
|
|
56
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/uv/include \
|
|
57
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/zlib \
|
|
58
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/v8/include \
|
|
59
59
|
-I$(srcdir)/../nan
|
|
60
60
|
|
|
61
61
|
DEFS_Release := \
|
|
@@ -102,13 +102,13 @@ CFLAGS_OBJC_Release :=
|
|
|
102
102
|
CFLAGS_OBJCC_Release :=
|
|
103
103
|
|
|
104
104
|
INCS_Release := \
|
|
105
|
-
-I/Users/
|
|
106
|
-
-I/Users/
|
|
107
|
-
-I/Users/
|
|
108
|
-
-I/Users/
|
|
109
|
-
-I/Users/
|
|
110
|
-
-I/Users/
|
|
111
|
-
-I/Users/
|
|
105
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/include/node \
|
|
106
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/src \
|
|
107
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/openssl/config \
|
|
108
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/openssl/openssl/include \
|
|
109
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/uv/include \
|
|
110
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/zlib \
|
|
111
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/v8/include \
|
|
112
112
|
-I$(srcdir)/../nan
|
|
113
113
|
|
|
114
114
|
OBJS := \
|
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
"v8_use_siphash": 1,
|
|
77
77
|
"want_separate_host_toolset": 0,
|
|
78
78
|
"xcode_version": "11.0",
|
|
79
|
-
"nodedir": "/Users/
|
|
79
|
+
"nodedir": "/Users/eva/Library/Caches/node-gyp/14.16.0",
|
|
80
80
|
"standalone_static_library": 1,
|
|
81
81
|
"version_git_tag": "true",
|
|
82
82
|
"init_license": "MIT",
|
|
@@ -49,13 +49,13 @@ CFLAGS_OBJC_Debug :=
|
|
|
49
49
|
CFLAGS_OBJCC_Debug :=
|
|
50
50
|
|
|
51
51
|
INCS_Debug := \
|
|
52
|
-
-I/Users/
|
|
53
|
-
-I/Users/
|
|
54
|
-
-I/Users/
|
|
55
|
-
-I/Users/
|
|
56
|
-
-I/Users/
|
|
57
|
-
-I/Users/
|
|
58
|
-
-I/Users/
|
|
52
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/include/node \
|
|
53
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/src \
|
|
54
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/openssl/config \
|
|
55
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/openssl/openssl/include \
|
|
56
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/uv/include \
|
|
57
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/zlib \
|
|
58
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/v8/include \
|
|
59
59
|
-I$(srcdir)/../nan
|
|
60
60
|
|
|
61
61
|
DEFS_Release := \
|
|
@@ -102,13 +102,13 @@ CFLAGS_OBJC_Release :=
|
|
|
102
102
|
CFLAGS_OBJCC_Release :=
|
|
103
103
|
|
|
104
104
|
INCS_Release := \
|
|
105
|
-
-I/Users/
|
|
106
|
-
-I/Users/
|
|
107
|
-
-I/Users/
|
|
108
|
-
-I/Users/
|
|
109
|
-
-I/Users/
|
|
110
|
-
-I/Users/
|
|
111
|
-
-I/Users/
|
|
105
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/include/node \
|
|
106
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/src \
|
|
107
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/openssl/config \
|
|
108
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/openssl/openssl/include \
|
|
109
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/uv/include \
|
|
110
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/zlib \
|
|
111
|
+
-I/Users/eva/Library/Caches/node-gyp/14.16.0/deps/v8/include \
|
|
112
112
|
-I$(srcdir)/../nan
|
|
113
113
|
|
|
114
114
|
OBJS := \
|
package/package.json
CHANGED
package/src/codegen/schema.js
CHANGED
|
@@ -120,41 +120,6 @@ module.exports = class SchemaCodeGenerator {
|
|
|
120
120
|
return klass
|
|
121
121
|
}
|
|
122
122
|
|
|
123
|
-
// Fields that are non-nullable get an empty/zero value set in the class constructor.
|
|
124
|
-
_generateDefaultFieldValues(fields) {
|
|
125
|
-
const indexOfIdField = fields.findIndex(field => field.getIn(['name', 'value']) === 'id')
|
|
126
|
-
const fieldsWithoutId = fields.remove(indexOfIdField)
|
|
127
|
-
|
|
128
|
-
const fieldsSetCalls = fieldsWithoutId
|
|
129
|
-
.map(field => {
|
|
130
|
-
const name = field.getIn(['name', 'value'])
|
|
131
|
-
const type = this._typeFromGraphQl(field.get('type'), true, true)
|
|
132
|
-
|
|
133
|
-
const isNullable = type instanceof tsCodegen.NullableType
|
|
134
|
-
|
|
135
|
-
const directives = field.get('directives')
|
|
136
|
-
const isDerivedFrom = directives.some(directive => directive.getIn(['name', 'value']) === 'derivedFrom')
|
|
137
|
-
|
|
138
|
-
return { name, type, isNullable, isDerivedFrom }
|
|
139
|
-
})
|
|
140
|
-
// We only call the setter with the default value in the constructor for fields that are:
|
|
141
|
-
// - Not nullable, so that AS doesn't break when subgraph developers try to access them before a `set`
|
|
142
|
-
// - It doesn't matter if it's primitive or not
|
|
143
|
-
// - Not tagged as `derivedFrom`, because they only exist in query time
|
|
144
|
-
.filter(({
|
|
145
|
-
isNullable,
|
|
146
|
-
isDerivedFrom,
|
|
147
|
-
}) => !isNullable && !isDerivedFrom)
|
|
148
|
-
.map(({ name, type, isNullable }) => {
|
|
149
|
-
const fieldTypeString = isNullable ? type.inner.toString() : type.toString()
|
|
150
|
-
|
|
151
|
-
return `
|
|
152
|
-
this.set('${name}', ${typesCodegen.initializedValueFromAsc(fieldTypeString)})`
|
|
153
|
-
})
|
|
154
|
-
|
|
155
|
-
return fieldsSetCalls.join('')
|
|
156
|
-
}
|
|
157
|
-
|
|
158
123
|
_generateConstructor(entityName, fields) {
|
|
159
124
|
const idField = IdField.fromFields(fields)
|
|
160
125
|
return tsCodegen.method(
|
|
@@ -164,7 +129,6 @@ module.exports = class SchemaCodeGenerator {
|
|
|
164
129
|
`
|
|
165
130
|
super()
|
|
166
131
|
this.set('id', ${idField.tsValueFrom()})
|
|
167
|
-
${this._generateDefaultFieldValues(fields)}
|
|
168
132
|
`,
|
|
169
133
|
)
|
|
170
134
|
}
|
|
@@ -313,7 +277,7 @@ Suggestion: add an '!' to the member type of the List, change from '[${baseType}
|
|
|
313
277
|
}
|
|
314
278
|
}
|
|
315
279
|
|
|
316
|
-
_typeFromGraphQl(gqlType, nullable = true
|
|
280
|
+
_typeFromGraphQl(gqlType, nullable = true) {
|
|
317
281
|
if (gqlType.get('kind') === 'NonNullType') {
|
|
318
282
|
return this._typeFromGraphQl(gqlType.get('type'), false)
|
|
319
283
|
} else if (gqlType.get('kind') === 'ListType') {
|
|
@@ -324,13 +288,8 @@ Suggestion: add an '!' to the member type of the List, change from '[${baseType}
|
|
|
324
288
|
let type = tsCodegen.namedType(
|
|
325
289
|
typesCodegen.ascTypeForValue(this._resolveFieldType(gqlType)),
|
|
326
290
|
)
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
if (!nullablePrimitive && type.isPrimitive()) {
|
|
330
|
-
return type
|
|
331
|
-
}
|
|
332
|
-
|
|
333
|
-
return nullable ? tsCodegen.nullableType(type) : type
|
|
291
|
+
// In AssemblyScript, primitives cannot be nullable.
|
|
292
|
+
return nullable && !type.isPrimitive() ? tsCodegen.nullableType(type) : type
|
|
334
293
|
}
|
|
335
294
|
}
|
|
336
295
|
}
|
|
@@ -114,9 +114,6 @@ describe('Schema code generator', () => {
|
|
|
114
114
|
body: `
|
|
115
115
|
super()
|
|
116
116
|
this.set('id', Value.fromString(id))
|
|
117
|
-
|
|
118
|
-
this.set('name', Value.fromString(''))
|
|
119
|
-
this.set('count', Value.fromI32(0))
|
|
120
117
|
`,
|
|
121
118
|
},
|
|
122
119
|
{
|
|
@@ -277,9 +274,6 @@ describe('Schema code generator', () => {
|
|
|
277
274
|
body: `
|
|
278
275
|
super()
|
|
279
276
|
this.set('id', Value.fromString(id))
|
|
280
|
-
|
|
281
|
-
this.set('amount', Value.fromBigInt(BigInt.zero()))
|
|
282
|
-
this.set('account', Value.fromString(''))
|
|
283
277
|
`,
|
|
284
278
|
},
|
|
285
279
|
{
|
|
@@ -188,28 +188,28 @@ const VALUE_TO_ASSEMBLYSCRIPT = [
|
|
|
188
188
|
const ASSEMBLYSCRIPT_TO_VALUE = [
|
|
189
189
|
// Arrays
|
|
190
190
|
|
|
191
|
-
['Array<Address>', '[Bytes]', code => `Value.fromBytesArray(${code})
|
|
192
|
-
['Array<Bytes>', '[Bytes]', code => `Value.fromBytesArray(${code})
|
|
193
|
-
['Array<boolean>', '[Boolean]', code => `Value.fromBooleanArray(${code})
|
|
194
|
-
['Array<i32>', '[Int]', code => `Value.fromI32Array(${code})
|
|
195
|
-
['Array<BigInt>', '[BigInt]', code => `Value.fromBigIntArray(${code})
|
|
196
|
-
['Array<string>', '[String]', code => `Value.fromStringArray(${code})
|
|
197
|
-
['Array<string>', '[ID]', code => `Value.fromStringArray(${code})
|
|
198
|
-
['Array<BigDecimal>', '[BigDecimal]', code => `Value.fromBigDecimalArray(${code})
|
|
199
|
-
['Array<string>', /\[.*\]/, code => `Value.fromStringArray(${code})
|
|
200
|
-
['Array<string | null>', null, code => `Value.fromStringArray(${code})
|
|
191
|
+
['Array<Address>', '[Bytes]', code => `Value.fromBytesArray(${code})`],
|
|
192
|
+
['Array<Bytes>', '[Bytes]', code => `Value.fromBytesArray(${code})`],
|
|
193
|
+
['Array<boolean>', '[Boolean]', code => `Value.fromBooleanArray(${code})`],
|
|
194
|
+
['Array<i32>', '[Int]', code => `Value.fromI32Array(${code})`],
|
|
195
|
+
['Array<BigInt>', '[BigInt]', code => `Value.fromBigIntArray(${code})`],
|
|
196
|
+
['Array<string>', '[String]', code => `Value.fromStringArray(${code})`],
|
|
197
|
+
['Array<string>', '[ID]', code => `Value.fromStringArray(${code})`],
|
|
198
|
+
['Array<BigDecimal>', '[BigDecimal]', code => `Value.fromBigDecimalArray(${code})`],
|
|
199
|
+
['Array<string>', /\[.*\]/, code => `Value.fromStringArray(${code})`],
|
|
200
|
+
['Array<string | null>', null, code => `Value.fromStringArray(${code})`],
|
|
201
201
|
|
|
202
202
|
// Scalar values
|
|
203
203
|
|
|
204
|
-
['Address', 'Bytes', code => `Value.fromBytes(${code})
|
|
205
|
-
['Bytes', 'Bytes', code => `Value.fromBytes(${code})
|
|
206
|
-
['boolean', 'Boolean', code => `Value.fromBoolean(${code})
|
|
207
|
-
['i32', 'Int', code => `Value.fromI32(${code})
|
|
208
|
-
['BigInt', 'BigInt', code => `Value.fromBigInt(${code})
|
|
209
|
-
['string', 'String', code => `Value.fromString(${code})
|
|
210
|
-
['string', 'ID', code => `Value.fromString(${code})
|
|
211
|
-
['BigDecimal', 'BigDecimal', code => `Value.fromBigDecimal(${code})
|
|
212
|
-
['string', /.*/, code => `Value.fromString(${code})
|
|
204
|
+
['Address', 'Bytes', code => `Value.fromBytes(${code})`],
|
|
205
|
+
['Bytes', 'Bytes', code => `Value.fromBytes(${code})`],
|
|
206
|
+
['boolean', 'Boolean', code => `Value.fromBoolean(${code})`],
|
|
207
|
+
['i32', 'Int', code => `Value.fromI32(${code})`],
|
|
208
|
+
['BigInt', 'BigInt', code => `Value.fromBigInt(${code})`],
|
|
209
|
+
['string', 'String', code => `Value.fromString(${code})`],
|
|
210
|
+
['string', 'ID', code => `Value.fromString(${code})`],
|
|
211
|
+
['BigDecimal', 'BigDecimal', code => `Value.fromBigDecimal(${code})`],
|
|
212
|
+
['string', /.*/, code => `Value.fromString(${code})`],
|
|
213
213
|
]
|
|
214
214
|
|
|
215
215
|
/**
|
|
@@ -66,27 +66,6 @@ const findConversionToType = (fromTypeSystem, toTypeSystem, toType) => {
|
|
|
66
66
|
return objectifyConversion(fromTypeSystem, toTypeSystem, conversion)
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
const findInitializationForType = (fromTypeSystem, toTypeSystem, ascType) => {
|
|
70
|
-
const conversions = conversionsForTypeSystems(fromTypeSystem, toTypeSystem)
|
|
71
|
-
|
|
72
|
-
const conversion = conversions.find(conversion =>
|
|
73
|
-
typeof conversion.get(0) === 'string'
|
|
74
|
-
? conversion.get(0) === ascType
|
|
75
|
-
: ascType.match(conversion.get(0)),
|
|
76
|
-
)
|
|
77
|
-
|
|
78
|
-
if (conversion === undefined) {
|
|
79
|
-
throw new Error(
|
|
80
|
-
`Conversion from '${fromTypeSystem}' to '${toTypeSystem}' for ` +
|
|
81
|
-
`target type '${ascType}' is not supported`,
|
|
82
|
-
)
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
const conversionObj = objectifyConversion(fromTypeSystem, toTypeSystem, conversion)
|
|
86
|
-
|
|
87
|
-
return conversionObj.get('convert')(conversion.get(3))
|
|
88
|
-
}
|
|
89
|
-
|
|
90
69
|
// High-level type system API
|
|
91
70
|
|
|
92
71
|
const ascTypeForProtocol = (protocol, protocolType) =>
|
|
@@ -120,9 +99,6 @@ const valueToAsc = (code, valueType) =>
|
|
|
120
99
|
const valueFromAsc = (code, valueType) =>
|
|
121
100
|
findConversionToType('AssemblyScript', 'Value', valueType).get('convert')(code)
|
|
122
101
|
|
|
123
|
-
const initializedValueFromAsc = ascType =>
|
|
124
|
-
findInitializationForType('AssemblyScript', 'Value', ascType)
|
|
125
|
-
|
|
126
102
|
module.exports = {
|
|
127
103
|
// protocol <-> AssemblyScript
|
|
128
104
|
ascTypeForProtocol,
|
|
@@ -138,5 +114,4 @@ module.exports = {
|
|
|
138
114
|
valueTypeForAsc,
|
|
139
115
|
valueToAsc,
|
|
140
116
|
valueFromAsc,
|
|
141
|
-
initializedValueFromAsc,
|
|
142
117
|
}
|
|
@@ -449,26 +449,4 @@ describe('AssemblyScript -> Value', () => {
|
|
|
449
449
|
expect(codegen.valueFromAsc('x', '[String]')).toBe('Value.fromStringArray(x)')
|
|
450
450
|
expect(codegen.valueTypeForAsc('Array<string>')).toBe('[String]')
|
|
451
451
|
})
|
|
452
|
-
|
|
453
|
-
describe('Initialization for zero/empty values', () => {
|
|
454
|
-
test('Array<string>', () => {
|
|
455
|
-
expect(codegen.initializedValueFromAsc('Array<string>')).toBe('Value.fromStringArray(new Array(0))')
|
|
456
|
-
})
|
|
457
|
-
|
|
458
|
-
test('Array<string | null>', () => {
|
|
459
|
-
expect(codegen.initializedValueFromAsc('Array<string | null>')).toBe('Value.fromStringArray(new Array(0))')
|
|
460
|
-
})
|
|
461
|
-
|
|
462
|
-
test('i32', () => {
|
|
463
|
-
expect(codegen.initializedValueFromAsc('i32')).toBe('Value.fromI32(0)')
|
|
464
|
-
})
|
|
465
|
-
|
|
466
|
-
test('string', () => {
|
|
467
|
-
expect(codegen.initializedValueFromAsc('string')).toBe("Value.fromString('')")
|
|
468
|
-
})
|
|
469
|
-
|
|
470
|
-
test('BigInt', () => {
|
|
471
|
-
expect(codegen.initializedValueFromAsc('BigInt')).toBe('Value.fromBigInt(BigInt.zero())')
|
|
472
|
-
})
|
|
473
|
-
})
|
|
474
452
|
})
|
package/src/commands/codegen.js
CHANGED
|
@@ -71,7 +71,7 @@ module.exports = {
|
|
|
71
71
|
// because that would mean the CLI would generate code to
|
|
72
72
|
// the wrong AssemblyScript version.
|
|
73
73
|
await assertManifestApiVersion(manifest, '0.0.5')
|
|
74
|
-
await assertGraphTsVersion(path.dirname(manifest), '0.
|
|
74
|
+
await assertGraphTsVersion(path.dirname(manifest), '0.25.0')
|
|
75
75
|
|
|
76
76
|
const dataSourcesAndTemplates = await DataSourcesExtractor.fromFilePath(manifest)
|
|
77
77
|
|
package/src/commands/deploy.js
CHANGED
|
@@ -200,7 +200,7 @@ module.exports = {
|
|
|
200
200
|
// because that would mean the CLI would try to compile code
|
|
201
201
|
// using the wrong AssemblyScript compiler.
|
|
202
202
|
await assertManifestApiVersion(manifest, '0.0.5')
|
|
203
|
-
await assertGraphTsVersion(path.dirname(manifest), '0.
|
|
203
|
+
await assertGraphTsVersion(path.dirname(manifest), '0.25.0')
|
|
204
204
|
|
|
205
205
|
const dataSourcesAndTemplates = await DataSourcesExtractor.fromFilePath(manifest)
|
|
206
206
|
|
package/src/commands/init.js
CHANGED
|
@@ -285,6 +285,7 @@ const getEtherscanLikeAPIUrl = (network) => {
|
|
|
285
285
|
case "mumbai": return `https://api-testnet.polygonscan.com/api`;
|
|
286
286
|
case "aurora": return `https://api.aurorascan.dev/api`;
|
|
287
287
|
case "aurora-testnet": return `https://api-testnet.aurorascan.dev/api`;
|
|
288
|
+
case "optimism-kovan": return `https://api-kovan-optimistic.etherscan.io/api`;
|
|
288
289
|
default: return `https://api-${network}.etherscan.io/api`;
|
|
289
290
|
}
|
|
290
291
|
}
|
|
@@ -212,11 +212,16 @@ module.exports = class AbiCodeGenerator {
|
|
|
212
212
|
`parameters`,
|
|
213
213
|
)
|
|
214
214
|
paramsClass.addMethod(paramObject.getter)
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
215
|
+
|
|
216
|
+
// Fixture generation
|
|
217
|
+
if (doFixtureCodegen) {
|
|
218
|
+
let ethType = typesCodegen.ethereumTypeForAsc(paramObject.getter.returnType)
|
|
219
|
+
if (typeof ethType === typeof {} && (ethType.test("int256") || ethType.test("uint256"))) {
|
|
220
|
+
ethType = "int32"
|
|
221
|
+
}
|
|
222
|
+
namesAndTypes.push({name: paramObject.getter.name.slice(4), type: ethType})
|
|
218
223
|
}
|
|
219
|
-
|
|
224
|
+
|
|
220
225
|
tupleClasses.push(...paramObject.classes)
|
|
221
226
|
})
|
|
222
227
|
|