@slicekit/abi
v0.1.0
Published
Slice protocol ABIs, typed contract configs, and canonical onchain deployment facts
Readme
@slicekit/abi
Slice protocol ABIs, typed contract configs, and canonical onchain deployment facts. This package is the single source of truth for "what is deployed where": every other Slice package derives addresses, chain support, and hook metadata from it instead of hardcoding them.
Installation
npm install @slicekit/abi viemviem is the only peer dependency.
Entry Points
@slicekit/abi: viem-compatible ABI constants plus typed onchain input models.@slicekit/abi/deployments: deployment facts generated from canonical JSON inputs — supported chain ids and guards, per-chain contract addresses and configs, token addresses, and hook manifests.
Usage
Read a contract with an ABI and its canonical address:
import { productsModuleAbi } from "@slicekit/abi"
import { getProductsModuleAddress } from "@slicekit/abi/deployments"
import { createPublicClient, http } from "viem"
import { base } from "viem/chains"
const client = createPublicClient({ chain: base, transport: http() })
await client.readContract({
abi: productsModuleAbi,
address: getProductsModuleAddress(base.id),
functionName: "productExists",
args: [123n, 1n]
})Or use a prebuilt config (ABI plus default-chain address) with wagmi-style APIs:
import { productsModuleConfig } from "@slicekit/abi/deployments"
await client.readContract({
...productsModuleConfig,
functionName: "productExists",
args: [123n, 1n]
})Guard chain support before touching the chain:
import {
assertSliceCheckoutChainId,
isSupportedSliceChainId
} from "@slicekit/abi/deployments"
isSupportedSliceChainId(chainId) // boolean
assertSliceCheckoutChainId(chainId) // throws on unsupported checkout chainsAvailable ABIs
sliceCoreAbi, slicerAbi, slicerManagerAbi, productsModuleAbi,
fundsModuleAbi, price and action interfaces (productPriceAbi,
productActionAbi, registry variants), and the AggregatorV3Interface price
feed ABI.
Deployment Facts
@slicekit/abi/deployments also exposes token addresses
(getSliceTokenAddress), price feeds (getPriceFeedAddress), chain
resolution (resolveSliceChainId, sliceDevelopmentChainIds), and the hook
manifest (getSliceHookContractInfo, isSliceHookAddress) for
Slice-registered hook contracts.
Generation
Both surfaces are generated, never hand-edited: ABIs via bun generate
(wagmi CLI) and deployment facts via bun generate:deployments from the JSON
inputs in deployments/. A check mode (bun generate:deployments:check)
keeps the generated sources in sync in CI.
