Skip to content

GuidesBuild schemas by venue

Step zero — from nothing to your first trade

Section titled “Step zero — from nothing to your first trade”
  1. Create the account. Open predict.fun, connect the EOA you will trade from, and follow the current prompts; Predictefy has no verified information on the identity-check sequence, so confirm it with the venue.
  2. Set up credentials. Create a wallet and secure its seed phrase; never share the private key, which Predictefy never sees. Get the API key in your venue account’s API settings. There is no session token to copy: the SDK has your wallet sign Predict.fun’s dynamic auth message locally and exchanges it directly for the JWT.
  3. Fund and approve. A practical first test is about $10–$25 of USDT on BNB Smart Chain (56), plus a little BNB for approval or on-chain cancellation gas—not a venue minimum. If funds start elsewhere, use GET /v1/bridge/quote before signing and broadcasting its transaction request.
  4. Allow time. Budget 1–2 hours for a first wallet, bridge, and approval; less if already funded.

Hosted requests use an eligible regional egress relay and reach Predict.fun; a live credentialed submit remains unverified. The direct path still requires your connection to be venue-eligible.

  • Production status: Enabled for build, submit, and cancel. Hosted requests use eligible regional egress and reach the venue; a live credentialed submit has not yet been verified on that path.
  • Wallet and chain: An EOA on BNB Smart Chain (56), or a Predict smart account (Privy key plus ZeroDev Kernel). Safe and proxy identities are rejected.
  • Venue account: Yes. The working direct path needs a Predict.fun API key and a wallet-authenticated venue session.
  • Credentials: client.accounts.predictfun keeps the API key and wallet private key in-process, creates the JWT directly with Predict.fun, and sends neither to Predictefy. The hosted path instead accepts the caller’s session bearer transiently for submit, cancel, or refresh.
  • Funding: BSC USDT in the EOA, with approval to the exchange selected by the market’s exact NegRisk/yield-bearing type. The LI.FI helper can fund the wallet.

Predict.fun is also server-built by default, using the same plain selector and order fields. The signed identity is always signature type 0 with maker == signer == owner; any Safe/proxy request is a typed 400 VALIDATION_ERROR. That one form covers both a pure EOA and a Predict smart account, because Predict.fun verifies type 0 with EIP-1271. The service fetches the exact catalog market from Predict.fun, requires the selected on-chain outcome token to occur exactly once, reads its current feeRateBps, and resolves the exchange from the exact (isNegRisk, isYieldBearing) pair. Missing type truth or any catalog/API/exchange disagreement fails closed with nothing persisted.

LIMIT amounts follow the pinned 1.3.8 SDK: 18-decimal price/size inputs are truncated to three and five significant digits respectively, and size must be at least 0.01 shares. Omitted expiresAt uses the SDK’s 2100-01-01 no-expiry placeholder. A chosen expiry is a good-til-date order: it must be at least two minutes away and no later than 2100-01-01. isPostOnly: true keeps the order away from taking resting liquidity. The server uses a full-width 256-bit cryptographic salt because Predict.fun’s relay also preserves salt as a decimal string. The response includes the venue-shaped unsigned payload, buildVersion: 1, and complete EIP-712 fields. An active session bearer is needed only when submitting, cancelling, or refreshing; it is never accepted in this build body. The legacy echoed buildResult remains accepted unchanged.

Where the deployment enables them, the same build call accepts strategy: "MARKET". The server reads Predict.fun’s order book for the traded outcome, derives the No side from the Yes-priced book as the venue documents, and signs the amounts the venue SDK would sign:

  • slippageBps is required, from 0 to 10000 basis points.
  • Size the order by size (shares) or, for a BUY only, by value (the most USDT to spend).
  • The unfilled part never rests: the order is fill-and-kill by default, or fill-or-kill with isFillOrKill: true.
  • price and expiresAt are not accepted. A market order expires five minutes after build.
  • The signed worst-case collateral is what spend caps reserve, so a moved book cannot spend past the cap. Direct clients send the exact unsigned build artifact to reserveOrder; the server rejects changed artifacts before reserving. The SDK also refuses collateral above the returned reservation before sending an order to the venue.

The response carries buildVersion: 2. The venue minimums apply: a buy must be worth at least 1 USDT, and a market sell at least 0.01 shares.

