How to setup ledger locally (using `icrc1_transfer ` with `ic_ledger_types`) to make a transfer?

Following these docs, but the provided candid/wasm files don’t have transfer or account_balance in them.

I found this related post to try another commit hash, but now I can’t deploy it.

Invalid data: Unable to serialize Candid values: record field send_whitelist not found.

I’ve tried other deploy commands from various docs/forum posts (including with send_whitelist), but can’t get it to work. Question one: which combination of ledger candid/wasm/deploy commands should I be using?

I also found this forum post which suggests icrc1_transfer should be used instead of transfer anyway. I’m using the Rust library ic_ledger_types, which doesn’t seem to call the new icrc1_transfer. Question two: Does this mean ic_ledger_types isn’t compatible with the latest ledger candid/wasm? If not, how can I call this to do a transfer in Rust?

1 Like

A version that works, with a deploy command, here: Questions about accountIdentifier and subaccount in ICPledger? - #12 by Damz

Question 2 remains: how to use the new icrc1_transfer with the ic_ledger_types? Or is sticking with the old transfer way fine?

Hi @Damz!

The ic-ledger-types package covers the original ICP ledger interface based on AccountIdentifiers, it doesn’t contain ICRC-1 endpoints. If you target only the ICP ledger, you can still use the ic-ledger-types directly (transfer and friends) and not worry about the ICRC-1 endpoints.

Hi @Damz ,

If you want to use icrc* types then I suggest to use the library instead. It is like ic_ledger_types but for icrc.
In general I would suggest to use the icrc interface over the old icp one because it is supported by icp and all the icrc ledgers.


Is there a transfer function available in the icrc-ledger-types crate? Similar to how previously the transfer function could be called with ic_ledger_types::transfer(), can it be called with something like icrc-ledger-types::icrc1::transfer(). I can’t find any direct transfer method in the crate, only the type definitions and only see the way to implement the function myself and calling it via api::call.

The crate only defines the types at the moment. You’ll have to implement the function yourself but for the input and output types you can use the ones from the crate.