Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# data-streams-sdk

Chainlink Data Streams client SDK implementation.

See the language directories for specific documentation, usage and examples.

## [Go](go/README.md) [![go.dev reference](https://img.shields.io/badge/go-reference-blue)](https://pkg.go.dev/github.com/smartcontractkit/data-streams-sdk/go) [![Go Report Card](https://goreportcard.com/badge/github.com/smartcontractkit/data-streams-sdk/go)](https://goreportcard.com/report/github.com/smartcontractkit/data-streams-sdk/go) [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/smartcontractkit/data-streams-sdk/blob/main/LICENSE)

## [Rust](rust/README.md) ![Crates.io sdk](https://img.shields.io/crates/v/chainlink-data-streams-sdk?label=chainlink-data-streams-sdk) ![Crates.io report](https://img.shields.io/crates/v/chainlink-data-streams-report?label=chainlink-data-streams-report) [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/smartcontractkit/data-streams-sdk/blob/main/LICENSE)
74 changes: 37 additions & 37 deletions rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

20 changes: 10 additions & 10 deletions rust/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ The Data Streams SDK is a Rust library that provides a convenient way to consume

The project is organized into the following crates:

- `data-streams-report` - The crate that provides the data structures for the reports.
- `data-streams-sdk` - The main crate that provides the REST and WebSocket clients.
- `chainlink-data-streams-report` - The crate that provides the data structures for the reports.
- `chainlink-data-streams-sdk` - The main crate that provides the REST and WebSocket clients.

## Installation

Add the following to your `Cargo.toml`:

```toml
[dependencies]
data-streams-sdk = { git = "https://github.com/smartcontractkit/data-streams-sdk.git", subdir = "rust/crates/sdk" }
chainlink-data-streams-sdk = { version = "0.1.0", features = ["full"] }
```

#### Features
Expand All @@ -37,10 +37,10 @@ data-streams-sdk = { git = "https://github.com/smartcontractkit/data-streams-sdk
Here is the basic example that demontstrates how to get the latest report for a ETH/USD feed on Arbitrum Sepolia:

```rust
use data_streams_report::feed_id::ID;
use data_streams_report::report::{decode_full_report, v3::ReportDataV3};
use data_streams_sdk::client::Client;
use data_streams_sdk::config::Config;
use chainlink_data_streams_report::feed_id::ID;
use chainlink_data_streams_report::report::{decode_full_report, v3::ReportDataV3};
use chainlink_data_streams_sdk::client::Client;
use chainlink_data_streams_sdk::config::Config;
use std::error::Error;

#[tokio::main]
Expand Down Expand Up @@ -94,9 +94,9 @@ async fn main() -> Result<(), Box<dyn Error>> {
Here is the basic example that demonstrates how to connect to the Data Streams WebSocket server and subscribe to a single stream of ETH/USD Feed Reports on Arbitrum Sepolia:

```rust
use data_streams_report::feed_id::ID;
use data_streams_sdk::config::Config;
use data_streams_sdk::stream::Stream;
use chainlink_data_streams_report::feed_id::ID;
use chainlink_data_streams_sdk::config::Config;
use chainlink_data_streams_sdk::stream::Stream;
use tokio::signal;
use tracing_subscriber::fmt::time::UtcTime;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish Chainlink Data Streams Report Crate

on:
push:
tags:
- "rust/chainlink-data-streams-report-v*"
workflow_dispatch: # Keeping manual trigger as fallback

jobs:
publish:
runs-on: ubuntu-latest
environment: publish

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable

- name: Verify tag matches version
run: |
VERSION=$(grep '^version = "' rust/crates/report/Cargo.toml | cut -d '"' -f2)
TAG_VERSION=${GITHUB_REF#refs/tags/rust/chainlink-data-streams-report-v}
if [ "$VERSION" != "$TAG_VERSION" ]; then
echo "Version mismatch: Cargo.toml ($VERSION) != tag ($TAG_VERSION)"
exit 1
fi

- name: Publish chainlink-data-streams-report
run: |
cd rust/crates/report
cargo publish --token ${CARGO_DATA_STREAMS_SDK}
if ! cargo owner --list | grep -q "github:smartcontractkit:RustCrates"; then
cargo owner --add github:smartcontractkit:RustCrates
fi
env:
CARGO_DATA_STREAMS_SDK: ${{ secrets.CARGO_DATA_STREAMS_SDK }}
2 changes: 1 addition & 1 deletion rust/crates/report/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "data-streams-report"
name = "chainlink-data-streams-report"
version = "0.0.1"
edition = "2021"
description = "Chainlink Data Streams Report"
Expand Down
38 changes: 38 additions & 0 deletions rust/crates/sdk/.github/workflows/publish-rust-sdk-crate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Publish Chainlink Data Streams SDK Crate

on:
push:
tags:
- "rust/chainlink-data-streams-sdk-v*"
workflow_dispatch: # Keeping manual trigger as fallback

jobs:
publish:
runs-on: ubuntu-latest
environment: publish

steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Setup Rust
uses: dtolnay/rust-toolchain@stable

- name: Verify tag matches version
run: |
VERSION=$(grep '^version = "' rust/crates/sdk/Cargo.toml | cut -d '"' -f2)
TAG_VERSION=${GITHUB_REF#refs/tags/rust/chainlink-data-streams-sdk-v}
if [ "$VERSION" != "$TAG_VERSION" ]; then
echo "Version mismatch: Cargo.toml ($VERSION) != tag ($TAG_VERSION)"
exit 1
fi

- name: Publish chainlink-data-streams-sdk
run: |
cd rust/crates/sdk
cargo publish --token ${CARGO_DATA_STREAMS_SDK}
if ! cargo owner --list | grep -q "github:smartcontractkit:RustCrates"; then
cargo owner --add github:smartcontractkit:RustCrates
fi
env:
CARGO_DATA_STREAMS_SDK: ${{ secrets.CARGO_DATA_STREAMS_SDK }}
4 changes: 2 additions & 2 deletions rust/crates/sdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "data-streams-sdk"
name = "chainlink-data-streams-sdk"
version = "0.0.1"
edition = "2021"
rust-version = "1.70"
Expand All @@ -11,7 +11,7 @@ exclude = ["/target/*", "examples/*", "tests/*", "docs/*", "book/*"]
keywords = ["chainlink"]

[dependencies]
data-streams-report = { git = "https://github.com/smartcontractkit/data-streams-sdk.git", subdir = "rust/crates/report" }
chainlink-data-streams-report = "0.0.1"
reqwest = { version = "0.11.20", features = ["json", "rustls-tls"] }
tokio = { version = "1.29.1", features = ["full"] }
tokio-tungstenite = { version = "0.20.1", features = [
Expand Down
Loading