@0xslots/contracts
v0.7.1
Published
Contract ABIs and addresses for 0xSlots protocol
Readme
@0xslots/contracts
Contract ABIs and addresses for the 0xSlots protocol.
Installation
npm install @0xslots/contracts viem
# or
pnpm add @0xslots/contracts viem
# or
yarn add @0xslots/contracts viemUsage
Import everything
import {
slotsAbi,
slotsHubAbi,
slotsHubAddress,
getSlotsHubAddress,
} from "@0xslots/contracts";Import specific modules
import { slotsAbi, slotsHubAbi } from "@0xslots/contracts/abis";
import { slotsHubAddress, getSlotsHubAddress } from "@0xslots/contracts/addresses";Use with viem
import { createPublicClient, http } from "viem";
import { baseSepolia } from "viem/chains";
import { slotsHubAbi, getSlotsHubAddress } from "@0xslots/contracts";
const client = createPublicClient({
chain: baseSepolia,
transport: http(),
});
const hubAddress = getSlotsHubAddress(baseSepolia.id);
if (hubAddress) {
const data = await client.readContract({
address: hubAddress,
abi: slotsHubAbi,
functionName: "...",
});
}Check if deployed on a chain
import { isSlotsHubDeployed, getSupportedChainIds } from "@0xslots/contracts";
if (isSlotsHubDeployed(84532)) {
console.log("SlotsHub is deployed on Base Sepolia");
}
const supportedChains = getSupportedChainIds();
console.log("Supported chains:", supportedChains);Exports
ABIs
slotsAbi- ABI for individual Slots contractsslotsHubAbi- ABI for the SlotsHub contract
Addresses
slotsHubAddress- Object mapping chain IDs to SlotsHub addressesgetSlotsHubAddress(chainId)- Get SlotsHub address for a chainisSlotsHubDeployed(chainId)- Check if SlotsHub is deployed on a chaingetSupportedChainIds()- Get all supported chain IDs
Types
SupportedChainId- Union type of supported chain IDs
Supported Networks
- Base Sepolia (84532):
0x268cfaB9ddDdF6A326458Ae79d55592516f382eF
License
MIT
