Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: clarinet-deployments wasm build #1144

Merged
merged 1 commit into from
Sep 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions components/clarinet-deployments/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand Down
11 changes: 6 additions & 5 deletions components/clarinet-deployments/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -522,15 +522,15 @@ 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;

pub fn serialize<S>(x: &str, s: S) -> Result<S::Ok, S::Error>
where
S: Serializer,
{
let enc = encode(&x);
let enc = b64.encode(&x);
s.serialize_str(&enc)
}

Expand All @@ -543,7 +543,8 @@ pub mod source_serde {
}

pub fn base64_decode(encoded: &str) -> Result<String, String> {
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!(
Expand Down Expand Up @@ -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};
Expand All @@ -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);
Expand Down
Loading