Skip to content
This repository was archived by the owner on May 23, 2022. It is now read-only.

Commit e6eeea0

Browse files
authored
Lg/more from impressions (#332)
* Doc updates based on feedback from the first impressions blog post * Continue with updates from impressions * Continue with updates from impressions * Remove wallet step to fix step numbering * Remove CanCan reference and add links to Rust CDK * Add package.json samples and fix formatting * Change title for different languages * Change title for different languagesin nav
1 parent b608429 commit e6eeea0

11 files changed

Lines changed: 144 additions & 43 deletions

File tree

modules/ROOT/nav.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
//xref:developer-guide:connect-network.adoc[Connect to a network]
1919
** xref:developers-guide:customize-projects.adoc[Design apps]
2020
** xref:developers-guide:customize-projects.adoc[Manage projects]
21-
** xref:developers-guide:work-with-languages.adoc[Develop using different backend languages]
21+
** xref:developers-guide:work-with-languages.adoc[Develop using different languages]
2222
//*** xref:language-guide:at-a-glance.adoc[Motoko]
2323
//*** xref:rust-guide:basic-syntax-rules.adoc[Rust]
2424
//*** xref:developers-guide:basic-syntax-rules.adoc[C and C++]
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "contacts_assets",
3+
"version": "0.1.0",
4+
"description": "",
5+
"keywords": [],
6+
"scripts": {
7+
"build": "webpack"
8+
},
9+
"devDependencies": {
10+
"@dfinity/agent": "0.6.23",
11+
"terser-webpack-plugin": "2.2.2",
12+
"webpack": "4.41.3",
13+
"webpack-cli": "3.3.10"
14+
},
15+
"dependencies": {
16+
"css-loader": "^5.0.2",
17+
"react": "^17.0.1",
18+
"react-dom": "^17.0.1",
19+
"style-loader": "^2.0.0",
20+
"ts-loader": "^8.0.17",
21+
"typescript": "^4.1.5"
22+
}
23+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"name": "custom_greeting_assets",
3+
"version": "0.1.0",
4+
"description": "",
5+
"keywords": [],
6+
"scripts": {
7+
"build": "webpack"
8+
},
9+
"devDependencies": {
10+
"@dfinity/agent": "0.6.23",
11+
"terser-webpack-plugin": "2.2.2",
12+
"webpack": "4.41.3",
13+
"webpack-cli": "3.3.10"
14+
},
15+
"dependencies": {
16+
"react": "^17.0.1",
17+
"react-dom": "^17.0.1",
18+
"ts-loader": "^8.0.17",
19+
"typescript": "^4.1.5"
20+
}
21+
}

modules/developers-guide/pages/cli-reference/dfx-envars.adoc

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ This section lists the environment variables that are currently supported with e
99

1010
== DFX_CONFIG_ROOT
1111

12-
Use the `+DFX_CONFIG_ROOT+` environment variable to specify a different location for for storing the `+.cache+` and `+.config+` subdirectories for `+dfx+`.
12+
Use the `+DFX_CONFIG_ROOT+` environment variable to specify a different location for storing the `+.cache+` and `+.config+` subdirectories for `+dfx+`.
1313

1414
By default, the `+.cache+` and `+.config+` directories are located in the home directory for your development environment.
1515
For example, on macOS the default location is in the `+/Users/<YOUR-USER-NAME>+` directory.
@@ -19,6 +19,12 @@ Use the `+DFX_CONFIG_ROOT+` environment variable to specify a different location
1919
DFX_CONFIG_ROOT=~/ic-root
2020
....
2121

22+
== DFX_INSTALLATION_ROOT
23+
24+
Use the `+DFX_INSTALLATION_ROOT+` environment variable to specify a different location for the `+dfx+` binary if you are not using the default location for your operating system.
25+
26+
The `+.cache/dfinity/uninstall.sh+` script uses this environment variable to identify the root directory for your {sdk-short-name} installation.
27+
2228
== DFX_TELEMETRY_DISABLED
2329

2430
Use the `+DFX_TELEMETRY_DISABLED+` environment variable to opt-out of having data collected about `+dfx+` usage.

modules/developers-guide/pages/tutorials/custom-frontend.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,12 @@ npm install --save react react-dom
8080
----
8181
npm install --save typescript ts-loader
8282
----
83+
+
84+
NOTE: As an alternative to installing these modules, you can edit the default `+package.json+` file to add dependencies for your project.
85+
+
86+
....
87+
include::example$custom-frontend-package.json[]
88+
....
8389

8490
== Modify the default configuration
8591

