Return account's asset balances (#13352)

* Runtime method to get user's assets balances

* Fix test (typo)

* Update frame/assets/src/functions.rs

* Remove instance param

* Update frame/assets/src/functions.rs

Co-authored-by: Bastian Köcher <git@kchr.de>

* Remove instance param

* Refactor

* Chore

* Update doc

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
Co-authored-by: parity-processbot <>
This commit is contained in:
Jegor Sidorenko
2023-03-02 15:58:41 +02:00
committed by GitHub
parent 2c37de32bf
commit 7981d4aa59
4 changed files with 60 additions and 1 deletions
+15
View File
@@ -105,6 +105,9 @@ use sp_runtime::generic::Era;
/// Generated voter bag information.
mod voter_bags;
/// Runtime API definition for assets.
pub mod assets_api;
// Make the WASM binary available.
#[cfg(feature = "std")]
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
@@ -2072,6 +2075,18 @@ impl_runtime_apis! {
}
}
impl assets_api::AssetsApi<
Block,
AccountId,
Balance,
u32,
> for Runtime
{
fn account_balances(account: AccountId) -> Vec<(u32, Balance)> {
Assets::account_balances(account)
}
}
impl pallet_contracts::ContractsApi<Block, AccountId, Balance, BlockNumber, Hash> for Runtime
{
fn call(