Skip to content

Instantly share code, notes, and snippets.

View gregfromstl's full-sized avatar
💻

greg gregfromstl

💻
View GitHub Profile
@gregfromstl
gregfromstl / address.ts
Created March 8, 2025 00:10
Checksum Address Hono
import { z } from "@hono/zod-openapi";
import { Address as ox__Address } from "ox";
export const AddressSchema = z
.string()
.refine((address) => ox__Address.validate(address), {
message: "Must be a valid Ethereum address",
})
.transform((address) => ox__Address.checksum(address));
export type Address = z.infer<typeof AddressSchema>;
@gregfromstl
gregfromstl / tranformJsonResponse.ts
Created February 3, 2025 05:02
Hono middleware for strinfigying BigInt types in responses
import { createMiddleware } from "hono/factory";
import type {
InvalidJSONValue,
JSONValue,
SimplifyDeepArray,
} from "hono/utils/types";
export const transformJsonResponse = createMiddleware(async (ctx, next) => {
const originalJson = ctx.json.bind(ctx);
type JsonFn = (
@gregfromstl
gregfromstl / data.json
Last active March 13, 2025 22:58
thirdweb sdk typedoc
This file has been truncated, but you can view the full file.
{
"meta": {
"typedocBetterJsonVersion": "0.9.4"
},
"functions": [
{
"kind": "function",
"name": "fromProvider",
"signatures": [
@gregfromstl
gregfromstl / CustomConnectButton.tsx
Last active September 26, 2024 16:32
Wagmi + Thirdweb ConnectButton
'use client';
import React from "react";
import {
Connector,
createConnector,
useConfig,
} from "wagmi";
import {
ConnectButton,
} from "thirdweb/react";
@gregfromstl
gregfromstl / registerFidAndSigner.ts
Created May 2, 2024 01:00
Register a Farcaster FID and Signer
import { createThirdwebClient, simulateTransaction } from "thirdweb";
import { sendAndConfirmTransaction } from "thirdweb/transaction";
import { privateKeyToAccount } from "thirdweb/wallets";
import {
createEd25519Keypair,
registerFidAndSigner,
} from "thirdweb/extensions/farcaster";
import { optimism } from "thirdweb/chains";
const ANVIL_PRIVATE_KEY_A =
@gregfromstl
gregfromstl / update-metadata.ts
Created May 1, 2024 06:56
Bulk update token metadata
import {
createThirdwebClient,
type Address,
getContract,
prepareContractCall,
sendAndConfirmTransaction,
} from "thirdweb";
import { privateKeyToAccount } from "thirdweb/wallets";
import { upload } from "thirdweb/storage";
import { sepolia } from "thirdweb/chains";