@dripzfi/sdk
v0.3.0
Published
TypeScript SDK for Dripz -- a Solana time-weighted Liquidity Bootstrapping Pool framework. Curve math, simulator, and weight trajectory utilities for the five Dripz curves (Linear / Exponential / Step / Dutch Auction / Fair Discovery).
Downloads
484
Maintainers
Readme
@dripzfi/sdk
TypeScript SDK for Dripz -- a Solana time-weighted Liquidity Bootstrapping Pool framework. Ships the curve math, weight-trajectory helpers, and a deterministic simulator that mirrors the on-chain program.
npm install @dripzfi/sdk decimal.jsWhat's included
| Module | Exports |
| --- | --- |
| curves/linear | linearWeight(config, elapsedSecs) |
| curves/exponential | exponentialWeight(config, elapsedSecs) |
| curves/step | stepWeight(config, elapsedSecs) |
| curves/dutch | dutchWeight(config, elapsedSecs), dutchPriceAt(config, elapsedSecs) |
| curves/fair | fairWeight(config, elapsedSecs, realizedBuyPressure) |
| spot-price | weightAt(config, elapsedSecs, pressure), spotPrice(state) |
| simulator | simulateCurve(config, initialState, opts) |
| types | CurveKind, CurveConfig, PoolState, SwapResult |
Quick start
import Decimal from "decimal.js";
import { simulateCurve, type CurveConfig } from "@dripzfi/sdk";
const config: CurveConfig = {
kind: "exponential",
startWeightToken: 0.95,
endWeightToken: 0.40,
durationSecs: 5 * 86_400,
exponentialK: 3.5,
};
const steps = simulateCurve(
config,
{
balanceToken: new Decimal(1_000_000),
balanceQuote: new Decimal(100_000),
startTimestampSecs: 0,
swapFeeBps: 30,
},
{ intervalSecs: 3_600 }
);
console.log("samples:", steps.length);
console.log("final spot price:", steps.at(-1)?.spotPrice.toFixed(6));Curve kinds
linear-- weight glides at a constant rate fromstartWeightTokentoendWeightToken.exponential-- weight decays on anexp(-k * t)schedule.exponentialKcontrols steepness.step-- discrete plateaus declared viasteps[]; the curve holds each plateau until the next breakpoint.dutch-- weight schedule pinned to a target spot price, descending fromdutchPriceMaxtodutchPriceMin.fair-- demand-aware: the realized buy pressure feeds back into the trajectory, smoothing late demand spikes.
Notes
- Math runs through
decimal.jsso precision matches the on-chainu64arithmetic. - The SDK does not submit transactions. Pair it with
@solana/web3.js/@coral-xyz/anchorand the open-source IDL indripz-labs/dripz. dripz-cliships the same math behind a terminal-friendly interface.
License
MIT. See LICENSE.
