From 11f2174930d4453a14ed92b7909b45b6cff29a3f Mon Sep 17 00:00:00 2001 From: Willem Wyndham Date: Tue, 10 Sep 2024 12:12:22 -0400 Subject: [PATCH] fix: tx::manage_data actually use hex to encode bytes --- cmd/soroban-cli/src/tx/builder.rs | 2 ++ cmd/soroban-cli/src/tx/builder/bytesm.rs | 6 ++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/cmd/soroban-cli/src/tx/builder.rs b/cmd/soroban-cli/src/tx/builder.rs index 89b7f8a24..be0c49051 100644 --- a/cmd/soroban-cli/src/tx/builder.rs +++ b/cmd/soroban-cli/src/tx/builder.rs @@ -21,4 +21,6 @@ pub use transaction::Transaction; pub enum Error { #[error("Transaction contains too many operations")] TooManyOperations, + #[error(transparent)] + BytesM(#[from] bytesm::Error), } diff --git a/cmd/soroban-cli/src/tx/builder/bytesm.rs b/cmd/soroban-cli/src/tx/builder/bytesm.rs index f416384a4..c3a074cde 100644 --- a/cmd/soroban-cli/src/tx/builder/bytesm.rs +++ b/cmd/soroban-cli/src/tx/builder/bytesm.rs @@ -9,13 +9,15 @@ pub struct Bytes64(pub xdr::BytesM<64>); pub enum Error { #[error(transparent)] Xdr(#[from] xdr::Error), + #[error(transparent)] + Hex(#[from] hex::FromHexError), } impl FromStr for Bytes64 { - type Err = xdr::Error; + type Err = Error; fn from_str(value: &str) -> Result { - Ok(Self(xdr::BytesM::<64>::try_from(value)?)) + Ok(Self(xdr::BytesM::<64>::try_from(&hex::decode(value)?)?)) } }