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
fromto 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
| Path | Encodes | Caller |
|---|---|---|
POST /v1/tx/erc20/approve | approve(spender, amount) on a token | Anyone 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)
| Path | Encodes | Caller |
|---|---|---|
POST /v1/tx/hedge/create-event | createEvent(...) (the 14-field tuple) | Anyone (underwriter) |
POST /v1/tx/hedge/deposit | deposit(eventId, amount) | LPs |
POST /v1/tx/hedge/buy-protection | buyProtection(eventId, notional, maxCost, deadline) | Hedgers |
POST /v1/tx/hedge/claim-payout | claimPayout(positionId) | Hedger of that position |
POST /v1/tx/hedge/claim-premiums | claimPremiums(depositId) | LP of that deposit |
POST /v1/tx/hedge/withdraw-capital | withdrawCapital(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"
}
| field | type | notes |
|---|---|---|
name | string | Human label for the event |
underlying | string | E.g. USD/GHS. Used to look up the FX rate |
strike | uint256 (1e6) | Strike rate (11.40 = "11400000") |
payoutCap | uint256 (1e6) | Cap rate. Pass "0" for legacy single-strike events |
premiumRate | uint256 (1e6) | Premium as fraction of notional (2.3% = "23000") |
expiry | uint256 | Unix seconds |
allowExternalLp | bool | If false, only the creator can deposit |
initialLiquidity | uint256 (payment-token decimals) | Seed capital |
initialRate | uint256 (1e6) | Spot rate at creation |
strikeAbove | bool | true = upward hedge / call spread |
paymentToken | address | USDC or USDT on the target chain |
signature | bytes | "0x" for self-priced; engine signature for attested |
quoteTimestamp | uint256 | "0" for self-priced; engine's timestamp otherwise |
quoteNonce | bytes32 | ethers.ZeroHash for self-priced; engine's nonce otherwise |
Hedge (creator-only)
| Path | Encodes |
|---|---|
POST /v1/tx/hedge/set-pool-settings | setPoolSettings(eventId, poolOpen, allowExternalLp) |
POST /v1/tx/hedge/withdraw-creator-earnings | withdrawCreatorEarnings(eventId) |
Only the wallet that called createEvent for that event can successfully
broadcast these. The API builds the calldata regardless.
Hedge (owner / admin)
| Path | Encodes |
|---|---|
POST /v1/tx/hedge/initialize-fees | initializeHedgeFees(creationFee, hedgerFeeRate, payoutFeeRate, lpProfitFeeRate, creatorLoyaltyRate) |
POST /v1/tx/hedge/settle-event | settleEvent(eventId, settlementPrice) (oracle admin) |
POST /v1/tx/hedge/pause | pause() |
POST /v1/tx/hedge/unpause | unpause() |
POST /v1/tx/hedge/activate-oracle-v2 | activateOracleV2() |
POST /v1/tx/hedge/set-oracle-admin | setOracleAdmin(admin) |
POST /v1/tx/hedge/set-pricing-engine-signer | setPricingEngineSigner(signer) |
POST /v1/tx/hedge/withdraw-platform-fees | withdrawPlatformFees(amount) (USDC) |
POST /v1/tx/hedge/withdraw-platform-fees-by-token | withdrawPlatformFeesByToken(token, amount) |
POST /v1/tx/hedge/rescue-eth | rescueETH(to) |
POST /v1/tx/hedge/rescue-erc20 | rescueERC20(token, to) |
POST /v1/tx/hedge/set-allowed-payment-token | setAllowedPaymentToken(token, allowed) |
POST /v1/tx/hedge/recover-expired-payouts | recoverExpiredPayouts(eventId) |
These will only succeed if signed by the Diamond owner (or oracle admin for
settleEvent).
Oracle
| Path | Encodes | Caller |
|---|---|---|
POST /v1/tx/oracle/submit-rate | submitRate(eventId, price) | Authorised oracles only |
POST /v1/tx/oracle/add-oracle | addOracle(oracle) | Owner |
POST /v1/tx/oracle/remove-oracle | removeOracle(oracle) | Owner |
POST /v1/tx/oracle/set-required-signers | setRequiredSigners(required) | Owner |
POST /v1/tx/oracle/set-tolerance-bps | setToleranceBps(bps) | Owner |
POST /v1/tx/oracle/clear-stale-submissions | clearStaleSubmissions(eventId) | Owner |
Ownership
| Path | Encodes |
|---|---|
POST /v1/tx/ownership/transfer-ownership | transferOwnership(newOwner) |
POST /v1/tx/ownership/accept-ownership | acceptOwnership() |
Two-step ownership handover. The current owner calls transfer, then the
new owner must call accept to finalize.
Governance (Timelock)
| Path | Encodes |
|---|---|
POST /v1/tx/governance/diamond-cut | diamondCut(cuts, init, initData) (queues an upgrade) |
POST /v1/tx/governance/execute-cut | executeCut(proposalId) (after ETA) |
POST /v1/tx/governance/cancel-cut | cancelCut(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).