substrate_api_client/api/rpc_api/
pallet_balances.rs

1/*
2   Copyright 2019 Supercomputing Systems AG
3   Licensed under the Apache License, Version 2.0 (the "License");
4   you may not use this file except in compliance with the License.
5   You may obtain a copy of the License at
6	   http://www.apache.org/licenses/LICENSE-2.0
7   Unless required by applicable law or agreed to in writing, software
8   distributed under the License is distributed on an "AS IS" BASIS,
9   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
10   See the License for the specific language governing permissions and
11   limitations under the License.
12*/
13use crate::{
14	api::{Api, GetStorage, Result},
15	rpc::Request,
16};
17use ac_primitives::config::Config;
18#[cfg(all(not(feature = "sync-api"), not(feature = "std")))]
19use alloc::boxed::Box;
20
21/// Interface to common calls of the substrate balances pallet.
22#[maybe_async::maybe_async(?Send)]
23pub trait GetBalance {
24	type Balance;
25
26	async fn get_existential_deposit(&self) -> Result<Self::Balance>;
27}
28
29#[maybe_async::maybe_async(?Send)]
30impl<T, Client> GetBalance for Api<T, Client>
31where
32	T: Config,
33	Client: Request,
34{
35	type Balance = T::Balance;
36
37	async fn get_existential_deposit(&self) -> Result<Self::Balance> {
38		self.get_constant("Balances", "ExistentialDeposit").await
39	}
40}