Querying Retroshades
For each retroshade struct defined in the contract, a table on the database will be created that can be queried using POST /retroshade/query:
curl -X POST https://mainnet.mercurydata.app/rest/retroshade/query \
-H "Authorization: Bearer <yourjwt>" \
-H 'Content-Type: application/json' \
-d '{
"query": "SELECT * FROM retroshade.program_1_liquidity_event LIMIT 50"
}'Table naming
Tables are named retroshade.program_{id}_{target} where:
idis the integer ID assigned to your program at deploy time (returned byPOST /retroshade/deployand visible inGET /retroshade/list)targetis the snake_case version of the struct name used in your retroshade emit (e.g.LiquidityEventbecomesliquidity_event)
To discover the exact table names for your programs, use GET /retroshade/tables:
curl https://mainnet.mercurydata.app/rest/retroshade/tables \
-H "Authorization: Bearer <yourjwt>"Response:
[
{
"table_name": "program_1_liquidity_event",
"project_name_plain": "my-retroshade-program"
}
]Mercury-injected columns
Every retroshade table has three columns added automatically by Mercury. Do not define these in your struct:
contract_id
TEXT
Soroban contract that triggered the emit
transaction
TEXT
Transaction hash
_mercury_event_id
TEXT UNIQUE
Mercury dedup key -- do not use as a semantic identifier
List Retroshades Subscriptions
Returns all retroshade programs deployed by the authenticated user.
Endpoint: GET /retroshade/list
Response:
Last updated