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
4 changes: 2 additions & 2 deletions mm2src/coins/eth/eth_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ fn test_eth_validate_valid_and_invalid_pubkey() {
#[test]
fn test_get_enabled_erc20_by_contract_and_platform() {
use super::erc20::get_enabled_erc20_by_platform_and_contract;
use crate::rpc_command::get_enabled_coins::{get_enabled_coins_rpc, GetEnabledCoinsRequest};
use crate::rpc_command::get_enabled_coins::get_enabled_coins_rpc;
const BNB_TOKEN: &str = "1INCH-BEP20";
const ETH_TOKEN: &str = "1INCH-ERC20";

Expand Down Expand Up @@ -1081,7 +1081,7 @@ fn test_get_enabled_erc20_by_contract_and_platform() {
});
block_on(lp_coininit(&ctx, ETH_TOKEN, &req_eth_token)).unwrap();

let coins = block_on(get_enabled_coins_rpc(ctx.clone(), GetEnabledCoinsRequest)).unwrap();
let coins = block_on(get_enabled_coins_rpc(ctx.clone(), None)).unwrap();
assert_eq!(coins.coins.len(), 2);

let contract_address = Address::from_str("0x111111111117dC0aa78b770fA6A738034120C302").unwrap();
Expand Down
4 changes: 2 additions & 2 deletions mm2src/coins/rpc_command/get_enabled_coins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ impl HttpStatusCode for GetEnabledCoinsError {
}

#[derive(Deserialize)]
pub struct GetEnabledCoinsRequest;
pub struct GetEnabledCoinsRequest {}

#[derive(Debug, Serialize)]
pub struct GetEnabledCoinsResponse {
Expand All @@ -36,7 +36,7 @@ pub struct EnabledCoinV2 {

pub async fn get_enabled_coins_rpc(
ctx: MmArc,
_req: GetEnabledCoinsRequest,
_req: Option<GetEnabledCoinsRequest>,
) -> MmResult<GetEnabledCoinsResponse, GetEnabledCoinsError> {
let coins_ctx = CoinsContext::from_ctx(&ctx).map_to_mm(GetEnabledCoinsError::Internal)?;
let coins_map = coins_ctx.coins.lock().await;
Expand Down
9 changes: 7 additions & 2 deletions mm2src/mm2_main/src/lp_init/init_hw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ pub enum InitHwInProgressStatus {
FollowHwDeviceInstructions,
}

#[derive(Deserialize, Clone)]
#[derive(Default, Deserialize, Clone)]
pub struct InitHwRequest {
device_pubkey: Option<HwPubkey>,
}
Expand Down Expand Up @@ -183,7 +183,12 @@ impl RpcTask for InitHwTask {
}
}

pub async fn init_trezor(ctx: MmArc, req: RpcInitReq<InitHwRequest>) -> MmResult<InitRpcTaskResponse, InitHwError> {
pub async fn init_trezor(
ctx: MmArc,
req: Option<RpcInitReq<InitHwRequest>>,
) -> MmResult<InitRpcTaskResponse, InitHwError> {
let req = req.unwrap_or_default();

let (client_id, req) = (req.client_id, req.inner);
let init_ctx = MmInitContext::from_ctx(&ctx).map_to_mm(InitHwError::Internal)?;
let spawner = ctx.spawner();
Expand Down
2 changes: 1 addition & 1 deletion mm2src/mm2_main/src/rpc/wc_commands/sessions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub struct GetSessionsResponse {
/// `Get all sessions connection` RPC command implementation.
pub async fn get_all_sessions(
ctx: MmArc,
_req: EmptyRpcRequest,
_req: Option<EmptyRpcRequest>,
) -> MmResult<GetSessionsResponse, WalletConnectRpcError> {
let wc_ctx =
WalletConnectCtx::from_ctx(&ctx).mm_err(|err| WalletConnectRpcError::InitializationError(err.to_string()))?;
Expand Down
2 changes: 1 addition & 1 deletion mm2src/mm2_main/tests/mm2_tests/mm2_tests_inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6725,7 +6725,7 @@ mod trezor_tests {

CryptoCtx::init_with_iguana_passphrase(ctx.clone(), "123456").unwrap(); // for now we need passphrase seed for init
let req: RpcInitReq<InitHwRequest> = serde_json::from_value(json!({ "device_pubkey": null })).unwrap();
let res = match init_trezor(ctx.clone(), req).await {
let res = match init_trezor(ctx.clone(), Some(req)).await {
Ok(res) => res,
_ => {
panic!("cannot start init trezor task");
Expand Down
2 changes: 1 addition & 1 deletion mm2src/rpc_task/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ pub trait RpcTask: RpcTaskTypes + Sized + Send + 'static {
///
/// `client_id` is used to identify the client to which the task should stream out update events
/// to and is common in each request. Other data is request-specific.
#[derive(Deserialize)]
#[derive(Default, Deserialize)]
pub struct RpcInitReq<T> {
// If the client ID isn't included, assume it's 0.
#[serde(default)]
Expand Down
Loading