An owner that is a Predict smart account (a Privy EOA plus a ZeroDev Kernel wallet) builds the same way. The server still returns signature type 0 and maker == signer == owner, with the account address in both fields. The owner EOA signs the Kernel-wrapped order digest, and the resulting 86-byte envelope is 0x01, the ZeroDev ECDSA validator address, then the 65-byte signature. Submit checks the envelope’s form, then asks the smart account’s on-chain ERC-1271 isValidSignature before relaying anything. A deployment that cannot run that check refuses the submit; no relay happens first.

On the catalog record, marketId and sourceMetadata.nativeMarketId are both the bare venue market id (for example 52261). Each outcome’s metadata.nativeOutcomeId is its ERC-1155 token id as a decimal string; pass that value as asset when you build the order. When the venue states no on-chain id, the field holds the catalog outcome id predictfun:{market}:{indexSet} instead (indexSet is 1 for the first outcome and 2 for the second), so treat the value as an execution id only when it is all digits. The build also accepts the market id in outcome together with outcomeSide.

Predict.fun rejects order traffic from restricted regions, and hosted submits route through Predictefy’s eligible regional egress relay. A live credentialed submit through that path has not yet been verified. The client-side route below stays fully supported for callers who prefer their own eligible connection: it builds at Predictefy, signs in the caller’s wallet, and submits under the caller’s own API key and in-process JWT:

const client = new Predictefy({
apiKey: process.env.PREDICTEFY_API_KEY,
execBaseUrl: PREDICTEFY_EXEC_BASE_URL,
venueCredentials: {
predictfun: {
apiKey: process.env.PREDICTFUN_API_KEY!,
privateKey: process.env.PREDICTFUN_WALLET_KEY!,
},
},
});
const placed = await client.accounts.predictfun.createOrder(
{
idempotencyKey: 'your-stable-build-key',
outcome: 12345,
outcomeSide: 'YES',
isBuy: true,
price: 0.4,
size: 10,
owner: wallet.address,
},
wallet,
);
const status = await client.accounts.predictfun.fetchOrder(placed.orderHash);

Before asking the wallet to sign, the SDK independently reconstructs the exact Predict.fun EIP-712 order, then reads the market’s authoritative record from the fixed api.predict.fun origin and refuses to sign unless everything agrees: the signed token must be the named outcome the caller requested (outcomes are matched by the venue’s own outcome names — non-binary shapes refuse rather than guess), the EIP-712 domain.verifyingContract must be the exact exchange contract selected by the market’s authoritative isNegRisk/isYieldBearing flags among the four known contracts, and the signed feeRateBps must equal the market’s authoritative fee. A failed or malformed venue read refuses before signing, and the immutable mapping is cached per client per market. Intent binding is mandatory: the exported signing helper requires the original order intent and a trusted market mapping at both the type and runtime level — there is no structural-only signing path for this venue. String prices and sizes are parsed losslessly (plain decimals up to 18 fractional digits; anything else refuses), so precision drift can never smuggle different economics past the amount check.

Submission sends the exact server wire body under the caller’s x-api-key and an in-process JWT (the dynamic auth message is signed by the caller’s wallet and exchanged directly with the venue). Every credentialed call goes only to the fixed venue origin and refuses redirects; failures are typed and generic. A successful create requires only the documented orderId and orderHash; a missing status field is treated as acknowledged, never as a failure — a placed order is never reported as failed.

Cancellation is the one verb where this SDK path is narrower than the hosted service. On this venue-direct path, client.accounts.predictfun.cancelOrder is honestly refused as unsupported: the venue’s /v1/orders/remove only removes the book entry while the signed order remains valid, and full invalidation requires an on-chain CTFExchange.cancelOrders transaction this SDK client does not send. The hosted service does both: its cancelOrder capability is enabled, and POST /v1/exec/predictfun/orders/{executionId}/cancel takes a mode:

  • mode: "book" (the default) relays the venue’s own POST /orders/remove under your transient session bearer — the book removal, with the same residual the venue itself warns about.
  • mode: "onchain" supports EOA orders only and returns an unsigned BSC transaction encoding CTFExchange.cancelOrders([order]), built from the stored order struct and its stored signature. You sign and broadcast it yourself; Predictefy verifies chain, recovered maker, and byte-equal {to, data, value}, then records signed without claiming a broadcast. A target that was never submitted has no stored signature and fails closed. Predict smart-wallet orders are refused at cancellation build because Kernel execution needs a different authorization format. Use book removal for those orders; it leaves the signature valid on-chain. Status observations and stored fills omit order signatures.

No single call fully invalidates a Predict.fun order. EOA orders support both hosted cancel modes. Predict smart-wallet orders support hosted book removal only. Before relying on the venue-direct path in production, complete one eligible submit-to-status pass.