To transfer an Fname, e.g. farcaster, make a POST request to /transfers with the following body:
{ "name": "farcaster", // Name to transfer "from": 123, // FID to transfer from "to": 321, // FID to transfer to "fid": 123, // FID making the request (must match from) "owner": "0x...", // Custody address of FID making the request "timestamp": 1641234567, // Current timestamp in seconds "signature": "0x..." // EIP-712 signature signed by the custody address of the FID}
To generate the EIP-712 signature, use the following code:
import { makeUserNameProofClaim, EIP712Signer } from '@farcaster/hub-nodejs';const accountKey: EIP712Signer = undefined; // Account Key for the custody address (use appropriate subclass from hub-nodejs for ethers or viem)const claim = makeUserNameProofClaim({ name: 'farcaster', owner: '0x...', timestamp: Math.floor(Date.now() / 1000),});const signature = ( await accountKey.signUserNameProofClaim(claim))._unsafeUnwrap();