@@ -337,7 +337,7 @@ async function processFromExampleInitForm(
337337 {
338338 type : 'input' ,
339339 name : 'subgraphName' ,
340- message : ( ) => 'Subgraph slug' ,
340+ message : 'Subgraph slug' ,
341341 initial : initSubgraphName ,
342342 } ,
343343 ] ) ;
@@ -483,13 +483,17 @@ async function processInitForm(
483483 const { protocol } = await prompt . ask < { protocol : string } > ( {
484484 type : 'select' ,
485485 name : 'protocol' ,
486- message : 'Protocol' ,
487- choices : [ network . graphNode ?. protocol ?? '' , 'substreams' ] . filter ( Boolean ) ,
488- validate : value => {
489- if ( value === 'arweave' ) {
486+ message : 'Source' ,
487+ choices : [
488+ { message : 'Smart contract' , name : network . graphNode ?. protocol ?? '' , value : 'contract' } ,
489+ { message : 'Substreams' , name : 'substreams' , value : 'substreams' } ,
490+ { message : 'Subgraph' , name : 'subgraph' , value : 'subgraph' } ,
491+ ] . filter ( ( { name } ) => name ) ,
492+ validate : name => {
493+ if ( name === 'arweave' ) {
490494 return 'Arweave only supported via substreams' ;
491495 }
492- if ( value === 'cosmos' ) {
496+ if ( name === 'cosmos' ) {
493497 return 'Cosmos only supported via substreams' ;
494498 }
495499 return true ;
@@ -522,7 +526,7 @@ async function processInitForm(
522526 ] ) ;
523527
524528 const sourceMessage = isComposedSubgraph
525- ? 'Source subgraph identifier '
529+ ? 'Source subgraph deployment ID '
526530 : `Contract ${ protocolInstance . getContract ( ) ?. identifierName ( ) } ` ;
527531
528532 const { source } = await prompt . ask < { source : string } > ( [
@@ -531,11 +535,13 @@ async function processInitForm(
531535 name : 'source' ,
532536 message : sourceMessage ,
533537 skip : ( ) =>
534- initFromExample !== undefined || ! protocolInstance . hasContract ( ) || isSubstreams ,
538+ initFromExample !== undefined ||
539+ isSubstreams ||
540+ ( ! protocolInstance . hasContract ( ) && ! isComposedSubgraph ) ,
535541 initial : initContract ,
536542 validate : async ( value : string ) => {
537543 if ( isComposedSubgraph ) {
538- return true ;
544+ return value . startsWith ( 'Qm' ) ? true : 'Subgraph deployment ID must start with Qm' ;
539545 }
540546
541547 if ( initFromExample !== undefined || ! protocolInstance . hasContract ( ) ) {
@@ -692,7 +698,7 @@ async function processInitForm(
692698 {
693699 type : 'input' ,
694700 name : 'startBlock' ,
695- message : 'Start Block ' ,
701+ message : 'Start block ' ,
696702 initial : initStartBlock || startBlockFromEtherscan || '0' ,
697703 skip : ( ) => initFromExample !== undefined || isSubstreams ,
698704 validate : value => parseInt ( value ) >= 0 ,
@@ -703,7 +709,7 @@ async function processInitForm(
703709 {
704710 type : 'input' ,
705711 name : 'contractName' ,
706- message : 'Contract Name ' ,
712+ message : 'Contract name ' ,
707713 initial : initContractName || contractNameFromEtherscan || 'Contract' ,
708714 skip : ( ) =>
709715 initFromExample !== undefined || ! protocolInstance . hasContract ( ) || isSubstreams ,
0 commit comments