npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@dimes-fi/multiply-sdk

v0.4.2

Published

TypeScript SDK for the Dimes Multiply leverage protocol on prediction markets

Readme

@dimes-fi/multiply-sdk

npm version License: MIT TypeScript

TypeScript SDK for the Dimes Multiply leverage protocol. Multiply is an embedded leverage layer for prediction markets — it lets traders take leveraged positions on market outcomes across platforms like Polymarket and Kalshi.

Installation

npm install @dimes-fi/multiply-sdk
# or
pnpm add @dimes-fi/multiply-sdk
# or
yarn add @dimes-fi/multiply-sdk

Quick Start

import { MultiplyClient } from "@dimes-fi/multiply-sdk";

const client = new MultiplyClient({
  apiKey: process.env.DIMES_API_KEY,
});

// Browse prediction markets with leverage
const { data: markets } = await client.getMarkets({
  platform: "polymarket",
  status: "active",
  minLeverage: 3,
});

// Open a 5x leveraged long position
const { position } = await client.createPosition({
  marketId: markets[0].id,
  outcomeId: markets[0].outcomes[0].id,
  side: "long",
  collateralUsdc: 100,
  leverage: 5,
});

console.log(`Opened ${position.leverage}x position — notional: $${position.notionalUsdc}`);

API Reference

new MultiplyClient(config)

| Parameter | Type | Default | Description | |-----------|------|---------|-------------| | apiKey | string | required | API key from app.dimes.fi/developers | | baseUrl | string | https://api.dimes.fi/v1 | API base URL | | chainId | number | 137 | Chain ID (Polygon) | | timeout | number | 30000 | Request timeout in ms |

Markets

client.getMarkets(filter?)

List available prediction markets. Returns PaginatedResponse<Market>.

const { data, total, hasMore } = await client.getMarkets({
  platform: "polymarket",  // Filter by platform
  status: "active",        // "active" | "paused" | "resolved" | "expired"
  minLiquidity: 10_000,    // Minimum USDC liquidity
  minLeverage: 2,          // Minimum leverage available
  query: "election",       // Search query
  limit: 50,               // Results per page (max 200)
  offset: 0,               // Pagination offset
});

client.getMarket(marketId)

Get a single market by ID. Returns Market.

client.getLeverage(marketId)

Get leverage tiers, margin requirements, and funding rates for a market. Returns LeverageInfo.

const info = await client.getLeverage("market_abc123");
console.log(`Max leverage: ${info.maxLeverage}x`);
console.log(`Funding rate: ${info.fundingRateAnnualized}%`);

for (const tier of info.tiers) {
  console.log(`${tier.leverage}x — margin: ${tier.initialMargin * 100}%`);
}

Positions

client.createPosition(params)

Open a leveraged position. Returns PositionResult with the position and transaction hash.

const { position, transaction } = await client.createPosition({
  marketId: "market_abc123",
  outcomeId: "outcome_yes",
  side: "long",           // "long" | "short"
  collateralUsdc: 100,    // Collateral in USDC
  leverage: 5,            // Leverage multiplier
  maxSlippage: 0.01,      // 1% slippage tolerance
});

client.getPosition(positionId)

Get position details including current PnL. Returns Position.

client.getPositions(status?)

List all positions. Optionally filter by "open", "closed", or "liquidated".

client.closePosition(params)

Close a position fully or partially. Returns PositionResult.

// Close 50% of a position
await client.closePosition({
  positionId: "pos_xyz789",
  fraction: 0.5,
  maxSlippage: 0.01,
});

Account

client.getAccount()

Get account summary. Returns Account with balance, locked collateral, unrealized PnL, and health factor.

Types

All types are exported for use in your application:

import type {
  Market,
  Position,
  LeverageInfo,
  LeverageTier,
  CreatePositionParams,
  Account,
} from "@dimes-fi/multiply-sdk";

Examples

See the examples/ directory:

Error Handling

The SDK throws MultiplyApiError for non-2xx responses:

import { MultiplyApiError } from "@dimes-fi/multiply-sdk";

try {
  await client.createPosition(params);
} catch (err) {
  if (err instanceof MultiplyApiError) {
    console.error(`API error ${err.statusCode}: ${err.body}`);
  }
}

Links

License

MIT