Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jessiemongeon1 authored Apr 12, 2024
1 parent dcb1af9 commit 907edb2
Showing 1 changed file with 30 additions and 12 deletions.
42 changes: 30 additions & 12 deletions rust/token_transfer_from/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,11 @@ This example requires an installation of:

The following steps will guide you through the process of setting up the token transfer canister for your own project.

> [!TIP]
> If you just want to interact with this example, follow steps 4-6 and 8-10 below.
:::info

If you just want to interact with this example, follow steps 4-6 and 8-10 below.

:::

### Step 1: Create a new `dfx` project and navigate into the project's directory.

Expand All @@ -35,8 +38,11 @@ cd token_transfer_from

### Step 2: Determine ICRC-1 ledger file locations

> [!NOTE]
> You can read more about how to setup the ICRC-1 ledger locally [here](https://internetcomputer.org/docs/current/developer-docs/defi/icrc-1/icrc1-ledger-setup).
:::info

You can read more about how to [setup the ICRC-1 ledger locally](https://internetcomputer.org/docs/current/developer-docs/defi/icrc-1/icrc1-ledger-setup).

:::

Go to the [releases overview](https://dashboard.internetcomputer.org/releases) and copy the latest replica binary revision. At the time of writing, this is `d87954601e4b22972899e9957e800406a0a6b929`.

Expand Down Expand Up @@ -100,8 +106,11 @@ dfx start --background --clean

### Step 5: Deploy the ICRC-1 ledger locally:

> [!IMPORTANT]
> Transfers from the `minting_account` will create Mint transactions. Transfers to the minting account will create Burn transactions.
:::info

Transfers from the `minting_account` will create Mint transactions. Transfers to the minting account will create Burn transactions.

:::

Take a moment to read the details of the call made below. Not only are you deploying an ICRC-1 ledger canister, you are also:

Expand Down Expand Up @@ -152,8 +161,11 @@ URLs:

### Step 6: Verify that the ledger canister is healthy and working as expected by using the command:

> [!NOTE]
> You can find more information on how to interact with the ICRC-1 ledger [here](https://internetcomputer.org/docs/current/developer-docs/defi/icrc-1/using-icrc1-ledger#icrc-1-and-icrc-1-extension-endpoints)
:::info

You can find more information on how to [interact with the ICRC-1 ledger](https://internetcomputer.org/docs/current/developer-docs/defi/icrc-1/using-icrc1-ledger#icrc-1-and-icrc-1-extension-endpoints)

:::

````bash
dfx canister call icrc1_ledger_canister icrc1_balance_of "(record {
Expand Down Expand Up @@ -259,8 +271,11 @@ ic_cdk::export_candid!();
Replace the contents of the `src/token_transfer_from_backend/token_transfer_from_backend.did` file with the following:
> [!NOTE]
> The `token_transfer_from.did` file is a Candid file that describes the service interface of the canister. It was generated from the Rust code using the `candid-extractor` tool. You can read more about the necessary steps [here](https://internetcomputer.org/docs/current/developer-docs/backend/rust/generating-candid).
:::info
The `token_transfer_from.did` file is a Candid file that describes the service interface of the canister. It was generated from the Rust code using the `candid-extractor` tool. You can read more about the [necessary steps](https://internetcomputer.org/docs/current/developer-docs/backend/rust/generating-candid).
:::
```did
type Account = record { owner : principal; subaccount : opt blob };
Expand All @@ -277,8 +292,11 @@ dfx deploy token_transfer_from_backend
### Step 9: Approve the canister to transfer funds on behalf of the user:
> [!IMPORTANT]
> Make sure that you are using the default `dfx` account that we minted tokens to in step 5 for the following steps.
:::info
Make sure that you are using the default `dfx` account that we minted tokens to in step 5 for the following steps.
:::
Make the following call to approve the `token_transfer_from_backend` canister to transfer 100 tokens on behalf of the `default` identity:
Expand Down

0 comments on commit 907edb2

Please sign in to comment.