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

feat(zcoin): allow ARRR/ZCOIN compilation in wasm #1805

Merged
merged 32 commits into from
Jun 9, 2023
Merged
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
653d1cc
allow ARRR compilation in wasm
borngraced May 5, 2023
7ffbf28
fix typo
borngraced May 5, 2023
7b745e1
minor changes
borngraced May 5, 2023
81f9790
minor changes and allow unused
borngraced May 9, 2023
b0cc19c
export SyncStatus as pub
borngraced May 9, 2023
2cd3da2
add error ZCoinBalanceError for balance error
borngraced May 9, 2023
d8f8fcc
Merge remote-tracking branch 'origin/dev' into arrr-wasm
borngraced May 10, 2023
f59c42e
fix merge conflicts
borngraced May 11, 2023
5db9c45
fix checks
borngraced May 11, 2023
b3e5fa6
save dev state
borngraced May 17, 2023
c753125
save dev state
borngraced May 17, 2023
607bfd2
make walletdb compatible for native and wasm
borngraced May 17, 2023
680fd8f
Merge branch 'dev' into arrr-wasm
borngraced May 17, 2023
f560e80
apply patch
borngraced May 17, 2023
418f074
minor changes
borngraced May 17, 2023
8ebb378
use zcoin_builder.ctx without ref
borngraced May 17, 2023
2e6b465
add all walletdb table for wasm
borngraced May 18, 2023
4878318
add table to naming
borngraced May 18, 2023
fbaeb8a
fix review notes
borngraced May 24, 2023
af55d86
Merge remote-tracking branch 'origin/dev' into arrr-wasm
borngraced May 24, 2023
00567f9
fix review notes
borngraced May 24, 2023
bc2b2a3
refactor duplicate errors
borngraced May 26, 2023
2d41590
fix build error
borngraced May 27, 2023
5a5123d
cleanup and minor changes
borngraced May 29, 2023
2f9b94a
fix bugs in wallet indexeddb indexes
borngraced May 30, 2023
2906e80
fix lint
borngraced May 30, 2023
48596c8
minor changes
borngraced Jun 1, 2023
33289e0
Merge remote-tracking branch 'origin/dev' into arrr-wasm
borngraced Jun 8, 2023
e41f3e2
fix merge conflicts carg
borngraced Jun 9, 2023
a14232a
fix merge conflicts
borngraced Jun 9, 2023
d474608
Merge branch 'arrr-wasm' of https://github.com/KomodoPlatform/atomicD…
borngraced Jun 9, 2023
dd9a4a3
remove line break
borngraced Jun 9, 2023
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
6 changes: 3 additions & 3 deletions mm2src/coins/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,9 @@ uuid = { version = "1.2.2", features = ["fast-rng", "serde", "v4"] }
# We don't need the default web3 features at all since we added our own web3 transport using shared HYPER instance.
web3 = { git = "https://github.com/KomodoPlatform/rust-web3", tag = "v0.19.0", default-features = false }
zbase32 = "0.1.2"
zcash_client_backend = { git = "https://github.com/KomodoPlatform/librustzcash.git", tag = "k-1.0.0" }
zcash_primitives = { features = ["transparent-inputs"], git = "https://github.com/KomodoPlatform/librustzcash.git", tag = "k-1.0.0" }
zcash_proofs = { git = "https://github.com/KomodoPlatform/librustzcash.git", tag = "k-1.0.0" }

[target.'cfg(all(not(target_os = "ios"), not(target_os = "android"), not(target_arch = "wasm32")))'.dependencies]
bincode = { version = "1.3.3", default-features = false, optional = true }
Expand Down Expand Up @@ -139,10 +142,7 @@ tokio = { version = "1.20" }
tokio-rustls = { version = "0.23" }
tonic = { version = "0.7", features = ["tls", "tls-webpki-roots", "compression"] }
webpki-roots = { version = "0.22" }
zcash_client_backend = { git = "https://github.com/KomodoPlatform/librustzcash.git", tag = "k-1.0.0" }
zcash_client_sqlite = { git = "https://github.com/KomodoPlatform/librustzcash.git", tag = "k-1.0.0" }
zcash_primitives = { features = ["transparent-inputs"], git = "https://github.com/KomodoPlatform/librustzcash.git", tag = "k-1.0.0" }
zcash_proofs = { git = "https://github.com/KomodoPlatform/librustzcash.git", tag = "k-1.0.0" }

[target.'cfg(windows)'.dependencies]
winapi = "0.3"
Expand Down
16 changes: 3 additions & 13 deletions mm2src/coins/lp_coins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ use std::sync::atomic::Ordering as AtomicOrdering;
use std::sync::Arc;
use std::time::Duration;
use utxo_signer::with_key_pair::UtxoSignWithKeyPairError;
use zcash_primitives::transaction::Transaction as ZTransaction;

