Fetch Signers - Backend
This guide demonstrates how to get a list of signers for an account if the developer has the user’s mnemonic/account private key (If not check: Frontend (Wallet Integration))
Related API: List signers
Prerequisites
Node.js Installed
Ensure you have Nodejs installed on your system. You can download it from Node.js’ official website.
API Key and Mnemonic
Obtain an API key from the dev portal Ensure you have a valid Ethereum mnemonic phrase of the account with a signer associated with the above API key.
Dependencies Installed
Install the required packages:
Code Breakdown and Steps
Import Required Libraries
The code begins by importing the necessary libraries:
Define Your Mnemonic
Replace "YOUR_MNEMONIC_HERE"
with your Ethereum mnemonic phrase:
Convert Mnemonic to Account
The mnemonicToAccount
function converts your mnemonic into an account object:
Configure Neynar API Client
Replace "YOUR_API_KEY_HERE"
with your API key and set the correct base path for the Neynar API:
Create the SIWE Message
The createSiweMessage
function generates a SIWE message with details such as domain, address, and nonce:
Sign and Verify the Message
The fetchSigners
function handles the signing process and fetches signers:
Note: The address
should be the custody_address
of the farcaster account (Check custody_address here)
Execute the Function
Call the fetchSigners
function and handle success or errors:
Expected Output
For additional help, feel free to contact us.
Was this page helpful?