You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/content/data-streams/tutorials/api-rwa-go.mdx
+23-25Lines changed: 23 additions & 25 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -107,7 +107,7 @@ You'll start with the set up of your Go project. Next, you'll fetch and decode r
107
107
funcmain() {
108
108
// Validate command-line arguments
109
109
iflen(os.Args) < 2 {
110
-
fmt.Printf("Usage: go run main.go [FeedID]\nExample: go run main.go 0x000434a5b30cafe7e853832a458ea1591dc2f5fb5e4cf80b9979b8248065a7ea\n")
110
+
fmt.Printf("Usage: go run main.go [FeedID]\nExample: go run main.go [FEED_ID]\n")
111
111
os.Exit(1)
112
112
}
113
113
feedIDInput:= os.Args[1]
@@ -216,21 +216,21 @@ You'll start with the set up of your Go project. Next, you'll fetch and decode r
216
216
217
217
See the [SDK Reference](/data-streams/reference/go-sdk#config-struct) page for more configuration options.
218
218
219
-
1. For this example, you will read from the AUD/USD stream. This stream ID is <CopyTexttext="0x000434a5b30cafe7e853832a458ea1591dc2f5fb5e4cf80b9979b8248065a7ea"code/>. See the [Data Streams RWA streams](/data-streams/rwa-streams) page for a complete list of available Real World Assets.
219
+
1. For this example, you will read from an RWA stream. See the [Data Streams RWA streams](/data-streams/rwa-streams) page for a complete list of available Real World Assets.
220
220
221
-
Execute your application:
221
+
Execute your application. Replace `[STREAM_ID]` with your stream ID.
222
222
223
223
```bash
224
-
go run single-stream.go 0x000434a5b30cafe7e853832a458ea1591dc2f5fb5e4cf80b9979b8248065a7ea
224
+
go run single-stream.go [STREAM_ID]
225
225
```
226
226
227
227
Expect output similar to the following in your terminal:
228
228
229
229
```bash
230
-
2024-12-14T17:50:49-05:00 Raw report data: {"fullReport":"0x0006aee203ef23a892e75b579f8c3f26fd933d9ca45de95c2f8ac470f4ddcd76000000000000000000000000000000000000000000000000000000000b75880c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000026001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000434a5b30cafe7e853832a458ea1591dc2f5fb5e4cf80b9979b8248065a7ea00000000000000000000000000000000000000000000000000000000675e0bc900000000000000000000000000000000000000000000000000000000675e0bc90000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000675f5d4900000000000000000000000000000000000000000000000008d460e8b7e50000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000023f21e9d219ae8e279d13a36b09a439ed71c0d1118561a93987c665fbad13cb6e37bd3763d7ef840b05fda0671b01f26f3c073bef1f3b53fcd9429836ba25eae600000000000000000000000000000000000000000000000000000000000000026bd87b2293422e41ec242088d8feedbe126474b791a85e54450af84e21d017fd59158fbe4adf47dcabe54c11a8ca606659e060839474545eb9b13bf5e7c902df","feedID":"0x000434a5b30cafe7e853832a458ea1591dc2f5fb5e4cf80b9979b8248065a7ea","validFromTimestamp":1734216649,"observationsTimestamp":1734216649}
230
+
2024-12-14T17:50:49-05:00 Raw report data: {"fullReport":"0x...","feedID":"[STREAM_ID]","validFromTimestamp":1734216649,"observationsTimestamp":1734216649}
231
231
232
232
2024-12-14T17:50:49-05:00
233
-
Decoded Report for Stream ID 0x000434a5b30cafe7e853832a458ea1591dc2f5fb5e4cf80b9979b8248065a7ea:
233
+
Decoded Report for Stream ID [STREAM_ID]:
234
234
------------------------------------------
235
235
Observations Timestamp: 1734216649
236
236
Benchmark Price : 636240000000000000
@@ -246,16 +246,16 @@ You'll start with the set up of your Go project. Next, you'll fetch and decode r
|`Stream ID`|`0x000434a5b30cafe7e853832a458ea1591dc2f5fb5e4cf80b9979b8248065a7ea`| The unique identifier for the stream. In this example, the stream is for AUD/USD.|
252
-
|`Observations Timestamp`|`1734216649`| The timestamp indicating when the data was captured. |
253
-
|`Benchmark Price`|`636240000000000000`| The observed price in the report, with 18 decimals. For readability: `0.63624` USD per AUD. |
254
-
|`Valid From Timestamp`|`1734216649`| The start validity timestamp for the report, indicating when the data becomes relevant. |
255
-
|`Expires At`|`1734303049`| The expiration timestamp of the report, indicating the point at which the data becomes outdated. |
256
-
|`Link Fee`|`0`| The fee to pay in LINK tokens for the onchain verification of the report data. With 18 decimals. **Note:** This example fee is not indicative of actual fees. |
257
-
|`Native Fee`|`0`| The fee to pay in the native blockchain token (e.g., ETH on Ethereum) for the onchain verification of the report data. With 18 decimals. **Note:** This example fee is not indicative of actual fees. |
258
-
|`Market Status`|`1`| The DON's consensus on whether the market is currently open. Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). |
|`Stream ID`|`[STREAM_ID]`| The unique identifier for the stream. |
252
+
|`Observations Timestamp`|`1734216649`| The timestamp indicating when the data was captured. |
253
+
|`Benchmark Price`|`636240000000000000`| The observed price in the report, with 18 decimals. For readability: `0.63624` USD per AUD. |
254
+
|`Valid From Timestamp`|`1734216649`| The start validity timestamp for the report, indicating when the data becomes relevant. |
255
+
|`Expires At`|`1734303049`| The expiration timestamp of the report, indicating the point at which the data becomes outdated. |
256
+
|`Link Fee`|`0`| The fee to pay in LINK tokens for the onchain verification of the report data. With 18 decimals. **Note:** This example fee is not indicative of actual fees. |
257
+
|`Native Fee`|`0`| The fee to pay in the native blockchain token (e.g., ETH on Ethereum) for the onchain verification of the report data. With 18 decimals. **Note:** This example fee is not indicative of actual fees. |
258
+
|`Market Status`|`1`| The DON's consensus on whether the market is currently open. Possible values: `0` (`Unknown`), `1` (`Closed`), `2` (`Open`). |
259
259
260
260
#### Payload for onchain verification
261
261
@@ -292,9 +292,7 @@ production environment, you should verify the data to ensure its integrity and a
292
292
// Validate command-line arguments
293
293
iflen(os.Args) < 3 {
294
294
fmt.Printf("Usage: go run multiple-streams.go [StreamID1] [StreamID2] ...\n"+
"Example: go run multiple-streams.go [STREAM_ID_1] [STREAM_ID_2]\n")
298
296
os.Exit(1)
299
297
}
300
298
@@ -401,19 +399,19 @@ production environment, you should verify the data to ensure its integrity and a
401
399
export API_SECRET="<YOUR_API_SECRET>"
402
400
```
403
401
404
-
1. For this example, you will read from the AUD/USD and EUR/USD RWA streams. Run your application:
402
+
1. For this example, you will read from two RWA streams. Run your application. Replace `[STREAM_ID_1]` and `[STREAM_ID_2]` with your stream IDs.
405
403
406
404
```bash
407
-
go run multiple-streams.go 0x000434a5b30cafe7e853832a458ea1591dc2f5fb5e4cf80b9979b8248065a7ea 0x0004b9905d8337c34e00f8dbe31619428bac5c3937e73e6af75c71780f1770ce
405
+
go run multiple-streams.go [STREAM_ID_1] [STREAM_ID_2]
408
406
```
409
407
410
408
Expect to see output similar to the following in your terminal:
411
409
412
410
```bash
413
-
2024-12-14T17:53:30-05:00 Raw report data for Stream ID 0x000434a5b30cafe7e853832a458ea1591dc2f5fb5e4cf80b9979b8248065a7ea: {"fullReport":"0x0006aee203ef23a892e75b579f8c3f26fd933d9ca45de95c2f8ac470f4ddcd76000000000000000000000000000000000000000000000000000000000b75a101000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000026000010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000434a5b30cafe7e853832a458ea1591dc2f5fb5e4cf80b9979b8248065a7ea00000000000000000000000000000000000000000000000000000000675e0c6900000000000000000000000000000000000000000000000000000000675e0c690000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000675f5de900000000000000000000000000000000000000000000000008d460e8b7e500000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000255d50eabaa1620b13c01d671b4b8478cbbf3c00a66c96652de0a4abd033447d4077c56723b911f683224b08615cb37103422a0c72f10930f2b2cf5d69ffa7a4100000000000000000000000000000000000000000000000000000000000000022139022d94d5ba9a5d7257866ab5ac2a892de57532a6d15f4d3bb4e0616fc89f26fcf652f60f3227466f986db7a494fdb2e71e7921eaedbfa7e6248220770373","feedID":"0x000434a5b30cafe7e853832a458ea1591dc2f5fb5e4cf80b9979b8248065a7ea","validFromTimestamp":1734216809,"observationsTimestamp":1734216809}
411
+
2024-12-14T17:53:30-05:00 Raw report data for Stream ID [STREAM_ID_1]: {"fullReport":"0x...","feedID":"[STREAM_ID_1]","validFromTimestamp":1734216809,"observationsTimestamp":1734216809}
414
412
415
413
416
-
Decoded Report for Stream ID 0x000434a5b30cafe7e853832a458ea1591dc2f5fb5e4cf80b9979b8248065a7ea:
414
+
Decoded Report for Stream ID [STREAM_ID_1]:
417
415
------------------------------------------
418
416
Observations Timestamp: 1734216809
419
417
Benchmark Price : 636240000000000000
@@ -423,10 +421,10 @@ production environment, you should verify the data to ensure its integrity and a
423
421
Native Fee : 0
424
422
Market Status : 1
425
423
------------------------------------------
426
-
2024-12-14T17:53:30-05:00 Raw report data for Stream ID 0x0004b9905d8337c34e00f8dbe31619428bac5c3937e73e6af75c71780f1770ce: {"fullReport":"0x00062f2fdc48a5bb737dad7fac44e3d35f5d0a0c43091fea90011dbcd3ca39ff000000000000000000000000000000000000000000000000000000000d25a501000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000000260000100000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001000004b9905d8337c34e00f8dbe31619428bac5c3937e73e6af75c71780f1770ce00000000000000000000000000000000000000000000000000000000675e0c6900000000000000000000000000000000000000000000000000000000675e0c690000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000675f5de90000000000000000000000000000000000000000000000000e933ccf7f5aa00000000000000000000000000000000000000000000000000000000000000000010000000000000000000000000000000000000000000000000000000000000002266357ecc8bccb8199db1d62be6b26ff251e51d821abac59095ffa3bd53f2b671ba72e1f0157b7269578f24574d75f21f4e16340e924a39966385a9204c7f5c5000000000000000000000000000000000000000000000000000000000000000258e69e20a244ec3dc6bcb309d08479656b37160e2210dd7278b6be12296456184d3871968c7511af5beec82528e6f8a9caedffd12f93ca65425850a400343299","feedID":"0x0004b9905d8337c34e00f8dbe31619428bac5c3937e73e6af75c71780f1770ce","validFromTimestamp":1734216809,"observationsTimestamp":1734216809}
424
+
2024-12-14T17:53:30-05:00 Raw report data for Stream ID [STREAM_ID_2]: {"fullReport":"0x...","feedID":"[STREAM_ID_2]","validFromTimestamp":1734216809,"observationsTimestamp":1734216809}
427
425
428
426
429
-
Decoded Report for Stream ID 0x0004b9905d8337c34e00f8dbe31619428bac5c3937e73e6af75c71780f1770ce:
0 commit comments