@@ -588,6 +588,19 @@ async function processInitForm(
588588 } ,
589589 } ) ;
590590
591+ promptManager . addStep ( {
592+ type : 'input' ,
593+ name : 'ipfs' ,
594+ message : `IPFS node to use for fetching subgraph manifest` ,
595+ initial : ipfsUrl ,
596+ skip : ( ) => ! isComposedSubgraph ,
597+ result : value => {
598+ ipfsNode = value ;
599+ initDebugger . extend ( 'processInitForm' ) ( 'ipfs: %O' , value ) ;
600+ return value ;
601+ } ,
602+ } ) ;
603+
591604 promptManager . addStep ( {
592605 type : 'input' ,
593606 name : 'source' ,
@@ -603,7 +616,7 @@ async function processInitForm(
603616 validate : async ( value : string ) : Promise < string | boolean > => {
604617 if ( isComposedSubgraph ) {
605618 if ( ! ipfsNode ) {
606- return true ; // Skip validation if no IPFS node is available
619+ return true ;
607620 }
608621 const ipfs = createIpfsClient ( ipfsNode ) ;
609622 const { valid, error } = await validateSubgraphNetworkMatch ( ipfs , value , network . id ) ;
@@ -691,19 +704,6 @@ async function processInitForm(
691704 } ,
692705 } ) ;
693706
694- promptManager . addStep ( {
695- type : 'input' ,
696- name : 'ipfs' ,
697- message : `IPFS node to use for fetching subgraph manifest` ,
698- initial : ipfsUrl ,
699- skip : ( ) => ! isComposedSubgraph ,
700- result : value => {
701- ipfsNode = value ;
702- initDebugger . extend ( 'processInitForm' ) ( 'ipfs: %O' , value ) ;
703- return value ;
704- } ,
705- } ) ;
706-
707707 promptManager . addStep ( {
708708 type : 'input' ,
709709 name : 'spkg' ,
@@ -834,11 +834,11 @@ async function processInitForm(
834834
835835 await promptManager . executeInteractive ( ) ;
836836
837- // If loading from IPFS, validate network matches
838- if ( ipfsNode && subgraphName . startsWith ( 'Qm' ) ) {
837+ // Validate network matches if loading from IPFS
838+ if ( ipfsNode && source && source . startsWith ( 'Qm' ) ) {
839839 const ipfs = createIpfsClient ( ipfsNode ) ;
840840 try {
841- const { valid, error } = await validateSubgraphNetworkMatch ( ipfs , subgraphName , network . id ) ;
841+ const { valid, error } = await validateSubgraphNetworkMatch ( ipfs , source ! , network . id ) ;
842842 if ( ! valid ) {
843843 throw new Error ( error || 'Invalid subgraph network match' ) ;
844844 }
0 commit comments