From 6470c85aad8a35f17e39a502746ff363b1e7e8d8 Mon Sep 17 00:00:00 2001 From: Gleb Date: Mon, 29 Jul 2024 10:50:35 -0700 Subject: [PATCH] Fix comments --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/lib.rs | 21 ++++++++++++++++++++- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c2fa77c..cf9450b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1079,7 +1079,7 @@ checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" [[package]] name = "stellar-rpc-client" -version = "21.5.0" +version = "21.4.0" dependencies = [ "clap", "hex", diff --git a/Cargo.toml b/Cargo.toml index c12a61a..958d73b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,7 @@ repository = "https://github.com/stellar/soroban-rpc" authors = ["Stellar Development Foundation "] license = "Apache-2.0" readme = "README.md" -version = "21.5.0" +version = "21.4.0" edition = "2021" rust-version = "1.74.0" autobins = false diff --git a/src/lib.rs b/src/lib.rs index 760f99c..2b2547d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -95,6 +95,7 @@ pub enum Error { #[error("unexpected contract instance type: {0:?}")] UnexpectedContractInstance(xdr::ScVal), #[error("unexpected contract code got token {0:?}")] + #[deprecated(note = "To be removed in future versions")] UnexpectedToken(ContractDataEntry), #[error("Fee was too large {0}")] LargeFee(u64), @@ -1065,7 +1066,25 @@ impl Client { /// /// # Errors - pub async fn get_remote_wasm_from_hash(&self, hash: &Hash) -> Result, Error> { + #[deprecated(note = "To be removed in future versions, use get_ledger_entries()")] + pub async fn get_remote_wasm(&self, contract_id: &[u8; 32]) -> Result, Error> { + match self.get_contract_data(contract_id).await? { + xdr::ContractDataEntry { + val: + xdr::ScVal::ContractInstance(xdr::ScContractInstance { + executable: xdr::ContractExecutable::Wasm(hash), + .. + }), + .. + } => self.get_remote_wasm_from_hash(hash).await, + scval => Err(Error::UnexpectedToken(scval)), + } + } + + /// + /// # Errors + #[deprecated(note = "To be removed in future versions, use get_ledger_entries()")] + pub async fn get_remote_wasm_from_hash(&self, hash: Hash) -> Result, Error> { let code_key = LedgerKey::ContractCode(xdr::LedgerKeyContractCode { hash: hash.clone() }); let contract_data = self.get_ledger_entries(&[code_key]).await?; let entries = contract_data.entries.unwrap_or_default();