Skip to content

Commit

Permalink
chore(solana): remove solana implementation (#2239)
Browse files Browse the repository at this point in the history
The solana implementation was removed until it can be redone using the latest solana sdk
  • Loading branch information
shamardy authored Oct 10, 2024
1 parent e65fefe commit 26b87c3
Show file tree
Hide file tree
Showing 23 changed files with 151 additions and 5,356 deletions.
1,851 changes: 150 additions & 1,701 deletions Cargo.lock

Large diffs are not rendered by default.

21 changes: 0 additions & 21 deletions mm2src/coins/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,6 @@ edition = "2018"

[features]
zhtlc-native-tests = []
# TODO
enable-solana = [
"dep:bincode",
"dep:ed25519-dalek-bip32",
"dep:solana-client",
"dep:solana-sdk",
"dep:solana-transaction-status",
"dep:spl-token",
"dep:spl-associated-token-account",
"dep:satomic-swap"
]
enable-sia = [
"dep:reqwest",
"dep:blake2b_simd",
Expand Down Expand Up @@ -96,7 +85,6 @@ rlp = { version = "0.5" }
rmp-serde = "0.14.3"
rpc = { path = "../mm2_bitcoin/rpc" }
rpc_task = { path = "../rpc_task" }
satomic-swap = { git = "https://github.com/KomodoPlatform/satomic-swap.git", rev = "413e472", optional = true }
script = { path = "../mm2_bitcoin/script" }
secp256k1 = { version = "0.20" }
ser_error = { path = "../derives/ser_error" }
Expand Down Expand Up @@ -125,15 +113,6 @@ zcash_client_backend = { git = "https://github.com/KomodoPlatform/librustzcash.g
zcash_extras = { git = "https://github.com/KomodoPlatform/librustzcash.git", tag = "k-1.4.1" }
zcash_primitives = {features = ["transparent-inputs"], git = "https://github.com/KomodoPlatform/librustzcash.git", tag = "k-1.4.1" }

[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 }
ed25519-dalek-bip32 = { version = "0.2.0", default-features = false, optional = true }
solana-client = { version = "1", default-features = false, optional = true }
solana-sdk = { version = "1", default-features = false, optional = true }
solana-transaction-status = { version = "1", optional = true }
spl-token = { version = "3", optional = true }
spl-associated-token-account = { version = "1", optional = true }

[target.'cfg(target_arch = "wasm32")'.dependencies]
blake2b_simd = "0.5"
ff = "0.8"
Expand Down
152 changes: 0 additions & 152 deletions mm2src/coins/lp_coins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,29 +124,6 @@ macro_rules! try_f {
};
}

#[cfg(all(feature = "enable-solana", not(target_arch = "wasm32")))]
macro_rules! try_tx_fus_err {
($err: expr) => {
return Box::new(futures01::future::err(crate::TransactionErr::Plain(ERRL!(
"{:?}", $err
))))
};
}

#[cfg(all(feature = "enable-solana", not(target_arch = "wasm32")))]
macro_rules! try_tx_fus_opt {
($e: expr, $err: expr) => {
match $e {
Some(ok) => ok,
None => {
return Box::new(futures01::future::err(crate::TransactionErr::Plain(ERRL!(
"{:?}", $err
))))
},
}
};
}

/// `TransactionErr` compatible `try_fus` macro.
macro_rules! try_tx_fus {
($e: expr) => {
Expand Down Expand Up @@ -280,30 +257,6 @@ pub mod tx_history_storage;
#[cfg(feature = "enable-sia")] pub mod siacoin;
#[cfg(feature = "enable-sia")] use siacoin::SiaCoin;

#[doc(hidden)]
#[allow(unused_variables)]
#[cfg(all(
feature = "enable-solana",
not(target_os = "ios"),
not(target_os = "android"),
not(target_arch = "wasm32")
))]
pub mod solana;
#[cfg(all(
feature = "enable-solana",
not(target_os = "ios"),
not(target_os = "android"),
not(target_arch = "wasm32")
))]
pub use solana::spl::SplToken;
#[cfg(all(
feature = "enable-solana",
not(target_os = "ios"),
not(target_os = "android"),
not(target_arch = "wasm32")
))]
pub use solana::{SolTransaction, SolanaActivationParams, SolanaCoin, SolanaFeeDetails};

