Social protocol integration with Farcaster
import { Farcaster } from './Farcaster.js'; const fc = Farcaster({ provider, idRegistry: ID_REGISTRY, keyRegistry: KEY_REGISTRY, }); // Get FID for address const fid = await fc.getFid(address); // Get custody address for FID const custody = await fc.getCustodyAddress(fid); // Register new FID await fc.register({ recovery: recoveryAddress, signer, });
// Add signer key await fc.addKey({ fid, key: signerPublicKey, keyType: 1, // Ed25519 signer, }); // Remove key await fc.removeKey({ fid, key: signerPublicKey, signer, });
// Validate frame action message const { isValid, message } = await fc.validateFrameAction( trustedData.messageBytes ); if (isValid) { console.log('FID:', message.fid); console.log('Button:', message.buttonIndex); console.log('Input:', message.inputText); }
Was this page helpful?