Skip to content

Commit

Permalink
Merge pull request #2632 from dfinity/jmongeon-patch1
Browse files Browse the repository at this point in the history
misc: Typos and revisions suggested in old PRs
  • Loading branch information
jessiemongeon1 authored Mar 9, 2024
2 parents 2e3a6d7 + 827647a commit 3328896
Show file tree
Hide file tree
Showing 15 changed files with 66 additions and 65 deletions.
22 changes: 11 additions & 11 deletions blog/features/dfx-deps.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,33 +9,33 @@ image: /img/blog/infinity-symbol.png

[!dfx deps](/img/blog/infinity-symbol.png)

Today we're excited to announce a new dfx feature: dfx deps!
Today we're excited to announce a new dfx feature: dfx deps!

## What is `dfx deps`?

`dfx deps` is a new set of subcommands designed to provide a consistent developer workflow for integrating and testing third-party canisters within local environments. Third-party canisters can be canisters created by DFINITY, such as the Internet Identity or NNS canisters, or they can be canisters created by members of the ICP community that provide a public service at a *static canister ID*.
`dfx deps` is a new set of subcommands designed to provide a consistent developer workflow for integrating and testing third-party canisters within local environments. Third-party canisters can be canisters created by DFINITY, such as the Internet Identity or NNS canisters, or they can be canisters created by members of the ICP community that provide a public service at a *static canister ID*.

Testing third-party canister integrations locally is important to verify the third-party canister's integration functionality without paying cycles or using production environments.
Testing third-party canister integrations locally is important to verify the third-party canister's integration functionality without paying cycles or using production environments.

The `dfx deps` command includes the following subcommands:
The `dfx deps` command includes the following subcommands:

- `dfx deps pull`: Pulls the dependencies from the mainnet and generates `deps/pulled.json`. The Candid files of direct dependencies will also be put into `deps/candid/`.
- `dfx deps init`: Sets the `init` arguments for the pulled dependencies and saves the data in `deps/init.json`.
- `dfx deps deploy`: Deploys the pulled dependencies on the local replica with the `init` arguments recorded in `deps/init.json`.

## Workflow overview
## Workflow overview

Let's take a look at how the `dfx deps` workflow operates. There are two roles: the **service provider** and the **service consumer**.
Let's take a look at how the `dfx deps` workflow operates. There are two roles: the **service provider** and the **service consumer**.

### Service provider

The **service provider** is responsible for configuring a canister to be `pullable`.

For a canister to be `pullable`, the following should be true:
- The canister provides a public service at a static canister ID.
- The canister provides a public service at a static canister ID.
- The wasm module of a `pullable` canister must be hosted via a URL so that service consumers can download it when pulling the dependency.

Canisters that do not use a static canister ID, or do not provide a public service that can be utilized by other developers, should not be configured to be `pullable`.
Canisters that do not use a static canister ID, or do not provide a public service that can be utilized by other developers, should not be configured to be `pullable`.

A canister is configured to be `pullable` by editing the `dfx.json` file to include the following information:

Expand All @@ -62,7 +62,7 @@ A canister is configured to be `pullable` by editing the `dfx.json` file to incl

### Service consumer

Once a canister is `pullable`, a **service consumer** can pull the canister as a dependency directly from the mainnet and then deploy the dependency on a local replica.
Once a canister is `pullable`, a **service consumer** can pull the canister as a dependency directly from the mainnet and then deploy the dependency on a local replica.

To pull the dependencies from the mainnet, the `dfx.json` file must include the dependencies configuration for the canister.

