Skip to content
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
20 changes: 14 additions & 6 deletions mm2src/coins/sia.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl<'a> SiaConfBuilder<'a> {
pub struct SiaCoinFields {
/// SIA coin config
pub conf: SiaCoinConf,
pub key_pair: PrivKeyPolicy<ed25519_dalek::Keypair>,
pub priv_key_policy: PrivKeyPolicy<ed25519_dalek::Keypair>,
/// HTTP(s) client
pub http_client: SiaApiClient,
}
Expand Down Expand Up @@ -176,7 +176,7 @@ impl<'a> SiaCoinBuilder<'a> {
conf,
http_client: SiaApiClient::new(self.ticker(), self.params.http_conf.clone())
.map_err(SiaCoinBuildError::ClientError)?,
key_pair: PrivKeyPolicy::Iguana(self.key_pair),
priv_key_policy: PrivKeyPolicy::Iguana(self.key_pair),
};
let sia_arc = SiaArc::new(sia_fields);

Expand Down Expand Up @@ -291,7 +291,7 @@ impl MarketCoinOps for SiaCoin {

// needs test coverage FIXME COME BACK
fn my_address(&self) -> MmResult<String, MyAddressError> {
let key_pair = match &self.0.key_pair {
let key_pair = match &self.0.priv_key_policy {
PrivKeyPolicy::Iguana(key_pair) => key_pair,
PrivKeyPolicy::Trezor => {
return Err(MyAddressError::UnexpectedDerivationMethod(
Expand All @@ -311,7 +311,7 @@ impl MarketCoinOps for SiaCoin {
Ok(address.to_string())
}

fn get_public_key(&self) -> Result<String, MmError<UnexpectedDerivationMethod>> { unimplemented!() }
async fn get_public_key(&self) -> Result<String, MmError<UnexpectedDerivationMethod>> { unimplemented!() }

fn sign_message_hash(&self, _message: &str) -> Option<[u8; 32]> { unimplemented!() }

Expand Down Expand Up @@ -371,6 +371,8 @@ impl MarketCoinOps for SiaCoin {
fn min_tx_amount(&self) -> BigDecimal { unimplemented!() }

fn min_trading_vol(&self) -> MmNumber { unimplemented!() }

fn is_trezor(&self) -> bool { self.0.priv_key_policy.is_trezor() }
}

#[async_trait]
Expand All @@ -381,11 +383,17 @@ impl SwapOps for SiaCoin {

fn send_taker_payment(&self, _taker_payment_args: SendPaymentArgs) -> TransactionFut { unimplemented!() }

fn send_maker_spends_taker_payment(&self, _maker_spends_payment_args: SpendPaymentArgs) -> TransactionFut {
async fn send_maker_spends_taker_payment(
&self,
_maker_spends_payment_args: SpendPaymentArgs<'_>,
) -> TransactionResult {
unimplemented!()
}

fn send_taker_spends_maker_payment(&self, _taker_spends_payment_args: SpendPaymentArgs) -> TransactionFut {
async fn send_taker_spends_maker_payment(
&self,
_taker_spends_payment_args: SpendPaymentArgs<'_>,
) -> TransactionResult {
unimplemented!()
}

Expand Down
10 changes: 7 additions & 3 deletions mm2src/coins_activation/src/sia_coin_activation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use coins::my_tx_history_v2::TxHistoryStorage;
use coins::sia::{sia_coin_from_conf_and_params, SiaCoin, SiaCoinActivationParams, SiaCoinBuildError,
SiaCoinProtocolInfo};
use coins::tx_history_storage::CreateTxHistoryStorageError;
use coins::{BalanceError, CoinProtocol, MarketCoinOps, PrivKeyBuildPolicy, RegisterCoinError};
use coins::{BalanceError, CoinBalance, CoinProtocol, MarketCoinOps, PrivKeyBuildPolicy, RegisterCoinError};
use crypto::hw_rpc_task::{HwRpcTaskAwaitingStatus, HwRpcTaskUserAction};
use crypto::CryptoCtxError;
use derive_more::Display;
Expand All @@ -36,7 +36,7 @@ pub struct SiaCoinActivationResult {
/// A string representing the ticker of the SiaCoin.
pub ticker: String,
pub current_block: u64,
pub wallet_balance: CoinBalanceReport,
pub wallet_balance: CoinBalanceReport<CoinBalance>,
}

impl CurrentBlock for SiaCoinActivationResult {
Expand All @@ -45,7 +45,11 @@ impl CurrentBlock for SiaCoinActivationResult {

impl GetAddressesBalances for SiaCoinActivationResult {
fn get_addresses_balances(&self) -> HashMap<String, BigDecimal> {
self.wallet_balance.to_addresses_total_balances()
self.wallet_balance
.to_addresses_total_balances(&self.ticker)
.into_iter()
.map(|(address, balance)| (address, balance.unwrap_or_default()))
.collect()
}
}

Expand Down