You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
An Eip712Signer that is initialized with an Viem LocalACcount and can be used with Builders to sign Farcaster Messages.
Properties
Name
Type
Description
scheme
Uint8Array
Signature scheme used when signing messages
Constructors
static new ViemLocalEip712Signer
Usage
import{ViemLocalEip712Signer}from'@farcaster/hub-nodejs';import{mnemonicToAccount}from'viem/accounts';constmnemonic='ordinary long coach bounce thank quit become youth belt pretty diet caught attract melt bargain';constaccount=mnemonicToAccount(mnemonic);consteip712Signer=newViemLocalEip712Signer(account);
Generates a 256-bit signature for a VerificationClaim and returns the bytes.
Usage
import{FarcasterNetwork,hexStringToBytes,makeVerificationEthAddressClaim}from'@farcaster/hub-nodejs';constblockHashHex='0x1d3b0456c920eb503450c7efdcf9b5cf1f5184bf04e5d8ecbcead188a0d02018';constblockHashBytes=hexStringToBytes(blockHashHex)._unsafeUnwrap();// Safety: blockHashHex is known and can't errorconstethereumAddressResult=awaiteip712Signer.getSignerKey();if(ethereumAddressResult.isOk()){constclaimResult=makeVerificationEthAddressClaim(1,ethereumAddressResult.value,FarcasterNetwork.DEVNET,blockHashBytes);if(claimResult.isOk()){constverificationResult=awaiteip712Signer.signVerificationEthAddressClaim(claimResult.value);if(verificationResult.isOk()){console.log(verificationResult.value);}}}