Skip to content

Releases: smartcontractkit/data-streams-sdk

v1.0.3

08 Aug 18:42
fb56ce0

Choose a tag to compare

Data Streams SDK - v1.0.3 Release (8 Aug 2025)

This release adds Report Schema versions 5, 6 & 7 which look like this:

V5

const reportBlobAbiV5 = [
  { type: 'bytes32', name: 'feedId' },
  { type: 'uint32', name: 'validFromTimestamp' },
  { type: 'uint32', name: 'observationsTimestamp' },
  { type: 'uint192', name: 'nativeFee' },
  { type: 'uint192', name: 'linkFee' },
  { type: 'uint32', name: 'expiresAt' },
  { type: 'int192', name: 'rate' },
  { type: 'uint32', name: 'timestamp' },
  { type: 'uint32', name: 'duration' },
]

V6

const reportBlobAbiV6 = [
  { type: 'bytes32', name: 'feedId' },
  { type: 'uint32', name: 'validFromTimestamp' },
  { type: 'uint32', name: 'observationsTimestamp' },
  { type: 'uint192', name: 'nativeFee' },
  { type: 'uint192', name: 'linkFee' },
  { type: 'uint32', name: 'expiresAt' },
  { type: 'int192', name: 'price' },
  { type: 'int192', name: 'price2' },
  { type: 'int192', name: 'price3' },
  { type: 'int192', name: 'price4' },
  { type: 'int192', name: 'price5' },
]

V7

const reportBlobAbiV7 = [
  { type: 'bytes32', name: 'feedId' },
  { type: 'uint32', name: 'validFromTimestamp' },
  { type: 'uint32', name: 'observationsTimestamp' },
  { type: 'uint192', name: 'nativeFee' },
  { type: 'uint192', name: 'linkFee' },
  { type: 'uint32', name: 'expiresAt' },
  { type: 'int192', name: 'exchangeRate' },
]

Changelog

Added

  • Added support for Report Schema version 5 to Go and Rust SDKs
  • Added support for Report Schema version 6 to Go and Rust SDKs
  • Added support for Report Schema version 7 to Go and Rust SDKs

Changed

Removed

  • /

Testing the release

To test this release use Data Streams SDK with the following examples as a starting point (we are showcasing usage of the Report Schema Version 5, but you can adjust them in the same way for Versions 6 and 7):

Go

Create the following go.mod file:

module example-sdk-consumer

go 1.24.5

require github.com/smartcontractkit/data-streams-sdk/go v1.0.3

// do not forget to run: go mod tidy

And start with the following main.go file:

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"log"

	streams "github.com/smartcontractkit/data-streams-sdk/go"
	"github.com/smartcontractkit/data-streams-sdk/go/feed"
	"github.com/smartcontractkit/data-streams-sdk/go/report"
	v5 "github.com/smartcontractkit/data-streams-sdk/go/report/v5"
)

func main() {
	apiKey := "YOUR_API_KEY_GOES_HERE"
	apiSecret := "YOUR_API_SECRET_GOES_HERE"
	restURL := "https://api.testnet-dataengine.chain.link"
	wsURL := "wss://api.testnet-dataengine.chain.link/ws"

	feedID := &feed.ID{}
	err := feedID.FromString("0x0005d559f0a35709ae9ba533476c553be3f55f4517a81c8b168a7a978470c32e")
	if err != nil {
		log.Fatal(err)
	}

	// Initialize the client
	client, err := streams.New(streams.Config{
		ApiKey:    apiKey,
		ApiSecret: apiSecret,
		RestURL:   restURL,
		WsURL:     wsURL,
	})
	if err != nil {
		log.Fatal(err)
	}

	// Get the latest report
	response, err := client.GetLatestReport(context.Background(), *feedID)
	if err != nil {
		log.Fatal(err)
	}

	// Decode the report data as V5
	reportData, err := report.Decode[v5.Data](response.FullReport)
	if err != nil {
		log.Fatal(err)
	}

	// Print report data
	jsonBytes, err := json.MarshalIndent(reportData.Data, "", "  ")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(string(jsonBytes))
}

Rust

Create the following Cargo.toml file:

[package]
name = "example-sdk-consumer"
version = "0.1.0"
edition = "2024"

[dependencies]
chainlink-data-streams-report = "1.0.3"
chainlink-data-streams-sdk = "1.0.3"
hex = "0.4"
tokio = { version = "1", features = ["full"] }

And start with the following main.rs file:

use chainlink_data_streams_report::feed_id::ID;
use chainlink_data_streams_report::report::{decode_full_report, v5::ReportDataV5};
use chainlink_data_streams_sdk::client::Client;
use chainlink_data_streams_sdk::config::Config;
use std::error::Error;

#[tokio::main]
async fn get_latest_report() -> Result<(), Box<dyn Error>> {
    let api_key = "YOUR_API_KEY_GOES_HERE";
    let user_secret = "YOUR_USER_SECRET_GOES_HERE";
    let rest_url = "https://api.testnet-dataengine.chain.link";
    let ws_url = "wss://api.testnet-dataengine.chain.link/ws";

    let feed_id =
        ID::from_hex_str("0x0005d559f0a35709ae9ba533476c553be3f55f4517a81c8b168a7a978470c32e")
            .unwrap();

    // Initialize the configuration
    let config = Config::new(
        api_key.to_string(),
        user_secret.to_string(),
        rest_url.to_string(),
        ws_url.to_string(),
    )
    .build()?;

    // Initialize the client
    let client = Client::new(config)?;

    // Make a GET request to "/api/v1/reports/latest?feedID={feed_id}"
    let response = client.get_latest_report(feed_id).await?;

    let report = response.report;

    // Uncomment to print the raw report data
    // println!("Raw Report data: {}", report.full_report);

    let full_report = hex::decode(&report.full_report[2..])?;
    let (_report_context, report_blob) = decode_full_report(&full_report)?;

    let report_data = ReportDataV5::decode(&report_blob)?;
    println!("{:#?}", report_data);

    Ok(())
}