modules/developers-guide/pages/tutorials/my-contacts.adoc

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,12 @@ npm install --save style-loader css-loader
7777
----
7878
+
7979
If the `+npm install+` command reports a vulnerability, you might also want to run the `+npm audit fix+` command to attempt to fix the vulnerability reported before continuing.
80+
+
81+
NOTE: As an alternative to installing these modules, you can edit the default `+package.json+` file to add dependencies for your project.
82+
+
83+
....
84+
include::example$add-stylesheet-package.json[]
85+
....
8086

8187
== Modify the default configuration
8288

modules/developers-guide/pages/work-with-languages.adoc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
= Working with different languages
1+
= Develop using different languages
22
:cpp: C++
33
:sdk-short-name: DFINITY Canister SDK
44

@@ -9,14 +9,12 @@ This section provides some high-level guidance for writing programs in different
99
== Using Rust
1010

1111
You can create Rust projects to run on the {IC} by using Cargo and compiling your program to use WebAssembly as the target output.
12-
The CanCan sample project illustrates one way of implementing a Rust-based canister—the `+BigMap+` library—using macros to write functions as query and update calls.
1312

1413
This section provides a summary of the key steps involved in deploying a Rust program as a canister on the {IC}.
1514
You should note, however, that the steps described here only illustrate one approach.
1615
Other implementation approaches are also possible.
17-
////
18-
The Rust CDK provides some shortcuts to make it easier to write functions as query and update calls, but you can develop applications for the {IC} without using the Rust CDK.
19-
////
16+
17+
Note that the link:https://github.com/dfinity/cdk-rs[Rust canister development kit (Rust CDK)] for provides some shortcuts to make it easier to write functions as query and update calls and includes several link:https://github.com/dfinity/cdk-rs/tree/next/examples[examples] to get you started building Rust-based projects, but you can also develop applications for the {IC} without using the Rust CDK.
2018

2119
=== Create a project
2220

