diff --git a/bin/index.js b/bin/index.js index 9559c23..de14696 100755 --- a/bin/index.js +++ b/bin/index.js @@ -150,6 +150,54 @@ async function init() { ]); answers.seedPhrase = seedPhraseAnswer.seedPhrase; + let account; + let custodyAddress; + let fid; + + if (answers.seedPhrase) { + let fidLookupSuccessful = false; + while (!fidLookupSuccessful) { + try { + // Generate custody address from seed phrase + account = mnemonicToAccount(answers.seedPhrase); + custodyAddress = account.address; + + // Look up FID using custody address + console.log('\nLooking up FID...'); + const neynarApiKey = answers.useNeynar ? answers.neynarApiKey : 'FARCASTER_V2_FRAMES_DEMO'; + fid = await lookupFidByCustodyAddress(custodyAddress, neynarApiKey); + + if (!fid) { + throw new Error('No FID found for this custody address'); + } + + fidLookupSuccessful = true; + } catch (error) { + console.error('\n❌ Error:', error.message); + console.log('\n⚠️ Could not find an FID for this seed phrase. This usually means:'); + console.log('1. The seed phrase might be incorrect'); + console.log('2. The account might not be registered on Farcaster'); + console.log('3. The custody address might not be linked to a Farcaster account\n'); + + // Ask for seed phrase again + const retryAnswer = await inquirer.prompt([ + { + type: 'password', + name: 'seedPhrase', + message: 'Please enter your seed phrase again (or leave empty to continue without signing):\n', + default: null + } + ]); + + if (!retryAnswer.seedPhrase) { + console.log('\n⚠️ Continuing without frame signing...'); + break; + } + answers.seedPhrase = retryAnswer.seedPhrase; + } + } + } + const projectName = answers.projectName; const projectPath = path.join(process.cwd(), projectName); diff --git a/dev.js b/dev.js index 0c479df..1355773 100644 --- a/dev.js +++ b/dev.js @@ -15,7 +15,7 @@ async function startDev() { 1. Open Warpcast on your phone 2. Go to Settings > Developer > Frames 4. Enter this URL: ${tunnel.url} - 5. Click "Launch" + 5. Click "Launch" (note that it may take ~10 seconds to load) `); // Start next dev with the tunnel URL as relevant environment variables diff --git a/package.json b/package.json index 75d6ccf..03ebe3e 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "frames-v2-demo", - "version": "0.1.4", + "version": "0.1.5", "type": "module", "files": [ "bin/index.js"