oasis_runtime_sdk/modules/accounts/
types.rs

1//! Account module types.
2use std::collections::BTreeMap;
3
4use crate::types::{address::Address, token};
5
6/// Transfer call.
7#[derive(Clone, Debug, Default, cbor::Encode, cbor::Decode)]
8pub struct Transfer {
9    pub to: Address,
10    pub amount: token::BaseUnits,
11}
12
13/// Account metadata.
14#[derive(Clone, Debug, Default, cbor::Encode, cbor::Decode)]
15pub struct Account {
16    #[cbor(optional)]
17    pub nonce: u64,
18}
19
20/// Arguments for the Nonce query.
21#[derive(Clone, Debug, Default, cbor::Encode, cbor::Decode)]
22pub struct NonceQuery {
23    pub address: Address,
24}
25
26/// Arguments for the Addresses query.
27#[derive(Clone, Debug, Default, cbor::Encode, cbor::Decode)]
28pub struct AddressesQuery {
29    pub denomination: token::Denomination,
30}
31
32/// Arguments for the Balances query.
33#[derive(Clone, Debug, Default, cbor::Encode, cbor::Decode)]
34pub struct BalancesQuery {
35    pub address: Address,
36}
37
38/// Balances in an account.
39#[derive(Clone, Debug, Default, cbor::Encode, cbor::Decode)]
40pub struct AccountBalances {
41    pub balances: BTreeMap<token::Denomination, u128>,
42}
43
44/// Arguments for the DenominationInfo query.
45#[derive(Clone, Debug, Default, cbor::Encode, cbor::Decode)]
46pub struct DenominationInfoQuery {
47    pub denomination: token::Denomination,
48}
49
50/// Information about a denomination.
51#[derive(Clone, Debug, Default, cbor::Encode, cbor::Decode)]
52pub struct DenominationInfo {
53    /// Number of decimals that the denomination is using.
54    pub decimals: u8,
55}