From cfe2c18a4b218d26921feeaa8bd933187750a3f2 Mon Sep 17 00:00:00 2001 From: lucas-neynar Date: Thu, 27 Mar 2025 08:28:49 -0700 Subject: [PATCH] fix: lowercase custody address --- bin/init.js | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/bin/init.js b/bin/init.js index 82f0fa0..0efcd12 100644 --- a/bin/init.js +++ b/bin/init.js @@ -61,9 +61,10 @@ async function lookupFidByCustodyAddress(custodyAddress, apiKey) { if (!apiKey) { throw new Error('Neynar API key is required'); } + const lowerCasedCustodyAddress = custodyAddress.toLowerCase(); const response = await fetch( - `https://api.neynar.com/v2/farcaster/user/bulk-by-address?addresses=${custodyAddress}&address_types=custody_address`, + `https://api.neynar.com/v2/farcaster/user/bulk-by-address?addresses=${lowerCasedCustodyAddress}&address_types=custody_address`, { headers: { 'accept': 'application/json', @@ -77,13 +78,11 @@ async function lookupFidByCustodyAddress(custodyAddress, apiKey) { } const data = await response.json(); - console.log('got address data:'); - console.log(data); - if (!data[custodyAddress]?.length && !data[custodyAddress][0].custody_address) { + if (!data[lowerCasedCustodyAddress]?.length && !data[lowerCasedCustodyAddress][0].custody_address) { throw new Error('No FID found for this custody address'); } - return data[custodyAddress][0].fid; + return data[lowerCasedCustodyAddress][0].fid; } // Export the main CLI function for programmatic use