IBExWalletAPI
Integration

cURL Examples

IBEX‑FI API Web3 — cURL Reference

Base

  • Base URL: http://HOST:PORT
  • Per‑chain endpoints: http://HOST:PORT/CHAIN_ID/rpc

You can export helpers:

export HOST=localhost
export PORT=8001
export CHAIN_ID=11155111

Health

curl -s http://$HOST:$PORT/health

Cache (RPC results)

  • Get cache snapshot:
curl -s http://$HOST:$PORT/cache/rpc | jq .
  • Clear cache:
curl -s -X DELETE http://$HOST:$PORT/cache/rpc | jq .

RPC (EVM JSON‑RPC node)

Endpoint: POST http://$HOST:$PORT/$CHAIN_ID/rpc

  • Network chain id:
curl -s -X POST http://$HOST:$PORT/$CHAIN_ID/rpc \
  -H 'Content-Type: application/json' \
  --data '{"jsonrpc":"2.0","id":1,"method":"eth_chainId","params":[]}' | jq .
  • Latest block number:
curl -s -X POST http://$HOST:$PORT/$CHAIN_ID/rpc \
  -H 'Content-Type: application/json' \
  --data '{"jsonrpc":"2.0","id":1,"method":"eth_blockNumber","params":[]}' | jq .
  • Legacy gas price:
curl -s -X POST http://$HOST:$PORT/$CHAIN_ID/rpc \
  -H 'Content-Type: application/json' \
  --data '{"jsonrpc":"2.0","id":1,"method":"eth_gasPrice","params":[]}' | jq .
  • Address balance:
ADDR=0x0000000000000000000000000000000000000000
curl -s -X POST http://$HOST:$PORT/$CHAIN_ID/rpc \
  -H 'Content-Type: application/json' \
  --data '{"jsonrpc":"2.0","id":1,"method":"eth_getBalance","params":["'"$ADDR"'","latest"]}' | jq .
  • eth_call (example):
TO=0x0000000000000000000000000000000000000000
DATA=0x
curl -s -X POST http://$HOST:$PORT/$CHAIN_ID/rpc \
  -H 'Content-Type: application/json' \
  --data '{"jsonrpc":"2.0","id":1,"method":"eth_call","params":[{"to":"'"$TO"'","data":"'"$DATA"'"},"latest"]}' | jq .

Notes:

  • Le serveur applique un cache opportuniste sur certaines mĂ©thodes (eth_call, eth_getCode, etc.).
  • Erreurs rĂ©seau et timeouts sont renvoyĂ©s en 500 avec un corps JSON‑RPC.

Bundler (EIP‑4337)

Endpoint: POST http://$HOST:$PORT/$CHAIN_ID/rpc/bundler

  • Gas price orientĂ© UserOperation (Pimlico Alto):
curl -s -X POST http://$HOST:$PORT/$CHAIN_ID/rpc/bundler \
  -H 'Content-Type: application/json' \
  --data '{"jsonrpc":"2.0","id":1,"method":"pimlico_getUserOperationGasPrice","params":[]}' | jq .
  • Estimation d’une UserOperation:
ENTRYPOINT=0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789
curl -s -X POST http://$HOST:$PORT/$CHAIN_ID/rpc/bundler \
  -H 'Content-Type: application/json' \
  --data '{
    "jsonrpc":"2.0","id":1,
    "method":"eth_estimateUserOperationGas",
    "params":[
      {
        "sender":"0x0000000000000000000000000000000000000000",
        "nonce":"0x0",
        "initCode":"0x",
        "callData":"0x",
        "maxFeePerGas":"0x77359400",
        "maxPriorityFeePerGas":"0x3b9aca00",
        "paymasterAndData":"0x"
      },
      "'"$ENTRYPOINT"'"
    ]
  }' | jq .
  • Envoi d’une UserOperation (signĂ©e):
ENTRYPOINT=0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789
curl -s -X POST http://$HOST:$PORT/$CHAIN_ID/rpc/bundler \
  -H 'Content-Type: application/json' \
  --data '{
    "jsonrpc":"2.0","id":1,
    "method":"eth_sendUserOperation",
    "params":[
      {
        "sender":"0x...",
        "nonce":"0x1",
        "initCode":"0x",
        "callData":"0x",
        "callGasLimit":"0x5208",
        "verificationGasLimit":"0x300000",
        "preVerificationGas":"0x10000",
        "maxFeePerGas":"0x77359400",
        "maxPriorityFeePerGas":"0x3b9aca00",
        "paymasterAndData":"0x",
        "signature":"0x..."
      },
      "'"$ENTRYPOINT"'"
    ]
  }' | jq .
  • Receipt et recherche:
UOHASH=0x...
curl -s -X POST http://$HOST:$PORT/$CHAIN_ID/rpc/bundler \
  -H 'Content-Type: application/json' \
  --data '{"jsonrpc":"2.0","id":1,"method":"eth_getUserOperationReceipt","params":["'"$UOHASH"'"]}' | jq .
 
curl -s -X POST http://$HOST:$PORT/$CHAIN_ID/rpc/bundler \
  -H 'Content-Type: application/json' \
  --data '{"jsonrpc":"2.0","id":1,"method":"eth_getUserOperationByHash","params":["'"$UOHASH"'"]}' | jq .

Paymaster (stubs)

Endpoint: POST http://$HOST:$PORT/$CHAIN_ID/rpc/paymaster

  • Obtenir un paymasterAndData de test:
curl -s -X POST http://$HOST:$PORT/$CHAIN_ID/rpc/paymaster \
  -H 'Content-Type: application/json' \
  --data '{
    "jsonrpc":"2.0","id":1,
    "method":"pm_getPaymasterStubData",
    "params":[{"sender":"0x...","nonce":"0x0","initCode":"0x","callData":"0x"}]
  }' | jq .
  • Demande de sponsoring (retourne paymasterAndData si Ă©ligible):
curl -s -X POST http://$HOST:$PORT/$CHAIN_ID/rpc/paymaster \
  -H 'Content-Type: application/json' \
  --data '{
    "jsonrpc":"2.0","id":1,
    "method":"pm_sponsorUserOperation",
    "params":[{"sender":"0x...","nonce":"0x0","initCode":"0x","callData":"0x"}]
  }' | jq .

Conseils & erreurs communes

  • 400 \{ "message": "Bad Request" \}: URL incorrecte. Utiliser /$CHAIN_ID/rpc (RPC) ou /$CHAIN_ID/rpc/bundler.
  • Chain id X is not supported: ajouter X Ă  CHAINS et ses variables associĂ©es cĂ´tĂ© serveur.
  • 500 erreurs JSON‑RPC:
    • code 40: UNKNOWN_ERROR (erreur bas niveau provider)
    • code 42: SERVER_ERROR (rĂ©ponse distante incluse)
    • code 0: message gĂ©nĂ©rique

On this page