@skate-org/amm-svm-v2
v2.0.0-beta.24
Published
Skate AMM v2 SDK — Solana + Eclipse periphery (readers, instruction builders, submitters)
Downloads
1,192
Readme
@skate-org/amm-svm-v2
Solana + Eclipse periphery surface for the Skate AMM v2 SDK. Purely
functional — readers, instruction builders, submitters — plus the
env-bound AmmSvm class for convenience.
Surface
Connection
getSolanaConnection({ chain, mode, transport? })—@solana/web3.jsConnection factory; resolves RPC fromDevModeConfig.rpcEndpoints→DEFAULT_SVM_RPC→ throw.
Readers
readPeripheryPool({ chain, kernelPool, mode, client? })→PeripheryPoolState(kernel linkage, manager, tokens, fee, staged amounts).readUserPoolBalances({ user, poolKey, chain, mode, client? })→UserPoolBalances.
Builders → Promise<TransactionInstruction[]>
buildSwap(params)buildMint(params)buildBurn(params)buildIncreaseLiquidity(params)buildDecreaseLiquidity(params)
All builder params objects include a mode field.
Submitters → Promise<TransactionSignature> (build + sign + broadcast)
submitSwap(wallet, params)—paramsincludesmodesubmitMint(wallet, params)—paramsincludesmodesubmitBurn(wallet, params)—paramsincludesmodesubmitIncreaseLiquidity(wallet, params)—paramsincludesmodesubmitDecreaseLiquidity(wallet, params)—paramsincludesmode
Wallet must be Anchor's Wallet (Keypair-backed). Browser adapters
should call the builder + sign manually with wallet.signTransaction
connection.sendRawTransaction.
SkateAmm class (headline entry point)
One object that composes AmmCore (pool catalog), AmmApi (quotes +
actions), and AmmSvm (build/submit/read). Expose escape hatches via
.core, .api, .vm.
const amm = new SkateAmm("PRODUCTION");
// Quotes
const quote = await amm.quote.swap({ poolKey: "USDC_USDT", ... });
const ranges = await amm.quote.boostedRange();
// Actions
const action = await amm.actions.get({ srcChain: CHAIN.SOLANA, srcHash: "..." });
await amm.actions.waitForExecuted({ srcChain: CHAIN.SOLANA, srcHash: "..." });
// Build + submit
const ixs = await amm.buildSwap({ poolKey: "USDC_USDT", chain: CHAIN.SOLANA, ... });
const sig = await amm.submitSwap(wallet, { poolKey: "USDC_USDT", chain: CHAIN.SOLANA, ... });
// Pool catalog
const keys = amm.pools.keys();
const info = amm.pools.byKey("USDC_USDT");
// SVM extra
const conn = amm.getSolanaConnection({ chain: CHAIN.SOLANA });AmmSvm class (env-bound)
Construct once with a fixed env; all methods accept the same params
as above but without the mode field (injected automatically).
const svm = new AmmSvm("PRODUCTION");
const conn = svm.getSolanaConnection({ chain: CHAIN.SOLANA });
const pool = await svm.readPeripheryPool({ chain: CHAIN.SOLANA, kernelPool: "0x..." });
const ixs = await svm.buildSwap({ poolKey: "USDC_USDT", chain: CHAIN.SOLANA, ... });
const sig = await svm.submitSwap(wallet, { poolKey: "USDC_USDT", chain: CHAIN.SOLANA, ... });Helpers
swapAmountNormalized(n: number) → bigint(NORMALIZED_DECIMALS = 6)swapAmountNative(n: number, decimals: number) → bigintvalidateRecipientBytes32,validateSqrtPrice,validateTickRange,validateDeadline
Errors
SvmReadError,SvmWriteError— both extendSdkError.
Install
pnpm add @skate-org/amm-svm-v2 @skate-org/amm-core-v2Peer deps: @solana/web3.js ^1.98, @coral-xyz/anchor ^0.30,
@solana/spl-token ^0.4.
Use via the umbrella
The umbrella @skate-org/amm-v2 namespaces the SVM surface to avoid
collisions with the EVM package:
import { svm } from "@skate-org/amm-v2";
const ixs = await svm.buildSwap({ ... });Direct package imports keep the unprefixed names:
import { buildSwap } from "@skate-org/amm-svm-v2";
const ixs = await buildSwap({ ... });Status
Solana is live on mainnet since 2026-05-15 (usdc-usdt-1bps pool).
STAGING + PRODUCTION alias DEV as of 2.0.0-beta.10.
Eclipse has no deployment yet — POOL_INFO_Dev[*].peripheryInfo[CHAIN.ECLIPSE]
is undefined. Calls with chain = CHAIN.ECLIPSE throw
SvmReadError/SvmWriteError("no SVM deployment registered for chain 902 in DEV").
See docs/superpowers/specs/2026-05-04-svm-sui-integration-design.md
for the design.