modules/developers-guide/pages/working-with-canisters.adoc

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
= Managing canisters
1+
= Manage canisters
22
March 2020 (Alpha)
33
ifdef::env-github,env-browser[:outfilesuffix:.adoc]
44
:proglang: Motoko
@@ -121,6 +121,28 @@ If you were installing canisters on a remote network, you would include the `+--
121121
dfx canister install --all
122122
----
123123

124+
== Look up a canister identifier
125+
126+
All canisters have unique, network-specific identifiers.
127+
You often need to use these identifiers to interact with the canister.
128+
For example, if you want to access the front-end canister for an application or interact with a service using the Candid web interface, you must specify the appropriate canister identifier.
129+
130+
Because the identifiers are network-specific, the files used to store the information are in different directories.
131+
For example, identifiers for a canister deployed locally are located in the project's `+.dfx/local/canister_ids.json+` file.
132+
133+
You can look up the canister identifier for any specific canister by running the `+dfx canister id+` command.
134+
For example, to look up the the canister identifier for the `+lookup+` canister deployed on the local network, you could run the following command:
135+
136+
....
137+
dfx canister id lookup
138+
....
139+
140+
To look up the canister identifier for the same canister deployed on the network specified by the `+ic+` alias, you would run the following command:
141+
142+
....
143+
dfx canister --network=ic id lookup
144+
....
145+
124146
== Reinstall a canister
125147

126148
During the development cycle, you might want to install, then replace your program as you debug and improve it.

modules/quickstart/pages/local-quickstart.adoc

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -128,16 +128,10 @@ As a best practice, this step requires you to have **two terminal shells** open,
128128
To start the network locally:
129129

130130
[arabic]
131-
. Open a new second terminal window or tab on your local computer and navigate to your project directory.
131+
. Open a new second terminal window or tab on your local computer.
132+
. Navigate to the root directory for your project, if necessary.
132133
+
133-
For example, you can do either of the following if running Terminal on macOS:
134-
+
135-
--
136-
* Click *Shell*, then select *New Tab* to open a new terminal in your current working directory.
137-
* Click *Shell* and select *New Window*, then run `+cd ~/ic-projects/hello+` in the new terminal if your `+hello+` project is in the `+ic-projects+` working folder.
138-
--
139-
+
140-
You should now have **two terminals** open with your **project directory** as your **current working directory**.
134+
You should now have **two terminals** open with your **project directory** as your **current working directory** in both terminals.
141135
. Start the {IC} network on your local computer in your second terminal by running the following command:
142136
+
143137
[source,bash]

modules/quickstart/pages/network-quickstart.adoc

Lines changed: 16 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ For example, you should see output similar to the following:
140140
+
141141
....
142142
{
143-
"ic_api_version": "0.11.1" "impl_version": "2020-10-14"
143+
"ic_api_version": "0.14.0" "impl_hash": "40d5e890ae5c3558fbb4281ec04a5c0d0c1c0104012a33dfc8ecb0445057f405" "impl_version": "0.1.0" "root_key": [48, 129, 130, 48, 29, 6, 13, 43, 6, 1, 4, 1, 130, 220, 124, 5, 3, 1, 2, 1, 6, 12, 43, 6, 1, 4, 1, 130, 220, 124, 5, 3, 2, 1, 3, 97, 0, 133, 168, 228, 168, 232, 127, 43, 51, 212, 173, 127, 167, 169, 84, 223, 125, 69, 157, 31, 105, 91, 34, 207, 123, 136, 227, 152, 187, 36, 246, 25, 58, 90, 24, 169, 86, 122, 201, 212, 11, 111, 43, 156, 193, 106, 11, 210, 217, 22, 13, 187, 148, 153, 152, 176, 171, 45, 130, 247, 231, 157, 251, 92, 190, 202, 13, 150, 116, 95, 187, 28, 157, 173, 170, 60, 156, 45, 127, 248, 25, 95, 9, 43, 102, 161, 46, 198, 237, 227, 77, 244, 79, 227, 134, 69, 161]
144144
}
145145
....
146146

@@ -168,51 +168,41 @@ dfx deploy --network=ic
168168
----
169169
+
170170
The `+dfx deploy+` command output displays information about the operations it performs.
171+
+
171172
For example, this step registers two network-specific identifiers—one for the `+hello+` main program and one for the `+hello_assets+` front-end user interface—and installation information similar to the following:
172173
+
173174
....
174175
Deploying all canisters.
175176
Creating canisters...
176177
Creating canister "hello"...
177-
"hello" canister created on network "ic" with canister id: "2lolz-fluaa-aaaaa-aaaaa-aaaaa-aaaaa-aaaaa-q"
178+
"hello" canister created on network "ic" with canister id: "bj6e2-xqaaa-aaaab-aagja-cai"
178179
Creating canister "hello_assets"...
179-
"hello_assets" canister created on network "ic" with canister id: "hupnp-k3uaa-aaaaa-aaaaa-caaaa-aaaaa-aaaaa-q"
180+
"hello_assets" canister created on network "ic" with canister id: "ro5wz-6qaaa-aaaaa-qagsa-cai"
180181
Building canisters...
181182
Building frontend...
182183
Installing canisters...
183-
Installing code for canister hello, with canister_id 2lolz-fluaa-aaaaa-aaaaa-aaaaa-aaaaa-aaaaa-q
184-
Installing code for canister hello_assets, with canister_id hupnp-k3uaa-aaaaa-aaaaa-caaaa-aaaaa-aaaaa-q
184+
Installing code for canister hello, with canister_id bj6e2-xqaaa-aaaab-aagja-cai
185+
Installing code for canister hello_assets, with canister_id ro5wz-6qaaa-aaaaa-qagsa-cai
186+
Uploading assets to asset canister...
185187
Deployed canisters.
186188
....
187-
+
188-
189-
NOTE: If you created a project with a different name, keep in mind that your canister names will match your project name instead of `+hello+` and `+hello_assets+`.
190-
191-
////
192-
. Check that your wallet canister is properly configured and holds a balance of cycles by running a command similar to the following:
193-
+
194-
[source,bash]
195-
----
196-
dfx canister --network=ic call <WALLET-CANISTER-ID> cycle_balance
197-
----
198-
+
199-
The command returns the cycle balance for the wallet canister identifier you specified.
200-
For example:
201-
+
202-
....
203-
(99999994564407680)
204-
....
205-
////
206189
. Call the `+hello+` canister and the predefined `+greet+` function by running the following command:
207190
+
208191
[source,bash]
209192
----
210193
dfx canister --network=ic call hello greet everyone
211194
----
212195
+
213-
This example uses the `+dfx canister call+` command to pass "everyone" as an argument to the `+greet+` function.
196+
Let's take a closer look at this example:
214197
+
215-
Remember, however, that if you created a project with a different name, the canister name will match your project name and you'll need to modify the command line to match the name you used instead of `+hello+`.
198+
--
199+
200+
* Using the `+--network=ic+` option indicates that the canister you want to call is deployed on the `+ic+` network. The `+ic+` network alias is an internally-reserved alias for accessing the {IC}.
201+
* Note that the `+--network=ic+` option must precede the operation subcommand, which, in this case, is the `+dfx canister call+` command.
202+
* The `+hello+` argument specifies the name of the canister you want to call.
203+
* The `+greet+` argument specifies the name of the function you want to call in the `+hello+` canister.
204+
* The text string `+everyone+` is the argument that you want to pass to the `+greet+` function.
205+
--
216206
. Verify the command displays the return value of the `+greet+` function.
217207
+
218208
For example:

0 commit comments

Comments
 (0)