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

polymarket-ctf-sdk

v0.0.3

Published

Interacting with Polymarket Conditional Tokens Framework

Readme

Polymarket CTF SDK

⚠️ Warning: This is NOT an official Polymarket repository.

A JavaScript/TypeScript SDK for interacting with the Polymarket Conditional Tokens Framework (CTF), supporting split and merge operations through proxy wallets.

Features

  • 🔄 Split Operations: Split USDC into "Yes" and "No" outcome tokens
  • 🔗 Merge Operations: Merge "Yes" and "No" outcome tokens back to USDC
  • 🛡️ Proxy Wallet Support: Secure transactions through proxy wallet factory
  • Negative Risk Market Support: Special handling for negative risk markets
  • 🔧 TypeScript Support: Complete type definitions

Installation

npm install polymarket-ctf-sdk

Quick Start

Import SDK

import { split, merge } from 'polymarket-ctf-sdk';

Split Operation

Split operation divides USDC into equal amounts of "Yes" and "No" outcome tokens.

import { split } from 'polymarket-ctf-sdk';

// Split 1 USDC into equal amounts of "Yes" and "No" tokens
await split({
    splitAmount: "1",           // Amount of USDC to split
    conditionId: "0x8bf53bab21d7dfcd8f6c311c6f78d41678475e9184b6f16f5bbd5a9da3b1508b", // Market condition ID
    negRisk: false,             // Whether it's a negative risk market
    rpcUrl: "https://polygon-rpc.com", // RPC node URL
    privateKey: "your-private-key",    // Wallet private key
    gasPrice: 30000000000       // Gas price (optional, default 30 gwei)
});

Parameter Description:

  • splitAmount: Amount of USDC to split (string format)
  • conditionId: Market condition ID, can be obtained from Polymarket market page
  • negRisk: Whether it's a negative risk market, check market details to determine
  • rpcUrl: Blockchain network RPC node URL
  • privateKey: Wallet private key
  • gasPrice: Gas price (optional, default 30 gwei)

Merge Operation

Merge operation combines "Yes" and "No" outcome tokens back to USDC.

import { merge } from 'polymarket-ctf-sdk';

// Merge 0.5 "Yes" and 0.5 "No" tokens to get 1 USDC
await merge({
    mergeAmount: "1",           // Amount of tokens to merge (corresponds to final USDC amount)
    conditionId: "0x8bf53bab21d7dfcd8f6c311c6f78d41678475e9184b6f16f5bbd5a9da3b1508b", // Market condition ID
    negRisk: false,             // Whether it's a negative risk market
    rpcUrl: "https://polygon-rpc.com", // RPC node URL
    privateKey: "your-private-key",    // Wallet private key
    gasPrice: 30000000000       // Gas price (optional, default 30 gwei)
});

Parameter Description:

  • mergeAmount: Amount of tokens to merge, corresponding to final USDC amount
  • conditionId: Market condition ID
  • negRisk: Whether it's a negative risk market
  • rpcUrl: Blockchain network RPC node URL
  • privateKey: Wallet private key
  • gasPrice: Gas price (optional, default 30 gwei)

Negative Risk Market Example

// For negative risk markets, set negRisk to true
await split({
    splitAmount: "1",
    conditionId: "your-condition-id",
    negRisk: true,  // Negative risk market
    rpcUrl: "https://polygon-rpc.com",
    privateKey: "your-private-key"
});

Important Notes

How to Determine the negRisk Parameter

  1. Visit the Polymarket API to view market details, for example: https://clob.polymarket.com/markets/0x8bf53bab21d7dfcd8f6c311c6f78d41678475e9184b6f16f5bbd5a9da3b1508b
  2. Check market details to confirm if it's a negative risk market
  3. Set the negRisk parameter based on market type

How to Get My Private Key

  1. Log in to Polymarket via email
  2. Export private key from user settings page

Account Funding

You can fund your account with USDC through the website interface

Funding Gas (Matic)

Since this directly interacts with contracts, using SDK methods requires gas consumption Methods to fund Matic:

  1. Import private key into wallet app (e.g., Metamask)
  2. Transfer Matic to this wallet

License

MIT License

Support

If you encounter issues during use, please check the example code or submit an issue.