check seed phrase and retry

This commit is contained in:
lucas-neynar 2025-03-14 14:08:49 -07:00
parent 109724f841
commit d899f59c2c
No known key found for this signature in database
3 changed files with 50 additions and 2 deletions

View File

@ -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);

2
dev.js
View File

@ -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

View File

@ -1,6 +1,6 @@
{
"name": "frames-v2-demo",
"version": "0.1.4",
"version": "0.1.5",
"type": "module",
"files": [
"bin/index.js"