Quickstart
Install
bun add farcaster-snapchain-utilsyarn add farcaster-snapchain-utilsUsage
- read-only with the public node from Pinata
import { SnapChainClient } from 'farcaster-snapchain-utils'
const client = SnapChainClient();
// client.method... -> must be a read method only, or it will throw an error
- read-write with your node
import { SnapChainClient } from 'farcaster-snapchain-utils'
const userFid = 1791;
// Example signer must be a valid signer of the FID
const signer = "0x222ab147ccbaa2dc660717f28ea4aaeea13b93fe9df297669efdd12f7c1669df";
const client = new SnapChainClient({
// FID & PK are needed if you will do write actions on behalf of the user
FID: userFid,
PK: signer,
// your node address, ex, node.fosscaster.xyz you can include the port
NODE_URL: 'hub.merv.fun:3383',
// node auth user if needed
NODE_USER: '',
// node auth password if needed
NODE_PASS: '',
// if node GRPC has SSL, this is optional, will default to true
GRPC_SSL: false
})
// client.method... -> you can call read/write methods like follow / createCast, etc
- read-write with Neynar Key
- add/change node later
You can also add or change either the node or key later, which is useful for avoiding creating multiple instances of SnapChainClient if you don't need to.
changeNodeneeds either NODE_URL or NEYNAR_API_KEY if neither is provided, it will throw an error; if both are provided, it will default to using the Neynar key instead of the node.
- add/change user (signer/fid) later
Check all methods to see all possible client actions
Last updated