Skip to main content

Tx · build (calldata)

Every state-changing contract function as a POST /v1/tx/... endpoint that returns ready-to-sign calldata. See the calldata-builder pattern for the integration flow.

Every endpoint accepts:

  • The function's args (decimal strings for bigints, booleans where applicable)
  • An optional from to enable gas estimation

And returns a BuiltTx.

All endpoints are unauthenticated — the security comes from the signing step in your wallet, not from any API key. Authorization on the on-chain function (owner-only, oracle-only, creator-only) is enforced by the smart contract.

ERC-20

PathEncodesCaller
POST /v1/tx/erc20/approveapprove(spender, amount) on a tokenAnyone needing to approve USDC/USDT before a hedge action
curl -X POST https://api.blockfinax.com/v1/tx/erc20/approve \
-d '{ "chainId": 8453, "token": "0x...USDC...", "spender": "0x...Diamond...", "amount": "110000000" }'

Hedge (public)

PathEncodesCaller
POST /v1/tx/hedge/create-eventcreateEvent(...) (the 14-field tuple)Anyone (underwriter)
POST /v1/tx/hedge/depositdeposit(eventId, amount)LPs
POST /v1/tx/hedge/buy-protectionbuyProtection(eventId, notional, maxCost, deadline)Hedgers
POST /v1/tx/hedge/claim-payoutclaimPayout(positionId)Hedger of that position
POST /v1/tx/hedge/claim-premiumsclaimPremiums(depositId)LP of that deposit
POST /v1/tx/hedge/withdraw-capitalwithdrawCapital(depositId)LP, after expiry

createEvent body

The full body (see the per-field reference below):

{
"chainId": 8453,
"name": "USD/GHS · Q2 wide",
"underlying": "USD/GHS",
"strike": "11400000",
"payoutCap": "12000000",
"premiumRate": "23000",
"expiry": "1782182400",
"allowExternalLp": true,
"initialLiquidity": "100000000000",
"initialRate": "11070000",
"strikeAbove": true,
"paymentToken": "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
"signature": "0x",
"quoteTimestamp": "0",
"quoteNonce": "0x0000000000000000000000000000000000000000000000000000000000000000"
}
fieldtypenotes
namestringHuman label for the event
underlyingstringE.g. USD/GHS. Used to look up the FX rate
strikeuint256 (1e6)Strike rate (11.40 = "11400000")
payoutCapuint256 (1e6)Cap rate. Pass "0" for legacy single-strike events
premiumRateuint256 (1e6)Premium as fraction of notional (2.3% = "23000")
expiryuint256Unix seconds
allowExternalLpboolIf false, only the creator can deposit
initialLiquidityuint256 (payment-token decimals)Seed capital
initialRateuint256 (1e6)Spot rate at creation
strikeAbovebooltrue = upward hedge / call spread
paymentTokenaddressUSDC or USDT on the target chain
signaturebytes"0x" for self-priced; engine signature for attested
quoteTimestampuint256"0" for self-priced; engine's timestamp otherwise
quoteNoncebytes32ethers.ZeroHash for self-priced; engine's nonce otherwise

Hedge (creator-only)

PathEncodes
POST /v1/tx/hedge/set-pool-settingssetPoolSettings(eventId, poolOpen, allowExternalLp)
POST /v1/tx/hedge/withdraw-creator-earningswithdrawCreatorEarnings(eventId)

Only the wallet that called createEvent for that event can successfully broadcast these. The API builds the calldata regardless.

Hedge (owner / admin)

PathEncodes
POST /v1/tx/hedge/initialize-feesinitializeHedgeFees(creationFee, hedgerFeeRate, payoutFeeRate, lpProfitFeeRate, creatorLoyaltyRate)
POST /v1/tx/hedge/settle-eventsettleEvent(eventId, settlementPrice) (oracle admin)
POST /v1/tx/hedge/pausepause()
POST /v1/tx/hedge/unpauseunpause()
POST /v1/tx/hedge/activate-oracle-v2activateOracleV2()
POST /v1/tx/hedge/set-oracle-adminsetOracleAdmin(admin)
POST /v1/tx/hedge/set-pricing-engine-signersetPricingEngineSigner(signer)
POST /v1/tx/hedge/withdraw-platform-feeswithdrawPlatformFees(amount) (USDC)
POST /v1/tx/hedge/withdraw-platform-fees-by-tokenwithdrawPlatformFeesByToken(token, amount)
POST /v1/tx/hedge/rescue-ethrescueETH(to)
POST /v1/tx/hedge/rescue-erc20rescueERC20(token, to)
POST /v1/tx/hedge/set-allowed-payment-tokensetAllowedPaymentToken(token, allowed)
POST /v1/tx/hedge/recover-expired-payoutsrecoverExpiredPayouts(eventId)

These will only succeed if signed by the Diamond owner (or oracle admin for settleEvent).

Oracle

PathEncodesCaller
POST /v1/tx/oracle/submit-ratesubmitRate(eventId, price)Authorised oracles only
POST /v1/tx/oracle/add-oracleaddOracle(oracle)Owner
POST /v1/tx/oracle/remove-oracleremoveOracle(oracle)Owner
POST /v1/tx/oracle/set-required-signerssetRequiredSigners(required)Owner
POST /v1/tx/oracle/set-tolerance-bpssetToleranceBps(bps)Owner
POST /v1/tx/oracle/clear-stale-submissionsclearStaleSubmissions(eventId)Owner

Ownership

PathEncodes
POST /v1/tx/ownership/transfer-ownershiptransferOwnership(newOwner)
POST /v1/tx/ownership/accept-ownershipacceptOwnership()

Two-step ownership handover. The current owner calls transfer, then the new owner must call accept to finalize.

Governance (Timelock)

PathEncodes
POST /v1/tx/governance/diamond-cutdiamondCut(cuts, init, initData) (queues an upgrade)
POST /v1/tx/governance/execute-cutexecuteCut(proposalId) (after ETA)
POST /v1/tx/governance/cancel-cutcancelCut(proposalId)

diamondCut body shape:

{
"chainId": 8453,
"cuts": [
{ "facetAddress": "0x...", "action": 0, "functionSelectors": ["0xdeadbeef"] }
],
"init": "0x0000000000000000000000000000000000000000",
"initData": "0x"
}

action enum: 0 = Add, 1 = Replace, 2 = Remove (EIP-2535).