Skip to main content

Polymarket (EVM)

1

Create the SDK instance

import { PredexonSDK, createViemAdapter } from '@predexon/trade-sdk';

// walletClient is a viem WalletClient — see Wallet Adapters for full setup
const wallet = createViemAdapter(walletClient);
const walletAddress = await wallet.account.getAddress();

const sdk = new PredexonSDK({
  apiKey: process.env.PREDEXON_API_KEY!,
  wallet,
});
2

Enable trading (one-time setup)

await sdk.enableTrading({
  core: { venue: 'polymarket', wallet: walletAddress },
  approvals: 'broadcast', // or 'sign' if wallet supports signTransaction
});
If you omit approvals, the SDK auto-selects based on your wallet’s capabilities. See Wallet Adapters for details.
3

Place a market order

const result = await sdk.placeOrder({
  core: {
    venue: 'polymarket',
    wallet: walletAddress,
    side: 'buy',
    amount: '10', // $10 USDC
    type: 'market',
  },
  flags: { tokenId: 'your-token-id' },
});

console.log('Order placed:', result.orderId, result.status);
Get tokenId from the markets list endpoint. Each market has two tokenIds (Yes/No outcomes).

Kalshi (Solana)

1

Create the SDK with Solana adapter

import { PredexonSDK, createSolanaAdapter } from '@predexon/trade-sdk';

// See Wallet Adapters for full Solana signing setup
const solanaSigner = createSolanaAdapter({
  signSolanaTransaction: async (base64Tx) => { /* sign and return base64 */ },
  signSolanaMessage: async (message) => { /* sign and return base64 */ },
});
const walletAddress = 'your-solana-wallet-address';

const sdk = new PredexonSDK({
  apiKey: process.env.PREDEXON_API_KEY!,
  solanaSigner,
});
2

Enable trading (wallet registration)

await sdk.enableTrading({
  core: { venue: 'kalshi', wallet: walletAddress },
});
3

Place a market order

const result = await sdk.placeOrder({
  core: {
    venue: 'kalshi',
    wallet: walletAddress,
    side: 'buy',
    amount: '10', // $10 USDC
    type: 'market',
  },
  flags: { ticker: 'TICKER-SYMBOL', outcome: 'Yes' },
});

console.log('Order placed:', result.orderId, result.status);
Get ticker from the Kalshi markets endpoint.

Next Steps