pub mod utxo;
use utxo::bch::{bch_coin_with_policy, BchActivationRequest, BchCoin};
use utxo::qtum::{self, qtum_coin_with_policy, Qrc20AddressError, QtumCoin, QtumDelegationOps, QtumDelegationRequest,
Expand Down Expand Up @@ -631,8 +584,6 @@ pub trait Transaction: fmt::Debug + 'static {
pub enum TransactionEnum {
UtxoTx(UtxoTx),
SignedEthTx(SignedEthTx),
#[cfg(all(feature = "enable-solana", not(target_arch = "wasm32")))]
SolTransaction(SolTransaction),
ZTransaction(ZTransaction),
CosmosTransaction(CosmosTransaction),
#[cfg(not(target_arch = "wasm32"))]
Expand All @@ -641,8 +592,6 @@ pub enum TransactionEnum {

ifrom!(TransactionEnum, UtxoTx);
ifrom!(TransactionEnum, SignedEthTx);
#[cfg(all(feature = "enable-solana", not(target_arch = "wasm32")))]
ifrom!(TransactionEnum, SolTransaction);
ifrom!(TransactionEnum, ZTransaction);
#[cfg(not(target_arch = "wasm32"))]
ifrom!(TransactionEnum, LightningPayment);
Expand All @@ -666,8 +615,6 @@ impl Deref for TransactionEnum {
TransactionEnum::CosmosTransaction(ref t) => t,
#[cfg(not(target_arch = "wasm32"))]
TransactionEnum::LightningPayment(ref p) => p,
#[cfg(all(feature = "enable-solana", not(target_arch = "wasm32")))]
TransactionEnum::SolTransaction(ref s) => s,
}
}
}
Expand Down Expand Up @@ -2271,13 +2218,6 @@ pub enum TxFeeDetails {
Qrc20(Qrc20FeeDetails),
Slp(SlpFeeDetails),
Tendermint(TendermintFeeDetails),
#[cfg(all(
feature = "enable-solana",
not(target_os = "ios"),
not(target_os = "android"),
not(target_arch = "wasm32")
))]
Solana(SolanaFeeDetails),
}

/// Deserialize the TxFeeDetails as an untagged enum.
Expand All @@ -2292,27 +2232,13 @@ impl<'de> Deserialize<'de> for TxFeeDetails {
Utxo(UtxoFeeDetails),
Eth(EthTxFeeDetails),
Qrc20(Qrc20FeeDetails),
#[cfg(all(
feature = "enable-solana",
not(target_os = "ios"),
not(target_os = "android"),
not(target_arch = "wasm32")
))]
Solana(SolanaFeeDetails),
Tendermint(TendermintFeeDetails),
}

match Deserialize::deserialize(deserializer)? {
TxFeeDetailsUnTagged::Utxo(f) => Ok(TxFeeDetails::Utxo(f)),
TxFeeDetailsUnTagged::Eth(f) => Ok(TxFeeDetails::Eth(f)),
TxFeeDetailsUnTagged::Qrc20(f) => Ok(TxFeeDetails::Qrc20(f)),
#[cfg(all(
feature = "enable-solana",
not(target_os = "ios"),
not(target_os = "android"),
not(target_arch = "wasm32")
))]
TxFeeDetailsUnTagged::Solana(f) => Ok(TxFeeDetails::Solana(f)),
TxFeeDetailsUnTagged::Tendermint(f) => Ok(TxFeeDetails::Tendermint(f)),
}
}
Expand All @@ -2330,16 +2256,6 @@ impl From<Qrc20FeeDetails> for TxFeeDetails {
fn from(qrc20_details: Qrc20FeeDetails) -> Self { TxFeeDetails::Qrc20(qrc20_details) }
}

#[cfg(all(
feature = "enable-solana",
not(target_os = "ios"),
not(target_os = "android"),
not(target_arch = "wasm32")
))]
impl From<SolanaFeeDetails> for TxFeeDetails {
fn from(solana_details: SolanaFeeDetails) -> Self { TxFeeDetails::Solana(solana_details) }
}

impl From<TendermintFeeDetails> for TxFeeDetails {
fn from(tendermint_details: TendermintFeeDetails) -> Self { TxFeeDetails::Tendermint(tendermint_details) }
}
Expand Down Expand Up @@ -3544,20 +3460,6 @@ pub enum MmCoinEnum {
SlpToken(SlpToken),
Tendermint(TendermintCoin),
TendermintToken(TendermintToken),
#[cfg(all(
feature = "enable-solana",
not(target_os = "ios"),
not(target_os = "android"),
not(target_arch = "wasm32")
))]
SolanaCoin(SolanaCoin),
#[cfg(all(
feature = "enable-solana",
not(target_os = "ios"),
not(target_os = "android"),
not(target_arch = "wasm32")
))]
SplToken(SplToken),
#[cfg(not(target_arch = "wasm32"))]
LightningCoin(LightningCoin),
#[cfg(feature = "enable-sia")]
Expand All @@ -3577,26 +3479,6 @@ impl From<TestCoin> for MmCoinEnum {
fn from(c: TestCoin) -> MmCoinEnum { MmCoinEnum::Test(c) }
}