Expand Down Expand Up @@ -93,7 +93,7 @@ For example, the following `dfx.json` file configures two dependencies for the c
}
```

Then, these dependencies can be pulled using the `dfx deps pull` command. By default, the `dfx deps pull` connects to the mainnet. To deploy locally, the `--network local` flag can be used.
Then, these dependencies can be pulled using the `dfx deps pull` command. By default, the `dfx deps pull` connects to the mainnet. To deploy locally, the `--network local` flag can be used.

When this command is called, several things happen in the background, including:

Expand Down Expand Up @@ -122,7 +122,7 @@ After this step, the pulled dependencies can be deployed on a local replica usin

## Conclusion

The `dfx deps` feature is available in dfx versions `0.14.1` and newer. You can learn more from our [developer documentation](https://internetcomputer.org/docs/current/developer-docs/setup/pulling-canister-dependencies), which includes an interactive example you can use to test the feature for yourself.
The `dfx deps` feature is available in dfx versions `0.14.1` and newer. You can learn more from our [developer documentation](https://internetcomputer.org/docs/current/developer-docs/smart-contracts/maintain/import), which includes an interactive example you can use to test the feature for yourself.

As always, please let us know if you have any feedback either through our [forum](https://forum.dfinity.org/) or [Discord server](https://discord.com/invite/5PJMmmETQB).

Expand Down
24 changes: 12 additions & 12 deletions blog/news-and-updates/2023-07-26-update.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Developer weekly update July 26, 2023
description: In this week's issue, we're going to take a brief look at the new `dfx deps` subcommand, plus explore a new QR code example project that showcases deterministic time slicing.
description: In this week's issue, we're going to take a brief look at the new `dfx deps` subcommand, plus explore a new QR code example project that showcases deterministic time slicing.
tags: [Devs]
image: /img/blog/dev-update-blog-jul-26.jpg
---
Expand All @@ -10,39 +10,39 @@ image: /img/blog/dev-update-blog-jul-26.jpg

![July 26 2023](../../static/img/blog/dev-update-blog-jul-26.jpg)

Hello devs and welcome to this week’s issue of developer weekly! In this issue, we're going to take a brief look at the new `dfx deps` subcommand, plus explore a new QR code example project that showcases deterministic time slicing.
Hello devs and welcome to this week’s issue of developer weekly! In this issue, we're going to take a brief look at the new `dfx deps` subcommand, plus explore a new QR code example project that showcases deterministic time slicing.

Ready to dive in?

## `dfx deps`

`dfx deps` is a new subcommand that allows developers to pull third-party canisters from the mainnet, then deploy them on a local replica to test integration functionality without worrying about paying cycles or using production environments.
`dfx deps` is a new subcommand that allows developers to pull third-party canisters from the mainnet, then deploy them on a local replica to test integration functionality without worrying about paying cycles or using production environments.

To use `dfx deps`, there are two roles to the workflow. A service provider can configure a canister to be 'pullable', meaning it can be pulled by others using `dfx deps`, and a service consumer can pull a canister from the mainnet if that canister has been configured to be 'pullable'.
To use `dfx deps`, there are two roles to the workflow. A service provider can configure a canister to be 'pullable', meaning it can be pulled by others using `dfx deps`, and a service consumer can pull a canister from the mainnet if that canister has been configured to be 'pullable'.

A separate blog post has been published on this subcommand and workflow that goes into much deeper detail. You can check out that blog post [here](https://internetcomputer.org/blog/features/dfx-deps), and the corresponding developer documentation for it [here](https://internetcomputer.org/docs/current/developer-docs/setup/pulling-canister-dependencies).
A separate blog post has been published on this subcommand and workflow that goes into much deeper detail. You can check out that blog post [here](https://internetcomputer.org/blog/features/dfx-deps), and the corresponding developer documentation for it [here](https://internetcomputer.org/docs/current/developer-docs/smart-contracts/maintain/import).

## New sample code: QR code generator
## New sample code: QR code generator

Thanks to Ulan Degenbaev from the Runtime team, a new Rust example has been added to the `DFINITY/examples` repository. This example demonstrates how dapps on ICP can perform long-running computation tasks, such as image processing, in a single message execution. This functionality is possible to Deterministic Time Slicing (DTS), which is a unique feature on ICP that divides long computational tasks into smaller slices that are then executed across multiple blocks. Using this new feature, developers can write long-running computational code as they normally would, and don't need to perform any special tasks to take advantage of the DTS benefits.
Thanks to Ulan Degenbaev from the Runtime team, a new Rust example has been added to the `DFINITY/examples` repository. This example demonstrates how dapps on ICP can perform long-running computation tasks, such as image processing, in a single message execution. This functionality is possible to Deterministic Time Slicing (DTS), which is a unique feature on ICP that divides long computational tasks into smaller slices that are then executed across multiple blocks. Using this new feature, developers can write long-running computational code as they normally would, and don't need to perform any special tasks to take advantage of the DTS benefits.

This new sample code demonstrates the DTS functionality using a QR code generation application. A live version of this sample can be found [here](https://khpe2-4qaaa-aaaao-a2fnq-cai.icp0.io/) for you to try out.

If you want to play with the sample locally, you can find the code in our examples repo [here](https://github.com/dfinity/examples/tree/master/rust/qrcode).

### How the QR code generator works

In this sample, the initial dapp code has been generated by dfx's standard template with the `dfx new` command.
In this sample, the initial dapp code has been generated by dfx's standard template with the `dfx new` command.

The frontend canister contains an HTML webpage that includes a form for users to enter text fields to configure the QR code. Then, a 'Generate!' button uses a JavaScript handler to initiate a call to the backend canister, which automatically generates a JavaScript object from the Candid interface. The JavaScript object uses async functions for each of the backend canister's endpoints. There are two backend endpoints: one for updates and one for queries. This is intentionally done for educational purposes. The JavaScript button uses async functions to make the call from the frontend to the backend.
The frontend canister contains an HTML webpage that includes a form for users to enter text fields to configure the QR code. Then, a 'Generate!' button uses a JavaScript handler to initiate a call to the backend canister, which automatically generates a JavaScript object from the Candid interface. The JavaScript object uses async functions for each of the backend canister's endpoints. There are two backend endpoints: one for updates and one for queries. This is intentionally done for educational purposes. The JavaScript button uses async functions to make the call from the frontend to the backend.

This sample is written in Rust and utilizes the `image` and `qrcode-generator` crates. There is some minor image processing that happens as well, in order to add the Internet Computer logo and color scheme to the final generated QR code image result.
This sample is written in Rust and utilizes the `image` and `qrcode-generator` crates. There is some minor image processing that happens as well, in order to add the Internet Computer logo and color scheme to the final generated QR code image result.

## `dfx deploy --playground`

For our last topic today, we're going to briefly introduce a new upcoming feature: `dfx deploy --playground`!

`dfx deploy --playground` is an upcoming feature that will soon be available in dfx. With this new `--playground` flag, canisters can be immediately deployed to the Motoko playground. When this flag is used, the canisters in the dfx project will be deployed to mainnet and a canister URL will be returned to the developer. This deployment method allows devs to quickly deploy canisters to the mainnet without having to first setup a cycles wallet or acquire cycles. This allows for developers to quickly get started using dfx to help aid in the developer onboarding process.
`dfx deploy --playground` is an upcoming feature that will soon be available in dfx. With this new `--playground` flag, canisters can be immediately deployed to the Motoko playground. When this flag is used, the canisters in the dfx project will be deployed to mainnet and a canister URL will be returned to the developer. This deployment method allows devs to quickly deploy canisters to the mainnet without having to first setup a cycles wallet or acquire cycles. This allows for developers to quickly get started using dfx to help aid in the developer onboarding process.

It is important to note that canisters deployed with the `--playground` flag will be subject to the same restrictions as other canisters deployed to the Motoko playground. These restrictions are:

Expand All @@ -51,7 +51,7 @@ It is important to note that canisters deployed with the `--playground` flag wil
- Canisters can call the management canister to manage itself without being the controller.
- Deployed canisters expire after 20 minutes.

This feature is upcoming and will be elaborated on further in a future blog post with additional documentation. Be sure to stay tuned for that update!
This feature is upcoming and will be elaborated on further in a future blog post with additional documentation. Be sure to stay tuned for that update!

That's it for this week! Be sure to tune back in next week for our weekly update, plus another installment of our team spotlight series!

Expand Down
2 changes: 1 addition & 1 deletion blog/news-and-updates/2023-09-13-update.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Over the past few weeks, we've had some great new pages added to our developer d

- [Developer journey level 1](/docs/current/tutorials/developer-journey/level-1/): In the next stage of the developer journey, become a space cadet by getting comfortable creating your first dapp, managing your canisters, and acquiring and using cycles.

- [Pulling canister dependencies](/docs/current/developer-docs/setup/pulling-canister-dependencies): Learn how to use the new `dfx deps` feature to pull third-party canister dependencies.
- [Pulling canister dependencies](/docs/current/developer-docs/smart-contracts/maintain/import): Learn how to use the new `dfx deps` feature to pull third-party canister dependencies.

- [Service Nervous System (SNS) documentation](/docs/current/developer-docs/daos/sns/): Over the past few months, our documentation on SNSs has been greatly expanded. New docs include a pre-flight checklist, guidelines on integrating with the ledger and index canisters, and guides for testing your SNS before deploying it.

Expand Down
2 changes: 1 addition & 1 deletion docs/developer-docs/defi/icp-tokens/ledger-local-setup.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ dfx identity use default
export DEFAULT_ACCOUNT_ID=$(dfx ledger account-id)
```

