Skip to content

Commit 23c7b8c

Browse files
author
Aton
authored
0.6 asset remove is_native (paritytech#262)
* 0.6 asset remove is_native
1 parent fbe80fc commit 23c7b8c

File tree

2 files changed

+1
-25
lines changed

2 files changed

+1
-25
lines changed

rpc/src/chainx/impl_rpc.rs

+1-19
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@ where
5252
.into_iter()
5353
.map(|(token, map)| AssetInfo {
5454
name: String::from_utf8_lossy(&token).into_owned(),
55-
is_native: true,
5655
details: map,
5756
})
5857
.collect();
@@ -92,25 +91,8 @@ where
9291
let free_issue = total_issue - other_total;
9392
bmap.insert(xassets::AssetType::Free, free_issue);
9493
}
95-
let mut trustee_addr = String::default();
96-
if asset.token().as_slice() == xbitcoin::Module::<Runtime>::TOKEN {
97-
let key = <xaccounts::TrusteeAddress<Runtime>>::key_for(xassets::Chain::Bitcoin);
98-
match Self::pickout::<xaccounts::TrusteeAddressPair>(&state, &key)? {
99-
Some(a) => {
100-
let hot_address =
101-
Address::from_layout(&a.hot_address.as_slice()).unwrap_or_default();
102-
trustee_addr = hot_address.to_string()
103-
}
104-
None => Default::default(),
105-
};
106-
}
10794

108-
all_assets.push(TotalAssetInfo::new(
109-
asset,
110-
valid,
111-
trustee_addr,
112-
CodecBTreeMap(bmap),
113-
));
95+
all_assets.push(TotalAssetInfo::new(asset, valid, CodecBTreeMap(bmap)));
11496
}
11597

11698
into_pagedata(all_assets, page_index, page_size)

rpc/src/chainx/types.rs

-6
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ pub struct PageData<T> {
1414
#[serde(rename_all = "camelCase")]
1515
pub struct AssetInfo {
1616
pub name: String,
17-
pub is_native: bool,
1817
pub details: CodecBTreeMap<AssetType, Balance>,
1918
}
2019

@@ -23,12 +22,10 @@ pub struct AssetInfo {
2322
pub struct TotalAssetInfo {
2423
name: String,
2524
token_name: String,
26-
is_native: bool,
2725
chain: Chain,
2826
precision: u16,
2927
desc: String,
3028
online: bool,
31-
trustee_addr: String,
3229
details: CodecBTreeMap<AssetType, Balance>,
3330
}
3431

@@ -52,18 +49,15 @@ impl TotalAssetInfo {
5249
pub fn new(
5350
asset: Asset,
5451
online: bool,
55-
trustee: String,
5652
details: CodecBTreeMap<AssetType, Balance>,
5753
) -> TotalAssetInfo {
5854
TotalAssetInfo {
5955
name: String::from_utf8_lossy(&asset.token()).into_owned(),
6056
token_name: String::from_utf8_lossy(&asset.token_name()).into_owned(),
61-
is_native: asset.chain() == Chain::ChainX,
6257
chain: asset.chain(),
6358
precision: asset.precision(),
6459
desc: String::from_utf8_lossy(&asset.desc()).into_owned(),
6560
online,
66-
trustee_addr: trustee,
6761
details,
6862
}
6963
}

0 commit comments

Comments
 (0)