@graphprotocol/graph-cli 0.61.0-alpha-20231106135106-bbe3519 → 0.61.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.
package/CHANGELOG.md CHANGED
@@ -1,11 +1,20 @@
1
1
  # @graphprotocol/graph-cli
2
2
 
3
- ## 0.61.0-alpha-20231106135106-bbe3519
3
+ ## 0.61.0
4
4
 
5
5
  ### Minor Changes
6
6
 
7
+ - [#1491](https://github.com/graphprotocol/graph-tooling/pull/1491)
8
+ [`326b303`](https://github.com/graphprotocol/graph-tooling/commit/326b30340ed5d922bfde995c9ff68e0899ac4cb3)
9
+ Thanks [@YaroShkvorets](https://github.com/YaroShkvorets)! - add etherscan api retries to
10
+ `graph init` wizard
11
+
12
+ - [#1489](https://github.com/graphprotocol/graph-tooling/pull/1489)
13
+ [`031fca8`](https://github.com/graphprotocol/graph-tooling/commit/031fca87fb163a69a06653f7822f4738452a91aa)
14
+ Thanks [@saihaj](https://github.com/saihaj)! - Arbitrum Sepolia support
15
+
7
16
  - [#1493](https://github.com/graphprotocol/graph-tooling/pull/1493)
8
- [`bbe3519`](https://github.com/graphprotocol/graph-tooling/commit/bbe3519799a3b848af22f6f118e9a5b1e7da115f)
17
+ [`f5f974d`](https://github.com/graphprotocol/graph-tooling/commit/f5f974d63416ba845c45c50b2931c9beffcca3a1)
9
18
  Thanks [@incrypto32](https://github.com/incrypto32)! - Fix codegen issues when using derived
10
19
  loaders with Bytes as ID's
11
20
 
@@ -47,8 +47,7 @@ const fetchContractCreationHashWithRetry = async (url, retryCount) => {
47
47
  /* empty */
48
48
  }
49
49
  }
50
- throw new Error(`Failed to fetch contract creation transaction hash
51
- `);
50
+ throw new Error(`Failed to fetch contract creation transaction hash`);
52
51
  };
53
52
  exports.fetchContractCreationHashWithRetry = fetchContractCreationHashWithRetry;
54
53
  const fetchTransactionByHashFromRPC = async (network, transactionHash) => {
@@ -108,6 +107,8 @@ const getEtherscanLikeAPIUrl = (network) => {
108
107
  return `https://api.arbiscan.io/api`;
109
108
  case 'arbitrum-goerli':
110
109
  return `https://api-goerli.arbiscan.io/api`;
110
+ case 'arbitrum-sepolia':
111
+ return `https://api-sepolia.arbiscan.io/api`;
111
112
  case 'bsc':
112
113
  return `https://api.bscscan.com/api`;
113
114
  case 'base-testnet':
@@ -172,6 +173,8 @@ const getPublicRPCEndpoint = (network) => {
172
173
  return 'https://goerli-rollup.arbitrum.io/rpc';
173
174
  case 'arbitrum-one':
174
175
  return 'https://arb1.arbitrum.io/rpc';
176
+ case 'arbitrum-sepolia':
177
+ return `https://sepolia-rollup.arbitrum.io/rpc`;
175
178
  case 'aurora':
176
179
  return 'https://rpc.mainnet.aurora.dev';
177
180
  case 'aurora-testnet':
@@ -1,4 +1,4 @@
1
- export declare const allowedStudioNetworks: readonly ["mainnet", "rinkeby", "goerli", "gnosis", "chapel", "optimism-goerli", "clover", "fantom", "matic", "fantom-testnet", "arbitrum-goerli", "fuji", "celo-alfajores", "mumbai", "aurora-testnet", "near-testnet", "optimism", "optimism-goerli", "theta-testnet-001", "osmo-test-4", "base-testnet", "base", "celo", "arbitrum-one", "avalanche", "zksync-era", "zksync-era-testnet", "sepolia", "polygon-zkevm-testnet", "polygon-zkevm", "scroll-sepolia", "scroll"];
1
+ export declare const allowedStudioNetworks: readonly ["mainnet", "rinkeby", "goerli", "gnosis", "chapel", "optimism-goerli", "clover", "fantom", "matic", "fantom-testnet", "arbitrum-goerli", "fuji", "celo-alfajores", "mumbai", "aurora-testnet", "near-testnet", "optimism", "optimism-goerli", "theta-testnet-001", "osmo-test-4", "base-testnet", "base", "celo", "arbitrum-one", "arbitrum-sepolia", "avalanche", "zksync-era", "zksync-era-testnet", "sepolia", "polygon-zkevm-testnet", "polygon-zkevm", "scroll-sepolia", "scroll"];
2
2
  export declare const validateStudioNetwork: ({ studio, product, network, }: {
3
3
  studio?: string | boolean | undefined;
4
4
  product?: string | undefined;
@@ -26,6 +26,7 @@ exports.allowedStudioNetworks = [
26
26
  'base',
27
27
  'celo',
28
28
  'arbitrum-one',
29
+ 'arbitrum-sepolia',
29
30
  'avalanche',
30
31
  'zksync-era',
31
32
  'zksync-era-testnet',
@@ -1,4 +1,27 @@
1
1
  "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
2
25
  var __importDefault = (this && this.__importDefault) || function (mod) {
3
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
27
  };
@@ -7,6 +30,7 @@ const fs_1 = __importDefault(require("fs"));
7
30
  const os_1 = __importDefault(require("os"));
8
31
  const path_1 = __importDefault(require("path"));
9
32
  const gluegun_1 = require("gluegun");
33
+ const toolbox = __importStar(require("gluegun"));
10
34
  const core_1 = require("@oclif/core");
11
35
  const abi_1 = require("../command-helpers/abi");
12
36
  const network_1 = require("../command-helpers/network");
@@ -321,6 +345,25 @@ async function processFromExampleInitForm({ directory: initDirectory, subgraphNa
321
345
  this.error(e, { exit: 1 });
322
346
  }
323
347
  }
348
+ async function retryWithPrompt(func) {
349
+ for (;;) {
350
+ try {
351
+ return await func();
352
+ }
353
+ catch (_) {
354
+ const { retry } = await toolbox.prompt.ask({
355
+ type: 'confirm',
356
+ name: 'retry',
357
+ message: 'Do you want to retry?',
358
+ initial: true,
359
+ });
360
+ if (!retry) {
361
+ break;
362
+ }
363
+ }
364
+ }
365
+ return undefined;
366
+ }
324
367
  async function processInitForm({ protocol: initProtocol, product: initProduct, studio: initStudio, node: initNode, abi: initAbi, abiPath: initAbiPath, directory: initDirectory, contract: initContract, indexEvents: initIndexEvents, fromExample: initFromExample, network: initNetwork, subgraphName: initSubgraphName, contractName: initContractName, startBlock: initStartBlock, allowSimpleName: initAllowSimpleName, spkgPath: initSpkgPath, }) {
325
368
  let abiFromEtherscan = undefined;
326
369
  try {
@@ -443,27 +486,19 @@ async function processInitForm({ protocol: initProtocol, product: initProduct, s
443
486
  const ABI = protocolInstance.getABI();
444
487
  // Try loading the ABI from Etherscan, if none was provided
445
488
  if (protocolInstance.hasABIs() && !initAbi) {
446
- try {
447
- if (network === 'poa-core') {
448
- // TODO: this variable is never used anywhere, what happens?
449
- // abiFromBlockScout = await loadAbiFromBlockScout(ABI, network, value)
450
- }
451
- else {
452
- abiFromEtherscan = await (0, abi_1.loadAbiFromEtherscan)(ABI, network, value);
453
- }
489
+ if (network === 'poa-core') {
490
+ abiFromEtherscan = await retryWithPrompt(() => (0, abi_1.loadAbiFromBlockScout)(ABI, network, value));
454
491
  }
455
- catch (e) {
456
- // noop
492
+ else {
493
+ abiFromEtherscan = await retryWithPrompt(() => (0, abi_1.loadAbiFromEtherscan)(ABI, network, value));
457
494
  }
458
495
  }
459
496
  // If startBlock is not set, try to load it.
460
497
  if (!initStartBlock) {
461
- try {
462
- // Load startBlock for this contract
463
- initStartBlock = Number(await (0, abi_1.loadStartBlockForContract)(network, value)).toString();
464
- }
465
- catch (error) {
466
- // noop
498
+ // Load startBlock for this contract
499
+ const startBlock = await retryWithPrompt(() => (0, abi_1.loadStartBlockForContract)(network, value));
500
+ if (startBlock) {
501
+ initStartBlock = Number(startBlock).toString();
467
502
  }
468
503
  }
469
504
  return value;
@@ -114,6 +114,7 @@ class Protocol {
114
114
  'mbase',
115
115
  'arbitrum-one',
116
116
  'arbitrum-goerli',
117
+ 'arbitrum-sepolia',
117
118
  'optimism',
118
119
  'optimism-goerli',
119
120
  'aurora',
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.61.0-alpha-20231106135106-bbe3519",
2
+ "version": "0.61.0",
3
3
  "commands": {
4
4
  "add": {
5
5
  "id": "add",
@@ -627,6 +627,7 @@
627
627
  "mbase",
628
628
  "arbitrum-one",
629
629
  "arbitrum-goerli",
630
+ "arbitrum-sepolia",
630
631
  "optimism",
631
632
  "optimism-goerli",
632
633
  "aurora",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphprotocol/graph-cli",
3
- "version": "0.61.0-alpha-20231106135106-bbe3519",
3
+ "version": "0.61.0",
4
4
  "description": "CLI for building for and deploying to The Graph",
5
5
  "license": "(Apache-2.0 OR MIT)",
6
6
  "engines": {