brew install pythonwith version 3.14+- run
python -m venv venvandsource ./venv/bin/activateto active local Python Interpreter. - run
pip install -r requirements.txt. - create
.envfrom.env.exmapleand edit your eoa private key and PredictDotFun api key.
run python jwt.py
run python approve.py to set approvals, this is interaction with contracts, no auth header reqeust.
| Hash (abbr) | Action | Block | Age | From (abbr) | To (abbr) | Amount | Txn Fee |
|---|---|---|---|---|---|---|---|
| 0x4865a5 | Set Approval For | 71940800 | 7 mins ago | 0xf155...54E6 | 0x22DA...9d244 | 0 BNB | 0.00000232 |
| 0x0983bc | Approve | 71940798 | 7 mins ago | 0xf155...54E6 | BUSD-T Stablecoin | 0 BNB | 0.00000232 |
| 0xa72989 | Set Approval For | 71940796 | 7 mins ago | 0xf155...54E6 | 0x22DA...9d244 | 0 BNB | 0.00000232 |
| 0xbddfca | Approve | 71940794 | 7 mins ago | 0xf155...54E6 | BUSD-T Stablecoin | 0 BNB | 0.00000232 |
| 0x5f70e4 | Set Approval For | 71940791 | 7 mins ago | 0xf155...54E6 | 0x22DA...9d244 | 0 BNB | 0.00000232 |
Find active market id by:
curl -X 'GET' 'https://api.predict.fun/v1/markets' -H 'accept: application/json' -H 'x-api-key: <your-api-key>'
Find orderbook of a specified market by:
curl -X 'GET' 'https://api.predict.fun/v1/markets/420/orderbook' -H 'accept: application/json' -H 'x-api-key: <your-api-key>'
- edit
limit_order.pyline32 price_per_share_wei, line33 quantity_wei, line46 token_id, line50 fee_rate_bps, line57 is_neg_risk and line58 is_yield_bearing. - run
python limit_order.pyto get information likes:
salt: 1786497918
maker: 0xf155A90e1308817f186Ad69E8Ee5939645ce54E6
signer: 0xf155A90e1308817f186Ad69E8Ee5939645ce54E6
taker: 0x0000000000000000000000000000000000000000
token_id: 51923869364888026720633707255758662304830403989354809616621058202583057583874
maker_amount: 1000000000000000000
taker_amount: 100000000000000000000
expiration: 4102444800
nonce: 0
fee_rate_bps: 200
side: 0
signature_type: 0
signature: e0863e219f72c00baf8b79e900ef8b6bab4155bbad2a7343c4e75532f6f5b7db6b231c8fb32e4ce823fef4d1151618a37fe9d01900cc4b26c721d5e47e6959ee1b
hash: None
curl -X 'POST' \
'https://api.predict.fun/v1/orders' \
-H 'accept: application/json' \
-H 'x-api-key: <your-api-key>' \
-H 'Authorization: Bearer <your-jwt-token>' \
-H 'Content-Type: application/json' \
-d '{
"data": {
"pricePerShare": "10000000000000000",
"strategy": "LIMIT",
"slippageBps": "0",
"order": {
"salt": "1786497918",
"maker": "0xf155A90e1308817f186Ad69E8Ee5939645ce54E6",
"signer": "0xf155A90e1308817f186Ad69E8Ee5939645ce54E6",
"taker": "0x0000000000000000000000000000000000000000",
"tokenId": "51923869364888026720633707255758662304830403989354809616621058202583057583874",
"makerAmount": "1000000000000000000",
"takerAmount": "100000000000000000000",
"expiration": "4102444800",
"nonce": "0",
"feeRateBps": "200",
"side": 0,
"signatureType": 0,
"signature": "0xe0863e219f72c00baf8b79e900ef8b6bab4155bbad2a7343c4e75532f6f5b7db6b231c8fb32e4ce823fef4d1151618a37fe9d01900cc4b26c721d5e47e6959ee1b"
}
}
}'
curl -X 'GET' \
'https://api.predict.fun/v1/orders/<order-hash>' \
-H 'accept: application/json' \
-H 'x-api-key: <your-api-key>' \
-H 'Authorization: Bearer <your-jwt-token>' \
curl -X 'POST' \
'https://api.predict.fun/v1/orders/remove' \
-H 'accept: application/json' \
-H 'x-api-key: <your-api-key>' \
-H 'Authorization: Bearer <your-jwt-token>' \
-H 'Content-Type: application/json' \
-d '{
"data": {
"ids": [
"42357"
]
}
}'