@@ -103,12 +103,10 @@ If you chose to download the ICRC-1 ledger files with the script, you need to re
103103dfx start --background --clean
104104```
105105
106- ### Step 5: Create a new identity that will work as a minting account:
106+ ### Step 5: Use the anonymous identity as the minting account:
107107
108108``` bash
109- dfx identity new minter --storage-mode plaintext
110- dfx identity use minter
111- export MINTER=$( dfx identity get-principal)
109+ export MINTER=$( dfx --identity anonymous identity get-principal)
112110```
113111
114112::: info
@@ -117,18 +115,17 @@ Transfers from the minting account will create Mint transactions. Transfers to t
117115
118116:::
119117
120- ### Step 6: Switch back to your default identity and record its principal to mint an initial balance to when deploying the ledger:
118+ ### Step 6: Record your default identity's principal to mint an initial balance to when deploying the ledger:
121119
122120``` bash
123- dfx identity use default
124121export DEFAULT=$( dfx identity get-principal)
125122```
126123
127124### Step 7: Deploy the ICRC-1 ledger locally:
128125
129126Take a moment to read the details of the call made below. Not only are you deploying an ICRC-1 ledger canister, you are also:
130127
131- - Setting the minting account to the principal you saved in a previous step (` MINTER ` )
128+ - Setting the minting account to the anonymous principal you saved in a previous step (` MINTER ` )
132129- Minting 100 tokens to the DEFAULT principal
133130- Setting the transfer fee to 0.0001 tokens
134131- Naming the token Local ICRC1 / L-ICRC1
@@ -189,23 +186,16 @@ Replace the contents of the `src/token_transfer_backend/main.mo` file with the f
189186import Icrc1Ledger " canister:icrc1_ledger_canister" ;
190187import Debug " mo:base/Debug" ;
191188import Result " mo:base/Result" ;
192- import Option " mo:base/Option" ;
193- import Blob " mo:base/Blob" ;
194189import Error " mo:base/Error" ;
195190
196191actor {
197192
198- type Account = {
199- owner : Principal;
200- subaccount : ? [Nat8];
201- };
202-
203193 type TransferArgs = {
204194 amount : Nat;
205- toAccount : Account;
195+ toAccount : Icrc1Ledger. Account;
206196 };
207197
208- public shared ({ caller }) func transfer(args : TransferArgs) : async Result.Result< Icrc1Ledger.BlockIndex, Text> {
198+ public shared func transfer(args : TransferArgs) : async Result.Result< Icrc1Ledger.BlockIndex, Text> {
209199 Debug.print(
210200 " Transferring "
211201 # debug_show (args.amount)
@@ -222,7 +212,7 @@ actor {
222212 from_subaccount = null;
223213 // if not specified, the default fee for the canister is used
224214 fee = null;
225- // we take the principal and subaccount from the arguments and convert them into an account identifier
215+ // the account we want to transfer tokens to
226216 to = args.toAccount;
227217 // a timestamp indicating when the transaction was created by the caller ; if it is not specified by the caller then this is set to the current ICP time
228218 created_at_time = null;
0 commit comments