@sfpro/sdk
Version:
TypeScript SDK for Superfluid Protocol - stream money every second
71 lines (63 loc) • 3.14 kB
text/typescript
import { http, type Transport, fallback } from "viem";
import {
type Chain as Chain_,
arbitrum,
avalanche,
avalancheFuji,
base,
baseSepolia,
bsc,
celo,
degen,
gnosis,
mainnet,
optimism,
optimismSepolia,
polygon,
scroll,
scrollSepolia,
sepolia,
} from "viem/chains";
type Chain = Omit<Chain_, "fees" | "formatters">;
export const superfluidMainnets: readonly [
Chain & { id: (typeof base)["id"] },
Chain & { id: (typeof arbitrum)["id"] },
Chain & { id: (typeof avalanche)["id"] },
Chain & { id: (typeof bsc)["id"] },
Chain & { id: (typeof celo)["id"] },
Chain & { id: (typeof degen)["id"] },
Chain & { id: (typeof gnosis)["id"] },
Chain & { id: (typeof mainnet)["id"] },
Chain & { id: (typeof optimism)["id"] },
Chain & { id: (typeof polygon)["id"] },
Chain & { id: (typeof scroll)["id"] },
] = [base, arbitrum, avalanche, bsc, celo, degen, gnosis, mainnet, optimism, polygon, scroll];
type MainnetChainId = (typeof superfluidMainnets)[number]["id"];
export const superfluidTestnets: readonly [
Chain & { id: (typeof baseSepolia)["id"] },
Chain & { id: (typeof avalancheFuji)["id"] },
Chain & { id: (typeof optimismSepolia)["id"] },
Chain & { id: (typeof scrollSepolia)["id"] },
Chain & { id: (typeof sepolia)["id"] },
] = [baseSepolia, avalancheFuji, optimismSepolia, scrollSepolia, sepolia] as const;
type TestnetChainId = (typeof superfluidTestnets)[number]["id"];
export const superfluidMainnetTransports = {
[]: fallback([http(), http("https://rpc-endpoints.superfluid.dev/base-mainnet")]),
[]: fallback([http(), http("https://rpc-endpoints.superfluid.dev/arbitrum-one")]),
[]: fallback([http(), http("https://rpc-endpoints.superfluid.dev/avalanche-c")]),
[]: fallback([http(), http("https://rpc-endpoints.superfluid.dev/bsc-mainnet")]),
[]: fallback([http(), http("https://rpc-endpoints.superfluid.dev/celo-mainnet")]),
[]: fallback([http(), http("https://rpc-endpoints.superfluid.dev/degenchain")]),
[]: fallback([http(), http("https://rpc-endpoints.superfluid.dev/xdai-mainnet")]),
[]: fallback([http(), http("https://rpc-endpoints.superfluid.dev/eth-mainnet")]),
[]: fallback([http(), http("https://rpc-endpoints.superfluid.dev/optimism-mainnet")]),
[]: fallback([http(), http("https://rpc-endpoints.superfluid.dev/polygon-mainnet")]),
[]: fallback([http(), http("https://rpc-endpoints.superfluid.dev/scroll-mainnet")]),
} as const satisfies Record<MainnetChainId, Transport>;
export const superfluidTestnetTransports = {
[]: fallback([http(), http("https://rpc-endpoints.superfluid.dev/base-sepolia")]),
[]: fallback([http(), http("https://rpc-endpoints.superfluid.dev/avalanche-fuji")]),
[]: fallback([http(), http("https://rpc-endpoints.superfluid.dev/optimism-sepolia")]),
[]: fallback([http(), http("https://rpc-endpoints.superfluid.dev/scroll-sepolia")]),
[]: fallback([http(), http("https://rpc-endpoints.superfluid.dev/eth-sepolia")]),
} as const satisfies Record<TestnetChainId, Transport>;