Skip to content

Commit

Permalink
implement MmCoin::wallet_only for tendermint
Browse files Browse the repository at this point in the history
Signed-off-by: onur-ozkan <work@onurozkan.dev>
  • Loading branch information
onur-ozkan committed Jul 2, 2024
1 parent 00059b3 commit 11c0a89
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
9 changes: 8 additions & 1 deletion mm2src/coins/tendermint/tendermint_coin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,7 +351,7 @@ pub struct TendermintCoinImpl {
client: TendermintRpcClient,
pub(crate) chain_registry_name: Option<String>,
pub(crate) ctx: MmWeak,
is_keplr_from_ledger: bool,
pub(crate) is_keplr_from_ledger: bool,
}

#[derive(Clone)]
Expand Down Expand Up @@ -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 {
Expand Down
7 changes: 7 additions & 0 deletions mm2src/coins/tendermint/tendermint_token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 11c0a89

Please sign in to comment.