@graphprotocol/graph-cli 0.61.1-alpha-20231115005019-24f43a5 → 0.61.1-alpha-20231115011038-12d4e4b
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/CHANGELOG.md +14 -4
- package/dist/package.json +92 -0
- package/dist/{command-helpers → src/command-helpers}/abi.js +7 -5
- package/dist/{command-helpers → src/command-helpers}/compiler.js +8 -1
- package/dist/{command-helpers → src/command-helpers}/node.js +2 -1
- package/dist/{commands → src/commands}/create.js +5 -1
- package/dist/{commands → src/commands}/deploy.js +13 -3
- package/dist/{commands → src/commands}/remove.js +5 -1
- package/dist/{commands → src/commands}/test.js +5 -4
- package/dist/src/constants.d.ts +3 -0
- package/dist/src/constants.js +7 -0
- package/dist/src/fetch.d.ts +2 -0
- package/dist/src/fetch.js +15 -0
- package/dist/{type-generator.js → src/type-generator.js} +6 -22
- package/oclif.manifest.json +2 -867
- package/package.json +1 -1
- /package/dist/{codegen → src/codegen}/schema.d.ts +0 -0
- /package/dist/{codegen → src/codegen}/schema.js +0 -0
- /package/dist/{codegen → src/codegen}/schema.test.d.ts +0 -0
- /package/dist/{codegen → src/codegen}/schema.test.js +0 -0
- /package/dist/{codegen → src/codegen}/template.d.ts +0 -0
- /package/dist/{codegen → src/codegen}/template.js +0 -0
- /package/dist/{codegen → src/codegen}/types/conversions.d.ts +0 -0
- /package/dist/{codegen → src/codegen}/types/conversions.js +0 -0
- /package/dist/{codegen → src/codegen}/types/index.d.ts +0 -0
- /package/dist/{codegen → src/codegen}/types/index.js +0 -0
- /package/dist/{codegen → src/codegen}/types/index.test.d.ts +0 -0
- /package/dist/{codegen → src/codegen}/types/index.test.js +0 -0
- /package/dist/{codegen → src/codegen}/typescript.d.ts +0 -0
- /package/dist/{codegen → src/codegen}/typescript.js +0 -0
- /package/dist/{codegen → src/codegen}/util.d.ts +0 -0
- /package/dist/{codegen → src/codegen}/util.js +0 -0
- /package/dist/{codegen → src/codegen}/util.test.d.ts +0 -0
- /package/dist/{codegen → src/codegen}/util.test.js +0 -0
- /package/dist/{command-helpers → src/command-helpers}/abi.d.ts +0 -0
- /package/dist/{command-helpers → src/command-helpers}/abi.test.d.ts +0 -0
- /package/dist/{command-helpers → src/command-helpers}/abi.test.js +0 -0
- /package/dist/{command-helpers → src/command-helpers}/auth.d.ts +0 -0
- /package/dist/{command-helpers → src/command-helpers}/auth.js +0 -0
- /package/dist/{command-helpers → src/command-helpers}/compiler.d.ts +0 -0
- /package/dist/{command-helpers → src/command-helpers}/compiler.test.d.ts +0 -0
- /package/dist/{command-helpers → src/command-helpers}/compiler.test.js +0 -0
- /package/dist/{command-helpers → src/command-helpers}/data-sources.d.ts +0 -0
- /package/dist/{command-helpers → src/command-helpers}/data-sources.js +0 -0
- /package/dist/{command-helpers → src/command-helpers}/fs.d.ts +0 -0
- /package/dist/{command-helpers → src/command-helpers}/fs.js +0 -0
- /package/dist/{command-helpers → src/command-helpers}/ipfs.d.ts +0 -0
- /package/dist/{command-helpers → src/command-helpers}/ipfs.js +0 -0
- /package/dist/{command-helpers → src/command-helpers}/jsonrpc.d.ts +0 -0
- /package/dist/{command-helpers → src/command-helpers}/jsonrpc.js +0 -0
- /package/dist/{command-helpers → src/command-helpers}/network.d.ts +0 -0
- /package/dist/{command-helpers → src/command-helpers}/network.js +0 -0
- /package/dist/{command-helpers → src/command-helpers}/network.test.d.ts +0 -0
- /package/dist/{command-helpers → src/command-helpers}/network.test.js +0 -0
- /package/dist/{command-helpers → src/command-helpers}/node.d.ts +0 -0
- /package/dist/{command-helpers → src/command-helpers}/scaffold.d.ts +0 -0
- /package/dist/{command-helpers → src/command-helpers}/scaffold.js +0 -0
- /package/dist/{command-helpers → src/command-helpers}/spinner.d.ts +0 -0
- /package/dist/{command-helpers → src/command-helpers}/spinner.js +0 -0
- /package/dist/{command-helpers → src/command-helpers}/studio.d.ts +0 -0
- /package/dist/{command-helpers → src/command-helpers}/studio.js +0 -0
- /package/dist/{command-helpers → src/command-helpers}/studio.test.d.ts +0 -0
- /package/dist/{command-helpers → src/command-helpers}/studio.test.js +0 -0
- /package/dist/{command-helpers → src/command-helpers}/subgraph.d.ts +0 -0
- /package/dist/{command-helpers → src/command-helpers}/subgraph.js +0 -0
- /package/dist/{command-helpers → src/command-helpers}/version.d.ts +0 -0
- /package/dist/{command-helpers → src/command-helpers}/version.js +0 -0
- /package/dist/{command-helpers → src/command-helpers}/version.test.d.ts +0 -0
- /package/dist/{command-helpers → src/command-helpers}/version.test.js +0 -0
- /package/dist/{commands → src/commands}/add.d.ts +0 -0
- /package/dist/{commands → src/commands}/add.js +0 -0
- /package/dist/{commands → src/commands}/auth.d.ts +0 -0
- /package/dist/{commands → src/commands}/auth.js +0 -0
- /package/dist/{commands → src/commands}/build.d.ts +0 -0
- /package/dist/{commands → src/commands}/build.js +0 -0
- /package/dist/{commands → src/commands}/clean.d.ts +0 -0
- /package/dist/{commands → src/commands}/clean.js +0 -0
- /package/dist/{commands → src/commands}/codegen.d.ts +0 -0
- /package/dist/{commands → src/commands}/codegen.js +0 -0
- /package/dist/{commands → src/commands}/create.d.ts +0 -0
- /package/dist/{commands → src/commands}/deploy.d.ts +0 -0
- /package/dist/{commands → src/commands}/init.d.ts +0 -0
- /package/dist/{commands → src/commands}/init.js +0 -0
- /package/dist/{commands → src/commands}/local.d.ts +0 -0
- /package/dist/{commands → src/commands}/local.js +0 -0
- /package/dist/{commands → src/commands}/remove.d.ts +0 -0
- /package/dist/{commands → src/commands}/test.d.ts +0 -0
- /package/dist/{compiler → src/compiler}/asc.d.ts +0 -0
- /package/dist/{compiler → src/compiler}/asc.js +0 -0
- /package/dist/{compiler → src/compiler}/index.d.ts +0 -0
- /package/dist/{compiler → src/compiler}/index.js +0 -0
- /package/dist/{debug.d.ts → src/debug.d.ts} +0 -0
- /package/dist/{debug.js → src/debug.js} +0 -0
- /package/dist/{index.d.ts → src/index.d.ts} +0 -0
- /package/dist/{index.js → src/index.js} +0 -0
- /package/dist/{migrations → src/migrations}/mapping_api_version_0_0_1.d.ts +0 -0
- /package/dist/{migrations → src/migrations}/mapping_api_version_0_0_1.js +0 -0
- /package/dist/{migrations → src/migrations}/mapping_api_version_0_0_2.d.ts +0 -0
- /package/dist/{migrations → src/migrations}/mapping_api_version_0_0_2.js +0 -0
- /package/dist/{migrations → src/migrations}/mapping_api_version_0_0_3.d.ts +0 -0
- /package/dist/{migrations → src/migrations}/mapping_api_version_0_0_3.js +0 -0
- /package/dist/{migrations → src/migrations}/mapping_api_version_0_0_4.d.ts +0 -0
- /package/dist/{migrations → src/migrations}/mapping_api_version_0_0_4.js +0 -0
- /package/dist/{migrations → src/migrations}/mapping_api_version_0_0_5.d.ts +0 -0
- /package/dist/{migrations → src/migrations}/mapping_api_version_0_0_5.js +0 -0
- /package/dist/{migrations → src/migrations}/spec_version_0_0_2.d.ts +0 -0
- /package/dist/{migrations → src/migrations}/spec_version_0_0_2.js +0 -0
- /package/dist/{migrations → src/migrations}/spec_version_0_0_3.d.ts +0 -0
- /package/dist/{migrations → src/migrations}/spec_version_0_0_3.js +0 -0
- /package/dist/{migrations → src/migrations}/util/load-manifest.d.ts +0 -0
- /package/dist/{migrations → src/migrations}/util/load-manifest.js +0 -0
- /package/dist/{migrations → src/migrations}/util/versions.d.ts +0 -0
- /package/dist/{migrations → src/migrations}/util/versions.js +0 -0
- /package/dist/{migrations.d.ts → src/migrations.d.ts} +0 -0
- /package/dist/{migrations.js → src/migrations.js} +0 -0
- /package/dist/{protocols → src/protocols}/arweave/scaffold/manifest.d.ts +0 -0
- /package/dist/{protocols → src/protocols}/arweave/scaffold/manifest.js +0 -0
- /package/dist/{protocols → src/protocols}/arweave/scaffold/mapping.d.ts +0 -0
- /package/dist/{protocols → src/protocols}/arweave/scaffold/mapping.js +0 -0
- /package/dist/{protocols → src/protocols}/arweave/subgraph.d.ts +0 -0
- /package/dist/{protocols → src/protocols}/arweave/subgraph.js +0 -0
- /package/dist/{protocols → src/protocols}/contract.d.ts +0 -0
- /package/dist/{protocols → src/protocols}/contract.js +0 -0
- /package/dist/{protocols → src/protocols}/cosmos/scaffold/manifest.d.ts +0 -0
- /package/dist/{protocols → src/protocols}/cosmos/scaffold/manifest.js +0 -0
- /package/dist/{protocols → src/protocols}/cosmos/scaffold/mapping.d.ts +0 -0
- /package/dist/{protocols → src/protocols}/cosmos/scaffold/mapping.js +0 -0
- /package/dist/{protocols → src/protocols}/cosmos/subgraph.d.ts +0 -0
- /package/dist/{protocols → src/protocols}/cosmos/subgraph.js +0 -0
- /package/dist/{protocols → src/protocols}/ethereum/abi.d.ts +0 -0
- /package/dist/{protocols → src/protocols}/ethereum/abi.js +0 -0
- /package/dist/{protocols → src/protocols}/ethereum/codegen/abi.d.ts +0 -0
- /package/dist/{protocols → src/protocols}/ethereum/codegen/abi.js +0 -0
- /package/dist/{protocols → src/protocols}/ethereum/codegen/abi.test.d.ts +0 -0
- /package/dist/{protocols → src/protocols}/ethereum/codegen/abi.test.js +0 -0
- /package/dist/{protocols → src/protocols}/ethereum/codegen/template.d.ts +0 -0
- /package/dist/{protocols → src/protocols}/ethereum/codegen/template.js +0 -0
- /package/dist/{protocols → src/protocols}/ethereum/contract.d.ts +0 -0
- /package/dist/{protocols → src/protocols}/ethereum/contract.js +0 -0
- /package/dist/{protocols → src/protocols}/ethereum/scaffold/manifest.d.ts +0 -0
- /package/dist/{protocols → src/protocols}/ethereum/scaffold/manifest.js +0 -0
- /package/dist/{protocols → src/protocols}/ethereum/scaffold/mapping.d.ts +0 -0
- /package/dist/{protocols → src/protocols}/ethereum/scaffold/mapping.js +0 -0
- /package/dist/{protocols → src/protocols}/ethereum/subgraph.d.ts +0 -0
- /package/dist/{protocols → src/protocols}/ethereum/subgraph.js +0 -0
- /package/dist/{protocols → src/protocols}/ethereum/type-generator.d.ts +0 -0
- /package/dist/{protocols → src/protocols}/ethereum/type-generator.js +0 -0
- /package/dist/{protocols → src/protocols}/file_template.d.ts +0 -0
- /package/dist/{protocols → src/protocols}/file_template.js +0 -0
- /package/dist/{protocols → src/protocols}/index.d.ts +0 -0
- /package/dist/{protocols → src/protocols}/index.js +0 -0
- /package/dist/{protocols → src/protocols}/near/contract.d.ts +0 -0
- /package/dist/{protocols → src/protocols}/near/contract.js +0 -0
- /package/dist/{protocols → src/protocols}/near/scaffold/manifest.d.ts +0 -0
- /package/dist/{protocols → src/protocols}/near/scaffold/manifest.js +0 -0
- /package/dist/{protocols → src/protocols}/near/scaffold/mapping.d.ts +0 -0
- /package/dist/{protocols → src/protocols}/near/scaffold/mapping.js +0 -0
- /package/dist/{protocols → src/protocols}/near/subgraph.d.ts +0 -0
- /package/dist/{protocols → src/protocols}/near/subgraph.js +0 -0
- /package/dist/{protocols → src/protocols}/subgraph.d.ts +0 -0
- /package/dist/{protocols → src/protocols}/subgraph.js +0 -0
- /package/dist/{protocols → src/protocols}/substreams/scaffold/manifest.d.ts +0 -0
- /package/dist/{protocols → src/protocols}/substreams/scaffold/manifest.js +0 -0
- /package/dist/{protocols → src/protocols}/substreams/subgraph.d.ts +0 -0
- /package/dist/{protocols → src/protocols}/substreams/subgraph.js +0 -0
- /package/dist/{scaffold → src/scaffold}/cosmos.test.d.ts +0 -0
- /package/dist/{scaffold → src/scaffold}/cosmos.test.js +0 -0
- /package/dist/{scaffold → src/scaffold}/ethereum.test.d.ts +0 -0
- /package/dist/{scaffold → src/scaffold}/ethereum.test.js +0 -0
- /package/dist/{scaffold → src/scaffold}/index.d.ts +0 -0
- /package/dist/{scaffold → src/scaffold}/index.js +0 -0
- /package/dist/{scaffold → src/scaffold}/mapping.d.ts +0 -0
- /package/dist/{scaffold → src/scaffold}/mapping.js +0 -0
- /package/dist/{scaffold → src/scaffold}/near.test.d.ts +0 -0
- /package/dist/{scaffold → src/scaffold}/near.test.js +0 -0
- /package/dist/{scaffold → src/scaffold}/schema.d.ts +0 -0
- /package/dist/{scaffold → src/scaffold}/schema.js +0 -0
- /package/dist/{scaffold → src/scaffold}/tests.d.ts +0 -0
- /package/dist/{scaffold → src/scaffold}/tests.js +0 -0
- /package/dist/{schema.d.ts → src/schema.d.ts} +0 -0
- /package/dist/{schema.js → src/schema.js} +0 -0
- /package/dist/{subgraph.d.ts → src/subgraph.d.ts} +0 -0
- /package/dist/{subgraph.js → src/subgraph.js} +0 -0
- /package/dist/{type-generator.d.ts → src/type-generator.d.ts} +0 -0
- /package/dist/{validation → src/validation}/contract.d.ts +0 -0
- /package/dist/{validation → src/validation}/contract.js +0 -0
- /package/dist/{validation → src/validation}/index.d.ts +0 -0
- /package/dist/{validation → src/validation}/index.js +0 -0
- /package/dist/{validation → src/validation}/manifest.d.ts +0 -0
- /package/dist/{validation → src/validation}/manifest.js +0 -0
- /package/dist/{validation → src/validation}/schema.d.ts +0 -0
- /package/dist/{validation → src/validation}/schema.js +0 -0
- /package/dist/{validation → src/validation}/schema.test.d.ts +0 -0
- /package/dist/{validation → src/validation}/schema.test.js +0 -0
- /package/dist/{version.d.ts → src/version.d.ts} +0 -0
- /package/dist/{version.js → src/version.js} +0 -0
- /package/dist/{watcher.d.ts → src/watcher.d.ts} +0 -0
- /package/dist/{watcher.js → src/watcher.js} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,12 +1,22 @@
|
|
|
1
1
|
# @graphprotocol/graph-cli
|
|
2
2
|
|
|
3
|
-
## 0.61.1-alpha-
|
|
3
|
+
## 0.61.1-alpha-20231115011038-12d4e4b
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
|
-
- [#
|
|
8
|
-
[`
|
|
9
|
-
Thanks [@saihaj](https://github.com/saihaj)! -
|
|
7
|
+
- [#1461](https://github.com/graphprotocol/graph-tooling/pull/1461)
|
|
8
|
+
[`a95cc2e`](https://github.com/graphprotocol/graph-tooling/commit/a95cc2e7adb2216c004311d2f5996840a746f905)
|
|
9
|
+
Thanks [@saihaj](https://github.com/saihaj)! - include user agent for CLI fetch calls
|
|
10
|
+
|
|
11
|
+
- [#1461](https://github.com/graphprotocol/graph-tooling/pull/1461)
|
|
12
|
+
[`66cee74`](https://github.com/graphprotocol/graph-tooling/commit/66cee7421debef12b41744a270e586786daa4286)
|
|
13
|
+
Thanks [@saihaj](https://github.com/saihaj)! - send graph cli version as user agent for all third
|
|
14
|
+
party API calls
|
|
15
|
+
|
|
16
|
+
- [#1461](https://github.com/graphprotocol/graph-tooling/pull/1461)
|
|
17
|
+
[`66cee74`](https://github.com/graphprotocol/graph-tooling/commit/66cee7421debef12b41744a270e586786daa4286)
|
|
18
|
+
Thanks [@saihaj](https://github.com/saihaj)! - send graph cli version as user agent for all ipfs
|
|
19
|
+
requests
|
|
10
20
|
|
|
11
21
|
## 0.61.0
|
|
12
22
|
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@graphprotocol/graph-cli",
|
|
3
|
+
"version": "0.61.1-alpha-20231115011038-12d4e4b",
|
|
4
|
+
"description": "CLI for building for and deploying to The Graph",
|
|
5
|
+
"license": "(Apache-2.0 OR MIT)",
|
|
6
|
+
"engines": {
|
|
7
|
+
"node": ">=14"
|
|
8
|
+
},
|
|
9
|
+
"bin": {
|
|
10
|
+
"graph": "bin/run"
|
|
11
|
+
},
|
|
12
|
+
"main": "dist/index.js",
|
|
13
|
+
"files": [
|
|
14
|
+
"CHANGELOG.md",
|
|
15
|
+
"bin",
|
|
16
|
+
"dist",
|
|
17
|
+
"oclif.manifest.json",
|
|
18
|
+
"README.md",
|
|
19
|
+
"!dist/*.tar.gz"
|
|
20
|
+
],
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsc -b tsconfig.build.json && oclif manifest && oclif readme && copyfiles -u 1 src/**/*.graphql dist/",
|
|
23
|
+
"oclif:pack": "npm pack && pnpm oclif pack tarballs --no-xz && node scripts/rename-tarballs.mjs",
|
|
24
|
+
"test": "jest --verbose",
|
|
25
|
+
"test:add": "jest tests/cli/add.test.ts --verbose",
|
|
26
|
+
"test:init": "jest tests/cli/init.test.ts --verbose",
|
|
27
|
+
"test:validation": "jest tests/cli/validation.test.ts --verbose",
|
|
28
|
+
"type-check": "tsc --noEmit"
|
|
29
|
+
},
|
|
30
|
+
"dependencies": {
|
|
31
|
+
"@float-capital/float-subgraph-uncrashable": "^0.0.0-alpha.4",
|
|
32
|
+
"@oclif/core": "2.8.6",
|
|
33
|
+
"@oclif/plugin-autocomplete": "^2.3.6",
|
|
34
|
+
"@oclif/plugin-not-found": "^2.4.0",
|
|
35
|
+
"@whatwg-node/fetch": "^0.8.4",
|
|
36
|
+
"assemblyscript": "0.19.23",
|
|
37
|
+
"binary-install-raw": "0.0.13",
|
|
38
|
+
"chalk": "3.0.0",
|
|
39
|
+
"chokidar": "3.5.3",
|
|
40
|
+
"debug": "4.3.4",
|
|
41
|
+
"docker-compose": "0.23.19",
|
|
42
|
+
"dockerode": "2.5.8",
|
|
43
|
+
"fs-extra": "9.1.0",
|
|
44
|
+
"glob": "9.3.5",
|
|
45
|
+
"gluegun": "5.1.2",
|
|
46
|
+
"graphql": "15.5.0",
|
|
47
|
+
"immutable": "4.2.1",
|
|
48
|
+
"ipfs-http-client": "55.0.0",
|
|
49
|
+
"jayson": "4.0.0",
|
|
50
|
+
"js-yaml": "3.14.1",
|
|
51
|
+
"prettier": "1.19.1",
|
|
52
|
+
"request": "2.88.2",
|
|
53
|
+
"semver": "7.4.0",
|
|
54
|
+
"sync-request": "6.1.0",
|
|
55
|
+
"tmp-promise": "3.0.3",
|
|
56
|
+
"web3-eth-abi": "1.7.0",
|
|
57
|
+
"which": "2.0.2",
|
|
58
|
+
"yaml": "1.10.2"
|
|
59
|
+
},
|
|
60
|
+
"devDependencies": {
|
|
61
|
+
"@types/debug": "^4.1.7",
|
|
62
|
+
"@types/fs-extra": "^9.0.13",
|
|
63
|
+
"@types/jest": "^29.0.0",
|
|
64
|
+
"@types/js-yaml": "^3.12.7",
|
|
65
|
+
"@types/semver": "^7.3.13",
|
|
66
|
+
"@types/which": "^2.0.1",
|
|
67
|
+
"copyfiles": "^2.4.1",
|
|
68
|
+
"jest": "29.7.0",
|
|
69
|
+
"oclif": "3.8.1",
|
|
70
|
+
"spawn-command": "0.0.2-1",
|
|
71
|
+
"strip-ansi": "6.0.1",
|
|
72
|
+
"tern": "0.24.3",
|
|
73
|
+
"typescript": "^5.0.0"
|
|
74
|
+
},
|
|
75
|
+
"publishConfig": {
|
|
76
|
+
"access": "public"
|
|
77
|
+
},
|
|
78
|
+
"oclif": {
|
|
79
|
+
"bin": "graph",
|
|
80
|
+
"commands": "./dist/commands",
|
|
81
|
+
"additionalHelpFlags": [
|
|
82
|
+
"-h"
|
|
83
|
+
],
|
|
84
|
+
"additionalVersionFlags": [
|
|
85
|
+
"-v"
|
|
86
|
+
],
|
|
87
|
+
"plugins": [
|
|
88
|
+
"@oclif/plugin-not-found",
|
|
89
|
+
"@oclif/plugin-autocomplete"
|
|
90
|
+
]
|
|
91
|
+
}
|
|
92
|
+
}
|
|
@@ -5,11 +5,12 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.loadAbiFromBlockScout = exports.getStartBlockForContract = exports.fetchTransactionByHashFromRPC = exports.fetchContractCreationHashWithRetry = exports.fetchDeployContractTransactionFromEtherscan = exports.loadStartBlockForContract = exports.loadAbiFromEtherscan = void 0;
|
|
7
7
|
const immutable_1 = __importDefault(require("immutable"));
|
|
8
|
-
const
|
|
8
|
+
const constants_1 = require("../constants");
|
|
9
|
+
const fetch_1 = __importDefault(require("../fetch"));
|
|
9
10
|
const spinner_1 = require("./spinner");
|
|
10
11
|
const loadAbiFromEtherscan = async (ABICtor, network, address) => await (0, spinner_1.withSpinner)(`Fetching ABI from Etherscan`, `Failed to fetch ABI from Etherscan`, `Warnings while fetching ABI from Etherscan`, async () => {
|
|
11
12
|
const scanApiUrl = getEtherscanLikeAPIUrl(network);
|
|
12
|
-
const result = await (0, fetch_1.
|
|
13
|
+
const result = await (0, fetch_1.default)(`${scanApiUrl}?module=contract&action=getabi&address=${address}`);
|
|
13
14
|
const json = await result.json();
|
|
14
15
|
// Etherscan returns a JSON object that has a `status`, a `message` and
|
|
15
16
|
// a `result` field. The `status` is '0' in case of errors and '1' in
|
|
@@ -37,7 +38,7 @@ const fetchContractCreationHashWithRetry = async (url, retryCount) => {
|
|
|
37
38
|
let json;
|
|
38
39
|
for (let i = 0; i < retryCount; i++) {
|
|
39
40
|
try {
|
|
40
|
-
const result = await (0, fetch_1.
|
|
41
|
+
const result = await (0, fetch_1.default)(url);
|
|
41
42
|
json = await result.json();
|
|
42
43
|
if (json.status !== '0') {
|
|
43
44
|
return json;
|
|
@@ -56,10 +57,11 @@ const fetchTransactionByHashFromRPC = async (network, transactionHash) => {
|
|
|
56
57
|
const RPCURL = getPublicRPCEndpoint(network);
|
|
57
58
|
if (!RPCURL)
|
|
58
59
|
throw new Error(`Unable to fetch RPC URL for ${network}`);
|
|
59
|
-
const result = await (0, fetch_1.
|
|
60
|
+
const result = await (0, fetch_1.default)(String(RPCURL), {
|
|
60
61
|
method: 'POST',
|
|
61
62
|
headers: {
|
|
62
63
|
'Content-Type': 'application/json',
|
|
64
|
+
...constants_1.GRAPH_CLI_SHARED_HEADERS,
|
|
63
65
|
},
|
|
64
66
|
body: JSON.stringify({
|
|
65
67
|
jsonrpc: '2.0',
|
|
@@ -88,7 +90,7 @@ const getStartBlockForContract = async (network, address) => {
|
|
|
88
90
|
};
|
|
89
91
|
exports.getStartBlockForContract = getStartBlockForContract;
|
|
90
92
|
const loadAbiFromBlockScout = async (ABICtor, network, address) => await (0, spinner_1.withSpinner)(`Fetching ABI from BlockScout`, `Failed to fetch ABI from BlockScout`, `Warnings while fetching ABI from BlockScout`, async () => {
|
|
91
|
-
const result = await (0, fetch_1.
|
|
93
|
+
const result = await (0, fetch_1.default)(`https://blockscout.com/${network.replace('-', '/')}/api?module=contract&action=getabi&address=${address}`);
|
|
92
94
|
const json = await result.json();
|
|
93
95
|
// BlockScout returns a JSON object that has a `status`, a `message` and
|
|
94
96
|
// a `result` field. The `status` is '0' in case of errors and '1' in
|
|
@@ -31,6 +31,7 @@ const url_1 = require("url");
|
|
|
31
31
|
const toolbox = __importStar(require("gluegun"));
|
|
32
32
|
const ipfs_http_client_1 = require("ipfs-http-client");
|
|
33
33
|
const compiler_1 = __importDefault(require("../compiler"));
|
|
34
|
+
const constants_1 = require("../constants");
|
|
34
35
|
/**
|
|
35
36
|
* Appends /api/v0 to the end of a The Graph IPFS URL
|
|
36
37
|
*/
|
|
@@ -61,7 +62,13 @@ The IPFS URL must be of the following format: http(s)://host[:port]/[path]`);
|
|
|
61
62
|
}
|
|
62
63
|
// Connect to the IPFS node (if a node address was provided)
|
|
63
64
|
const ipfsClient = ipfs
|
|
64
|
-
? (0, ipfs_http_client_1.create)({
|
|
65
|
+
? (0, ipfs_http_client_1.create)({
|
|
66
|
+
url: appendApiVersionForGraph(ipfs.toString()),
|
|
67
|
+
headers: {
|
|
68
|
+
...headers,
|
|
69
|
+
...constants_1.GRAPH_CLI_SHARED_HEADERS,
|
|
70
|
+
},
|
|
71
|
+
})
|
|
65
72
|
: undefined;
|
|
66
73
|
return new compiler_1.default({
|
|
67
74
|
ipfs: ipfsClient,
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.getHostedServiceSubgraphId = exports.chooseNodeUrl = exports.normalizeNodeUrl = exports.validateNodeUrl = void 0;
|
|
4
4
|
const url_1 = require("url");
|
|
5
5
|
const gluegun_1 = require("gluegun");
|
|
6
|
+
const constants_1 = require("../constants");
|
|
6
7
|
const SUBGRAPH_STUDIO_URL = 'https://api.studio.thegraph.com/deploy/';
|
|
7
8
|
const HOSTED_SERVICE_URL = 'https://api.thegraph.com/deploy/';
|
|
8
9
|
const HOSTED_SERVICE_INDEX_NODE_URL = 'https://api.thegraph.com/index-node/graphql';
|
|
@@ -58,7 +59,7 @@ async function getHostedServiceSubgraphId({ subgraphName, }) {
|
|
|
58
59
|
}),
|
|
59
60
|
headers: {
|
|
60
61
|
'content-type': 'application/json',
|
|
61
|
-
|
|
62
|
+
...constants_1.GRAPH_CLI_SHARED_HEADERS,
|
|
62
63
|
},
|
|
63
64
|
});
|
|
64
65
|
const { data, errors } = await response.json();
|
|
@@ -6,6 +6,7 @@ const core_1 = require("@oclif/core");
|
|
|
6
6
|
const auth_1 = require("../command-helpers/auth");
|
|
7
7
|
const jsonrpc_1 = require("../command-helpers/jsonrpc");
|
|
8
8
|
const node_1 = require("../command-helpers/node");
|
|
9
|
+
const constants_1 = require("../constants");
|
|
9
10
|
class CreateCommand extends core_1.Command {
|
|
10
11
|
async run() {
|
|
11
12
|
const { args: { 'subgraph-name': subgraphName }, flags: { 'access-token': accessTokenFlag, node }, } = await this.parse(CreateCommand);
|
|
@@ -26,7 +27,10 @@ class CreateCommand extends core_1.Command {
|
|
|
26
27
|
const accessToken = await (0, auth_1.identifyDeployKey)(node, accessTokenFlag);
|
|
27
28
|
if (accessToken !== undefined && accessToken !== null) {
|
|
28
29
|
// @ts-expect-error options property seems to exist
|
|
29
|
-
client.options.headers = {
|
|
30
|
+
client.options.headers = {
|
|
31
|
+
...constants_1.GRAPH_CLI_SHARED_HEADERS,
|
|
32
|
+
Authorization: `Bearer ${accessToken}`,
|
|
33
|
+
};
|
|
30
34
|
}
|
|
31
35
|
const spinner = gluegun_1.print.spin(`Creating subgraph in Graph node: ${requestUrl}`);
|
|
32
36
|
client.request('subgraph_create', { name: subgraphName }, (
|
|
@@ -40,6 +40,7 @@ const network_1 = require("../command-helpers/network");
|
|
|
40
40
|
const node_1 = require("../command-helpers/node");
|
|
41
41
|
const studio_1 = require("../command-helpers/studio");
|
|
42
42
|
const version_1 = require("../command-helpers/version");
|
|
43
|
+
const constants_1 = require("../constants");
|
|
43
44
|
const protocols_1 = __importDefault(require("../protocols"));
|
|
44
45
|
const headersFlag = core_1.Flags.custom({
|
|
45
46
|
summary: 'Add custom headers that will be used by the IPFS HTTP client.',
|
|
@@ -86,7 +87,10 @@ class DeployCommand extends core_1.Command {
|
|
|
86
87
|
this.error('No deploy key available');
|
|
87
88
|
}
|
|
88
89
|
// @ts-expect-error options property seems to exist
|
|
89
|
-
client.options.headers = {
|
|
90
|
+
client.options.headers = {
|
|
91
|
+
...constants_1.GRAPH_CLI_SHARED_HEADERS,
|
|
92
|
+
Authorization: 'Bearer ' + deployKey,
|
|
93
|
+
};
|
|
90
94
|
const subgraphName = await core_1.ux.prompt('What is the name of the subgraph you want to deploy?', {
|
|
91
95
|
required: true,
|
|
92
96
|
});
|
|
@@ -194,7 +198,10 @@ class DeployCommand extends core_1.Command {
|
|
|
194
198
|
deployKey = await (0, auth_1.identifyDeployKey)(node, deployKey);
|
|
195
199
|
if (deployKey !== undefined && deployKey !== null) {
|
|
196
200
|
// @ts-expect-error options property seems to exist
|
|
197
|
-
client.options.headers = {
|
|
201
|
+
client.options.headers = {
|
|
202
|
+
...constants_1.GRAPH_CLI_SHARED_HEADERS,
|
|
203
|
+
Authorization: 'Bearer ' + deployKey,
|
|
204
|
+
};
|
|
198
205
|
}
|
|
199
206
|
// Ask for label if not on hosted service
|
|
200
207
|
let versionLabel = versionLabelFlag;
|
|
@@ -271,7 +278,10 @@ class DeployCommand extends core_1.Command {
|
|
|
271
278
|
// Connect to the IPFS node (if a node address was provided)
|
|
272
279
|
const ipfsClient = (0, ipfs_http_client_1.create)({
|
|
273
280
|
url: (0, compiler_1.appendApiVersionForGraph)(ipfs.toString()),
|
|
274
|
-
headers
|
|
281
|
+
headers: {
|
|
282
|
+
...headers,
|
|
283
|
+
...constants_1.GRAPH_CLI_SHARED_HEADERS,
|
|
284
|
+
},
|
|
275
285
|
});
|
|
276
286
|
// Fetch the manifest from IPFS
|
|
277
287
|
const manifestBuffer = ipfsClient.cat(ipfsHash);
|
|
@@ -6,6 +6,7 @@ const core_1 = require("@oclif/core");
|
|
|
6
6
|
const auth_1 = require("../command-helpers/auth");
|
|
7
7
|
const jsonrpc_1 = require("../command-helpers/jsonrpc");
|
|
8
8
|
const node_1 = require("../command-helpers/node");
|
|
9
|
+
const constants_1 = require("../constants");
|
|
9
10
|
class RemoveCommand extends core_1.Command {
|
|
10
11
|
async run() {
|
|
11
12
|
const { args: { 'subgraph-name': subgraphName }, flags: { 'access-token': accessTokenFlag, node }, } = await this.parse(RemoveCommand);
|
|
@@ -26,7 +27,10 @@ class RemoveCommand extends core_1.Command {
|
|
|
26
27
|
const accessToken = await (0, auth_1.identifyDeployKey)(node, accessTokenFlag);
|
|
27
28
|
if (accessToken !== undefined && accessToken !== null) {
|
|
28
29
|
// @ts-expect-error options property seems to exist
|
|
29
|
-
client.options.headers = {
|
|
30
|
+
client.options.headers = {
|
|
31
|
+
...constants_1.GRAPH_CLI_SHARED_HEADERS,
|
|
32
|
+
Authorization: `Bearer ${accessToken}`,
|
|
33
|
+
};
|
|
30
34
|
}
|
|
31
35
|
const spinner = gluegun_1.print.spin(`Creating subgraph in Graph node: ${requestUrl}`);
|
|
32
36
|
client.request('subgraph_remove', { name: subgraphName }, (
|
|
@@ -11,7 +11,8 @@ const gluegun_1 = require("gluegun");
|
|
|
11
11
|
const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
12
12
|
const semver_1 = __importDefault(require("semver"));
|
|
13
13
|
const core_1 = require("@oclif/core");
|
|
14
|
-
const
|
|
14
|
+
const constants_1 = require("../constants");
|
|
15
|
+
const fetch_1 = __importDefault(require("../fetch"));
|
|
15
16
|
class TestCommand extends core_1.Command {
|
|
16
17
|
async run() {
|
|
17
18
|
const { args: { datasource }, flags: { coverage, docker, force, logs, recompile, version }, } = await this.parse(TestCommand);
|
|
@@ -48,9 +49,9 @@ class TestCommand extends core_1.Command {
|
|
|
48
49
|
// Fetch the latest version tag if version is not specified with -v/--version or if the version is not cached
|
|
49
50
|
if (opts.force || (!opts.version && !opts.latestVersion)) {
|
|
50
51
|
this.log('Fetching latest version tag...');
|
|
51
|
-
const result = await (0, fetch_1.
|
|
52
|
+
const result = await (0, fetch_1.default)('https://api.github.com/repos/LimeChain/matchstick/releases/latest', {
|
|
52
53
|
headers: {
|
|
53
|
-
|
|
54
|
+
...constants_1.GRAPH_CLI_SHARED_HEADERS,
|
|
54
55
|
},
|
|
55
56
|
});
|
|
56
57
|
const json = await result.json();
|
|
@@ -281,7 +282,7 @@ async function dockerfile(dockerfilePath, versionOpt, latestVersion) {
|
|
|
281
282
|
const spinner = gluegun_1.print.spin('Generating Dockerfile...');
|
|
282
283
|
try {
|
|
283
284
|
// Fetch the Dockerfile template content from the demo-subgraph repo
|
|
284
|
-
const content = await (0, fetch_1.
|
|
285
|
+
const content = await (0, fetch_1.default)('https://raw.githubusercontent.com/LimeChain/demo-subgraph/main/Dockerfile').then(response => {
|
|
285
286
|
if (response.ok) {
|
|
286
287
|
return response.text();
|
|
287
288
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.GRAPH_CLI_SHARED_HEADERS = void 0;
|
|
4
|
+
const package_json_1 = require("../package.json");
|
|
5
|
+
exports.GRAPH_CLI_SHARED_HEADERS = {
|
|
6
|
+
'User-Agent': `@graphprotocol/graph-cli@${package_json_1.version}`,
|
|
7
|
+
};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// eslint-disable-next-line no-restricted-imports
|
|
4
|
+
const fetch_1 = require("@whatwg-node/fetch");
|
|
5
|
+
const constants_1 = require("./constants");
|
|
6
|
+
function fetchWrapper(input, init) {
|
|
7
|
+
return (0, fetch_1.fetch)(input, {
|
|
8
|
+
...init,
|
|
9
|
+
headers: {
|
|
10
|
+
...init?.headers,
|
|
11
|
+
...constants_1.GRAPH_CLI_SHARED_HEADERS,
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
exports.default = fetchWrapper;
|
|
@@ -151,7 +151,6 @@ class TypeGenerator {
|
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
153
|
async generateTypesForDataSourceTemplates(subgraph) {
|
|
154
|
-
const moduleImports = [];
|
|
155
154
|
return await (0, spinner_1.withSpinner)(`Generate types for data source templates`, `Failed to generate types for data source templates`, `Warnings while generating types for data source templates`, async (spinner) => {
|
|
156
155
|
// Combine the generated code for all templates
|
|
157
156
|
const codeSegments = subgraph
|
|
@@ -159,30 +158,15 @@ class TypeGenerator {
|
|
|
159
158
|
.reduce((codeSegments, template) => {
|
|
160
159
|
(0, spinner_1.step)(spinner, 'Generate types for data source template', String(template.get('name')));
|
|
161
160
|
const codeGenerator = new template_1.default(template, this.protocol);
|
|
162
|
-
//
|
|
163
|
-
|
|
161
|
+
// Only generate module imports once, because they are identical for
|
|
162
|
+
// all types generated for data source templates.
|
|
163
|
+
if (codeSegments.isEmpty()) {
|
|
164
|
+
codeSegments = codeSegments.concat(codeGenerator.generateModuleImports());
|
|
165
|
+
}
|
|
164
166
|
return codeSegments.concat(codeGenerator.generateTypes());
|
|
165
167
|
}, immutable_1.default.List());
|
|
166
|
-
// we want to dedupe the imports from the templates
|
|
167
|
-
const dedupeModulesImports = moduleImports.reduce((acc, curr) => {
|
|
168
|
-
const found = acc.find(item => item.module === curr.module);
|
|
169
|
-
if (found) {
|
|
170
|
-
const foundNames = Array.isArray(found.nameOrNames)
|
|
171
|
-
? found.nameOrNames
|
|
172
|
-
: [found.nameOrNames];
|
|
173
|
-
const currNames = Array.isArray(curr.nameOrNames)
|
|
174
|
-
? curr.nameOrNames
|
|
175
|
-
: [curr.nameOrNames];
|
|
176
|
-
const names = new Set([...foundNames, ...currNames]);
|
|
177
|
-
found.nameOrNames = Array.from(names);
|
|
178
|
-
}
|
|
179
|
-
else {
|
|
180
|
-
acc.push(curr);
|
|
181
|
-
}
|
|
182
|
-
return acc;
|
|
183
|
-
}, []);
|
|
184
168
|
if (!codeSegments.isEmpty()) {
|
|
185
|
-
const code = prettier_1.default.format([typescript_1.GENERATED_FILE_NOTE, ...
|
|
169
|
+
const code = prettier_1.default.format([typescript_1.GENERATED_FILE_NOTE, ...codeSegments].join('\n'), {
|
|
186
170
|
parser: 'typescript',
|
|
187
171
|
});
|
|
188
172
|
const outputFile = path_1.default.join(this.options.outputDir, 'templates.ts');
|