@graphprotocol/graph-cli 0.89.0 → 0.89.1-alpha-20241120083236-1915251

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,5 +1,14 @@
1
1
  # @graphprotocol/graph-cli
2
2
 
3
+ ## 0.89.1-alpha-20241120083236-1915251
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1767](https://github.com/graphprotocol/graph-tooling/pull/1767)
8
+ [`6f2cb45`](https://github.com/graphprotocol/graph-tooling/commit/6f2cb45e5a07d8de2946a485763feb0b1bcfd4f0)
9
+ Thanks [@0237h](https://github.com/0237h)! - Fix CLI validation for `startBlock` and
10
+ `contractName` fetched from external APIs
11
+
3
12
  ## 0.89.0
4
13
 
5
14
  ### Minor Changes
@@ -362,6 +362,8 @@ async function retryWithPrompt(func) {
362
362
  }
363
363
  async function processInitForm({ protocol: initProtocol, abi: initAbi, abiPath: initAbiPath, directory: initDirectory, contract: initContract, indexEvents: initIndexEvents, fromExample: initFromExample, network: initNetwork, subgraphName: initSubgraphName, contractName: initContractName, startBlock: initStartBlock, spkgPath: initSpkgPath, }) {
364
364
  let abiFromEtherscan = undefined;
365
+ let startBlockFromEtherscan = undefined;
366
+ let contractNameFromEtherscan = undefined;
365
367
  try {
366
368
  const { protocol } = await gluegun_1.prompt.ask({
367
369
  type: 'select',
@@ -461,7 +463,7 @@ async function processInitForm({ protocol: initProtocol, abi: initAbi, abiPath:
461
463
  // Load startBlock for this contract
462
464
  const startBlock = await retryWithPrompt(() => (0, abi_1.loadStartBlockForContract)(network, value));
463
465
  if (startBlock) {
464
- initStartBlock = Number(startBlock).toString();
466
+ startBlockFromEtherscan = Number(startBlock).toString();
465
467
  }
466
468
  }
467
469
  // If contract name is not set, try to load it.
@@ -469,7 +471,7 @@ async function processInitForm({ protocol: initProtocol, abi: initAbi, abiPath:
469
471
  // Load contract name for this contract
470
472
  const contractName = await retryWithPrompt(() => (0, abi_1.loadContractNameForAddress)(network, value));
471
473
  if (contractName) {
472
- initContractName = contractName;
474
+ contractNameFromEtherscan = contractName;
473
475
  }
474
476
  }
475
477
  return value;
@@ -532,14 +534,9 @@ async function processInitForm({ protocol: initProtocol, abi: initAbi, abiPath:
532
534
  type: 'input',
533
535
  name: 'startBlock',
534
536
  message: 'Start Block',
535
- initial: initStartBlock || '0',
537
+ initial: initStartBlock || startBlockFromEtherscan || '0',
536
538
  skip: () => initFromExample !== undefined || isSubstreams,
537
539
  validate: value => parseInt(value) >= 0,
538
- result(value) {
539
- if (initStartBlock)
540
- return initStartBlock;
541
- return value;
542
- },
543
540
  },
544
541
  ]);
545
542
  const { contractName } = await gluegun_1.prompt.ask([
@@ -547,14 +544,9 @@ async function processInitForm({ protocol: initProtocol, abi: initAbi, abiPath:
547
544
  type: 'input',
548
545
  name: 'contractName',
549
546
  message: 'Contract Name',
550
- initial: initContractName || 'Contract' || isSubstreams,
547
+ initial: initContractName || contractNameFromEtherscan || 'Contract' || isSubstreams,
551
548
  skip: () => initFromExample !== undefined || !protocolInstance.hasContract(),
552
549
  validate: value => value && value.length > 0,
553
- result(value) {
554
- if (initContractName)
555
- return initContractName;
556
- return value;
557
- },
558
550
  },
559
551
  ]);
560
552
  const { indexEvents } = await gluegun_1.prompt.ask([
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.89.0",
2
+ "version": "0.89.1-alpha-20241120083236-1915251",
3
3
  "commands": {
4
4
  "add": {
5
5
  "id": "add",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@graphprotocol/graph-cli",
3
- "version": "0.89.0",
3
+ "version": "0.89.1-alpha-20241120083236-1915251",
4
4
  "description": "CLI for building for and deploying to The Graph",
5
5
  "license": "(Apache-2.0 OR MIT)",
6
6
  "engines": {