How to send ICP from Account Identifier to ledger Canister

I’m newbie on Motoko. I read docs about the Ledger Canister, dfx ledger transfer --to [account-identifier]. This transfers ICP from ledger canister account to destination(account identifier). How to transfer ICP from account identifier to Ledger Canister on Motoko?

Thanks

I am not an expert in motoko but you will need the nns ledger interface
https://k7gat-daaaa-aaaae-qaahq-cai.ic0.app/listing/nns-ledger-10244
and call the transfer method
transfer : ( TransferArgs, ) -> (TransferResult);

You can find an example how to call other canisters from your actor here

You can use the playground to experiment.

4 Likes

Many thanks,
let me ask commands:

Minter

dfx identity new minter

dfx identity use minter

export MINT_ACC=$(dfx ledger account-id)

# ledger

dfx identity use default
export LEDGER_ACC=$(dfx ledger account-id)

can Account Identifier(use NNS) to be the Ledger Canister account? Or The Ledger Canister account is only our developer to hold ICP to payment, convert to cycles…?

I’m not clear, hold u can explain it.
Thanks

maybe this code can help

1 Like