MCPcopy Create free account

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

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

↓ 9 callersMethodensureBuilderCode
* Validate that a V2 builder code is available before any order placement * path. Pulled into a helper so each order entry-point fails fast with th
src/services/trading-service.ts:663
↓ 9 callersFunctionfmtTime
(ms: number)
scripts/test-copy-trading-full-e2e.ts:96
↓ 9 callersFunctiongetArg
(name: string, defaultValue?: string)
scripts/arb/token-rebalancer.ts:57
↓ 9 callersMethodgetCredentials
()
src/services/trading-service.ts:2310
↓ 9 callersMethodgetGasOptions
* Get gas options for Polygon network using EIP-1559 * * Polygon requires higher priority fees than default ethers.js estimates. * Uses minim
src/clients/ctf-client.ts:1367
↓ 9 callersMethodgetWatchedOrders
* Get all watched orders
src/services/order-manager.ts:1159
↓ 9 callersMethodinvokeHandlers
(event: HandleEvent, ...args: any[])
src/services/order-manager.ts:675
↓ 9 callersFunctionlogFail
(step: string, msg: string)
scripts/e2e-builder-test.ts:99
↓ 9 callersFunctionmakeService
()
src/__tests__/unit/v2-relayer-token-routing.test.ts:74
↓ 9 callersFunctionreadBuilderCodeOptional
()
src/constants/builder-config.ts:53
↓ 9 callersMethodrequest
( method: string, path: string, options: { params?: Record<string, string | number | boolean
src/signal/signal-service.ts:55
↓ 9 callersMethodsplit
* Split USDC into YES + NO tokens * Transaction is automatically tracked via on-chain events
src/services/ctf-manager.ts:277
↓ 9 callersMethodstart
* Initialize OrderManager * - Initializes TradingService * - Optionally initializes RealtimeService (for WebSocket mode) * - Optionally initi
src/services/order-manager.ts:756
↓ 9 callersMethodstop
* Stop OrderManager * - Unwatch all orders * - Disconnect WebSocket (if connected)
src/services/order-manager.ts:777
↓ 9 callersFunctionvalidatePrice
( price: number, tickSize: TickSize )
src/utils/price-utils.ts:74
↓ 8 callersMethodcheckAllowances
* Check all ERC20 and ERC1155 allowances required for trading * * @returns Status of all allowances and whether trading is ready
src/services/onchain-service.ts:219
↓ 8 callersMethodensureInitialized
()
src/services/market-service.ts:209
↓ 8 callersFunctionfetchAndAnalyze
(name: string, url: string, extractFirst = true)
scripts/verify/verify-all-apis.ts:39
↓ 8 callersFunctionfetchJson
(url: string)
scripts/api-verification/04-prices-history-vs-trades.ts:34
↓ 8 callersMethodgetOpenOrders
(marketId?: string)
src/services/trading-service.ts:1912
↓ 8 callersMethodgetSafeAddress
* Get the deterministic Safe address for this EOA (without deploying) * * Uses the same CREATE2 derivation as the Relayer to compute the Safe ad
src/services/relayer-service.ts:193
↓ 8 callersMethodgetTokenDecimals
* Get token decimals
src/services/swap-service.ts:211
↓ 8 callersMethodgetTrades
* Get recent trades * * @param params - Query parameters (P2: user, side, takerOnly, etc.) * * @example * ```typescript * // Get mar
src/clients/data-api.ts:656
↓ 8 callersFunctionmakeService
()
src/__tests__/unit/v2-relayer-wrap.test.ts:78
↓ 8 callersMethodmarkDetected
(name: string, details?: string)
scripts/benchmark/copy-trade-detection-latency.ts:164
↓ 8 callersMethodmergeByTokenIds
* Merge YES and NO tokens using explicit token IDs * * Supports both standard CTF and NegRisk markets. * For NegRisk: uses NegRisk Adapter (s
src/services/onchain-service.ts:297
↓ 8 callersFunctionprintSeparator
(title: string)
scripts/api-verification/04-prices-history-vs-trades.ts:48
↓ 8 callersFunctionquery
(endpoint: string, q: string)
scripts/archive/api-verification-history/08-subgraph-explore.ts:14
↓ 8 callersFunctionrunTest
(name: string, testFn: () => Promise<void>)
scripts/ordermanager/full-e2e.ts:57
↓ 8 callersMethodsetStatus
(status: ConnectionStatus)
src/realtime/realtime-data-client.ts:893
↓ 8 callersMethodsubscribeUserEvents
* Subscribe to user order and trade events * * User channel requires a separate WebSocket endpoint (USER endpoint). * Subscription format: {
src/services/realtime-service-v2.ts:926
↓ 8 callersFunctiontestEndpoint
(name: string, endpoint: string, testQuery: string)
scripts/archive/api-verification-history/10-subgraph-official.ts:64
↓ 7 callersFunctioncategorizeMarket
(title: string)
src/smart-money/constants.ts:39
↓ 7 callersFunctioncheckArbitrage
( yesAsk: number, noAsk: number, yesBid: number, noBid: number )
src/utils/price-utils.ts:231
↓ 7 callersMethodfetchJson
(path: string, options: RequestInit = {})
src/insider-scan/insider-scan-service.ts:152
↓ 7 callersFunctionformatUSDC
(amount: number)
src/utils/price-utils.ts:278
↓ 7 callersMethodgetActiveSubscriptions
* Get all active subscriptions
src/services/realtime-service-v2.ts:1262
↓ 7 callersMethodgetAddress
()
src/services/trading-service.ts:2302
↓ 7 callersMethodgetKLinesOHLCV
* Get OHLCV K-Line candles for a market (single token). * * Aggregates raw trade data into OHLCV candles. For lightweight * price charts from
src/services/market-service.ts:764
↓ 7 callersFunctionmakeService
()
src/__tests__/unit/v2-authorization.test.ts:118
↓ 7 callersFunctionmakeService
(overrides: { builderCode?: string } = {})
src/__tests__/unit/v2-trading-service-init.test.ts:22
↓ 7 callersFunctionmapInternalStatusToApi
(status: OrderStatus)
src/core/order-status.ts:131
↓ 7 callersMethodresolveMarketTokens
* Resolve market tokens from CLOB API * * This method fetches the actual token IDs from the CLOB API, * which are different from the calculat
src/services/market-service.ts:310
↓ 7 callersMethodtestGetEffectivePrices
* Run a test case for getEffectivePrices()
scripts/arb-tests/01-unit-tests.ts:40
↓ 7 callersMethodupdateBalance
()
src/services/arbitrage-service.ts:1350
↓ 6 callersMethodaddHandler
(event: HandleEvent, handler: (...args: any[]) => void)
src/services/order-manager.ts:668
↓ 6 callersMethodcreateLeg1Signal
( side: DipArbSide, price: number, oppositeAsk: number, source: 'dip' | 'surge' | 'mispricing'
src/services/dip-arb-service.ts:1290
↓ 6 callersFunctioncreateMockOrder
(overrides?: Partial<Order>)
src/services/order-handle.test.ts:50
↓ 6 callersMethodensureInitialized
()
src/services/order-manager.ts:1695
↓ 6 callersFunctionformatTimestamp
(ts: number)
scripts/ordermanager/test-market-order-lifecycle.ts:48
↓ 6 callersMethodgetGasOptions
* Get dynamic gas options for Polygon network * Uses RPC fee data with minimum priority fee of 30 gwei
src/services/swap-service.ts:171
↓ 6 callersMethodgetGasPrice
* Get current gas price info
src/clients/ctf-client.ts:1000
↓ 6 callersMethodgetLeaderboard
* Get leaderboard by time period.
src/smart-money/core.ts:48
↓ 6 callersMethodgetOrSet
(key: string, ttlMs: number, factory: () => Promise<T>)
src/core/unified-cache.ts:29
↓ 6 callersMethodgetPositionBalanceByTokenIds
* Get token balances using CLOB API token IDs * * This is the recommended method for checking balances when working with * Polymarket CLOB ma
src/services/onchain-service.ts:368
↓ 6 callersMethodgetSupportedAssets
* Get all supported assets for bridge deposits * * @returns Array of supported assets with their chain/token details * * @example * ```
src/clients/bridge-client.ts:247
↓ 6 callersMethodgetTickSize
* Get tick size for a token
src/services/trading-service.ts:1067
↓ 6 callersMethodhandleMempoolMessage
(data: Buffer)
src/smart-money/monitor.ts:262
↓ 6 callersFunctionlog
(msg: string)
scripts/real-time-service/test-5m-orderbook-pairing.ts:21
↓ 6 callersFunctionlogSeparator
(title?: string)
examples/12-trending-arb-monitor.ts:67
↓ 6 callersFunctionlogTest
(name: string)
scripts/arb-tests/03-e2e-tests.ts:81
↓ 6 callersMethodnormalizeTimestamp
* Normalize timestamp to milliseconds * Polymarket WebSocket returns timestamps in seconds, need to convert to milliseconds
src/services/realtime-service-v2.ts:1918
↓ 6 callersMethodobserveMarketAck
* Record first inbound market event for a tokenId — confirms WS sub ack. * Logs latency once, then removes the token from pendingSubAck so subseque
src/services/realtime-service-v2.ts:731
↓ 6 callersFunctionrunTest
( name: string, capitalUsed: number, testFn: () => Promise<number> )
scripts/ordermanager/minimal-loop-test.ts:53
↓ 6 callersFunctionsaveCurrentLog
(suffix?: string)
scripts/dip-arb/auto-trade.ts:125
↓ 6 callersFunctionsub
(title: string)
scripts/api-verification/07-verify-sdk-klines-methods.ts:59
↓ 6 callersFunctiontestEndpoint
(name: string, endpoint: string, testQuery: string)
scripts/archive/api-verification-history/09-subgraph-correct.ts:34
↓ 6 callersMethodvalidateSignalProfitability
(signal: DipArbLeg1Signal)
src/services/dip-arb-service.ts:1382
↓ 5 callersFunctionbuildV1Calldata
()
src/__tests__/unit/v2-calldata-decoder.test.ts:61
↓ 5 callersMethodcancelOrder
(orderId: string)
src/services/trading-service.ts:1838
↓ 5 callersFunctiondecodeMatchOrdersCalldataV1
( data: string )
src/utils/calldata-decoder.ts:236
↓ 5 callersFunctiondelay
(ms: number)
scripts/ordermanager/bug24-tokenid-test.ts:87
↓ 5 callersFunctionexploreSubgraph
(name: string, endpoint: string)
scripts/archive/api-verification-history/10-subgraph-official.ts:81
↓ 5 callersMethodfetchJson
(path: string)
src/catalyst/catalyst-query-service.ts:160
↓ 5 callersFunctionformatPrice
(price: number, tickSize?: TickSize)
src/utils/price-utils.ts:270
↓ 5 callersMethodgetAddress
* Get the wallet address
src/services/onchain-service.ts:178
↓ 5 callersFunctiongetArgValue
(name: string, defaultVal: number)
scripts/dip-arb/auto-trade.ts:50
↓ 5 callersFunctiongetEffectivePrices
( yesAsk: number, yesBid: number, noAsk: number, noBid: number )
src/utils/price-utils.ts:189
↓ 5 callersMethodgetMarketResolution
* Check if a market is resolved and get payout info
src/services/onchain-service.ts:435
↓ 5 callersMethodgetPositionBalance
* Get token balances for a market using calculated position IDs * * NOTE: This method calculates position IDs from conditionId, which may not ma
src/clients/ctf-client.ts:846
↓ 5 callersFunctiongetSchemaFields
(endpoint: string, typeName: string)
scripts/archive/api-verification-history/10-subgraph-official.ts:40
↓ 5 callersMethodgetTrades
(marketId?: string)
src/services/trading-service.ts:1986
↓ 5 callersMethodgetUserPeriodPnl
* Get a specific user's PnL and ranking for a time period * * Uses the official Data API's user filter to get a single user's stats. * * @
src/services/wallet-service.ts:592
↓ 5 callersMethodinitialize
* 初始化 Privy 客户端 * 需要动态导入 @privy-io/server-auth
src/wallets/privy-wallet.ts:109
↓ 5 callersFunctionisDipArbLeg1Signal
(signal: DipArbSignal)
src/services/dip-arb-types.ts:700
↓ 5 callersMethodisNegRisk
* Check if token is neg risk
src/services/trading-service.ts:1081
↓ 5 callersFunctionisValidStatusTransition
(from: OrderStatus, to: OrderStatus)
src/core/order-status.ts:275
↓ 5 callersFunctionmakeMempoolMessage
(tx: { to: string; input: string; hash?: string; })
src/__tests__/unit/v2-smart-money-monitor-filter.test.ts:113
↓ 5 callersMethodonFilled
Called when the order is fully filled
src/services/order-manager.ts:411
↓ 5 callersFunctionprintSeparator
(title: string)
scripts/api-verification/05-prices-history-deep-test.ts:36
↓ 5 callersMethodresolveTerminal
(status: 'filled' | 'cancelled' | 'rejected' | 'expired', reason?: string)
src/services/order-manager.ts:647
↓ 5 callersMethodscanMarkets
* Scan markets for arbitrage opportunities * * @param criteria Filter criteria for markets * @param minProfit Minimum profit threshold (defau
src/services/arbitrage-service.ts:1621
↓ 5 callersMethodseedClobClientMarketMetadata
( tokenId: string, metadata: { tickSize?: TickSize; negRisk?: boolean }, )
src/services/trading-service.ts:932
↓ 5 callersMethodsendTransaction
* 发送链上交易 * * 使用 Privy Delegated Actions 签名并广播交易 * * @param tx - 交易请求 * @returns 交易结果
src/wallets/privy-wallet.ts:139
↓ 5 callersFunctionsleep
(ms: number)
scripts/test-copy-trading-full-e2e.ts:95
↓ 5 callersFunctionsleep
(ms: number)
scripts/arb/token-rebalancer.ts:417
↓ 5 callersFunctionsummarizePricePoints
(label: string, points: PricePoint[])
scripts/api-verification/07-verify-sdk-klines-methods.ts:63
↓ 5 callersMethodunwatchOrder
* Stop watching an order
src/services/order-manager.ts:1143
↓ 5 callersFunctionvalidateSize
( size: number, minOrderSize = 0.1 )
src/utils/price-utils.ts:104
↓ 5 callersMethodwatch
* Start polling for a list of addresses. * Returns a cleanup function.
src/smart-money/copy.ts:43
← previousnext →101–200 of 1,210, ranked by callers