MCPcopy Create free account

hub / github.com/cyl19970726/poly-sdk / functions

Functions1,210 in github.com/cyl19970726/poly-sdk

↓ 5 callersMethodwrapUsdcToPUSD
* Wrap USDC.e → pUSD via the V2 Collateral Onramp (gasless, 1:1, no fee). * * V2 trade settlement uses pUSD as collateral. Each Safe must wrap i
src/services/relayer-service.ts:349
↓ 4 callersMethodapproveAll
* Set up all required approvals for trading * * @returns Results of all approval transactions
src/services/onchain-service.ts:228
↓ 4 callersFunctionbuildV2Calldata
()
src/__tests__/unit/v2-smart-money-monitor-filter.test.ts:81
↓ 4 callersFunctionbuildV2Calldata
()
src/__tests__/unit/v2-calldata-decoder.test.ts:94
↓ 4 callersFunctioncalculateDipArbProfitRate
(totalCost: number)
src/services/dip-arb-types.ts:638
↓ 4 callersFunctioncalculateOrderProgress
(originalSize: number, filledSize: number)
src/core/order-status.ts:254
↓ 4 callersMethodcheckPool
* Check if a pool exists for a token pair
src/services/swap-service.ts:219
↓ 4 callersMethodcreateBatchOrders
* Create multiple orders in batch * Auto-watches all successfully created orders
src/services/order-manager.ts:1000
↓ 4 callersFunctiondebug
(message: string)
scripts/real-time-service/test-realtime-15m.ts:76
↓ 4 callersFunctiondecodeMatchOrdersCalldataV2
( data: string )
src/utils/calldata-decoder.ts:261
↓ 4 callersFunctiondelay
(ms: number)
scripts/ctfmanager/full-e2e.ts:60
↓ 4 callersFunctiondelay
(ms: number)
scripts/ordermanager/balanced-test.ts:46
↓ 4 callersFunctiondepositUsdc
( signer: ethers.Wallet, amount: number, options: DepositOptions = {} )
src/clients/bridge-client.ts:748
↓ 4 callersFunctionfetchJson
(url: string)
scripts/api-verification/05-prices-history-deep-test.ts:22
↓ 4 callersFunctionformatTimestamp
(ts: number)
scripts/verify-user-events.ts:27
↓ 4 callersFunctiongetBookPrices
Get orderbook bid/ask for a token via CLOB REST API
scripts/e2e-builder-test.ts:107
↓ 4 callersMethodgetCurrentRewards
()
src/services/trading-service.ts:2038
↓ 4 callersMethodgetDepositStatus
* Get deposit status for a deposit address * * Check the status of deposits made to a specific deposit address. * Returns all transactions as
src/clients/bridge-client.ts:388
↓ 4 callersFunctiongetExplorerUrl
(chainId: number, txHash: string)
src/clients/bridge-client.ts:1039
↓ 4 callersMethodgetLatestDeposit
* Get the latest deposit transaction for a deposit address * * @param depositAddress - The deposit address * @returns The most recent deposit
src/clients/bridge-client.ts:399
↓ 4 callersMethodgetLeaderboardByPeriod
* Get leaderboard by time period using official Polymarket API * * Uses the official Data API which supports time period filtering. * This is
src/services/wallet-service.ts:437
↓ 4 callersMethodgetMarketResolution
* Check if a market is resolved and get payout info
src/clients/ctf-client.ts:912
↓ 4 callersMethodgetPricesHistory
* Get price history for a token
src/services/market-service.ts:452
↓ 4 callersMethodgetResults
()
scripts/benchmark/copy-trade-detection-latency.ts:178
↓ 4 callersMethodgetSplits
* 获取用户的 Split 事件
src/clients/subgraph.ts:331
↓ 4 callersMethodgetStatusDescription
* Get a human-readable description of a deposit status * * @param status - The deposit status * @returns Human-readable description
src/clients/bridge-client.ts:509
↓ 4 callersMethodgetWalletIdentity
()
src/services/trading-service.ts:703
↓ 4 callersMethodgetWalletPositions
* Get positions for a wallet
src/services/wallet-service.ts:301
↓ 4 callersMethodisConnected
Check if connected
src/realtime/types.ts:563
↓ 4 callersFunctionisTerminalStatus
(status: OrderStatus)
src/core/order-status.ts:184
↓ 4 callersFunctionprintSummary
()
scripts/arb-tests/03-e2e-tests.ts:97
↓ 4 callersMethodquickScan
* Quick scan for best arbitrage opportunities * * @param minProfit Minimum profit threshold (default: 0.005 = 0.5%) * @param limit Maximum nu
src/services/arbitrage-service.ts:1797
↓ 4 callersMethodreadLastClobPostTelemetry
()
src/services/trading-service.ts:777
↓ 4 callersMethodredeemByTokenIds
* Redeem winning tokens using Polymarket token IDs (Polymarket CLOB) * * This is the correct method for Polymarket CLOB markets. * Supports d
src/services/onchain-service.ts:328
↓ 4 callersFunctionroundSize
(size: number)
src/utils/price-utils.ts:63
↓ 4 callersFunctionrpcCall
(url: string, method: string, params: any[])
scripts/benchmark/rpc-latency.ts:45
↓ 4 callersFunctionrunScenario
( name: string, description: string, orderFn: () => Promise<{ orderId: string | null; orderType: s
scripts/ordermanager/bug20-deep-analysis.ts:367
↓ 4 callersFunctionrunTest
(name: string, testFn: () => Promise<void>)
scripts/ordermanager/balanced-test.ts:50
↓ 4 callersFunctionrunTokenIdTest
( orderMgr: OrderManager, testName: string, params: { tokenId: string; tokenType: 'YES' | 'NO';
scripts/ordermanager/bug24-tokenid-test.ts:100
↓ 4 callersMethodsearchMarkets
* Search markets
src/services/market-service.ts:1381
↓ 4 callersMethodsendSubscription
(msg: { subscriptions: Array<{ topic: string; type: string; filters?: string; clob_auth?: ClobApiKeyCreds }> }
src/services/realtime-service-v2.ts:1861
↓ 4 callersMethodsendUnsubscription
(msg: { subscriptions: Array<{ topic: string; type: string; filters?: string }> }, subId?: string)
src/services/realtime-service-v2.ts:1877
↓ 4 callersFunctionseparator
(title: string)
scripts/api-verification/07-verify-sdk-klines-methods.ts:53
↓ 4 callersFunctionsleep
(ms: number)
scripts/e2e-builder-test.ts:102
↓ 4 callersMethodstart
* Start monitoring a market
src/services/dip-arb-service.ts:295
↓ 4 callersMethodstop
* Stop monitoring
src/services/dip-arb-service.ts:433
↓ 4 callersMethodsubscribe
@deprecated Use subscribeMarket or subscribeUser instead
src/realtime/types.ts:545
↓ 4 callersFunctionsummarizeCandles
(label: string, candles: KLineCandle[])
scripts/api-verification/07-verify-sdk-klines-methods.ts:79
↓ 4 callersFunctiontestDataTrades
* Test 2: /data/trades 行为
scripts/api-verification/04-prices-history-vs-trades.ts:114
↓ 4 callersMethodtransfer
* Transfer an ERC20 token to another address
src/services/swap-service.ts:822
↓ 4 callersMethodupdateBalanceAllowance
( assetType: 'COLLATERAL' | 'CONDITIONAL', tokenId?: string )
src/services/trading-service.ts:2285
↓ 3 callersMethodaggregateToKLines
* Aggregate trades into K-Line candles * * Note: Polymarket API may return timestamps in seconds or milliseconds. * This function normalizes
src/services/market-service.ts:1138
↓ 3 callersMethodapproveUsdc
* Approve a collateral token for CTF / Onramp / Offramp operations. * * V2 default is `pUSD` (the trading collateral). Pass `'USDC.e'` for *
src/services/relayer-service.ts:287
↓ 3 callersMethodbuildPieChart
( name: string, items: Array<{ title: string; value: number }> )
src/smart-money/reports.ts:644
↓ 3 callersFunctionbuyCycle
( orderMgr: OrderManager, cycleNum: number, tokenId: string, side: 'Up' | 'Down' )
scripts/ordermanager/smart-cycle-test.ts:62
↓ 3 callersFunctioncalculateBuyAmount
(price: number, size: number)
src/utils/price-utils.ts:125
↓ 3 callersFunctioncalculatePnL
( entryPrice: number, currentPrice: number, size: number, side: 'long' | 'short' = 'long' )
src/utils/price-utils.ts:290
↓ 3 callersMethodcalculateRebalanceAction
* Calculate recommended rebalance action based on current state
src/services/arbitrage-service.ts:613
↓ 3 callersFunctioncalculateSharesForAmount
( amount: number, price: number )
src/utils/price-utils.ts:147
↓ 3 callersFunctioncanOrderBeCancelled
(status: OrderStatus)
src/core/order-status.ts:237
↓ 3 callersMethodcancel
Cancel the order. Returns true if cancellation succeeded.
src/services/order-manager.ts:420
↓ 3 callersMethodcheckAllowances
* Check all V2 ERC20 and ERC1155 allowances required for trading. * * Reads pUSD balance + per-spender allowances on both pUSD and USDC.e, and
src/services/authorization-service.ts:184
↓ 3 callersMethodcleanup
()
src/realtime/realtime-data-client.ts:888
↓ 3 callersMethodclearPongTimeout
()
src/realtime/realtime-data-client.ts:817
↓ 3 callersMethodclearPositions
* Clear all positions in a market using the best strategy * * Strategy: * - Active market: Merge paired tokens → Sell remaining unpaired toke
src/services/arbitrage-service.ts:914
↓ 3 callersMethodcreate
* Create and initialize SDK in one call * * @example * ```typescript * const sdk = await PolymarketSDK.create({ privateKey: '...' }); *
src/index.ts:713
↓ 3 callersFunctiondelay
(ms: number)
scripts/ctfmanager/cycle-test.ts:68
↓ 3 callersMethoddetectArbitrage
* Detect arbitrage opportunity * * 使用有效价格计算套利机会(正确考虑镜像订单) * 详细文档见: docs/01-polymarket-orderbook-arbitrage.md
src/index.ts:824
↓ 3 callersFunctionestimateBridgeOutput
(amount: number, tokenSymbol: string)
src/clients/bridge-client.ts:1017
↓ 3 callersMethodexecuteWithWallet
* 使用用户钱包执行操作 * * 私钥仅在回调执行期间存在于内存中,执行完毕后立即清除。 * * @param userId - 用户 ID * @param callback - 使用钱包执行的操作 * @returns 回调的返回值
src/wallets/hot-wallet-service.ts:188
↓ 3 callersFunctionextractTraderAddresses
(decoded: DecodedMatchOrders)
src/utils/calldata-decoder.ts:327
↓ 3 callersMethodfetch
(path: string, options: RequestInit = {})
src/clients/bridge-client.ts:673
↓ 3 callersMethodfindNearestPrice
* Find the nearest available price for a timestamp
src/services/market-service.ts:1046
↓ 3 callersMethodfindNextMarket
()
src/services/dip-arb-service.ts:1999
↓ 3 callersFunctionformatTimestamp
(ts: number)
scripts/api-verification/05-prices-history-deep-test.ts:18
↓ 3 callersMethodfromGammaMarket
(gamma: GammaMarket)
src/services/market-service.ts:1819
↓ 3 callersFunctiongetArg
(name: string, defaultValue: string)
scripts/ordermanager/bug20-deep-analysis.ts:55
↓ 3 callersMethodgetClosedPositions
* Get closed positions for a wallet address * * @param address - Wallet address * @param params - Query parameters * * @example * ``
src/clients/data-api.ts:495
↓ 3 callersMethodgetDualKLinesOHLCV
* Get dual OHLCV K-Lines (YES + NO tokens) from trade data. * * Aggregates raw trade data into dual OHLCV candles with spread analysis * and
src/services/market-service.ts:835
↓ 3 callersMethodgetEarningsForDay
(date: string)
src/services/trading-service.ts:2023
↓ 3 callersMethodgetGasPrice
* Get current gas price info
src/services/onchain-service.ts:458
↓ 3 callersMethodgetGlobalOpenInterest
* 获取全局 Open Interest
src/clients/subgraph.ts:437
↓ 3 callersMethodgetKLines
* Get K-lines (candlestick data) for a symbol * * @param symbol - Trading pair (BTCUSDT, ETHUSDT, SOLUSDT) * @param interval - K-line interva
src/services/binance-service.ts:119
↓ 3 callersMethodgetMakerFills
* 获取用户作为 maker 的成交事件
src/clients/subgraph.ts:471
↓ 3 callersMethodgetMarket
* Get market by slug or condition ID
src/services/market-service.ts:522
↓ 3 callersMethodgetOrder
* Get a single order by ID * * @param orderId - Order ID (hash) * @returns Order details or null if not found
src/services/trading-service.ts:1794
↓ 3 callersMethodgetOrderFilledEvents
* 获取订单成交事件
src/clients/subgraph.ts:453
↓ 3 callersMethodgetOrderbook
* Get processed orderbook with analytics (alias for getProcessedOrderbook)
src/services/market-service.ts:1329
↓ 3 callersMethodgetPrice
* Get current price for a symbol * * @param symbol - Trading pair (BTCUSDT, ETHUSDT, SOLUSDT) * @returns Current price * * @example
src/services/binance-service.ts:164
↓ 3 callersMethodgetSmartMoneyList
* Get list of Smart Money wallets from leaderboard.
src/smart-money/core.ts:91
↓ 3 callersMethodgetTokenBalances
* Get all token balances
src/services/onchain-service.ts:193
↓ 3 callersMethodgetTokenOrderbook
* Get orderbook for a single token
src/services/market-service.ts:349
↓ 3 callersMethodgetTradesByMarket
* Get trades for a specific market
src/clients/data-api.ts:706
↓ 3 callersMethodgetWalletAddress
Get wallet address by user ID
src/wallets/hot-wallet-service.ts:52
↓ 3 callersMethodgetWalletProfile
* Get comprehensive wallet profile with PnL analysis
src/services/wallet-service.ts:243
↓ 3 callersMethodhandleDeadConnection
()
src/realtime/realtime-data-client.ts:824
↓ 3 callersMethodinvalidate
(pattern: string)
src/core/unified-cache.ts:30
↓ 3 callersMethodisCacheValid
()
src/smart-money/core.ts:152
↓ 3 callersMethodisInitialized
()
src/services/trading-service.ts:2314
↓ 3 callersMethodlogAlways
* Log unconditionally (bypasses this.config.debug gate). * Used for observability events that must always be visible: subscribe-sent, * subscrib
src/services/realtime-service-v2.ts:780
← previousnext →201–300 of 1,210, ranked by callers