@kashdao/protocol-sdk is the direct-to-chain TypeScript SDK for
Kash. Its @kashdao/protocol-sdk/solana entry point talks straight to
the Kash market program on Solana mainnet-beta: no ZeroID backend and no
REST API in the trade path, no ZeroID-held keys, no ZeroID-sponsored fees.
If you want a hosted, API-key-authed integration (the fastest path to a
first trade), use the REST API and
@kashdao/sdk instead. This
SDK is for builders who run their own signing infrastructure: market
makers, trading bots, AI agents and on-chain UIs.
Trust model
The package never holds keys, never sponsors fees and never contacts ZeroID-hosted infrastructure. You bring the RPC endpoint (or aConnection), the signer and the funded self-custodial wallet. It builds
TransactionInstructions for the market program, asks your signer to
sign, and sends through your RPC. ZeroID sees only what lands on chain.
Install
@solana/web3.js ^1.98, @coral-xyz/anchor
^0.32.1, @solana/spl-token ^0.4.9, bn.js ^5.2.1). Requires Node.js 22
or later.
Supported clusters
mainnet-beta is the default. getSolanaDeployment(cluster) returns the
addresses, and createSolanaClient({ cluster: { programId, usdcMint } })
targets an unlisted deployment such as a local validator.
Client surface
createSolanaClient({ connection }) (or { rpcUrl }) returns a client
with four namespaces:
The low-level instruction builders (
buyInstruction, sellInstruction,
redeemInstruction, …) and PDA derivations (kashMarketPdas) are
exported too, for composing your own transactions.
Key concepts
- Market references. A market is named by its numeric id (
12n) or its market account address. The REST API’scontractAddressfor a Solana market is that account address, so you can pass it straight tomarkets.get. - Amounts. USDC is an atomic
bigintwith 6 decimals (1_000_000n= 1 USDC). Outcome balances are a WADbigintwith 18 decimals (10n ** 18n= 1 token). - Positions are not SPL tokens. The program keeps each position as a
balance in a position account (one per market, owner and outcome).
buildBuyopens that account in the same transaction when it is missing, andclosePositionreclaims its rent once it is empty. - Slippage is mandatory. Every trade takes
maxSlippageBps(a floor derived from a fresh quote) or an explicit floor (minTokensOutWad/minAmountOutUsdc). - Signers.
keypairSigner(keypair)for bots and scripts;walletAdapterSigner(wallet)for@solana/wallet-adapter, Phantom or any self-custodial wallet exposingpublicKeyandsignTransaction. PassfeePayerto sponsor fees and rent from a second signer.
Where to next
Quickstart
Read a market, quote it, then buy, sell and redeem from a keypair.
Error handling
Typed errors, retry semantics, and what to do when a send’s outcome is unknown.
Python SDK
The same program and trust model, in Python.
Source
KashDAO/protocol-sdk-typescript on GitHub, with runnable examples.