├── README.md ├── asset-id-query-example ├── README.md └── asset-id-query-example.json ├── logs-by-contract-id-example ├── README.md └── logs-by-contract-id-example.json └── predicate-root-query-example ├── README.md └── predicate-root-query-example.json /README.md: -------------------------------------------------------------------------------- 1 | ## Queries can be made by sending a json post request to the endpoint: `https://fuel-testnet.hypersync.xyz/query` 2 | 3 | # hyperfuel-json-api 4 | 5 | HyperFuel supports a json api mainly for debugging. It's recommended to use the clients because their binary data transfer is much more efficient than json serialization. The clients also have more idiomatic response structuring, supporting functions, data filtering, and receipt ordering. 6 | - [python client](https://github.com/enviodev/hyperfuel-client-python) 7 | - [rust client](https://github.com/enviodev/hyperfuel-client-rust) 8 | - [node js client](https://github.com/enviodev/hyperfuel-client-node) 9 | 10 | # Example curl query 11 | In this example, we query from blocks 0 (inclusive) to 1300000 (exclusive) for all `Inputs` where the address `0x2a0d0ed9d2217ec7f32dcd9a1902ce2a66d68437aeff84e3a3cc8bebee0d2eea` matches on an input's `asset_id` field. 12 | 13 | Paste the example curl request into your terminal! 14 | ```bash 15 | curl --request POST \ 16 | --url https://fuel-testnet.hypersync.xyz/query \ 17 | --header 'Content-Type: application/json' \ 18 | --data '{ 19 | "from_block": 0, 20 | "to_block": 1300000, 21 | "inputs": [ 22 | { 23 | "asset_id": ["0x2a0d0ed9d2217ec7f32dcd9a1902ce2a66d68437aeff84e3a3cc8bebee0d2eea"] 24 | } 25 | ], 26 | "field_selection": { 27 | "input": [ 28 | "block_height", 29 | "tx_id", 30 | "owner", 31 | "amount", 32 | "asset_id" 33 | ] 34 | } 35 | }' 36 | ``` 37 | -------------------------------------------------------------------------------- /asset-id-query-example/README.md: -------------------------------------------------------------------------------- 1 | ### Queries can be made by sending a json post request to the endpoint: `https://fuel-testnet.hypersync.xyz/query` 2 | 3 | # asset id query example 4 | We query from blocks 0 (inclusive) to 1300000 (exclusive) for all `Inputs` where the address `0x2a0d0ed9d2217ec7f32dcd9a1902ce2a66d68437aeff84e3a3cc8bebee0d2eea` matches on an input's `asset_id` field. 5 | 6 | ## query as curl request 7 | You can paste this command into your terminal to execute the query from `asset-id-query-example.json` as a curl request. 8 | 9 | ```bash 10 | curl --request POST \ 11 | --url https://fuel-testnet.hypersync.xyz/query \ 12 | --header 'Content-Type: application/json' \ 13 | --data '{ 14 | "from_block": 0, 15 | "to_block": 1300000, 16 | "inputs": [ 17 | { 18 | "asset_id": ["0x2a0d0ed9d2217ec7f32dcd9a1902ce2a66d68437aeff84e3a3cc8bebee0d2eea"] 19 | } 20 | ], 21 | "field_selection": { 22 | "input": [ 23 | "block_height", 24 | "tx_id", 25 | "owner", 26 | "amount", 27 | "asset_id" 28 | ] 29 | } 30 | }' 31 | ``` -------------------------------------------------------------------------------- /asset-id-query-example/asset-id-query-example.json: -------------------------------------------------------------------------------- 1 | { 2 | "from_block": 0, 3 | "to_block": 1300000, 4 | "inputs": [ 5 | { 6 | "asset_id": [ 7 | "0x2a0d0ed9d2217ec7f32dcd9a1902ce2a66d68437aeff84e3a3cc8bebee0d2eea" 8 | ] 9 | } 10 | ], 11 | "field_selection": { 12 | "input": [ 13 | "block_height", 14 | "tx_id", 15 | "owner", 16 | "amount", 17 | "asset_id" 18 | ] 19 | } 20 | } -------------------------------------------------------------------------------- /logs-by-contract-id-example/README.md: -------------------------------------------------------------------------------- 1 | ## Queries can be made by sending a json post request to the endpoint: `https://fuel-testnet.hypersync.xyz/query` 2 | 3 | # logs by contract id example 4 | Queries from block 0 to 1300000 for all `LogData` receipts that were emitted by contract `0x4a2ce054e3e94155f7092f7365b212f7f45105b74819c623744ebcc5d065c6ac`. 5 | 6 | ## query as curl request 7 | You can paste this curl command into your terminal to execute the query from `logs-by-contract-id-example.json` as a curl request. 8 | 9 | ```bash 10 | curl --request POST \ 11 | --url https://fuel-testnet.hypersync.xyz/query \ 12 | --header 'Content-Type: application/json' \ 13 | --data '{ 14 | "from_block": 0, 15 | "to_block": 1300000, 16 | "receipts": [ 17 | { 18 | "root_contract_id": [ 19 | "0x4a2ce054e3e94155f7092f7365b212f7f45105b74819c623744ebcc5d065c6ac" 20 | ], 21 | "receipt_type": [ 22 | 6 23 | ] 24 | } 25 | ], 26 | "field_selection": { 27 | "receipt": [ 28 | "tx_id", 29 | "block_height", 30 | "root_contract_id", 31 | "ra", 32 | "rb", 33 | "rc", 34 | "rd", 35 | "data", 36 | "receipt_type" 37 | ] 38 | } 39 | }' 40 | ``` 41 | 42 | -------------------------------------------------------------------------------- /logs-by-contract-id-example/logs-by-contract-id-example.json: -------------------------------------------------------------------------------- 1 | { 2 | "from_block": 0, 3 | "to_block": 1300000, 4 | "receipts": [ 5 | { 6 | "root_contract_id": [ 7 | "0x4a2ce054e3e94155f7092f7365b212f7f45105b74819c623744ebcc5d065c6ac" 8 | ], 9 | "receipt_type": [ 10 | 6 11 | ] 12 | } 13 | ], 14 | "field_selection": { 15 | "receipt": [ 16 | "tx_id", 17 | "block_height", 18 | "root_contract_id", 19 | "ra", 20 | "rb", 21 | "rc", 22 | "rd", 23 | "data", 24 | "receipt_type" 25 | ] 26 | } 27 | } -------------------------------------------------------------------------------- /predicate-root-query-example/README.md: -------------------------------------------------------------------------------- 1 | ## Queries can be made by sending a json post request to the endpoint: `https://fuel-testnet.hypersync.xyz/query` 2 | 3 | 4 | # predicate root query example 5 | This example query searches for all insances where a given address is the `owner`. `owner` is ["The owning address or predicate root."](https://docs.fuel.network/docs/specs/tx-format/input/#inputcoin) of an InputCoin Input type. We search for instances of this `owner` over the block range 0 (inclusive) to 1427625 (exclusive) and return the data of that coin input. 6 | 7 | ## query as curl request 8 | You can paste this command into your terminal to execute the query from `predicate-root-query-example.json` as a curl request. 9 | 10 | ```bash 11 | curl --request POST \ 12 | --url https://fuel-testnet.hypersync.xyz/query \ 13 | --header 'User-Agent: insomnium/0.2.3-a' \ 14 | --data '{ 15 | "from_block": 0, 16 | "to_block": 1427625, 17 | "inputs": [ 18 | { 19 | "owner": [ 20 | "0x94a8e322ff02baeb1d625e83dadf5ec88870ac801da370d4b15bbd5f0af01169" 21 | ] 22 | } 23 | ], 24 | "field_selection": { 25 | "input": [ 26 | "tx_id", 27 | "block_height", 28 | "input_type", 29 | "utxo_id", 30 | "owner", 31 | "amount", 32 | "asset_id", 33 | "predicate_gas_used", 34 | "predicate", 35 | "predicate_data" 36 | ] 37 | } 38 | }' 39 | ``` -------------------------------------------------------------------------------- /predicate-root-query-example/predicate-root-query-example.json: -------------------------------------------------------------------------------- 1 | { 2 | "from_block": 0, 3 | "to_block": 1427625, 4 | "inputs": [ 5 | { 6 | "owner": [ 7 | "0x94a8e322ff02baeb1d625e83dadf5ec88870ac801da370d4b15bbd5f0af01169" 8 | ] 9 | } 10 | ], 11 | "field_selection": { 12 | "input": [ 13 | "tx_id", 14 | "block_height", 15 | "input_type", 16 | "utxo_id", 17 | "owner", 18 | "amount", 19 | "asset_id", 20 | "predicate_gas_used", 21 | "predicate", 22 | "predicate_data" 23 | ] 24 | } 25 | } --------------------------------------------------------------------------------