fn main() {
    let _ = get_latest_report();
}

PRs included

Full Changelog: go/v1.0.2...go/v1.0.3

v1.0.2

07 Aug 22:08
29ae48c

Choose a tag to compare

Data Streams SDK - v1.0.2 Release (7 Aug 2025)

This release adds Report Schema version 10 which looks like this:

const reportBlobAbiV10 = [
  { type: 'bytes32', name: 'feedId' },
  { type: 'uint32', name: 'validFromTimestamp' },
  { type: 'uint32', name: 'observationsTimestamp' },
  { type: 'uint192', name: 'nativeFee' },
  { type: 'uint192', name: 'linkFee' },
  { type: 'uint32', name: 'expiresAt' },
  { type: 'uint64', name: 'lastUpdateTimestamp' },
  { type: 'int192', name: 'price' },
  { type: 'uint32', name: 'marketStatus' },
  { type: 'int192', name: 'currentMultiplier' },
  { type: 'int192', name: 'newMultiplier' },
  { type: 'uint32', name: 'activationDateTime' },
  { type: 'int192', name: 'tokenizedPrice' },
]

Changelog

Added

  • Added support for Report Schema version 10 to Go and Rust SDK versions

Changed

Removed

  • /

Testing the release

To test this release use Data Streams SDK with the following examples as a starting point:

Go

Create the following go.mod file:

module example-sdk-consumer

go 1.24.5

require github.com/smartcontractkit/data-streams-sdk/go v1.0.2

// do not forget to run: go mod tidy

And start with the following main.go file:

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"log"

	streams "github.com/smartcontractkit/data-streams-sdk/go"
	"github.com/smartcontractkit/data-streams-sdk/go/feed"
	"github.com/smartcontractkit/data-streams-sdk/go/report"
	v10 "github.com/smartcontractkit/data-streams-sdk/go/report/v10"
)

func main() {
	apiKey := "YOUR_API_KEY_GOES_HERE"
	apiSecret := "YOUR_API_SECRET_GOES_HERE"
	restURL := "https://api.testnet-dataengine.chain.link"
	wsURL := "wss://api.testnet-dataengine.chain.link/ws"

	feedID := &feed.ID{}
	err := feedID.FromString("0x000a467071063234dc6dabf93febccc424c54a9e0e73e4094d3e7fda375b4f3f")
	if err != nil {
		log.Fatal(err)
	}

	// Initialize the client
	client, err := streams.New(streams.Config{
		ApiKey:    apiKey,
		ApiSecret: apiSecret,
		RestURL:   restURL,
		WsURL:     wsURL,
	})
	if err != nil {
		log.Fatal(err)
	}

	// Get the latest report
	response, err := client.GetLatestReport(context.Background(), *feedID)
	if err != nil {
		log.Fatal(err)
	}

	// Decode the report data as V10
	reportData, err := report.Decode[v10.Data](response.FullReport)
	if err != nil {
		log.Fatal(err)
	}

	// Print report data
	jsonBytes, err := json.MarshalIndent(reportData.Data, "", "  ")
	if err != nil {
		log.Fatal(err)
	}
	fmt.Println(string(jsonBytes))
}

Rust

Create the following Cargo.toml file:

[package]
name = "example-sdk-consumer"
version = "0.1.0"
edition = "2024"

[dependencies]
chainlink-data-streams-report = "1.0.2"
chainlink-data-streams-sdk = "1.0.2"
hex = "0.4"
tokio = { version = "1", features = ["full"] }

And start with the following main.rs file:

use chainlink_data_streams_report::feed_id::ID;
use chainlink_data_streams_report::report::{decode_full_report, v10::ReportDataV10};
use chainlink_data_streams_sdk::client::Client;
use chainlink_data_streams_sdk::config::Config;
use std::error::Error;

#[tokio::main]
async fn get_latest_report() -> Result<(), Box<dyn Error>> {
    let api_key = "YOUR_API_KEY_GOES_HERE";
    let user_secret = "YOUR_USER_SECRET_GOES_HERE";
    let rest_url = "https://api.testnet-dataengine.chain.link";
    let ws_url = "wss://api.testnet-dataengine.chain.link/ws";

    let feed_id =
        ID::from_hex_str("0x000a467071063234dc6dabf93febccc424c54a9e0e73e4094d3e7fda375b4f3f")
            .unwrap();

    // Initialize the configuration
    let config = Config::new(
        api_key.to_string(),
        user_secret.to_string(),
        rest_url.to_string(),
        ws_url.to_string(),
    )
    .build()?;

    // Initialize the client
    let client = Client::new(config)?;

    // Make a GET request to "/api/v1/reports/latest?feedID={feed_id}"
    let response = client.get_latest_report(feed_id).await?;

    let report = response.report;

    // Uncomment to print the raw report data
    // println!("Raw Report data: {}", report.full_report);

    let full_report = hex::decode(&report.full_report[2..])?;
    let (_report_context, report_blob) = decode_full_report(&full_report)?;

    let report_data = ReportDataV10::decode(&report_blob)?;
    println!("{:#?}", report_data);

    Ok(())
}

fn main() {
    let _ = get_latest_report();
}

PRs included

Full Changelog: go/v1.0.1...go/v1.0.2

v1.0.1

29 Jul 12:53
74c3aea

Choose a tag to compare

Added new report schemas