Skip to content

Commit

Permalink
Merge pull request #1 from ston-fi/support-get-libraries-method
Browse files Browse the repository at this point in the history
Support getLibraries
  • Loading branch information
Sild authored Aug 21, 2024
2 parents 480b758 + 42a0342 commit 984bcac
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 48 deletions.
52 changes: 4 additions & 48 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
8 changes: 8 additions & 0 deletions liteapi/src/tl/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,3 +190,11 @@ pub struct TransactionId {
#[tl(flags_bit = "mode.2")]
pub hash: Option<Int256>,
}

/// 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<u8>,
}
10 changes: 10 additions & 0 deletions liteapi/src/tl/request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,12 @@ pub struct GetValidatorStats {
pub modified_after: Option<u32>,
}

#[derive(TlRead, TlWrite, Derivative)]
#[derivative(Debug, Clone, PartialEq)]
pub struct GetLibraries {
pub library_list: Vec<Int256>,
}

#[derive(TlRead, TlWrite, Derivative)]
#[derivative(Debug, Clone, PartialEq)]
#[tl(boxed)]
Expand Down Expand Up @@ -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),
}
10 changes: 10 additions & 0 deletions liteapi/src/tl/response.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,12 @@ pub struct ValidatorStats {
pub data_proof: Vec<u8>,
}

#[derive(TlRead, TlWrite, Derivative)]
#[derivative(Debug, Clone, PartialEq)]
pub struct LibraryResult {
pub result: Vec<LibraryEntry>,
}

#[derive(TlRead, TlWrite, Derivative)]
#[derivative(Debug, Clone, PartialEq)]
pub struct Error {
Expand Down Expand Up @@ -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),
Expand Down

0 comments on commit 984bcac

Please sign in to comment.