From 6f11e218e71b15307308265fc23ef736c4bc0053 Mon Sep 17 00:00:00 2001 From: Hugo Caillard <911307+hugocaillard@users.noreply.github.com> Date: Wed, 6 Sep 2023 17:48:28 +0200 Subject: [PATCH] fix: clarinet-deployments wasm build --- Cargo.lock | 9 +++++---- components/clarinet-deployments/Cargo.toml | 1 + components/clarinet-deployments/src/types.rs | 11 ++++++----- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3025b9746..57b5716b0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -386,9 +386,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.0" +version = "0.21.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" +checksum = "414dcefbc63d77c526a76b3afcf6fbb9b5e2791c19c3aa2297733208750c6e53" [[package]] name = "base64-compat" @@ -986,6 +986,7 @@ name = "clarinet-deployments" version = "1.0.1" dependencies = [ "base58 0.2.0", + "base64 0.21.3", "bitcoin", "bitcoincore-rpc", "bitcoincore-rpc-json", @@ -4732,7 +4733,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "27b71749df584b7f4cac2c426c127a7c785a5106cc98f7a8feb044115f0fa254" dependencies = [ "async-compression", - "base64 0.21.0", + "base64 0.21.3", "bytes", "encoding_rs", "futures-core", @@ -5054,7 +5055,7 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" dependencies = [ - "base64 0.21.0", + "base64 0.21.3", ] [[package]] diff --git a/components/clarinet-deployments/Cargo.toml b/components/clarinet-deployments/Cargo.toml index 73155c0c2..06375fb7f 100644 --- a/components/clarinet-deployments/Cargo.toml +++ b/components/clarinet-deployments/Cargo.toml @@ -22,6 +22,7 @@ bitcoin = { version = "0.29.2", optional = true } bitcoincore-rpc = { version = "0.16.0", optional = true } bitcoincore-rpc-json = { version = "0.16.0", optional = true } base58 = { version = "0.2.0", optional = true } +base64 = "0.21.3" tiny-hderive = { version = "0.3.0", optional = true } libsecp256k1 = { version = "0.7.0", optional = true } clarinet_utils = { package = "clarinet-utils", path = "../clarinet-utils", optional = true } diff --git a/components/clarinet-deployments/src/types.rs b/components/clarinet-deployments/src/types.rs index f6e2c250a..ea1ca9239 100644 --- a/components/clarinet-deployments/src/types.rs +++ b/components/clarinet-deployments/src/types.rs @@ -522,7 +522,7 @@ pub struct RequirementPublishSpecification { } pub mod source_serde { - use bitcoincore_rpc::jsonrpc::base64::{decode, encode}; + use base64::{engine::general_purpose::STANDARD as b64, Engine as _}; use serde::{Deserialize, Deserializer, Serializer}; use std::str::from_utf8; @@ -530,7 +530,7 @@ pub mod source_serde { where S: Serializer, { - let enc = encode(&x); + let enc = b64.encode(&x); s.serialize_str(&enc) } @@ -543,7 +543,8 @@ pub mod source_serde { } pub fn base64_decode(encoded: &str) -> Result { - let bytes = decode(&encoded) + let bytes = b64 + .decode(&encoded) .map_err(|e| format!("unable to decode contract source: {}", e.to_string()))?; let decoded = from_utf8(&bytes).map_err(|e| { format!( @@ -893,7 +894,7 @@ pub struct DeploymentSpecification { } pub mod contracts_serde { - use bitcoincore_rpc::jsonrpc::base64::encode; + use base64::{engine::general_purpose::STANDARD as b64, Engine as _}; use clarinet_files::FileLocation; use clarity_repl::clarity::vm::types::QualifiedContractIdentifier; use serde::{ser::SerializeSeq, Deserializer, Serializer}; @@ -910,7 +911,7 @@ pub mod contracts_serde { { let mut out = serializer.serialize_seq(Some(target.len()))?; for (contract_id, (source, file_location)) in target { - let encoded = encode(&source); + let encoded = b64.encode(&source); let mut map = BTreeMap::new(); map.insert("contract_id", contract_id.to_string()); map.insert("source", encoded);