Re-exports§
pub use signer::ExternalSigner;
Modules§
- IERC20
- Module containing a contract’s types and functions.
- IERC20
Balance - Module containing a contract’s types and functions.
- IERC1155
- Module containing a contract’s types and functions.
- IGnosis
Safe - Module containing a contract’s types and functions.
- INativeUSDC
- Module containing a contract’s types and functions.
- ISwapER
C20 - Module containing a contract’s types and functions.
- ISwap
Router - Module containing a contract’s types and functions.
- ctf
- CTF (Conditional Token Framework) calldata encoding for on-chain operations.
- relayer
- Gasless relayer client for Polymarket CTF operations.
- signer
Structs§
- Allowance
Status - Status of a single allowance check
- ApiCredentials
- Approval
Request - Request for setting approvals
- Approval
Response - Response from approval operations
- Approval
Result - Result of a single approval transaction
- Auth
Config - Configuration for Polymarket authentication
- Balance
Allowance - Clob
Order Data - Detected
Wallet - Result of auto-detecting the proxy wallet type from an EOA private key.
- Http
Client - Order
Args - Order
Response - Polymarket
- Polymarket
Config - Polymarket
Market Fetcher - Market fetcher for Polymarket Bronze layer ingestion.
- Polymarket
WebSocket - Swap
Result - Result of the native USDC → USDC.e swap attempt.
- Token
Approver - Token approver for Polymarket contracts
- Wallet
Diagnostics
Enums§
- Approval
Target - Target contract for approval
- Clob
Order Side - Clob
Order Type - Polymarket
Error - Polymarket
Signature Type - Token
Type - Token type for approval
Constants§
- BRIDGED_
USDC_ E_ ADDRESS - Bridged USDC.e on Polygon (input to CollateralOnramp.wrap() in V2)
- CLOB_
API_ URL - CLOB_
URL - COLLATERAL_
ONRAMP - CollateralOnramp — wraps USDC.e into pUSD (V2 trading collateral). API-only flow: approve USDC.e to this address, then call wrap(amount). Source: https://docs.polymarket.com/resources/contracts
- CTF_
ADDRESS - CTF_
EXCHANGE - DATA_
API_ URL - DEFAULT_
POLYGON_ RPC - GAMMA_
API_ URL - MAX_
APPROVAL - MIN_
SWAP_ BALANCE - Minimum balance to trigger swap (0.01 USDC = 10_000 units at 6 decimals)
- NATIVE_
USDC_ ADDRESS - Native USDC on Polygon (what MetaMask shows as “USDC”)
- NEG_
RISK_ ADAPTER - NEG_
RISK_ CTF_ EXCHANGE - PUSD_
ADDRESS - SLIPPAGE_
BPS - Slippage tolerance: 0.5% for a 1:1 stablecoin peg
Functions§
- check_
erc20_ balance - Check any ERC20 token balance for an address. Returns 0 on any error (fail-silent).
- check_
native_ usdc_ balance - Check native USDC balance for an address. Returns 0 on any error (fail-silent).
- check_
pol_ balance - Check native POL (MATIC) balance for an address. Returns 0 on any error (fail-silent).
- compute_
swap_ amounts - Compute the swap amount and min_out from a raw native USDC balance.
Returns
(amount_in, min_out)as(u128, u128)to avoid leaking alloy types. - detect_
proxy_ wallet - Auto-detect the Polymarket proxy wallet from an EOA private key.
- detect_
signature_ type_ from_ env - Detect signature type from environment variables
- diagnose_
wallets - Diagnose potential Polymarket wallet mismatches.
- encode_
approval_ calldata - Build ABI-encoded calldata for an approval pair. Returns (to_address, hex_calldata). Used by the link handler to build transactions for Privy-managed wallets.
- encode_
native_ usdc_ approval - Encode
approve(router, amount)on native USDC. Returns(to, calldata). - encode_
native_ usdc_ approval_ u128 - Convenience wrapper: encode approval from a u128 amount.
- encode_
swap_ calldata - Encode Uniswap V3
exactInputSinglecall. Returns(to, calldata). - encode_
swap_ calldata_ u128 - Convenience wrapper: encode swap calldata from u128 amounts.
- encode_
usdc_ approval - Encode USDC ERC-20 approve(spender, MAX) for an arbitrary address. Used to approve the fee escrow contract during onboarding.
- format_
token_ balance - Format a raw token balance as a human-readable string (e.g., 2000000 with 6 decimals → “2.00”).
- get_
orderbook_ snapshot