@eyettea/powfi-sdk
v0.0.1-rc.16
Published
Typescript SDK for Alephium Powfi
Downloads
420
Maintainers
Readme
Powfi SDK (@eyettea/powfi-sdk)
TypeScript SDK for Powfi on Alephium. This package provides high-level modules for CPMM, CLMM, staking, and token operations, and re-exports generated contract artifacts/deployments.
Scope
Powfientrypoint for network/provider/signer configurationpowfi.cpmmfor constant-product liquidity poolspowfi.clmmfor concentrated-liquidity poolspowfi.stakingfor xALPH staking flowspowfi.tokenfor token metadata helpers- Re-exported contract types and deployment loaders from
clmm,cpmm, andstaking
Installation
For SDK consumers:
npm install @eyettea/powfi-sdkFor monorepo development:
bun installQuick Start
import { Powfi, CpmmModule } from '@eyettea/powfi-sdk';
const powfi = Powfi.load({ networkId: 'testnet' });
const poolState = await powfi.cpmm.getPoolState(tokenAId, tokenBId);
const quote = CpmmModule.computeSwapAmount({
state: poolState,
tokenInId: tokenAId,
tokenOutId: tokenBId,
amountIn: 1_000_000n,
slippageBps: 50n,
});CLMM simulation example:
const simulation = await powfi.clmm.simulateSwap({
configIndex: 0n,
token0,
token1,
zeroForOne: true,
amount: 1_000_000n,
});For write operations (swap, add/remove liquidity, staking), pass a signer when loading the SDK:
const powfi = Powfi.load({ networkId: 'testnet', signer });Development Commands
Run inside packages/sdk:
bun run build
bun run test
bun run typecheck
bun run lint
bun run format:checkArtifact Packaging
bun run build runs copy-artifacts before bundling. It copies:
../clmm/artifactsand../clmm/deployments../cpmm/artifactsand../cpmm/deployments../staking/artifactsand../staking/deployments
into this package so the published SDK includes contract bindings and deployment metadata.
If contracts changed, rebuild contract artifacts first:
bun run compile
bun run build:sdk