### Step 8: Deploy the ledger canister with archiving options:
### Step 8: Deploy the ledger canister:

```
dfx deploy --specified-id ryjl3-tyaaa-aaaaa-aaaba-cai icp_ledger_canister --argument "
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Theoretically, WSL 1 and WSL 2 should both allow you to run `dfx`. However, it i

### Check your WSL version

Run the command `wsl –list –verbose (wsl -l -v)` to check the Linux distributions installed on your Windows machine. Below is an example output.
Run the command `wsl –-list –-verbose (wsl -l -v)` to check the Linux distributions installed on your Windows machine. Below is an example output.

```
NAME STATE VERSION
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,6 @@ System canisters are canisters that provide a necessary function to the ICP netw

Developers can use system canisters in their project to integrate services into their dapp or enable functionality that requires data from a system canister.

For example, Internet Identity can be integrated into a dapp to provide user authentication service to the project. Internet Identity is commonly integrated into a dapp through the [`dfx deps`](/docs/current/developer-docs/setup/pulling-canister-dependencies) command. `dfx deps` allows you to pull a system canister into your local project for testing.
For example, Internet Identity can be integrated into a dapp to provide user authentication service to the project. Internet Identity is commonly integrated into a dapp through the [`dfx deps`](/docs/current/developer-docs/smart-contracts/maintain/import) command. `dfx deps` allows you to pull a system canister into your local project for testing.

