radix_native_sdk/account/
account.rs

1use radix_common::data::scrypto::scrypto_encode;
2use radix_engine_interface::api::*;
3use radix_engine_interface::blueprints::account::{AccountDepositInput, ACCOUNT_DEPOSIT_IDENT};
4use radix_engine_interface::blueprints::resource::Bucket;
5use radix_engine_interface::types::ComponentAddress;
6use sbor::rust::fmt::Debug;
7
8#[derive(Debug)]
9pub struct Account(pub ComponentAddress);
10
11impl Account {
12    pub fn deposit<Y: SystemObjectApi<E>, E: SystemApiError>(
13        &self,
14        bucket: Bucket,
15        api: &mut Y,
16    ) -> Result<(), E> {
17        api.call_method(
18            self.0.as_node_id(),
19            ACCOUNT_DEPOSIT_IDENT,
20            scrypto_encode(&AccountDepositInput { bucket }).unwrap(),
21        )?;
22
23        Ok(())
24    }
25}