From 11c0a8974421effd65c1d26415db00bf6cee7f28 Mon Sep 17 00:00:00 2001 From: onur-ozkan Date: Tue, 2 Jul 2024 08:27:46 +0300 Subject: [PATCH] implement `MmCoin::wallet_only` for tendermint Signed-off-by: onur-ozkan --- mm2src/coins/tendermint/tendermint_coin.rs | 9 ++++++++- mm2src/coins/tendermint/tendermint_token.rs | 7 +++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/mm2src/coins/tendermint/tendermint_coin.rs b/mm2src/coins/tendermint/tendermint_coin.rs index b23d006936..0dbb933580 100644 --- a/mm2src/coins/tendermint/tendermint_coin.rs +++ b/mm2src/coins/tendermint/tendermint_coin.rs @@ -351,7 +351,7 @@ pub struct TendermintCoinImpl { client: TendermintRpcClient, pub(crate) chain_registry_name: Option, pub(crate) ctx: MmWeak, - is_keplr_from_ledger: bool, + pub(crate) is_keplr_from_ledger: bool, } #[derive(Clone)] @@ -2121,6 +2121,13 @@ pub async fn get_ibc_chain_list() -> IBCChainRegistriesResult { impl MmCoin for TendermintCoin { fn is_asset_chain(&self) -> bool { false } + fn wallet_only(&self, ctx: &MmArc) -> bool { + let coin_conf = crate::coin_conf(ctx, self.ticker()); + let wallet_only_conf = coin_conf["wallet_only"].as_bool().unwrap_or(false); + + wallet_only_conf || self.is_keplr_from_ledger + } + fn spawner(&self) -> CoinFutSpawner { CoinFutSpawner::new(&self.abortable_system) } fn withdraw(&self, req: WithdrawRequest) -> WithdrawFut { diff --git a/mm2src/coins/tendermint/tendermint_token.rs b/mm2src/coins/tendermint/tendermint_token.rs index 894982aa83..6ef4d45cc4 100644 --- a/mm2src/coins/tendermint/tendermint_token.rs +++ b/mm2src/coins/tendermint/tendermint_token.rs @@ -475,6 +475,13 @@ impl MarketCoinOps for TendermintToken { impl MmCoin for TendermintToken { fn is_asset_chain(&self) -> bool { false } + fn wallet_only(&self, ctx: &MmArc) -> bool { + let coin_conf = crate::coin_conf(ctx, self.ticker()); + let wallet_only_conf = coin_conf["wallet_only"].as_bool().unwrap_or(false); + + wallet_only_conf || self.platform_coin.is_keplr_from_ledger + } + fn spawner(&self) -> CoinFutSpawner { CoinFutSpawner::new(&self.abortable_system) } fn withdraw(&self, req: WithdrawRequest) -> WithdrawFut {