From b1242daf9cf16e8fe00aa90543c3cdbb156b21bc Mon Sep 17 00:00:00 2001 From: Sild Date: Wed, 21 Aug 2024 12:08:42 +0200 Subject: [PATCH] Support getLibraries method (#6) * Support getLibraries * Update github-ci --------- Co-authored-by: Dmitrii Korchagin --- .github/workflows/ci.yml | 52 +++----------------------------------- liteapi/src/tl/common.rs | 8 ++++++ liteapi/src/tl/request.rs | 10 ++++++++ liteapi/src/tl/response.rs | 10 ++++++++ 4 files changed, 32 insertions(+), 48 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 139a5f2..5a41c12 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,8 +3,8 @@ on: [push, pull_request] name: Continuous integration jobs: - check: - name: Check + build: + name: Build liteapi runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 @@ -15,50 +15,6 @@ jobs: override: true - uses: actions-rs/cargo@v1 with: - command: check + command: build + args: --manifest-path=liteapi/Cargo.toml -# test: -# name: Test Suite -# runs-on: ubuntu-latest -# steps: -# - uses: actions/checkout@v2 -# - uses: actions-rs/toolchain@v1 -# with: -# profile: minimal -# toolchain: stable -# override: true -# - uses: actions-rs/cargo@v1 -# with: -# command: test - - fmt: - name: Rustfmt - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - run: rustup component add rustfmt - - uses: actions-rs/cargo@v1 - with: - command: fmt - args: --all -- --check - - clippy: - name: Clippy - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions-rs/toolchain@v1 - with: - profile: minimal - toolchain: stable - override: true - - run: rustup component add clippy - - uses: actions-rs/cargo@v1 - with: - command: clippy - args: -- -D warnings diff --git a/liteapi/src/tl/common.rs b/liteapi/src/tl/common.rs index 0f3d8e2..fef82ce 100644 --- a/liteapi/src/tl/common.rs +++ b/liteapi/src/tl/common.rs @@ -190,3 +190,11 @@ pub struct TransactionId { #[tl(flags_bit = "mode.2")] pub hash: Option, } + +/// liteServer.libraryEntry hash:int256 data:bytes = liteServer.LibraryEntry; +#[derive(TlRead, TlWrite, Derivative)] +#[derivative(Debug, Clone, PartialEq)] +pub struct LibraryEntry { + pub hash: Int256, + pub data: Vec, +} diff --git a/liteapi/src/tl/request.rs b/liteapi/src/tl/request.rs index 8853220..79f1f9e 100644 --- a/liteapi/src/tl/request.rs +++ b/liteapi/src/tl/request.rs @@ -256,6 +256,12 @@ pub struct GetValidatorStats { pub modified_after: Option, } +#[derive(TlRead, TlWrite, Derivative)] +#[derivative(Debug, Clone, PartialEq)] +pub struct GetLibraries { + pub library_list: Vec, +} + #[derive(TlRead, TlWrite, Derivative)] #[derivative(Debug, Clone, PartialEq)] #[tl(boxed)] @@ -339,4 +345,8 @@ pub enum Request { /// liteServer.getValidatorStats#091a58bc mode:# id:tonNode.blockIdExt limit:int start_after:mode.0?int256 modified_after:mode.2?int = liteServer.ValidatorStats; #[tl(id = 0xe7253699)] GetValidatorStats(GetValidatorStats), + + /// liteServer.getLibraries library_list:(vector int256) = liteServer.LibraryResult; + #[tl(id = 0xd122b662)] + GetLibraries(GetLibraries), } diff --git a/liteapi/src/tl/response.rs b/liteapi/src/tl/response.rs index be84e4d..6ea60b0 100644 --- a/liteapi/src/tl/response.rs +++ b/liteapi/src/tl/response.rs @@ -225,6 +225,12 @@ pub struct ValidatorStats { pub data_proof: Vec, } +#[derive(TlRead, TlWrite, Derivative)] +#[derivative(Debug, Clone, PartialEq)] +pub struct LibraryResult { + pub result: Vec, +} + #[derive(TlRead, TlWrite, Derivative)] #[derivative(Debug, Clone, PartialEq)] pub struct Error { @@ -313,6 +319,10 @@ pub enum Response { #[tl(id = 0xb9f796d8)] ValidatorStats(ValidatorStats), + /// liteServer.libraryResult result:(vector liteServer.libraryEntry) = liteServer.LibraryResult; + #[tl(id = 0x117ab96b)] + LibraryResult(LibraryResult), + /// liteServer.error code:int message:string = liteServer.Error; #[tl(id = 0xbba9e148)] Error(Error),