canic_core/api/ic/
ledger.rs1use crate::{
2 cdk::types::{Account, Principal},
3 dto::error::Error,
4 workflow::ic::ledger::LedgerWorkflow,
5};
6
7pub struct LedgerApi;
12
13impl LedgerApi {
14 pub async fn transfer_from(
18 ledger_id: Principal,
19 payer: Principal,
20 spender: Account,
21 to: Account,
22 amount: u64,
23 memo: Option<Vec<u8>>,
24 ) -> Result<u64, Error> {
25 LedgerWorkflow::transfer_with_allowance_check(ledger_id, payer, spender, to, amount, memo)
26 .await
27 .map_err(Error::from)
28 }
29}