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
↓ 5 callers
Method
wrapUsdcToPUSD
* 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 callers
Method
approveAll
* Set up all required approvals for trading * * @returns Results of all approval transactions
src/services/onchain-service.ts:228
↓ 4 callers
Function
buildV2Calldata
()
src/__tests__/unit/v2-smart-money-monitor-filter.test.ts:81
↓ 4 callers
Function
buildV2Calldata
()
src/__tests__/unit/v2-calldata-decoder.test.ts:94
↓ 4 callers
Function
calculateDipArbProfitRate
(totalCost: number)
src/services/dip-arb-types.ts:638
↓ 4 callers
Function
calculateOrderProgress
(originalSize: number, filledSize: number)
src/core/order-status.ts:254
↓ 4 callers
Method
checkPool
* Check if a pool exists for a token pair
src/services/swap-service.ts:219
↓ 4 callers
Method
createBatchOrders
* Create multiple orders in batch * Auto-watches all successfully created orders
src/services/order-manager.ts:1000
↓ 4 callers
Function
debug
(message: string)
scripts/real-time-service/test-realtime-15m.ts:76
↓ 4 callers
Function
decodeMatchOrdersCalldataV2
( data: string )
src/utils/calldata-decoder.ts:261
↓ 4 callers
Function
delay
(ms: number)
scripts/ctfmanager/full-e2e.ts:60
↓ 4 callers
Function
delay
(ms: number)
scripts/ordermanager/balanced-test.ts:46
↓ 4 callers
Function
depositUsdc
( signer: ethers.Wallet, amount: number, options: DepositOptions = {} )
src/clients/bridge-client.ts:748
↓ 4 callers
Function
fetchJson
(url: string)
scripts/api-verification/05-prices-history-deep-test.ts:22
↓ 4 callers
Function
formatTimestamp
(ts: number)
scripts/verify-user-events.ts:27
↓ 4 callers
Function
getBookPrices
Get orderbook bid/ask for a token via CLOB REST API
scripts/e2e-builder-test.ts:107
↓ 4 callers
Method
getCurrentRewards
()
src/services/trading-service.ts:2038
↓ 4 callers
Method
getDepositStatus
* 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 callers
Function
getExplorerUrl
(chainId: number, txHash: string)
src/clients/bridge-client.ts:1039
↓ 4 callers
Method
getLatestDeposit
* 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 callers
Method
getLeaderboardByPeriod
* 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 callers
Method
getMarketResolution
* Check if a market is resolved and get payout info
src/clients/ctf-client.ts:912
↓ 4 callers
Method
getPricesHistory
* Get price history for a token
src/services/market-service.ts:452
↓ 4 callers
Method
getResults
()
scripts/benchmark/copy-trade-detection-latency.ts:178
↓ 4 callers
Method
getSplits
* 获取用户的 Split 事件
src/clients/subgraph.ts:331
↓ 4 callers
Method
getStatusDescription
* 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 callers
Method
getWalletIdentity
()
src/services/trading-service.ts:703
↓ 4 callers
Method
getWalletPositions
* Get positions for a wallet
src/services/wallet-service.ts:301
↓ 4 callers
Method
isConnected
Check if connected
src/realtime/types.ts:563
↓ 4 callers
Function
isTerminalStatus
(status: OrderStatus)
src/core/order-status.ts:184
↓ 4 callers
Function
printSummary
()
scripts/arb-tests/03-e2e-tests.ts:97
↓ 4 callers
Method
quickScan
* 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 callers
Method
readLastClobPostTelemetry
()
src/services/trading-service.ts:777
↓ 4 callers
Method
redeemByTokenIds
* 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 callers
Function
roundSize
(size: number)
src/utils/price-utils.ts:63
↓ 4 callers
Function
rpcCall
(url: string, method: string, params: any[])
scripts/benchmark/rpc-latency.ts:45
↓ 4 callers
Function
runScenario
( name: string, description: string, orderFn: () => Promise<{ orderId: string | null; orderType: s
scripts/ordermanager/bug20-deep-analysis.ts:367
↓ 4 callers
Function
runTest
(name: string, testFn: () => Promise<void>)
scripts/ordermanager/balanced-test.ts:50
↓ 4 callers
Function
runTokenIdTest
( orderMgr: OrderManager, testName: string, params: { tokenId: string; tokenType: 'YES' | 'NO';
scripts/ordermanager/bug24-tokenid-test.ts:100
↓ 4 callers
Method
searchMarkets
* Search markets
src/services/market-service.ts:1381
↓ 4 callers
Method
sendSubscription
(msg: { subscriptions: Array<{ topic: string; type: string; filters?: string; clob_auth?: ClobApiKeyCreds }> }
src/services/realtime-service-v2.ts:1861
↓ 4 callers
Method
sendUnsubscription
(msg: { subscriptions: Array<{ topic: string; type: string; filters?: string }> }, subId?: string)
src/services/realtime-service-v2.ts:1877
↓ 4 callers
Function
separator
(title: string)
scripts/api-verification/07-verify-sdk-klines-methods.ts:53
↓ 4 callers
Function
sleep
(ms: number)
scripts/e2e-builder-test.ts:102
↓ 4 callers
Method
start
* Start monitoring a market
src/services/dip-arb-service.ts:295
↓ 4 callers
Method
stop
* Stop monitoring
src/services/dip-arb-service.ts:433
↓ 4 callers
Method
subscribe
@deprecated Use subscribeMarket or subscribeUser instead
src/realtime/types.ts:545
↓ 4 callers
Function
summarizeCandles
(label: string, candles: KLineCandle[])
scripts/api-verification/07-verify-sdk-klines-methods.ts:79
↓ 4 callers
Function
testDataTrades
* Test 2: /data/trades 行为
scripts/api-verification/04-prices-history-vs-trades.ts:114
↓ 4 callers
Method
transfer
* Transfer an ERC20 token to another address
src/services/swap-service.ts:822
↓ 4 callers
Method
updateBalanceAllowance
( assetType: 'COLLATERAL' | 'CONDITIONAL', tokenId?: string )
src/services/trading-service.ts:2285
↓ 3 callers
Method
aggregateToKLines
* 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 callers
Method
approveUsdc
* 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 callers
Method
buildPieChart
( name: string, items: Array<{ title: string; value: number }> )
src/smart-money/reports.ts:644
↓ 3 callers
Function
buyCycle
( orderMgr: OrderManager, cycleNum: number, tokenId: string, side: 'Up' | 'Down' )
scripts/ordermanager/smart-cycle-test.ts:62
↓ 3 callers
Function
calculateBuyAmount
(price: number, size: number)
src/utils/price-utils.ts:125
↓ 3 callers
Function
calculatePnL
( entryPrice: number, currentPrice: number, size: number, side: 'long' | 'short' = 'long' )
src/utils/price-utils.ts:290
↓ 3 callers
Method
calculateRebalanceAction
* Calculate recommended rebalance action based on current state
src/services/arbitrage-service.ts:613
↓ 3 callers
Function
calculateSharesForAmount
( amount: number, price: number )
src/utils/price-utils.ts:147
↓ 3 callers
Function
canOrderBeCancelled
(status: OrderStatus)
src/core/order-status.ts:237
↓ 3 callers
Method
cancel
Cancel the order. Returns true if cancellation succeeded.
src/services/order-manager.ts:420
↓ 3 callers
Method
checkAllowances
* 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 callers
Method
cleanup
()
src/realtime/realtime-data-client.ts:888
↓ 3 callers
Method
clearPongTimeout
()
src/realtime/realtime-data-client.ts:817
↓ 3 callers
Method
clearPositions
* 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 callers
Method
create
* Create and initialize SDK in one call * * @example * ```typescript * const sdk = await PolymarketSDK.create({ privateKey: '...' }); *
src/index.ts:713
↓ 3 callers
Function
delay
(ms: number)
scripts/ctfmanager/cycle-test.ts:68
↓ 3 callers
Method
detectArbitrage
* Detect arbitrage opportunity * * 使用有效价格计算套利机会(正确考虑镜像订单) * 详细文档见: docs/01-polymarket-orderbook-arbitrage.md
src/index.ts:824
↓ 3 callers
Function
estimateBridgeOutput
(amount: number, tokenSymbol: string)
src/clients/bridge-client.ts:1017
↓ 3 callers
Method
executeWithWallet
* 使用用户钱包执行操作 * * 私钥仅在回调执行期间存在于内存中,执行完毕后立即清除。 * * @param userId - 用户 ID * @param callback - 使用钱包执行的操作 * @returns 回调的返回值
src/wallets/hot-wallet-service.ts:188
↓ 3 callers
Function
extractTraderAddresses
(decoded: DecodedMatchOrders)
src/utils/calldata-decoder.ts:327
↓ 3 callers
Method
fetch
(path: string, options: RequestInit = {})
src/clients/bridge-client.ts:673
↓ 3 callers
Method
findNearestPrice
* Find the nearest available price for a timestamp
src/services/market-service.ts:1046
↓ 3 callers
Method
findNextMarket
()
src/services/dip-arb-service.ts:1999
↓ 3 callers
Function
formatTimestamp
(ts: number)
scripts/api-verification/05-prices-history-deep-test.ts:18
↓ 3 callers
Method
fromGammaMarket
(gamma: GammaMarket)
src/services/market-service.ts:1819
↓ 3 callers
Function
getArg
(name: string, defaultValue: string)
scripts/ordermanager/bug20-deep-analysis.ts:55
↓ 3 callers
Method
getClosedPositions
* Get closed positions for a wallet address * * @param address - Wallet address * @param params - Query parameters * * @example * ``
src/clients/data-api.ts:495
↓ 3 callers
Method
getDualKLinesOHLCV
* 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 callers
Method
getEarningsForDay
(date: string)
src/services/trading-service.ts:2023
↓ 3 callers
Method
getGasPrice
* Get current gas price info
src/services/onchain-service.ts:458
↓ 3 callers
Method
getGlobalOpenInterest
* 获取全局 Open Interest
src/clients/subgraph.ts:437
↓ 3 callers
Method
getKLines
* 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 callers
Method
getMakerFills
* 获取用户作为 maker 的成交事件
src/clients/subgraph.ts:471
↓ 3 callers
Method
getMarket
* Get market by slug or condition ID
src/services/market-service.ts:522
↓ 3 callers
Method
getOrder
* 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 callers
Method
getOrderFilledEvents
* 获取订单成交事件
src/clients/subgraph.ts:453
↓ 3 callers
Method
getOrderbook
* Get processed orderbook with analytics (alias for getProcessedOrderbook)
src/services/market-service.ts:1329
↓ 3 callers
Method
getPrice
* Get current price for a symbol * * @param symbol - Trading pair (BTCUSDT, ETHUSDT, SOLUSDT) * @returns Current price * * @example
src/services/binance-service.ts:164
↓ 3 callers
Method
getSmartMoneyList
* Get list of Smart Money wallets from leaderboard.
src/smart-money/core.ts:91
↓ 3 callers
Method
getTokenBalances
* Get all token balances
src/services/onchain-service.ts:193
↓ 3 callers
Method
getTokenOrderbook
* Get orderbook for a single token
src/services/market-service.ts:349
↓ 3 callers
Method
getTradesByMarket
* Get trades for a specific market
src/clients/data-api.ts:706
↓ 3 callers
Method
getWalletAddress
Get wallet address by user ID
src/wallets/hot-wallet-service.ts:52
↓ 3 callers
Method
getWalletProfile
* Get comprehensive wallet profile with PnL analysis
src/services/wallet-service.ts:243
↓ 3 callers
Method
handleDeadConnection
()
src/realtime/realtime-data-client.ts:824
↓ 3 callers
Method
invalidate
(pattern: string)
src/core/unified-cache.ts:30
↓ 3 callers
Method
isCacheValid
()
src/smart-money/core.ts:152
↓ 3 callers
Method
isInitialized
()
src/services/trading-service.ts:2314
↓ 3 callers
Method
logAlways
* 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
← previous
next →
201–300 of 1,210, ranked by callers