I have an icrc1_ledger canister set up locally for a custom token. I can interact with it via candid so I know it is live and working. I can call the icrc1_transfer via the CLI with my identity set to the minter account’s principal and it does what is expected, i.e. it mints the tokens and transfers them to the designated user.
However, I now want to call the icrc1_transfer function via an inter-canister call as the minter from ‘myCanister’ written in motoko. myCanister makes a call to icrc1_ledger/icrc1_transfer.
The call doesn’t seem to work (I think) because the incoming message to icrc1_ledger is not coming from the minter’s principal. My understanding is that the call will be made using the id of the canister. (The minter principal is the controller of myCanister, but that doesn’t seem to do the trick).
I’m not sure how this is supposed to work. Do I need to sign the transaction with the minter principal before it is sent? Is there a way for another canister to perform minting of tokens?
I could define myCanister’s principal as the minter principal in icrc1_ledger but that doesn’t seem like a realistic scenario - or maybe that’s the solution? I’d appreciate any pointers on (a) whether minting programmatically from another canister is possible, and (b) what approach should I use?