Skip to content

Commit

Permalink
chore: Replace GItHub formatted alerts/info boxes (#848)
Browse files Browse the repository at this point in the history
* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md

* Update README.md
  • Loading branch information
jessiemongeon1 authored Jun 4, 2024
1 parent 01b1e4d commit 02fdc23
Show file tree
Hide file tree
Showing 6 changed files with 167 additions and 68 deletions.
42 changes: 30 additions & 12 deletions motoko/icp_transfer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,11 @@

ICP transfer is a canister that can transfer ICP from its account to other accounts. It is an example of a canister that uses the ledger canister. Sample code is available in [Motoko](https://github.com/dfinity/examples/tree/master/motoko/icp_transfer) and [Rust](https://github.com/dfinity/examples/tree/master/rust/icp_transfer).

> [!NOTE]
> The ICP ledger supports the ICRC1 standard, which is the recommended standard for token transfers. You can read more about the differences [here](https://internetcomputer.org/docs/current/developer-docs/defi/overview) and find an example of how to transfer ICRC1 tokens from a canister in [Motoko](https://github.com/dfinity/examples/tree/master/motoko/token_transfer) and [Rust](https://github.com/dfinity/examples/tree/master/rust/token_transfer).
:::info

The ICP ledger supports the ICRC1 standard, which is the recommended standard for token transfers. You can read more about the differences [here](https://internetcomputer.org/docs/current/developer-docs/defi/overview) and find an example of how to transfer ICRC1 tokens from a canister in [Motoko](https://github.com/dfinity/examples/tree/master/motoko/token_transfer) and [Rust](https://github.com/dfinity/examples/tree/master/rust/token_transfer).

:::

## Architecture

Expand All @@ -26,8 +29,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-11 below.
:::info

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

:::

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

Expand All @@ -38,8 +44,11 @@ cd icp_transfer

### Step 2: Determine ledger file locations

> [!NOTE]
> You can read more about how to setup the ICP ledger locally [here](https://internetcomputer.org/docs/current/developer-docs/defi/icp-tokens/ledger-local-setup).
:::info

You can read more about how to setup the ICP ledger locally [here](https://internetcomputer.org/docs/current/developer-docs/defi/icp-tokens/ledger-local-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 All @@ -60,8 +69,11 @@ chmod +x download_latest_icp_ledger.sh

Replace its contents with this but adapt the URLs to be the ones you determined in step 2:

> [!IMPORTANT]
> Don't forget to add the `icp_ledger_canister` as a dependency for `icp_transfer_backend`, otherwise the build will fail.
:::info

Don't forget to add the `icp_ledger_canister` as a dependency for `icp_transfer_backend`, otherwise the build will fail.

:::

```json
{
Expand Down Expand Up @@ -101,8 +113,11 @@ dfx start --background --clean

### Step 5: Deploy the ledger canister to your network:

> [!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 the ICP ledger canister, you are also:

Expand Down Expand Up @@ -241,8 +256,11 @@ TOKENS_TRANSFER_ACCOUNT_ID_BYTES="$(python3 -c 'print("vec{" + ";".join([str(b)
### Step 10: Transfer funds to your canister:
> [!IMPORTANT]
> Make sure that you are using the default `dfx` account that we minted tokens to in step 7 for the following steps.
:::info
Make sure that you are using the default `dfx` account that we minted tokens to in step 7 for the following steps.
:::
Make the following call to transfer funds to the canister:
Expand Down
35 changes: 25 additions & 10 deletions motoko/token_transfer/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-8 and 10-12 below.
:::info

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

:::

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

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

### 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

[Learn 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 @@ -105,8 +111,11 @@ dfx identity use minter
export MINTER=$(dfx identity get-principal)
```

> [!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.

:::

### Step 6: Switch back to your default identity and record its principal to mint an initial balance to when deploying the ledger:

Expand Down Expand Up @@ -153,8 +162,11 @@ URLs:

### Step 8: 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

[Learn more about 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 @@ -244,8 +256,11 @@ dfx deploy token_transfer_backend
### Step 11: Transfer funds to your canister:
> [!IMPORTANT]
> Make sure that you are using the default `dfx` account that we minted tokens to in step 7 for the following steps.
:::info
Make sure that you are using the default `dfx` account that we minted tokens to in step 7 for the following steps.
:::
Make the following call to transfer 10 tokens to the canister:
Expand Down
42 changes: 30 additions & 12 deletions motoko/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 [here](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 All @@ -57,8 +63,11 @@ chmod +x download_latest_icrc1_ledger.sh

Replace its contents with this but adapt the URLs to be the ones you determined in step 2. Note that we are deploying the ICRC-1 ledger to the same canister id the ckBTC ledger uses on mainnet. This will make it easier to interact with it later.

> [!IMPORTANT]
> Don't forget to add the `icrc1_ledger_canister` as a dependency for `token_transfer_from_backend`, otherwise the build will fail.
:::info

Don't forget to add the `icrc1_ledger_canister` as a dependency for `token_transfer_from_backend`, otherwise the build will fail.

:::

```json
{
Expand Down Expand Up @@ -103,8 +112,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 @@ -155,8 +167,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

[Learn more about 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 @@ -243,8 +258,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
34 changes: 24 additions & 10 deletions rust/icp_transfer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@

ICP transfer is a canister that can transfer ICP from its account to other accounts. It is an example of a canister that uses the ledger canister. Sample code is available in [Motoko](https://github.com/dfinity/examples/tree/master/motoko/icp_transfer) and [Rust](https://github.com/dfinity/examples/tree/master/rust/icp_transfer).

> [!NOTE]
> The ICP ledger supports the ICRC1 standard, which is the recommended standard for token transfers. You can read more about the differences [here](https://internetcomputer.org/docs/current/developer-docs/defi/overview) and find an example of how to transfer ICRC1 tokens from a canister in [Motoko](https://github.com/dfinity/examples/tree/master/motoko/token_transfer) and [Rust](https://github.com/dfinity/examples/tree/master/rust/token_transfer).
:::info

The ICP ledger supports the ICRC1 standard, which is the recommended standard for token transfers. You can [read more about the differences](https://internetcomputer.org/docs/current/developer-docs/defi/overview) and find an example of how to transfer ICRC1 tokens from a canister in [Motoko](https://github.com/dfinity/examples/tree/master/motoko/token_transfer) and [Rust](https://github.com/dfinity/examples/tree/master/rust/token_transfer).
:::

## Architecture

Expand All @@ -26,8 +28,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-8 and 10-13 below.
:::info

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

:::

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

Expand All @@ -38,8 +43,11 @@ cd icp_transfer

### Step 2: Determine ledger file locations

> [!NOTE]
> You can read more about how to setup the ICP ledger locally [here](https://internetcomputer.org/docs/current/developer-docs/defi/icp-tokens/ledger-local-setup).
:::info

You can read more about how to [setup the ICP ledger locally](https://internetcomputer.org/docs/current/developer-docs/defi/icp-tokens/ledger-local-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 @@ -246,8 +254,11 @@ ic_cdk::export_candid!();
Replace the contents of the `src/icp_transfer_backend/icp_transfer_backend.did` file with the following:
> [!NOTE]
> The `icp_transfer_backend.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 `icp_transfer_backend.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 Result = variant { Ok : nat64; Err : text };
Expand Down Expand Up @@ -279,8 +290,11 @@ TOKENS_TRANSFER_ACCOUNT_ID_BYTES="$(python3 -c 'print("vec{" + ";".join([str(b)
### Step 12: Transfer funds to your canister:
> [!IMPORTANT]
> Make sure that you are using the default `dfx` account that we minted tokens to in step 7 for the following steps.
:::info
Make sure that you are using the default `dfx` account that we minted tokens to in step 7 for the following steps.
:::
Make the following call to transfer funds to the canister:
Expand Down
40 changes: 28 additions & 12 deletions rust/token_transfer/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-8 and 10-12 below.
:::info

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

:::

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

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

### 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 @@ -107,8 +113,11 @@ dfx identity use minter
export MINTER=$(dfx identity get-principal)
```

> [!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.

:::

### Step 6: Switch back to your default identity and record its principal to mint an initial balance to when deploying the ledger:

Expand Down Expand Up @@ -155,8 +164,9 @@ URLs:

### Step 8: 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 @@ -261,8 +271,11 @@ ic_cdk::export_candid!();
Replace the contents of the `src/token_transfer_backend/token_transfer_backend.did` file with the following:
> [!NOTE]
> The `token_transfer_backend.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_backend.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 vec nat8 };
Expand All @@ -280,8 +293,11 @@ dfx deploy token_transfer_backend
### Step 11: Transfer funds to your canister:
> [!IMPORTANT]
> Make sure that you are using the default `dfx` account that we minted tokens to in step 7 for the following steps.
:::info
Make sure that you are using the default `dfx` account that we minted tokens to in step 7 for the following steps.
:::
Make the following call to transfer 10 tokens to the canister:
Expand Down
Loading

0 comments on commit 02fdc23

Please sign in to comment.