cfg_native! {
use crate::lightning::LightningCoin;
Expand All @@ -91,8 +92,6 @@ cfg_native! {
use lightning_invoice::{Invoice, ParseOrSemanticError};
use std::io;
use std::path::PathBuf;
use zcash_primitives::transaction::Transaction as ZTransaction;
use z_coin::ZcoinProtocolInfo;
}

cfg_wasm32! {
Expand Down Expand Up @@ -287,8 +286,8 @@ use utxo::{BlockchainNetwork, GenerateTxError, UtxoFeeDetails, UtxoTx};
pub mod nft;
use nft::nft_errors::GetNftInfoError;

#[cfg(not(target_arch = "wasm32"))] pub mod z_coin;
shamardy marked this conversation as resolved.
Show resolved Hide resolved
#[cfg(not(target_arch = "wasm32"))] use z_coin::ZCoin;
#[allow(unused)] pub mod z_coin;
#[allow(unused)] use z_coin::{ZCoin, ZcoinProtocolInfo};
shamardy marked this conversation as resolved.
Show resolved Hide resolved

pub type TransactionFut = Box<dyn Future<Item = TransactionEnum, Error = TransactionErr> + Send>;
pub type BalanceResult<T> = Result<T, MmError<BalanceError>>;
Expand Down Expand Up @@ -467,7 +466,6 @@ pub trait Transaction: fmt::Debug + 'static {
pub enum TransactionEnum {
UtxoTx(UtxoTx),
SignedEthTx(SignedEthTx),
#[cfg(not(target_arch = "wasm32"))]
ZTransaction(ZTransaction),
CosmosTransaction(CosmosTransaction),
#[cfg(not(target_arch = "wasm32"))]
Expand All @@ -476,7 +474,6 @@ pub enum TransactionEnum {

ifrom!(TransactionEnum, UtxoTx);
ifrom!(TransactionEnum, SignedEthTx);
#[cfg(not(target_arch = "wasm32"))]
ifrom!(TransactionEnum, ZTransaction);
#[cfg(not(target_arch = "wasm32"))]
ifrom!(TransactionEnum, LightningPayment);
Expand All @@ -496,7 +493,6 @@ impl Deref for TransactionEnum {
match self {
TransactionEnum::UtxoTx(ref t) => t,
TransactionEnum::SignedEthTx(ref t) => t,
#[cfg(not(target_arch = "wasm32"))]
TransactionEnum::ZTransaction(ref t) => t,
TransactionEnum::CosmosTransaction(ref t) => t,
#[cfg(not(target_arch = "wasm32"))]
Expand Down Expand Up @@ -2341,7 +2337,6 @@ pub enum MmCoinEnum {
QtumCoin(QtumCoin),
Qrc20Coin(Qrc20Coin),
EthCoin(EthCoin),
#[cfg(not(target_arch = "wasm32"))]
ZCoin(ZCoin),
Bch(BchCoin),
SlpToken(SlpToken),
Expand Down Expand Up @@ -2427,7 +2422,6 @@ impl From<LightningCoin> for MmCoinEnum {
fn from(c: LightningCoin) -> MmCoinEnum { MmCoinEnum::LightningCoin(c) }
}

#[cfg(not(target_arch = "wasm32"))]
impl From<ZCoin> for MmCoinEnum {
fn from(c: ZCoin) -> MmCoinEnum { MmCoinEnum::ZCoin(c) }
}
Expand All @@ -2447,7 +2441,6 @@ impl Deref for MmCoinEnum {
MmCoinEnum::TendermintToken(ref c) => c,
#[cfg(not(target_arch = "wasm32"))]
MmCoinEnum::LightningCoin(ref c) => c,
#[cfg(not(target_arch = "wasm32"))]
MmCoinEnum::ZCoin(ref c) => c,
MmCoinEnum::Test(ref c) => c,
#[cfg(all(
Expand Down Expand Up @@ -2840,7 +2833,6 @@ pub enum CoinProtocol {
token_contract_address: String,
decimals: u8,
},
#[cfg(not(target_arch = "wasm32"))]
ZHTLC(ZcoinProtocolInfo),
}

Expand Down Expand Up @@ -3093,7 +3085,6 @@ pub async fn lp_coininit(ctx: &MmArc, ticker: &str, req: &Json) -> Result<MmCoin
},
CoinProtocol::TENDERMINT { .. } => return ERR!("TENDERMINT protocol is not supported by lp_coininit"),
CoinProtocol::TENDERMINTTOKEN(_) => return ERR!("TENDERMINTTOKEN protocol is not supported by lp_coininit"),
#[cfg(not(target_arch = "wasm32"))]
CoinProtocol::ZHTLC { .. } => return ERR!("ZHTLC protocol is not supported by lp_coininit"),
#[cfg(not(target_arch = "wasm32"))]
CoinProtocol::LIGHTNING { .. } => return ERR!("Lightning protocol is not supported by lp_coininit"),
Expand Down Expand Up @@ -3686,7 +3677,6 @@ pub fn address_by_coin_conf_and_pubkey_str(
CoinProtocol::SOLANA | CoinProtocol::SPLTOKEN { .. } => {
ERR!("Solana pubkey is the public address - you do not need to use this rpc call.")
},
#[cfg(not(target_arch = "wasm32"))]
CoinProtocol::ZHTLC { .. } => ERR!("address_by_coin_conf_and_pubkey_str is not supported for ZHTLC protocol!"),
}
}
Expand Down
Loading