Crate farcaster_rs

Source
Expand description

§farcaster-rs

A Rust crate to interact with the Farcaster smart contracrts & merkle APIs

§Quickstart

To get started with the farcaster-rs crate, this should serve as a simple example of how to use it

use farcaster_rs::{
    Account,
    Farcaster
};
use std::error::Error;

#[tokio::main]
async fn main() -> Result<(), Box<dyn Error>> {
    // Initialize a new Account w/ your key and an optional token duration (milliseconds)
    let account: Account = Account::from_mnemonic("super top secret phrase", None).await?;

    // Connect to an ETH node
    let farcaster: Farcaster = Farcaster::new("node url", account).await?;

    // Get Dan Romero's Casts with his Username, while specifying a limit, and a cursor
    let casts = farcaster.get_casts_by_username("dwr", Some(5), None).await?;

    println!("{:#?}", casts);

    Ok(())
}

Quick explanation of all folders/modules in farcaster-rs

§If you’re looking for authentication

It’s best to look in the Account Struct

It’s best to look in the Farcaster Struct

§If you’re looking to convert stuff like Username -> FID, FID -> Address, etc….

It’s best to look in the Registry Struct


§account

The account module handles authentication w/ the Farcaster Merkle APIs. Generating tokens, revoking tokens, etc…. View documentation here

§api

The API module has room for growth, but for now holds some reqwest wrappers to make my life easier View documentation here

§assets

The assets module holds functions to get NFT collection related data. View documentation here

§casts

The casts module holds functions related to casts on Farcaster. Getting casts, publishing casts, etc… View documentation here

§follows

The follows module holds function related to followers and following. Follow users, unfollow, view followers, etc.. View documentation here

§misc

The misc module holds functions that don’t entirely have a place. The only one for now is API Health View documentation here

§notifications

The notifications module holds functions relating to notifications, which right now allows you to fetch notifications //! View documentation here

§reactions

The reactions module allows you to view and modify your reactions. Like, recast, list likes/recasts, etc… View documentation here

§registry

The registry module holds important functions most importantly relating to getting users. - Convert addres/username to FID, get users via FID, etc…… View documentation here

§users

The users module holds functions relating to users on Farcaster. Get users, get custody adress’, etc… //! View documentation here

§verifications

The verifications module holds functions relating to cryptographic proofs such as getting verified address’ //! View documentation here

Re-exports§

pub use types::account::Account;
pub use types::registry::Registry;

Modules§

account
The Account module that handles authentication and tokens
api
The API module that has internal functions for wrappers and such
assets
The Assets module that handles getting related NFT assets
casts
The Casts module that handles protocol casts
constants
follows
The Follows module that handles followers and follows and following
misc
notifications
The Notifications module that handles notifications
reactions
The Reactions module that handles likes and recasts
registry
types
Contains all of the types used throughout farcaster-rs
users
The Users module that handles users
verifications
The Verifications module that handles proof verifications

Structs§

Farcaster
The Farcaster type that holds the keys to the castle - so to speak :)