@skate-org/amm-contracts-binding
v1.0.0
Published
TypeScript bindings for Skate AMM contracts
Readme
@skate-org/amm-contracts-binding
TypeScript bindings for Skate AMM contracts - providing type-safe access to ABIs and function selectors.
Features
- ✅ Type-safe ABIs - All contract ABIs exported as TypeScript constants with proper typing
- ✅ Function Selectors - Enums for all contract function selectors
- ✅ Dual Build - ESM and CJS support via tsup
- ✅ Auto-generated - Automatically generated from contract artifacts
- ✅ Tree-shakeable - Import only what you need
- ✅ Source Maps - Full source map support for debugging
Installation
npm install @skate-org/amm-contracts-binding
# or
yarn add @skate-org/amm-contracts-binding
# or
pnpm add @skate-org/amm-contracts-bindingUsage
Importing ABIs
import { KernelManagerABI, PeripheryPoolABI } from '@skate-org/amm-contracts-binding';
// Use with viem
import { createPublicClient, http } from 'viem';
const client = createPublicClient({
transport: http(),
});
const data = await client.readContract({
address: '0x...',
abi: KernelManagerABI,
functionName: 'getPool',
args: [token0, token1, fee],
});Importing Selectors
import {
KernelManagerSelectors,
KernelManagerSelectorsMap
} from '@skate-org/amm-contracts-binding';
// Use enum values
const selector = KernelManagerSelectors.createPool;
console.log(selector); // '0x...'
// Use selector map for signature lookups
const sig = 'createPool(address,address,uint24)';
const selector2 = KernelManagerSelectorsMap[sig];
console.log(selector2); // '0x...'Importing Everything
import { ABIs, Selectors } from '@skate-org/amm-contracts-binding';
// Access all ABIs
const kernelManagerABI = ABIs.KernelManager;
const peripheryPoolABI = ABIs.PeripheryPool;
// Access all selectors
const kernelSelectors = Selectors.KernelManager;
const peripherySelectors = Selectors.PeripheryPool;Available Contracts
AMM Contracts
Kernel:
KernelManager/KernelManagerABI/KernelManagerSelectorsKernelPool/KernelPoolABI/KernelPoolSelectorsKernelEventEmitter/KernelEventEmitterABI/KernelEventEmitterSelectorsKernelManagerStorage/KernelManagerStorageABI/KernelManagerStorageSelectors
Periphery:
PeripheryManager/PeripheryManagerABI/PeripheryManagerSelectorsPeripheryPool/PeripheryPoolABI/PeripheryPoolSelectorsPeripheryEventEmitter/PeripheryEventEmitterABI/PeripheryEventEmitterSelectors
Interfaces:
- All kernel and periphery interfaces (
IKernelManager,IPeripheryPool, etc.)
Skate Contracts
Kernel:
AccountRegistry/AccountRegistryABI/AccountRegistrySelectorsMessageBox/MessageBoxABI/MessageBoxSelectorsSkateApp/SkateAppABI/SkateAppSelectors
Periphery:
SkateGateway/SkateGatewayABI/SkateGatewaySelectorsSkateAppPeriphery/SkateAppPeripheryABI/SkateAppPeripherySelectorsActionBox/ActionBoxABI/ActionBoxSelectors
Common:
ExecutorRegistry/ExecutorRegistryABI/ExecutorRegistrySelectorsMulticall/MulticallABI/MulticallSelectors
Development
Regenerate Bindings
# From the package directory (packages/ts-binding)
npm run generate
# or
make generate
# From the root repository
make gen-all
cd packages/ts-binding && make generateBuild
npm run build
# or
make buildClean
npm run clean
# or
make cleanAvailable Make Commands
Run make help to see all available commands:
make install- Install dependenciesmake generate- Generate TypeScript from ABIs/selectorsmake build- Build the packagemake clean- Clean generated filesmake check- Verify generated files are up-to-datemake all- Clean, install, generate, and build
Package Structure
dist/
├── index.js # ESM build
├── index.cjs # CommonJS build
├── index.d.ts # TypeScript declarations (ESM)
├── index.d.cts # TypeScript declarations (CJS)
└── *.map # Source mapsTypeScript Support
This package is built with TypeScript and includes full type definitions. ABIs are typed as const assertions, providing maximum type safety.
import { KernelManagerABI } from '@skate-org/amm-contracts-binding';
// The ABI type is inferred from the const assertion
type KernelManagerABIType = typeof KernelManagerABI;License
MIT
Publishing
Prerequisites
- NPM Account: You need an npm account with publish access to
@skate-org - Authentication: Login to npm (only needed once per machine)
npm loginPublishing Workflow
# 1. Update version in package.json
# Follow semantic versioning: major.minor.patch
# 2. Generate and build
make build
# 3. Test the package locally (dry run)
npm run publish:dry
# or
make publish-dry
# 4. Publish to npm
npm run publish:release
# or
make publishAutomated Publishing (CI/CD)
For CI/CD pipelines, set the NPM_TOKEN environment variable:
# GitHub Actions example
- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}Contributing
This package is auto-generated from the contract artifacts. To update:
- Update the contracts in the main repository
- Run
make gen-allto regenerate ABIs and selectors - Run
npm run buildin this package to rebuild bindings - Commit the generated files
