Skip to content

Commit 0d1549b

Browse files
committed
fix: build
1 parent 5c44c97 commit 0d1549b

File tree

2 files changed

+24
-19
lines changed

2 files changed

+24
-19
lines changed

src/handlers/wallet/get_assets.rs

+23-18
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,22 @@ use crate::{
77
},
88
state::AppState,
99
};
10-
use alloy::primitives::{address, Address, U64};
10+
use alloy::primitives::{address, Address, U256};
1111
use axum::{
1212
extract::{ConnectInfo, Path, Query, State},
1313
response::{IntoResponse, Response},
1414
Json,
1515
};
1616
use hyper::{HeaderMap, StatusCode};
17-
use serde::{de, Deserialize, Deserializer, Serialize, Serializer};
17+
use serde::Deserialize;
1818
use std::{collections::HashMap, net::SocketAddr, sync::Arc};
1919
use thiserror::Error;
2020
use tracing::error;
2121
use wc::future::FutureExt;
22+
use yttrium::wallet_service_api::{
23+
AddressOrNative, Asset, AssetData, AssetFilter, AssetType, AssetTypeFilter, ChainFilter,
24+
Erc20Metadata, GetAssetsFilters, GetAssetsParams, GetAssetsResult, NativeMetadata,
25+
};
2226

2327
#[derive(Error, Debug)]
2428
pub enum GetAssetsError {
@@ -373,8 +377,8 @@ fn create_response(balances: Vec<BalanceItem>) -> GetAssetsResult {
373377
)
374378
.or_insert_with(Vec::new)
375379
.push({
376-
fn convert_balance_to_hex(quantity: &BalanceQuantity) -> U64 {
377-
U64::from(
380+
fn convert_balance_to_hex(quantity: &BalanceQuantity) -> U256 {
381+
U256::from(
378382
(quantity.numeric.parse::<f64>().unwrap()
379383
* 10f64.powf(quantity.decimals.parse::<f64>().unwrap()))
380384
.round() as u64,
@@ -521,6 +525,7 @@ mod ported_tests {
521525

522526
mod aggregation_and_conversion {
523527
use super::*;
528+
use alloy::primitives::U64;
524529

525530
#[test]
526531
fn should_correctly_convert_balance_to_hex() {
@@ -548,7 +553,7 @@ mod ported_tests {
548553
))
549554
.unwrap()
550555
.balance(),
551-
U64::from(0x26fdd0)
556+
U256::from(0x26fdd0)
552557
);
553558

554559
assert_eq!(
@@ -565,7 +570,7 @@ mod ported_tests {
565570
))
566571
.unwrap()
567572
.balance(),
568-
U64::from(0x102189ccc07ac_u64)
573+
U256::from(0x102189ccc07ac_u64)
569574
);
570575
}
571576

@@ -595,7 +600,7 @@ mod ported_tests {
595600
))
596601
.unwrap()
597602
.balance(),
598-
U64::from(0x26fdd0)
603+
U256::from(0x26fdd0)
599604
);
600605

601606
assert_eq!(
@@ -612,7 +617,7 @@ mod ported_tests {
612617
))
613618
.unwrap()
614619
.balance(),
615-
U64::from(0x26fdd0)
620+
U256::from(0x26fdd0)
616621
);
617622
}
618623

@@ -639,7 +644,7 @@ mod ported_tests {
639644

640645
assert_eq!(
641646
result[&U64::from(0x2105)].first().unwrap().balance(),
642-
U64::from(0x0)
647+
U256::from(0x0)
643648
);
644649
}
645650

@@ -704,7 +709,7 @@ mod ported_tests {
704709
))
705710
.unwrap()
706711
.balance(),
707-
U64::from(0x75bcd15)
712+
U256::from(0x75bcd15)
708713
);
709714

710715
assert_eq!(
@@ -721,7 +726,7 @@ mod ported_tests {
721726
))
722727
.unwrap()
723728
.balance(),
724-
U64::from(0x112210f4768db400_u64)
729+
U256::from(0x112210f4768db400_u64)
725730
);
726731
}
727732

@@ -757,7 +762,7 @@ mod ported_tests {
757762

758763
assert_eq!(
759764
result[&U64::from(0x2105)].first().unwrap().balance(),
760-
U64::from(0xde0b6b3a7640000_u64)
765+
U256::from(0xde0b6b3a7640000_u64)
761766
);
762767
}
763768

@@ -793,7 +798,7 @@ mod ported_tests {
793798

794799
assert_eq!(
795800
result[&U64::from(0x2105)].first().unwrap().balance(),
796-
U64::from(0xf4240)
801+
U256::from(0xf4240)
797802
);
798803
}
799804

@@ -828,7 +833,7 @@ mod ported_tests {
828833
let asset = result[&U64::from(42161)].first().unwrap();
829834

830835
assert_eq!(asset.asset_type(), AssetType::Native);
831-
assert_eq!(asset.balance(), U64::from(0xde0b6b3a7640000_u64));
836+
assert_eq!(asset.balance(), U256::from(0xde0b6b3a7640000_u64));
832837
if let Asset::Native { data } = asset {
833838
assert_eq!(data.address, AddressOrNative::Native);
834839
} else {
@@ -934,17 +939,17 @@ mod ported_tests {
934939

935940
assert_eq!(
936941
result[&U64::from(0xa4b1)].first().unwrap().balance(),
937-
U64::from(0x11e1a300)
942+
U256::from(0x11e1a300)
938943
);
939944
assert_eq!(
940945
result[&U64::from(10)].first().unwrap().balance(),
941-
U64::from(0x11e1a300)
946+
U256::from(0x11e1a300)
942947
);
943948

944949
// Since BASE is missing, an entry with zero balance should be created
945950
assert_eq!(
946951
result[&U64::from(8453)].first().unwrap().balance(),
947-
U64::from(0xbebc200)
952+
U256::from(0xbebc200)
948953
);
949954
}
950955

@@ -1003,7 +1008,7 @@ mod ported_tests {
10031008
== &erc20_groups["USDC"][caip2]
10041009
})
10051010
.unwrap();
1006-
assert_eq!(usdc_asset.balance(), U64::from(0x5f5e100));
1011+
assert_eq!(usdc_asset.balance(), U256::from(0x5f5e100));
10071012
}
10081013
}
10091014

src/handlers/wallet/handler.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ enum Error {
125125
#[error("{WALLET_GET_CALLS_STATUS}: {0}")]
126126
GetCallsStatus(GetCallsStatusError),
127127

128-
#[error("{WALLET_GET_ASSETS}: {0}")]
128+
#[error("{}: {0}", wallet_service_api::WALLET_GET_ASSETS)]
129129
GetAssets(GetAssetsError),
130130

131131
#[error("Method not found")]

0 commit comments

Comments
 (0)