Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/cyl19970726/poly-sdk
/ functions
Functions
1,210 in github.com/cyl19970726/poly-sdk
⨍
Functions
1,210
◇
Types & classes
510
↓ 9 callers
Method
ensureBuilderCode
* 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 callers
Function
fmtTime
(ms: number)
scripts/test-copy-trading-full-e2e.ts:96
↓ 9 callers
Function
getArg
(name: string, defaultValue?: string)
scripts/arb/token-rebalancer.ts:57
↓ 9 callers
Method
getCredentials
()
src/services/trading-service.ts:2310
↓ 9 callers
Method
getGasOptions
* 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 callers
Method
getWatchedOrders
* Get all watched orders
src/services/order-manager.ts:1159
↓ 9 callers
Method
invokeHandlers
(event: HandleEvent, ...args: any[])
src/services/order-manager.ts:675
↓ 9 callers
Function
logFail
(step: string, msg: string)
scripts/e2e-builder-test.ts:99
↓ 9 callers
Function
makeService
()
src/__tests__/unit/v2-relayer-token-routing.test.ts:74
↓ 9 callers
Function
readBuilderCodeOptional
()
src/constants/builder-config.ts:53
↓ 9 callers
Method
request
( method: string, path: string, options: { params?: Record<string, string | number | boolean
src/signal/signal-service.ts:55
↓ 9 callers
Method
split
* Split USDC into YES + NO tokens * Transaction is automatically tracked via on-chain events
src/services/ctf-manager.ts:277
↓ 9 callers
Method
start
* Initialize OrderManager * - Initializes TradingService * - Optionally initializes RealtimeService (for WebSocket mode) * - Optionally initi
src/services/order-manager.ts:756
↓ 9 callers
Method
stop
* Stop OrderManager * - Unwatch all orders * - Disconnect WebSocket (if connected)
src/services/order-manager.ts:777
↓ 9 callers
Function
validatePrice
( price: number, tickSize: TickSize )
src/utils/price-utils.ts:74
↓ 8 callers
Method
checkAllowances
* 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 callers
Method
ensureInitialized
()
src/services/market-service.ts:209
↓ 8 callers
Function
fetchAndAnalyze
(name: string, url: string, extractFirst = true)
scripts/verify/verify-all-apis.ts:39
↓ 8 callers
Function
fetchJson
(url: string)
scripts/api-verification/04-prices-history-vs-trades.ts:34
↓ 8 callers
Method
getOpenOrders
(marketId?: string)
src/services/trading-service.ts:1912
↓ 8 callers
Method
getSafeAddress
* 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 callers
Method
getTokenDecimals
* Get token decimals
src/services/swap-service.ts:211
↓ 8 callers
Method
getTrades
* Get recent trades * * @param params - Query parameters (P2: user, side, takerOnly, etc.) * * @example * ```typescript * // Get mar
src/clients/data-api.ts:656
↓ 8 callers
Function
makeService
()
src/__tests__/unit/v2-relayer-wrap.test.ts:78
↓ 8 callers
Method
markDetected
(name: string, details?: string)
scripts/benchmark/copy-trade-detection-latency.ts:164
↓ 8 callers
Method
mergeByTokenIds
* 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 callers
Function
printSeparator
(title: string)
scripts/api-verification/04-prices-history-vs-trades.ts:48
↓ 8 callers
Function
query
(endpoint: string, q: string)
scripts/archive/api-verification-history/08-subgraph-explore.ts:14
↓ 8 callers
Function
runTest
(name: string, testFn: () => Promise<void>)
scripts/ordermanager/full-e2e.ts:57
↓ 8 callers
Method
setStatus
(status: ConnectionStatus)
src/realtime/realtime-data-client.ts:893
↓ 8 callers
Method
subscribeUserEvents
* 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 callers
Function
testEndpoint
(name: string, endpoint: string, testQuery: string)
scripts/archive/api-verification-history/10-subgraph-official.ts:64
↓ 7 callers
Function
categorizeMarket
(title: string)
src/smart-money/constants.ts:39
↓ 7 callers
Function
checkArbitrage
( yesAsk: number, noAsk: number, yesBid: number, noBid: number )
src/utils/price-utils.ts:231
↓ 7 callers
Method
fetchJson
(path: string, options: RequestInit = {})
src/insider-scan/insider-scan-service.ts:152
↓ 7 callers
Function
formatUSDC
(amount: number)
src/utils/price-utils.ts:278
↓ 7 callers
Method
getActiveSubscriptions
* Get all active subscriptions
src/services/realtime-service-v2.ts:1262
↓ 7 callers
Method
getAddress
()
src/services/trading-service.ts:2302
↓ 7 callers
Method
getKLinesOHLCV
* 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 callers
Function
makeService
()
src/__tests__/unit/v2-authorization.test.ts:118
↓ 7 callers
Function
makeService
(overrides: { builderCode?: string } = {})
src/__tests__/unit/v2-trading-service-init.test.ts:22
↓ 7 callers
Function
mapInternalStatusToApi
(status: OrderStatus)
src/core/order-status.ts:131
↓ 7 callers
Method
resolveMarketTokens
* 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 callers
Method
testGetEffectivePrices
* Run a test case for getEffectivePrices()
scripts/arb-tests/01-unit-tests.ts:40
↓ 7 callers
Method
updateBalance
()
src/services/arbitrage-service.ts:1350
↓ 6 callers
Method
addHandler
(event: HandleEvent, handler: (...args: any[]) => void)
src/services/order-manager.ts:668
↓ 6 callers
Method
createLeg1Signal
( side: DipArbSide, price: number, oppositeAsk: number, source: 'dip' | 'surge' | 'mispricing'
src/services/dip-arb-service.ts:1290
↓ 6 callers
Function
createMockOrder
(overrides?: Partial<Order>)
src/services/order-handle.test.ts:50
↓ 6 callers
Method
ensureInitialized
()
src/services/order-manager.ts:1695
↓ 6 callers
Function
formatTimestamp
(ts: number)
scripts/ordermanager/test-market-order-lifecycle.ts:48
↓ 6 callers
Method
getGasOptions
* 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 callers
Method
getGasPrice
* Get current gas price info
src/clients/ctf-client.ts:1000
↓ 6 callers
Method
getLeaderboard
* Get leaderboard by time period.
src/smart-money/core.ts:48
↓ 6 callers
Method
getOrSet
(key: string, ttlMs: number, factory: () => Promise<T>)
src/core/unified-cache.ts:29
↓ 6 callers
Method
getPositionBalanceByTokenIds
* 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 callers
Method
getSupportedAssets
* 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 callers
Method
getTickSize
* Get tick size for a token
src/services/trading-service.ts:1067
↓ 6 callers
Method
handleMempoolMessage
(data: Buffer)
src/smart-money/monitor.ts:262
↓ 6 callers
Function
log
(msg: string)
scripts/real-time-service/test-5m-orderbook-pairing.ts:21
↓ 6 callers
Function
logSeparator
(title?: string)
examples/12-trending-arb-monitor.ts:67
↓ 6 callers
Function
logTest
(name: string)
scripts/arb-tests/03-e2e-tests.ts:81
↓ 6 callers
Method
normalizeTimestamp
* Normalize timestamp to milliseconds * Polymarket WebSocket returns timestamps in seconds, need to convert to milliseconds
src/services/realtime-service-v2.ts:1918
↓ 6 callers
Method
observeMarketAck
* 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 callers
Function
runTest
( name: string, capitalUsed: number, testFn: () => Promise<number> )
scripts/ordermanager/minimal-loop-test.ts:53
↓ 6 callers
Function
saveCurrentLog
(suffix?: string)
scripts/dip-arb/auto-trade.ts:125
↓ 6 callers
Function
sub
(title: string)
scripts/api-verification/07-verify-sdk-klines-methods.ts:59
↓ 6 callers
Function
testEndpoint
(name: string, endpoint: string, testQuery: string)
scripts/archive/api-verification-history/09-subgraph-correct.ts:34
↓ 6 callers
Method
validateSignalProfitability
(signal: DipArbLeg1Signal)
src/services/dip-arb-service.ts:1382
↓ 5 callers
Function
buildV1Calldata
()
src/__tests__/unit/v2-calldata-decoder.test.ts:61
↓ 5 callers
Method
cancelOrder
(orderId: string)
src/services/trading-service.ts:1838
↓ 5 callers
Function
decodeMatchOrdersCalldataV1
( data: string )
src/utils/calldata-decoder.ts:236
↓ 5 callers
Function
delay
(ms: number)
scripts/ordermanager/bug24-tokenid-test.ts:87
↓ 5 callers
Function
exploreSubgraph
(name: string, endpoint: string)
scripts/archive/api-verification-history/10-subgraph-official.ts:81
↓ 5 callers
Method
fetchJson
(path: string)
src/catalyst/catalyst-query-service.ts:160
↓ 5 callers
Function
formatPrice
(price: number, tickSize?: TickSize)
src/utils/price-utils.ts:270
↓ 5 callers
Method
getAddress
* Get the wallet address
src/services/onchain-service.ts:178
↓ 5 callers
Function
getArgValue
(name: string, defaultVal: number)
scripts/dip-arb/auto-trade.ts:50
↓ 5 callers
Function
getEffectivePrices
( yesAsk: number, yesBid: number, noAsk: number, noBid: number )
src/utils/price-utils.ts:189
↓ 5 callers
Method
getMarketResolution
* Check if a market is resolved and get payout info
src/services/onchain-service.ts:435
↓ 5 callers
Method
getPositionBalance
* 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 callers
Function
getSchemaFields
(endpoint: string, typeName: string)
scripts/archive/api-verification-history/10-subgraph-official.ts:40
↓ 5 callers
Method
getTrades
(marketId?: string)
src/services/trading-service.ts:1986
↓ 5 callers
Method
getUserPeriodPnl
* 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 callers
Method
initialize
* 初始化 Privy 客户端 * 需要动态导入 @privy-io/server-auth
src/wallets/privy-wallet.ts:109
↓ 5 callers
Function
isDipArbLeg1Signal
(signal: DipArbSignal)
src/services/dip-arb-types.ts:700
↓ 5 callers
Method
isNegRisk
* Check if token is neg risk
src/services/trading-service.ts:1081
↓ 5 callers
Function
isValidStatusTransition
(from: OrderStatus, to: OrderStatus)
src/core/order-status.ts:275
↓ 5 callers
Function
makeMempoolMessage
(tx: { to: string; input: string; hash?: string; })
src/__tests__/unit/v2-smart-money-monitor-filter.test.ts:113
↓ 5 callers
Method
onFilled
Called when the order is fully filled
src/services/order-manager.ts:411
↓ 5 callers
Function
printSeparator
(title: string)
scripts/api-verification/05-prices-history-deep-test.ts:36
↓ 5 callers
Method
resolveTerminal
(status: 'filled' | 'cancelled' | 'rejected' | 'expired', reason?: string)
src/services/order-manager.ts:647
↓ 5 callers
Method
scanMarkets
* Scan markets for arbitrage opportunities * * @param criteria Filter criteria for markets * @param minProfit Minimum profit threshold (defau
src/services/arbitrage-service.ts:1621
↓ 5 callers
Method
seedClobClientMarketMetadata
( tokenId: string, metadata: { tickSize?: TickSize; negRisk?: boolean }, )
src/services/trading-service.ts:932
↓ 5 callers
Method
sendTransaction
* 发送链上交易 * * 使用 Privy Delegated Actions 签名并广播交易 * * @param tx - 交易请求 * @returns 交易结果
src/wallets/privy-wallet.ts:139
↓ 5 callers
Function
sleep
(ms: number)
scripts/test-copy-trading-full-e2e.ts:95
↓ 5 callers
Function
sleep
(ms: number)
scripts/arb/token-rebalancer.ts:417
↓ 5 callers
Function
summarizePricePoints
(label: string, points: PricePoint[])
scripts/api-verification/07-verify-sdk-klines-methods.ts:63
↓ 5 callers
Method
unwatchOrder
* Stop watching an order
src/services/order-manager.ts:1143
↓ 5 callers
Function
validateSize
( size: number, minOrderSize = 0.1 )
src/utils/price-utils.ts:104
↓ 5 callers
Method
watch
* Start polling for a list of addresses. * Returns a cleanup function.
src/smart-money/copy.ts:43
← previous
next →
101–200 of 1,210, ranked by callers