alchemy-sdk-patterns

Featured

Apply production-ready Alchemy SDK patterns for Web3 applications. Use when building reusable blockchain clients, implementing caching, multi-chain abstractions, or type-safe contract interactions. Trigger: "alchemy SDK patterns", "alchemy best practices", "alchemy code patterns".

AI & Automation 2,926 stars 433 forks Updated yesterday MIT

Install

View on GitHub

Quality Score: 99/100

Stars 20%
100
Recency 20%
100
Frontmatter 20%
70
Documentation 15%
100
Issue Health 10%
50
License 10%
100
Description 5%
100

Skill Content

# Alchemy SDK Patterns ## Overview Production patterns for the `alchemy-sdk` package: singleton clients, multi-chain factories, response caching, and type-safe contract wrappers. ## Instructions ### Step 1: Multi-Chain Client Factory ```typescript // src/alchemy/client-factory.ts import { Alchemy, Network } from 'alchemy-sdk'; type ChainName = 'ethereum' | 'polygon' | 'arbitrum' | 'optimism' | 'base'; const NETWORK_MAP: Record<ChainName, Network> = { ethereum: Network.ETH_MAINNET, polygon: Network.MATIC_MAINNET, arbitrum: Network.ARB_MAINNET, optimism: Network.OPT_MAINNET, base: Network.BASE_MAINNET, }; class AlchemyClientFactory { private static clients = new Map<string, Alchemy>(); static getClient(chain: ChainName): Alchemy { if (!this.clients.has(chain)) { this.clients.set(chain, new Alchemy({ apiKey: process.env.ALCHEMY_API_KEY, network: NETWORK_MAP[chain], maxRetries: 3, })); } return this.clients.get(chain)!; } static getAllClients(): Map<ChainName, Alchemy> { for (const chain of Object.keys(NETWORK_MAP) as ChainName[]) { this.getClient(chain); } return this.clients as Map<ChainName, Alchemy>; } } export { AlchemyClientFactory, ChainName }; ``` ### Step 2: Response Caching Layer ```typescript // src/alchemy/cache.ts interface CacheEntry<T> { data: T; expiresAt: number; } class AlchemyCache { private cache = new Map<string, CacheEntry<any>>(); private defaultTtlMs: nu...

Details

Author
jeremylongshore
Repository
jeremylongshore/claude-code-plugins-plus-skills
Created
1 years ago
Last Updated
yesterday
Language
Python
License
MIT

Integrates with

Bundled in these plugins

Similar Skills

Semantically similar based on skill content — not just same category