From 5d588007d84eeec1991e0092debbbe058e5bf40e Mon Sep 17 00:00:00 2001 From: Douglas Chimento Date: Sat, 2 Mar 2024 19:04:49 +0200 Subject: [PATCH] Add timestamp to enhanced transaction. closes #17 --- .github/workflows/publish.yml | 21 +++++++++++++++++++++ Cargo.toml | 28 ++++++++++++++-------------- src/api/types/enhanced.rs | 1 + src/lib.rs | 1 + 4 files changed, 37 insertions(+), 14 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..3f24bea --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,21 @@ +name: Publish to Crates.io + +on: + push: + tags: + - 'v*' + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - name: Login to Crates.io + uses: actions-rs/cargo@v1 + with: + command: login + args: ${{ secrets.CARGO_REGISTRY_TOKEN }} + + - name: Publish to Crates.io + run: cargo publish diff --git a/Cargo.toml b/Cargo.toml index e0e5175..113ee82 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "selene-helius-sdk" -version = "0.2.1" +version = "0.2.2" edition = "2021" authors = ["dougefresh "] description = "Rust implementation of the Helius API & RPC" @@ -12,14 +12,14 @@ license = "MIT" keywords = ["solana", "helius"] categories = ["cryptography::cryptocurrencies"] exclude = [ - "assets/*", - ".github", - "CONTRIBUTING.md", - "*.log", - "Dockerfile", - ".env*", - ".dockerignore", - "codecov.yml" + "assets/*", + ".github", + "CONTRIBUTING.md", + "*.log", + "Dockerfile", + ".env*", + ".dockerignore", + "codecov.yml" ] @@ -42,9 +42,9 @@ missing_const_for_fn = "allow" [dependencies] -solana-client = { version = ">= 1.16" } +solana-client = { version = ">= 1.16" } solana-sdk = { version = ">= 1.16" } -reqwest = {version = "0.11", features = [ "json"] } +reqwest = { version = "0.11", features = ["json"] } serde-enum-str = "0.4" serde_json = "1" serde = { version = "1", features = ["derive"] } @@ -53,11 +53,11 @@ tokio = { version = "> 1.24", features = ["full"] } color-eyre = { version = "0.6" } thiserror = "1" url = "2" -tracing = { version = "0.1" } -tracing-log = {version = "0.2" } +tracing = { version = "0.1" } +tracing-log = { version = "0.2" } tracing-error = { version = "0.2" } tracing-subscriber = { version = "0.3", features = ["env-filter", "serde"] } -bigdecimal = { version = "^0.3", features = ["serde"] } +bigdecimal = { version = "^0.3", features = ["serde"] } [dev-dependencies] dotenvy = "0.15" diff --git a/src/api/types/enhanced.rs b/src/api/types/enhanced.rs index c0a76b6..34e8f14 100644 --- a/src/api/types/enhanced.rs +++ b/src/api/types/enhanced.rs @@ -20,6 +20,7 @@ pub struct EnhancedTransaction { pub transaction_error: Option, pub instructions: Vec, pub events: TransactionEvent, + pub timestamp: u64, } #[derive(Deserialize, Serialize, Debug)] diff --git a/src/lib.rs b/src/lib.rs index b352743..761f4e3 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -158,6 +158,7 @@ mod tests { let sigs = ParseTransactionsRequest::from_slice(&sigs); let res = client.parse_transaction(&sigs[0]).await?; assert!(!res.is_empty()); + assert!(res[0].timestamp > 0); Ok(()) }