For other projects calls can be made to system canisters to obtain information, such as DeFi projects making calls to the ICP index to obtain information about ICP transactions or price.
4 changes: 2 additions & 2 deletions docs/developer-docs/smart-contracts/build/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ To generate a locally-defined identifier:
Note that you must register unique canister identifiers to replace your locally-defined identifier before you can deploy the project on ICP blockchain.

:::info
When a canister is deployed with [`dfx deploy`](/docs/current/developer-docs/setup/deploy), the `dfx build` command is run in the background as part of the deployment process.
When a canister is deployed with [`dfx deploy`](/docs/current/developer-docs/setup/deploy), the `dfx build` command is run in the background as part of the deployment process.
:::

## How to change the source directory
Expand Down Expand Up @@ -80,7 +80,7 @@ Keep in mind that changing the configuration setting for the dapp file name only

- [Canister history](/docs/current/developer-docs/production/canister-history)

- [Import canisters](/docs/current/developer-docs/setup/pulling-canister-dependencies)
- [Import canisters](/docs/current/developer-docs/smart-contracts/maintain/import)

- [Recover canisters](/docs/current/developer-docs/production/canister-recovery)

Expand Down
2 changes: 1 addition & 1 deletion docs/developer-docs/smart-contracts/deploy/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -314,7 +314,7 @@ def timer_callback():

- [Canister history](/docs/current/developer-docs/production/canister-history)

- [Import canisters](/docs/current/developer-docs/setup/pulling-canister-dependencies)
- [Import canisters](/docs/current/developer-docs/smart-contracts/maintain/import)

- [Recover canisters](/docs/current/developer-docs/production/canister-recovery)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,15 @@ Next, select 'Create Passkey'.

![Internet Identity 2](../_attachments/II_mainnet2.png)

When prompted, choose how to create your passkey. You can create this on either on your current device or another device.
When prompted, choose how to create your passkey. You can create this on either on your current device or another device.

![Internet Identity 3](../_attachments/II_mainnet3.png)

Then, enter the CAPTCHA to continue.

![Internet Identity 4](../_attachments/II_mainnet4.png)

Your Internet Identity has been created! It'll be shown on the screen, and it is recommended that you write it down in a safe location to save it.
Your Internet Identity has been created! It'll be shown on the screen, and it is recommended that you write it down in a safe location to save it.

This number is your Internet Identity. With this number and your passkey, you will be able to create and securely connect to ICP dapps. If you lose this number, you will lose any accounts that were created with it. This number is not a secret, but is unique to you.

Expand All @@ -54,4 +54,4 @@ If you scroll down, you will see an option to add another passkey and options to
- [Internet Identity specification](https://internetcomputer.org/docs/current/references/ii-spec).
- [Internet Identity GitHub repository](https://github.com/dfinity/internet-identity).
- [Internet Identity alternative frontend origins](https://internetcomputer.org/docs/current/developer-docs/integrations/internet-identity/alternative-origins).
- [Internet Identity integration](https://internetcomputer.org/docs/current/developer-docs/integrations/internet-identity/integrate-identity).
- [Internet Identity integration](https://internetcomputer.org/docs/current/developer-docs/integrations/internet-identity/integrate-internet-identity).
Loading

0 comments on commit 3328896

Please sign in to comment.