#[cfg(all(
feature = "enable-solana",
not(target_os = "ios"),
not(target_os = "android"),
not(target_arch = "wasm32")
))]
impl From<SolanaCoin> for MmCoinEnum {
fn from(c: SolanaCoin) -> MmCoinEnum { MmCoinEnum::SolanaCoin(c) }
}

#[cfg(all(
feature = "enable-solana",
not(target_os = "ios"),
not(target_os = "android"),
not(target_arch = "wasm32")
))]
impl From<SplToken> for MmCoinEnum {
fn from(c: SplToken) -> MmCoinEnum { MmCoinEnum::SplToken(c) }
}

impl From<QtumCoin> for MmCoinEnum {
fn from(coin: QtumCoin) -> Self { MmCoinEnum::QtumCoin(coin) }
}
Expand Down Expand Up @@ -3654,20 +3536,6 @@ impl Deref for MmCoinEnum {
#[cfg(feature = "enable-sia")]
MmCoinEnum::SiaCoin(ref c) => c,
MmCoinEnum::Test(ref c) => c,
#[cfg(all(
feature = "enable-solana",
not(target_os = "ios"),
not(target_os = "android"),
not(target_arch = "wasm32")
))]
MmCoinEnum::SolanaCoin(ref c) => c,
#[cfg(all(
feature = "enable-solana",
not(target_os = "ios"),
not(target_os = "android"),
not(target_arch = "wasm32")
))]
MmCoinEnum::SplToken(ref c) => c,
}
}
}
Expand Down Expand Up @@ -4377,14 +4245,6 @@ pub enum CoinProtocol {
network: BlockchainNetwork,
confirmation_targets: PlatformCoinConfirmationTargets,
},
#[cfg(all(feature = "enable-solana", not(target_arch = "wasm32")))]
SOLANA,
#[cfg(all(feature = "enable-solana", not(target_arch = "wasm32")))]
SPLTOKEN {
platform: String,
token_contract_address: String,
decimals: u8,
},
ZHTLC(ZcoinProtocolInfo),
#[cfg(feature = "enable-sia")]
SIA,
Expand Down Expand Up @@ -4646,14 +4506,6 @@ pub async fn lp_coininit(ctx: &MmArc, ticker: &str, req: &Json) -> Result<MmCoin
CoinProtocol::NFT { .. } => return ERR!("NFT protocol is not supported by lp_coininit"),
#[cfg(not(target_arch = "wasm32"))]
CoinProtocol::LIGHTNING { .. } => return ERR!("Lightning protocol is not supported by lp_coininit"),
#[cfg(all(feature = "enable-solana", not(target_arch = "wasm32")))]
CoinProtocol::SOLANA => {
return ERR!("Solana protocol is not supported by lp_coininit - use enable_solana_with_tokens instead")
},
#[cfg(all(feature = "enable-solana", not(target_arch = "wasm32")))]
CoinProtocol::SPLTOKEN { .. } => {
return ERR!("SplToken protocol is not supported by lp_coininit - use enable_spl instead")
},
#[cfg(feature = "enable-sia")]
CoinProtocol::SIA { .. } => {
return ERR!("SIA protocol is not supported by lp_coininit. Use task::enable_sia::init");
Expand Down Expand Up @@ -5238,10 +5090,6 @@ pub fn address_by_coin_conf_and_pubkey_str(
CoinProtocol::LIGHTNING { .. } => {
ERR!("address_by_coin_conf_and_pubkey_str is not implemented for lightning protocol yet!")
},
#[cfg(all(feature = "enable-solana", not(target_arch = "wasm32")))]
CoinProtocol::SOLANA | CoinProtocol::SPLTOKEN { .. } => {
ERR!("Solana pubkey is the public address - you do not need to use this rpc call.")
},
CoinProtocol::ZHTLC { .. } => ERR!("address_by_coin_conf_and_pubkey_str is not supported for ZHTLC protocol!"),
#[cfg(feature = "enable-sia")]
CoinProtocol::SIA { .. } => ERR!("address_by_coin_conf_and_pubkey_str is not supported for SIA protocol!"), // TODO Alright
Expand Down
Loading

0 comments on commit 26b87c3

Please sign in to comment.