Skip to content

Instantly share code, notes, and snippets.

@i001962
i001962 / gist:f9a075245f1afe8463d0df102a7bb307
Created May 18, 2025 04:02
Privy Signer Write to Farcaster
import React, { useState } from "react";
import { usePrivy, useLogin, useFarcasterSigner } from "@privy-io/react-auth";
import { ExternalEd25519Signer, HubRestAPIClient } from "@standard-crypto/farcaster-js";
const TestSubmitCast = () => {
const { authenticated, user } = usePrivy();
const { login } = useLogin();
const { getFarcasterSignerPublicKey, signFarcasterMessage, requestFarcasterSignerFromWarpcast } = useFarcasterSigner();
const [status, setStatus] = useState<"idle" | "posting" | "success" | "error">("idle");
@i001962
i001962 / gist:01ece86dbe14f476c5cdc3ef0cd42d09
Created May 11, 2025 00:08
trying to write to snapchain w privy signer
import { useState } from 'react';
import { ExternalEd25519Signer, HubRestAPIClient } from '@standard-crypto/farcaster-js';
import { useLogin, usePrivy, useFarcasterSigner } from '@privy-io/react-auth';
export default function Cast() {
const [text, setText] = useState('');
const { login } = useLogin();
const { user } = usePrivy();
const { getFarcasterSignerPublicKey, signFarcasterMessage, requestFarcasterSignerFromWarpcast } = useFarcasterSigner();
@i001962
i001962 / gist:e1cd9f86423eda772df8e49acab8b3d9
Created May 10, 2025 17:24
Footy Revnet Deployer - example only
export const SCORES_TEST_FORM_DATA: RevnetFormData = {
name: "Footy App Scores",
description: "The Footy App tracks scores, where points are utilized and awarded within the app. A fraction of each purchase contributes to the community of open source developers and supporters.",
logoUri: "",
tokenName: "Footy Scores",
tokenSymbol: "SCORES",
stages: [
// 1. Keep the current first stage unchanged.
{
initialOperator: "0xDf087B724174A3E4eD2338C0798193932E851F1b",
@i001962
i001962 / footy_favs.ts
Created February 2, 2025 16:09
footy fav team helper
import { Redis } from "@upstash/redis";
const redis = new Redis({
url: process.env.NEXT_PUBLIC_KV_REST_API_URL,
token: process.env.NEXT_PUBLIC_KV_REST_API_TOKEN,
});
function getTeamPreferencesKey(fid: number): string {
return `fc-footy:preference:${fid}`;
}
const submitUserData = async () => {
const server = "https://hub.farcaster.standardcrypto.vc:2281";
const url = `${server}/v1/submitMessage`;
const fid = farcasterAccount?.fid;
// Ensure fid exists
if (!fid) {
setStatus('Farcaster ID (FID) is missing');
return;
}
@i001962
i001962 / gist:400f7336ca09a0674c807bf19f2b9b4e
Created September 3, 2024 15:24
FC fantasy table schemas
""" CREATE TABLE IF NOT EXISTS standings (
id INTEGER PRIMARY KEY,
event_total INTEGER,
player_name VARCHAR(100),
rank INTEGER,
last_rank INTEGER,
rank_sort INTEGER,
total INTEGER,
entry INTEGER,
***
manager data insert without success alert - no window open
javascript:(function(){const gunScript=document.createElement('script');gunScript.src='https://cdn.jsdelivr.net/npm/gun/gun.js';gunScript.onload=function(){const gun=Gun({peers:['https://gun-manhattan.herokuapp.com/gun']});const preElement=document.querySelector('pre');if(preElement){try{const jsonText=preElement.innerText.trim();console.log('Raw JSON text:',jsonText);const jsonData=JSON.parse(jsonText);console.log('Parsed JSON data:',jsonData);if(jsonData.new_entries&&jsonData.new_entries.results){jsonData.new_entries.results.forEach(user=>{const specificPath='kmac1fepl/users';const userId=user.entry.toString();const userObject={entry:user.entry,entry_name:user.entry_name,joined_time:user.joined_time,player_first_name:user.player_first_name,player_last_name:user.player_last_name};gun.get(specificPath).get(userId).put(userObject,ack=>{if(ack.err){console.error('Error inserting data:',ack.err);alert('Error inserting data: '+ack.err);}else{console.l
import type { InferGetServerSidePropsType, GetServerSideProps } from "next";
import Head from "next/head";
import {
fetchMetadata,
metadataToMetaTags,
} from "frames.js/next/pages-router/client";
import {
FrameUI,
fallbackFrameContext,
FrameContext,
@i001962
i001962 / cast.ts
Created February 21, 2024 04:29
cast example plus some
import { FarcasterNetwork, Message, makeCastAdd, NobleEd25519Signer } from "@farcaster/core";
import axios from "axios";
import sendBio from './bioUpdate';
import sendAi from './ai';
import { CastLengthLimit, NeynarAPI } from "../constants/constants";
const sendCast = async (
newPost: string,
setNewPost: React.Dispatch<React.SetStateAction<string>>,
setRemainingChars: React.Dispatch<React.SetStateAction<number>>,
@i001962
i001962 / FarcasterLogin.tsx
Created May 13, 2023 20:53
farcaster-react-login-warpcast
import styles from "./Farcaster.module.css";
import React, { useState, useEffect } from "react";
//import styles from "./DeployerInfo.module.css";
import * as ed from '@noble/ed25519';
import axios from "axios";
import QRCode from "react-qr-code";
import Button from "../../../UI/Button";
const generateKeyPair = async () => {
const privateKey = ed.utils.randomPrivateKey();