@graphprotocol/graph-cli 0.58.0-alpha-20230912110505-e2ae2a5 → 0.58.0-alpha-20230918230348-a16f8e3
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 +7 -1
- package/dist/command-helpers/abi.d.ts +1 -1
- package/dist/command-helpers/abi.js +114 -114
- package/dist/command-helpers/studio.js +33 -33
- package/dist/protocols/index.d.ts +5 -5
- package/dist/protocols/index.js +65 -63
- package/oclif.manifest.json +1 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @graphprotocol/graph-cli
|
|
2
2
|
|
|
3
|
-
## 0.58.0-alpha-
|
|
3
|
+
## 0.58.0-alpha-20230918230348-a16f8e3
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
@@ -9,6 +9,12 @@
|
|
|
9
9
|
Thanks [@incrypto32](https://github.com/incrypto32)! - Add data source context support in ethereum
|
|
10
10
|
manifest
|
|
11
11
|
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- [#1451](https://github.com/graphprotocol/graph-tooling/pull/1451)
|
|
15
|
+
[`7b6cfb9`](https://github.com/graphprotocol/graph-tooling/commit/7b6cfb9c318d716c1c2b86caaf6e056a9efc6ddb)
|
|
16
|
+
Thanks [@azf20](https://github.com/azf20)! - Align zksync testnet name
|
|
17
|
+
|
|
12
18
|
## 0.57.0
|
|
13
19
|
|
|
14
20
|
### Minor Changes
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import ABI from
|
|
1
|
+
import ABI from "../protocols/ethereum/abi";
|
|
2
2
|
export declare const loadAbiFromEtherscan: (ABICtor: typeof ABI, network: string, address: string) => Promise<ABI>;
|
|
3
3
|
export declare const loadStartBlockForContract: (network: string, address: string) => Promise<string>;
|
|
4
4
|
export declare const fetchDeployContractTransactionFromEtherscan: (network: string, address: string) => Promise<string>;
|
|
@@ -4,8 +4,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
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
|
-
const immutable_1 = __importDefault(require("immutable"));
|
|
8
7
|
const fetch_1 = require("@whatwg-node/fetch");
|
|
8
|
+
const immutable_1 = __importDefault(require("immutable"));
|
|
9
9
|
const spinner_1 = require("./spinner");
|
|
10
10
|
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
11
|
const scanApiUrl = getEtherscanLikeAPIUrl(network);
|
|
@@ -14,10 +14,10 @@ const loadAbiFromEtherscan = async (ABICtor, network, address) => await (0, spin
|
|
|
14
14
|
// Etherscan returns a JSON object that has a `status`, a `message` and
|
|
15
15
|
// a `result` field. The `status` is '0' in case of errors and '1' in
|
|
16
16
|
// case of success
|
|
17
|
-
if (json.status ===
|
|
18
|
-
return new ABICtor(
|
|
17
|
+
if (json.status === "1") {
|
|
18
|
+
return new ABICtor("Contract", undefined, immutable_1.default.fromJS(JSON.parse(json.result)));
|
|
19
19
|
}
|
|
20
|
-
throw new Error(
|
|
20
|
+
throw new Error("ABI not found, try loading it from a local file");
|
|
21
21
|
});
|
|
22
22
|
exports.loadAbiFromEtherscan = loadAbiFromEtherscan;
|
|
23
23
|
const loadStartBlockForContract = async (network, address) => await (0, spinner_1.withSpinner)(`Fetching Start Block`, `Failed to fetch Start Block`, `Warnings while fetching deploy contract transaction from Etherscan`, async () => {
|
|
@@ -27,7 +27,7 @@ exports.loadStartBlockForContract = loadStartBlockForContract;
|
|
|
27
27
|
const fetchDeployContractTransactionFromEtherscan = async (network, address) => {
|
|
28
28
|
const scanApiUrl = getEtherscanLikeAPIUrl(network);
|
|
29
29
|
const json = await (0, exports.fetchContractCreationHashWithRetry)(`${scanApiUrl}?module=contract&action=getcontractcreation&contractaddresses=${address}`, 5);
|
|
30
|
-
if (json.status ===
|
|
30
|
+
if (json.status === "1") {
|
|
31
31
|
return json.result[0].txHash;
|
|
32
32
|
}
|
|
33
33
|
throw new Error(`Failed to fetch deploy contract transaction`);
|
|
@@ -39,7 +39,7 @@ const fetchContractCreationHashWithRetry = async (url, retryCount) => {
|
|
|
39
39
|
try {
|
|
40
40
|
const result = await (0, fetch_1.fetch)(url);
|
|
41
41
|
json = await result.json();
|
|
42
|
-
if (json.status !==
|
|
42
|
+
if (json.status !== "0") {
|
|
43
43
|
return json;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -58,13 +58,13 @@ const fetchTransactionByHashFromRPC = async (network, transactionHash) => {
|
|
|
58
58
|
if (!RPCURL)
|
|
59
59
|
throw new Error(`Unable to fetch RPC URL for ${network}`);
|
|
60
60
|
const result = await (0, fetch_1.fetch)(String(RPCURL), {
|
|
61
|
-
method:
|
|
61
|
+
method: "POST",
|
|
62
62
|
headers: {
|
|
63
|
-
|
|
63
|
+
"Content-Type": "application/json",
|
|
64
64
|
},
|
|
65
65
|
body: JSON.stringify({
|
|
66
|
-
jsonrpc:
|
|
67
|
-
method:
|
|
66
|
+
jsonrpc: "2.0",
|
|
67
|
+
method: "eth_getTransactionByHash",
|
|
68
68
|
params: [transactionHash],
|
|
69
69
|
id: 1,
|
|
70
70
|
}),
|
|
@@ -73,7 +73,7 @@ const fetchTransactionByHashFromRPC = async (network, transactionHash) => {
|
|
|
73
73
|
return json;
|
|
74
74
|
}
|
|
75
75
|
catch (error) {
|
|
76
|
-
throw new Error(
|
|
76
|
+
throw new Error("Failed to fetch contract creation transaction");
|
|
77
77
|
}
|
|
78
78
|
};
|
|
79
79
|
exports.fetchTransactionByHashFromRPC = fetchTransactionByHashFromRPC;
|
|
@@ -89,76 +89,76 @@ const getStartBlockForContract = async (network, address) => {
|
|
|
89
89
|
};
|
|
90
90
|
exports.getStartBlockForContract = getStartBlockForContract;
|
|
91
91
|
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 () => {
|
|
92
|
-
const result = await (0, fetch_1.fetch)(`https://blockscout.com/${network.replace(
|
|
92
|
+
const result = await (0, fetch_1.fetch)(`https://blockscout.com/${network.replace("-", "/")}/api?module=contract&action=getabi&address=${address}`);
|
|
93
93
|
const json = await result.json();
|
|
94
94
|
// BlockScout returns a JSON object that has a `status`, a `message` and
|
|
95
95
|
// a `result` field. The `status` is '0' in case of errors and '1' in
|
|
96
96
|
// case of success
|
|
97
|
-
if (json.status ===
|
|
98
|
-
return new ABICtor(
|
|
97
|
+
if (json.status === "1") {
|
|
98
|
+
return new ABICtor("Contract", undefined, immutable_1.default.fromJS(JSON.parse(json.result)));
|
|
99
99
|
}
|
|
100
|
-
throw new Error(
|
|
100
|
+
throw new Error("ABI not found, try loading it from a local file");
|
|
101
101
|
});
|
|
102
102
|
exports.loadAbiFromBlockScout = loadAbiFromBlockScout;
|
|
103
103
|
const getEtherscanLikeAPIUrl = (network) => {
|
|
104
104
|
switch (network) {
|
|
105
|
-
case
|
|
105
|
+
case "mainnet":
|
|
106
106
|
return `https://api.etherscan.io/api`;
|
|
107
|
-
case
|
|
107
|
+
case "arbitrum-one":
|
|
108
108
|
return `https://api.arbiscan.io/api`;
|
|
109
|
-
case
|
|
109
|
+
case "arbitrum-goerli":
|
|
110
110
|
return `https://api-goerli.arbiscan.io/api`;
|
|
111
|
-
case
|
|
111
|
+
case "bsc":
|
|
112
112
|
return `https://api.bscscan.com/api`;
|
|
113
|
-
case
|
|
113
|
+
case "base-testnet":
|
|
114
114
|
return `https://api-goerli.basescan.org/api`;
|
|
115
|
-
case
|
|
115
|
+
case "base":
|
|
116
116
|
return `https://api.basescan.org/api`;
|
|
117
|
-
case
|
|
117
|
+
case "chapel":
|
|
118
118
|
return `https://api-testnet.bscscan.com/api`;
|
|
119
|
-
case
|
|
119
|
+
case "matic":
|
|
120
120
|
return `https://api.polygonscan.com/api`;
|
|
121
|
-
case
|
|
121
|
+
case "mumbai":
|
|
122
122
|
return `https://api-testnet.polygonscan.com/api`;
|
|
123
|
-
case
|
|
123
|
+
case "aurora":
|
|
124
124
|
return `https://api.aurorascan.dev/api`;
|
|
125
|
-
case
|
|
125
|
+
case "aurora-testnet":
|
|
126
126
|
return `https://api-testnet.aurorascan.dev/api`;
|
|
127
|
-
case
|
|
127
|
+
case "optimism-goerli":
|
|
128
128
|
return `https://api-goerli-optimistic.etherscan.io/api`;
|
|
129
|
-
case
|
|
129
|
+
case "optimism":
|
|
130
130
|
return `https://api-optimistic.etherscan.io/api`;
|
|
131
|
-
case
|
|
131
|
+
case "moonbeam":
|
|
132
132
|
return `https://api-moonbeam.moonscan.io/api`;
|
|
133
|
-
case
|
|
133
|
+
case "moonriver":
|
|
134
134
|
return `https://api-moonriver.moonscan.io/api`;
|
|
135
|
-
case
|
|
135
|
+
case "mbase":
|
|
136
136
|
return `https://api-moonbase.moonscan.io/api`;
|
|
137
|
-
case
|
|
137
|
+
case "avalanche":
|
|
138
138
|
return `https://api.snowtrace.io/api`;
|
|
139
|
-
case
|
|
139
|
+
case "fuji":
|
|
140
140
|
return `https://api-testnet.snowtrace.io/api`;
|
|
141
|
-
case
|
|
141
|
+
case "celo":
|
|
142
142
|
return `https://api.celoscan.io/api`;
|
|
143
|
-
case
|
|
143
|
+
case "celo-alfajores":
|
|
144
144
|
return `https://alfajores.celoscan.io/api`;
|
|
145
|
-
case
|
|
145
|
+
case "gnosis":
|
|
146
146
|
return `https://api.gnosisscan.io/api`;
|
|
147
|
-
case
|
|
147
|
+
case "fantom":
|
|
148
148
|
return `https://api.ftmscan.com/api`;
|
|
149
|
-
case
|
|
149
|
+
case "fantom-testnet":
|
|
150
150
|
return `https://api-testnet.ftmscan.com/api`;
|
|
151
|
-
case
|
|
151
|
+
case "zksync-era":
|
|
152
152
|
return `https://block-explorer-api.mainnet.zksync.io/api`;
|
|
153
|
-
case
|
|
153
|
+
case "zksync-era-testnet":
|
|
154
154
|
return `https://block-explorer-api.testnets.zksync.dev/api`;
|
|
155
|
-
case
|
|
155
|
+
case "polygon-zkevm-testnet":
|
|
156
156
|
return `https://testnet-zkevm.polygonscan.com/api`;
|
|
157
|
-
case
|
|
157
|
+
case "polygon-zkevm":
|
|
158
158
|
return `https://zkevm.polygonscan.com/api`;
|
|
159
|
-
case
|
|
159
|
+
case "sepolia":
|
|
160
160
|
return `https://api-sepolia.etherscan.io/api`;
|
|
161
|
-
case
|
|
161
|
+
case "scroll-sepolia":
|
|
162
162
|
return `https://sepolia-blockscout.scroll.io/api`;
|
|
163
163
|
default:
|
|
164
164
|
return `https://api-${network}.etherscan.io/api`;
|
|
@@ -166,76 +166,76 @@ const getEtherscanLikeAPIUrl = (network) => {
|
|
|
166
166
|
};
|
|
167
167
|
const getPublicRPCEndpoint = (network) => {
|
|
168
168
|
switch (network) {
|
|
169
|
-
case
|
|
170
|
-
return
|
|
171
|
-
case
|
|
172
|
-
return
|
|
173
|
-
case
|
|
174
|
-
return
|
|
175
|
-
case
|
|
176
|
-
return
|
|
177
|
-
case
|
|
178
|
-
return
|
|
179
|
-
case
|
|
180
|
-
return
|
|
181
|
-
case
|
|
182
|
-
return
|
|
183
|
-
case
|
|
184
|
-
return
|
|
185
|
-
case
|
|
186
|
-
return
|
|
187
|
-
case
|
|
188
|
-
return
|
|
189
|
-
case
|
|
190
|
-
return
|
|
191
|
-
case
|
|
192
|
-
return
|
|
193
|
-
case
|
|
194
|
-
return
|
|
195
|
-
case
|
|
196
|
-
return
|
|
197
|
-
case
|
|
198
|
-
return
|
|
199
|
-
case
|
|
200
|
-
return
|
|
201
|
-
case
|
|
202
|
-
return
|
|
203
|
-
case
|
|
204
|
-
return
|
|
205
|
-
case
|
|
206
|
-
return
|
|
207
|
-
case
|
|
208
|
-
return
|
|
209
|
-
case
|
|
210
|
-
return
|
|
211
|
-
case
|
|
212
|
-
return
|
|
213
|
-
case
|
|
214
|
-
return
|
|
215
|
-
case
|
|
216
|
-
return
|
|
217
|
-
case
|
|
218
|
-
return
|
|
219
|
-
case
|
|
220
|
-
return
|
|
221
|
-
case
|
|
222
|
-
return
|
|
223
|
-
case
|
|
224
|
-
return
|
|
225
|
-
case
|
|
226
|
-
return
|
|
227
|
-
case
|
|
228
|
-
return
|
|
229
|
-
case
|
|
230
|
-
return
|
|
231
|
-
case
|
|
232
|
-
return
|
|
233
|
-
case
|
|
234
|
-
return
|
|
235
|
-
case
|
|
236
|
-
return
|
|
237
|
-
case
|
|
238
|
-
return
|
|
169
|
+
case "arbitrum-goerli":
|
|
170
|
+
return "https://goerli-rollup.arbitrum.io/rpc";
|
|
171
|
+
case "arbitrum-one":
|
|
172
|
+
return "https://arb1.arbitrum.io/rpc";
|
|
173
|
+
case "aurora":
|
|
174
|
+
return "https://rpc.mainnet.aurora.dev";
|
|
175
|
+
case "aurora-testnet":
|
|
176
|
+
return "https://rpc.testnet.aurora.dev";
|
|
177
|
+
case "avalanche":
|
|
178
|
+
return "https://api.avax.network/ext/bc/C/rpc";
|
|
179
|
+
case "base-testnet":
|
|
180
|
+
return "https://goerli.base.org";
|
|
181
|
+
case "base":
|
|
182
|
+
return "https://rpc.base.org";
|
|
183
|
+
case "bsc":
|
|
184
|
+
return "https://bsc-dataseed.binance.org";
|
|
185
|
+
case "celo":
|
|
186
|
+
return "https://forno.celo.org";
|
|
187
|
+
case "celo-alfajores":
|
|
188
|
+
return "https://alfajores-forno.celo-testnet.org";
|
|
189
|
+
case "chapel":
|
|
190
|
+
return "https://rpc.chapel.dev";
|
|
191
|
+
case "clover":
|
|
192
|
+
return "https://rpc.clover.finance";
|
|
193
|
+
case "fantom":
|
|
194
|
+
return "https://rpcapi.fantom.network";
|
|
195
|
+
case "fantom-testnet":
|
|
196
|
+
return "https://rpc.testnet.fantom.network";
|
|
197
|
+
case "fuji":
|
|
198
|
+
return "https://api.avax-test.network/ext/bc/C/rpc";
|
|
199
|
+
case "fuse":
|
|
200
|
+
return "https://rpc.fuse.io";
|
|
201
|
+
case "goerli":
|
|
202
|
+
return "https://rpc.ankr.com/eth_goerli";
|
|
203
|
+
case "gnosis":
|
|
204
|
+
return "https://safe-transaction.gnosis.io";
|
|
205
|
+
case "mainnet":
|
|
206
|
+
return "https://rpc.ankr.com/eth";
|
|
207
|
+
case "matic":
|
|
208
|
+
return "https://rpc-mainnet.maticvigil.com";
|
|
209
|
+
case "mbase":
|
|
210
|
+
return "https://rpc.moonbase.moonbeam.network";
|
|
211
|
+
case "mumbai":
|
|
212
|
+
return "https://rpc-mumbai.maticvigil.com";
|
|
213
|
+
case "moonbeam":
|
|
214
|
+
return "https://rpc.api.moonbeam.network";
|
|
215
|
+
case "moonriver":
|
|
216
|
+
return "https://moonriver.public.blastapi.io";
|
|
217
|
+
case "optimism":
|
|
218
|
+
return "https://mainnet.optimism.io";
|
|
219
|
+
case "optimism-goerli":
|
|
220
|
+
return "https://goerli.optimism.io";
|
|
221
|
+
case "poa-core":
|
|
222
|
+
return "https://core.poa.network";
|
|
223
|
+
case "poa-sokol":
|
|
224
|
+
return "https://sokol.poa.network";
|
|
225
|
+
case "polygon-zkevm-testnet":
|
|
226
|
+
return "https://rpc.public.zkevm-test.net";
|
|
227
|
+
case "polygon-zkevm":
|
|
228
|
+
return "https://zkevm-rpc.com";
|
|
229
|
+
case "rinkeby":
|
|
230
|
+
return "https://rpc.ankr.com/eth_rinkeby";
|
|
231
|
+
case "zksync-era":
|
|
232
|
+
return "https://mainnet.era.zksync.io";
|
|
233
|
+
case "zksync-era-testnet":
|
|
234
|
+
return "https://testnet.era.zksync.dev";
|
|
235
|
+
case "sepolia":
|
|
236
|
+
return "https://rpc.ankr.com/eth_sepolia";
|
|
237
|
+
case "scroll-sepolia":
|
|
238
|
+
return "https://rpc.ankr.com/scroll_sepolia_testnet";
|
|
239
239
|
default:
|
|
240
240
|
throw new Error(`Unknown network: ${network}`);
|
|
241
241
|
}
|
|
@@ -2,46 +2,46 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validateStudioNetwork = exports.allowedStudioNetworks = void 0;
|
|
4
4
|
exports.allowedStudioNetworks = [
|
|
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
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
5
|
+
"mainnet",
|
|
6
|
+
"rinkeby",
|
|
7
|
+
"goerli",
|
|
8
|
+
"gnosis",
|
|
9
|
+
"chapel",
|
|
10
|
+
"optimism-goerli",
|
|
11
|
+
"clover",
|
|
12
|
+
"fantom",
|
|
13
|
+
"matic",
|
|
14
|
+
"fantom-testnet",
|
|
15
|
+
"arbitrum-goerli",
|
|
16
|
+
"fuji",
|
|
17
|
+
"celo-alfajores",
|
|
18
|
+
"mumbai",
|
|
19
|
+
"aurora-testnet",
|
|
20
|
+
"near-testnet",
|
|
21
|
+
"optimism",
|
|
22
|
+
"optimism-goerli",
|
|
23
|
+
"theta-testnet-001",
|
|
24
|
+
"osmo-test-4",
|
|
25
|
+
"base-testnet",
|
|
26
|
+
"base",
|
|
27
|
+
"celo",
|
|
28
|
+
"arbitrum-one",
|
|
29
|
+
"avalanche",
|
|
30
|
+
"zksync-era",
|
|
31
|
+
"zksync-era-testnet",
|
|
32
|
+
"sepolia",
|
|
33
|
+
"polygon-zkevm-testnet",
|
|
34
|
+
"polygon-zkevm",
|
|
35
|
+
"scroll-sepolia",
|
|
36
36
|
];
|
|
37
37
|
const validateStudioNetwork = ({ studio, product, network, }) => {
|
|
38
|
-
const isStudio = studio || product ===
|
|
38
|
+
const isStudio = studio || product === "subgraph-studio";
|
|
39
39
|
const isAllowedNetwork = !network ||
|
|
40
40
|
exports.allowedStudioNetworks.includes(
|
|
41
41
|
// @ts-expect-error we're checking if the network is allowed
|
|
42
42
|
network);
|
|
43
43
|
if (isStudio && !isAllowedNetwork) {
|
|
44
|
-
throw new Error(`The Subgraph Studio only allows subgraphs for these networks: ${exports.allowedStudioNetworks.join(
|
|
44
|
+
throw new Error(`The Subgraph Studio only allows subgraphs for these networks: ${exports.allowedStudioNetworks.join(", ")}`);
|
|
45
45
|
}
|
|
46
46
|
};
|
|
47
47
|
exports.validateStudioNetwork = validateStudioNetwork;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import immutable from
|
|
2
|
-
import Subgraph from
|
|
3
|
-
import { ContractCtor } from
|
|
4
|
-
import { SubgraphOptions } from
|
|
1
|
+
import immutable from "immutable";
|
|
2
|
+
import Subgraph from "../subgraph";
|
|
3
|
+
import { ContractCtor } from "./contract";
|
|
4
|
+
import { SubgraphOptions } from "./subgraph";
|
|
5
5
|
export default class Protocol {
|
|
6
6
|
static fromDataSources(dataSourcesAndTemplates: any): Protocol;
|
|
7
7
|
name: ProtocolName;
|
|
@@ -25,7 +25,7 @@ export default class Protocol {
|
|
|
25
25
|
getManifestScaffold(): any;
|
|
26
26
|
getMappingScaffold(): any;
|
|
27
27
|
}
|
|
28
|
-
export type ProtocolName =
|
|
28
|
+
export type ProtocolName = "arweave" | "ethereum" | "near" | "cosmos" | "substreams";
|
|
29
29
|
export interface ProtocolConfig {
|
|
30
30
|
displayName: string;
|
|
31
31
|
abi?: any;
|
package/dist/protocols/index.js
CHANGED
|
@@ -47,7 +47,7 @@ const NearMappingScaffold = __importStar(require("./near/scaffold/mapping"));
|
|
|
47
47
|
const subgraph_4 = __importDefault(require("./near/subgraph"));
|
|
48
48
|
const SubstreamsManifestScaffold = __importStar(require("./substreams/scaffold/manifest"));
|
|
49
49
|
const subgraph_5 = __importDefault(require("./substreams/subgraph"));
|
|
50
|
-
const protocolDebug = (0, debug_1.default)(
|
|
50
|
+
const protocolDebug = (0, debug_1.default)("graph-cli:protocol");
|
|
51
51
|
class Protocol {
|
|
52
52
|
static fromDataSources(dataSourcesAndTemplates) {
|
|
53
53
|
const firstDataSourceKind = dataSourcesAndTemplates[0].kind;
|
|
@@ -56,19 +56,19 @@ class Protocol {
|
|
|
56
56
|
constructor(name) {
|
|
57
57
|
this.name = Protocol.normalizeName(name);
|
|
58
58
|
switch (this.name) {
|
|
59
|
-
case
|
|
59
|
+
case "arweave":
|
|
60
60
|
this.config = arweaveProtocol;
|
|
61
61
|
break;
|
|
62
|
-
case
|
|
62
|
+
case "cosmos":
|
|
63
63
|
this.config = cosmosProtocol;
|
|
64
64
|
break;
|
|
65
|
-
case
|
|
65
|
+
case "ethereum":
|
|
66
66
|
this.config = ethereumProtocol;
|
|
67
67
|
break;
|
|
68
|
-
case
|
|
68
|
+
case "near":
|
|
69
69
|
this.config = nearProtocol;
|
|
70
70
|
break;
|
|
71
|
-
case
|
|
71
|
+
case "substreams":
|
|
72
72
|
this.config = substreamsProtocol;
|
|
73
73
|
break;
|
|
74
74
|
default:
|
|
@@ -80,67 +80,67 @@ class Protocol {
|
|
|
80
80
|
return immutable_1.default.fromJS({
|
|
81
81
|
// `ethereum/contract` is kept for backwards compatibility.
|
|
82
82
|
// New networks (or protocol perhaps) shouldn't have the `/contract` anymore (unless a new case makes use of it).
|
|
83
|
-
arweave: [
|
|
84
|
-
ethereum: [
|
|
85
|
-
near: [
|
|
86
|
-
cosmos: [
|
|
87
|
-
substreams: [
|
|
83
|
+
arweave: ["arweave"],
|
|
84
|
+
ethereum: ["ethereum", "ethereum/contract"],
|
|
85
|
+
near: ["near"],
|
|
86
|
+
cosmos: ["cosmos"],
|
|
87
|
+
substreams: ["substreams"],
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
static availableNetworks() {
|
|
91
91
|
return immutable_1.default.fromJS({
|
|
92
|
-
arweave: [
|
|
92
|
+
arweave: ["arweave-mainnet"],
|
|
93
93
|
ethereum: [
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
94
|
+
"mainnet",
|
|
95
|
+
"rinkeby",
|
|
96
|
+
"goerli",
|
|
97
|
+
"poa-core",
|
|
98
|
+
"poa-sokol",
|
|
99
|
+
"gnosis",
|
|
100
|
+
"matic",
|
|
101
|
+
"mumbai",
|
|
102
|
+
"fantom",
|
|
103
|
+
"fantom-testnet",
|
|
104
|
+
"bsc",
|
|
105
|
+
"chapel",
|
|
106
|
+
"clover",
|
|
107
|
+
"avalanche",
|
|
108
|
+
"fuji",
|
|
109
|
+
"celo",
|
|
110
|
+
"celo-alfajores",
|
|
111
|
+
"fuse",
|
|
112
|
+
"moonbeam",
|
|
113
|
+
"moonriver",
|
|
114
|
+
"mbase",
|
|
115
|
+
"arbitrum-one",
|
|
116
|
+
"arbitrum-goerli",
|
|
117
|
+
"optimism",
|
|
118
|
+
"optimism-goerli",
|
|
119
|
+
"aurora",
|
|
120
|
+
"aurora-testnet",
|
|
121
|
+
"base-testnet",
|
|
122
|
+
"base",
|
|
123
|
+
"zksync-era",
|
|
124
|
+
"zksync-era-testnet",
|
|
125
|
+
"sepolia",
|
|
126
|
+
"polygon-zkevm-testnet",
|
|
127
|
+
"polygon-zkevm",
|
|
128
|
+
"scroll-sepolia",
|
|
129
129
|
],
|
|
130
|
-
near: [
|
|
130
|
+
near: ["near-mainnet", "near-testnet"],
|
|
131
131
|
cosmos: [
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
132
|
+
"cosmoshub-4",
|
|
133
|
+
"theta-testnet-001",
|
|
134
|
+
"osmosis-1",
|
|
135
|
+
"osmo-test-4",
|
|
136
|
+
"juno-1",
|
|
137
|
+
"uni-3", // Juno testnet
|
|
138
138
|
],
|
|
139
|
-
substreams: [
|
|
139
|
+
substreams: ["mainnet"],
|
|
140
140
|
});
|
|
141
141
|
}
|
|
142
142
|
static normalizeName(name) {
|
|
143
|
-
return Protocol.availableProtocols().findKey(possibleNames => {
|
|
143
|
+
return Protocol.availableProtocols().findKey((possibleNames) => {
|
|
144
144
|
return possibleNames.includes(name);
|
|
145
145
|
});
|
|
146
146
|
}
|
|
@@ -150,7 +150,9 @@ class Protocol {
|
|
|
150
150
|
// Receives a data source kind, and checks if it's valid
|
|
151
151
|
// for the given protocol instance (this).
|
|
152
152
|
isValidKindName(kind) {
|
|
153
|
-
return Protocol.availableProtocols()
|
|
153
|
+
return Protocol.availableProtocols()
|
|
154
|
+
.get(this.name, immutable_1.default.List())
|
|
155
|
+
.includes(kind);
|
|
154
156
|
}
|
|
155
157
|
hasABIs() {
|
|
156
158
|
return this.config.abi != null;
|
|
@@ -200,7 +202,7 @@ class Protocol {
|
|
|
200
202
|
}
|
|
201
203
|
exports.default = Protocol;
|
|
202
204
|
const arweaveProtocol = {
|
|
203
|
-
displayName:
|
|
205
|
+
displayName: "Arweave",
|
|
204
206
|
abi: undefined,
|
|
205
207
|
contract: undefined,
|
|
206
208
|
getTemplateCodeGen: undefined,
|
|
@@ -212,7 +214,7 @@ const arweaveProtocol = {
|
|
|
212
214
|
mappingScaffold: ArweaveMappingScaffold,
|
|
213
215
|
};
|
|
214
216
|
const cosmosProtocol = {
|
|
215
|
-
displayName:
|
|
217
|
+
displayName: "Cosmos",
|
|
216
218
|
abi: undefined,
|
|
217
219
|
contract: undefined,
|
|
218
220
|
getTemplateCodeGen: undefined,
|
|
@@ -224,7 +226,7 @@ const cosmosProtocol = {
|
|
|
224
226
|
mappingScaffold: CosmosMappingScaffold,
|
|
225
227
|
};
|
|
226
228
|
const ethereumProtocol = {
|
|
227
|
-
displayName:
|
|
229
|
+
displayName: "Ethereum",
|
|
228
230
|
abi: abi_1.default,
|
|
229
231
|
contract: contract_1.default,
|
|
230
232
|
getTemplateCodeGen(template) {
|
|
@@ -240,7 +242,7 @@ const ethereumProtocol = {
|
|
|
240
242
|
mappingScaffold: EthereumMappingScaffold,
|
|
241
243
|
};
|
|
242
244
|
const nearProtocol = {
|
|
243
|
-
displayName:
|
|
245
|
+
displayName: "NEAR",
|
|
244
246
|
abi: undefined,
|
|
245
247
|
contract: contract_2.default,
|
|
246
248
|
getTypeGenerator: undefined,
|
|
@@ -252,7 +254,7 @@ const nearProtocol = {
|
|
|
252
254
|
mappingScaffold: NearMappingScaffold,
|
|
253
255
|
};
|
|
254
256
|
const substreamsProtocol = {
|
|
255
|
-
displayName:
|
|
257
|
+
displayName: "Substreams",
|
|
256
258
|
abi: undefined,
|
|
257
259
|
contract: undefined,
|
|
258
260
|
getTypeGenerator: undefined,
|
|
@@ -263,4 +265,4 @@ const substreamsProtocol = {
|
|
|
263
265
|
manifestScaffold: SubstreamsManifestScaffold,
|
|
264
266
|
mappingScaffold: undefined,
|
|
265
267
|
};
|
|
266
|
-
protocolDebug(
|
|
268
|
+
protocolDebug("Available networks %M", Protocol.availableNetworks());
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphprotocol/graph-cli",
|
|
3
|
-
"version": "0.58.0-alpha-
|
|
3
|
+
"version": "0.58.0-alpha-20230918230348-a16f8e3",
|
|
4
4
|
"description": "CLI for building for and deploying to The Graph",
|
|
5
5
|
"license": "(Apache-2.0 OR MIT)",
|
|
6
6
|
"engines": {
|
|
@@ -56,7 +56,7 @@
|
|
|
56
56
|
"@types/semver": "^7.3.13",
|
|
57
57
|
"@types/which": "^2.0.1",
|
|
58
58
|
"copyfiles": "^2.4.1",
|
|
59
|
-
"jest": "29.
|
|
59
|
+
"jest": "29.5.0",
|
|
60
60
|
"oclif": "3.8.1",
|
|
61
61
|
"spawn-command": "0.0.2-1",
|
|
62
62
|
"strip-ansi": "6.0.1",
|