Skip to content

Commit f8efde2

Browse files
committed
fix(docs): add enhancement to the FDC guides
1 parent 8377d13 commit f8efde2

File tree

1 file changed

+28
-22
lines changed

1 file changed

+28
-22
lines changed
Lines changed: 28 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,48 @@
11
---
22
title: JsonApi
3-
description: An attestation request that fetches data from the given url and then edits the information with a jq transformation.
4-
keywords: [fdc, oracle, flare-data-connector, flare-network]
3+
description: An attestation type that fetches and transforms JSON data from web APIs using JQ transformations.
4+
keywords: [fdc, oracle, flare-data-connector, flare-network, json, api, web2]
55
sidebar_position: 1
66
---
77

8-
An attestation request that fetches data from the given url and then edits the information with a jq transformation.
8+
An attestation type that enables secure data retrieval from Web2 JSON APIs with custom JQ transformations. This attestation type allows smart contracts to access and process external JSON data in a verifiable way.
9+
10+
:::warning[Testing Networks Only]
11+
JsonApi attestation type is currently only available on Coston and Coston2 test networks.
12+
:::
913

1014
## Supported sources
1115

12-
- `WEB2`
13-
- test networks: `testWEB2`
16+
- `WEB2` (Web 2.0 JSON APIs)
17+
- Test networks: `testWEB2`
1418

1519
## Request
1620

17-
| Field | Solidity type | Description |
18-
| --------------- | ------------- | -------------------------------------------------------- |
19-
| `url` | `string` | URL of the data source. |
20-
| `postprocessJq` | `string` | JQ filter to postprocess the json received from the url. |
21-
| `abi_signature` | `string` | ABI signature of struct for encoding. |
21+
| Field | Solidity Type | Description |
22+
| --------------- | ------------- | -------------------------------------------------------------------------------- |
23+
| `url` | `string` | URL of the JSON API endpoint to query. |
24+
| `postprocessJq` | `string` | JQ filter expression to transform the retrieved JSON data. |
25+
| `abi_signature` | `string` | ABI signature defining the struct format for encoding the transformed JSON data. |
2226

2327
## Response
2428

25-
| Field | Solidity type | Description |
26-
| ------------------ | ------------- | ----------------- |
27-
| `abi_encoded_data` | `bytes` | ABI encoded data. |
28-
29-
## Lowest Used Timestamp
29+
| Field | Solidity Type | Description |
30+
| ------------------ | ------------- | ------------------------------------------------ |
31+
| `abi_encoded_data` | `bytes` | ABI-encoded data result after JQ transformation. |
3032

31-
For `lowestUsedTimestamp`, `0xffffffffffffffff` ($2^{64}-1$ in hex) is used.
33+
## Verification Process
3234

33-
## Verification process
35+
1. The attestation service performs a GET request to the specified `url`.
3436

35-
Query the URL with GET method.
36-
If the query is unsuccessful or does not return a json, reject the request.
37+
- If the request fails or returns non-JSON data, the attestation request is rejected.
38+
- The service validates that the response is valid JSON data.
3739

38-
Apply the jq filter specified in the request to the received json.
40+
2. The specified `postprocessJq` filter is applied to the retrieved JSON:
3941

40-
ABI encode the filtered json with the abi_signature provided in the request and return it as abi_encoded_data.
42+
- The JQ filter must be a valid JQ expression.
43+
- The filter's output must match the structure defined in `abi_signature`.
44+
- If the JQ transformation fails, the attestation request is rejected.
4145

42-
`LowestUsedTimestamp` is unlimited.
46+
3. The transformed data is ABI-encoded according to the provided `abi_signature`:
47+
- The encoding must match the Solidity ABI specification.
48+
- The encoded bytes are returned in `abi_encoded_data`.

0 commit comments

Comments
 (0)