Skip to content

Conversation

@waleedlatif1
Copy link
Collaborator

Summary

  • updated kalshi and polymarket tools and blocks

Type of Change

  • Bug fix

Testing

Tested manually

Checklist

  • Code follows project style guidelines
  • Self-reviewed my changes
  • Tests added/updated and passing
  • No new warnings introduced
  • I confirm that I have read and agree to the terms outlined in the Contributor License Agreement (CLA)

@vercel
Copy link

vercel bot commented Jan 27, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
docs Ready Ready Preview, Comment Jan 27, 2026 4:54am

Request Review

@greptile-apps
Copy link
Contributor

greptile-apps bot commented Jan 27, 2026

Greptile Overview

Greptile Summary

This PR updates the Kalshi and Polymarket prediction market integrations with enhanced API coverage and improved data structures.

Kalshi Updates:

  • Added V2 variants of all 17 Kalshi tools that provide complete API response structures instead of simplified outputs
  • V2 tools include additional parameters like countFp (fractional contracts), cancelOrderOnPause, and subaccount support
  • Updated block configuration to use versioned tool selector pattern, defaulting to V2 tools
  • V1 tools remain available for backward compatibility

Polymarket Updates:

  • Added 3 new tools: get_activity (on-chain user activity), get_leaderboard (platform rankings), and get_holders (market holder information)
  • Enhanced existing tools (get_positions, get_trades) with richer data including user profiles, transaction hashes, and detailed PnL metrics
  • Updated type definitions to match current Polymarket Data API structure
  • Added comprehensive block UI configurations for new operations

Documentation:

  • Updated both Kalshi and Polymarket documentation with detailed field descriptions
  • Changed Kalshi docs to reference kalshi_v2 block type

All tools follow established patterns for authentication (user-only visibility for API keys), error handling, and response transformation. The changes maintain backward compatibility by keeping V1 Kalshi tools alongside V2 variants.

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk
  • All changes follow established patterns for tool implementation with proper TypeScript types, error handling, and authentication. V2 Kalshi tools maintain backward compatibility. New Polymarket tools match API specifications. No breaking changes detected.
  • No files require special attention

Important Files Changed

Filename Overview
apps/sim/tools/kalshi/create_order.ts Added V2 tool variant with enhanced response structure and additional parameters (countFp, cancelOrderOnPause, subaccount)
apps/sim/tools/kalshi/index.ts Updated exports to include V2 variants of all Kalshi tools alongside existing V1 tools
apps/sim/tools/polymarket/get_activity.ts New tool for retrieving user on-chain activity including trades, splits, merges, redemptions, and rewards
apps/sim/tools/polymarket/get_leaderboard.ts New tool for retrieving Polymarket leaderboard with filtering by category, time period, and user
apps/sim/tools/polymarket/get_holders.ts New tool for retrieving market holder information with balance thresholds
apps/sim/tools/polymarket/types.ts Updated type definitions with enhanced fields for tags, orderbook, positions, trades, and new types for activity, leaderboard, holders, and profiles
apps/sim/blocks/blocks/kalshi.ts Updated block configuration to use versioned tool selector pattern with V2 as default for all operations
apps/sim/blocks/blocks/polymarket.ts Added support for new operations (activity, leaderboard, holders) with comprehensive UI configurations and parameter mappings
apps/sim/tools/registry.ts Registered all new V2 Kalshi tools and new Polymarket tools (activity, leaderboard, holders)

Sequence Diagram

sequenceDiagram
    participant User
    participant Block as Kalshi/Polymarket Block
    participant Registry as Tool Registry
    participant Tool as Tool (V1/V2)
    participant API as External API

    Note over User,API: Kalshi V2 Tool Flow
    User->>Block: Select operation & provide params
    Block->>Registry: Request kalshi_*_v2 tool
    Registry->>Tool: Load V2 tool config
    Tool->>Tool: Build auth headers (RSA signature)
    Tool->>API: POST/GET with authentication
    API-->>Tool: Full API response
    Tool->>Tool: Transform to structured output
    Tool-->>Block: Return enhanced data
    Block-->>User: Display results

    Note over User,API: Polymarket New Tools Flow
    User->>Block: Select activity/leaderboard/holders
    Block->>Registry: Request polymarket_get_* tool
    Registry->>Tool: Load tool config
    Tool->>Tool: Build query parameters
    Tool->>API: GET request to Data API
    API-->>Tool: JSON response
    Tool->>Tool: Map to TypeScript types
    Tool-->>Block: Return typed data
    Block-->>User: Display results
Loading

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No files reviewed, no comments

Edit Code Review Agent Settings | Greptile

@waleedlatif1 waleedlatif1 merged commit 077e702 into staging Jan 27, 2026
12 checks passed
@waleedlatif1 waleedlatif1 deleted the improvement/kalshi branch January 27, 2026 05:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants