Skip to content

Commit 3d9672b

Browse files
Merge pull request #1172 from dfinity/composite_query
add: Deploy to ICP Ninja + standardize README
2 parents 38b6983 + 77e22f9 commit 3d9672b

File tree

1 file changed

+9
-61
lines changed

1 file changed

+9
-61
lines changed

motoko/composite_query/README.md

Lines changed: 9 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -27,76 +27,24 @@ Each new `Bucket` must be provisioned with enough cycles to pay for its installa
2727

2828
`Map`'s `test` method simply `put`s 16 consecutive entries into `Map`. These entries are distributed evenly amongst the buckets making up the key-value store. Adding the first entry to a bucket takes longer than adding a subsequent one, since the bucket needs to be installed on first use.
2929

30-
## Prerequisites
30+
## Deploying from ICP Ninja
3131

32-
- [x] Install the [IC
33-
SDK](https://internetcomputer.org/docs/current/developer-docs/getting-started/install). For local testing, `dfx >= 0.22.0` is required.
34-
- [x] Clone the example dapp project: `git clone https://github.com/dfinity/examples`
32+
[![](https://icp.ninja/assets/open.svg)](https://icp.ninja/editor?g=https://github.com/dfinity/examples/tree/master/motoko/composite_query)
3533

36-
Begin by opening a terminal window.
34+
## Build and deploy from the command-line
3735

38-
## Step 1: Setup the project environment
36+
### 1. [Download and install the IC SDK.](https://internetcomputer.org/docs/building-apps/getting-started/install)
3937

40-
Navigate into the folder containing the project's files and start a local instance of the Internet Computer with the commands:
38+
### 2. Download your project from ICP Ninja using the 'Download files' button on the upper left corner, or [clone the GitHub examples repository.](https://github.com/dfinity/examples/)
4139

40+
### 3. Navigate into the project's directory.
4241

43-
```bash
44-
cd examples/motoko/composite_query
45-
dfx start --background
46-
```
47-
48-
## Step 2: Deploy the `Map` canister
49-
50-
```bash
51-
dfx deploy Map --no-wallet
52-
```
53-
54-
## Step 3: Invoke the `test` method of canister `Map` to add some entries
55-
56-
```bash
57-
dfx canister call Map test '()'
58-
```
42+
### 4. Deploy the project to your local environment:
5943

60-
## Step 4: Observe the following result
61-
62-
```bash
63-
debug.print: putting: (0, "0")
64-
debug.print: putting: (1, "1")
65-
debug.print: putting: (2, "2")
66-
debug.print: putting: (3, "3")
67-
debug.print: putting: (4, "4")
68-
debug.print: putting: (5, "5")
69-
debug.print: putting: (6, "6")
70-
debug.print: putting: (7, "7")
71-
debug.print: putting: (8, "8")
72-
debug.print: putting: (9, "9")
73-
debug.print: putting: (10, "10")
74-
debug.print: putting: (11, "11")
75-
debug.print: putting: (12, "12")
76-
debug.print: putting: (13, "13")
77-
debug.print: putting: (14, "14")
78-
debug.print: putting: (15, "15")
79-
()
8044
```
81-
82-
## Step 5: Invoke the `get` composite query method of canister `Main`
83-
84-
```bash
85-
dfx canister call --query Map get '(15)'
45+
dfx start --background --clean && dfx deploy
8646
```
8747

88-
### Step 6: Observe the result
89-
90-
```bash
91-
(opt "15")
92-
```
93-
94-
## Resources
95-
96-
- [Actor classes](https://internetcomputer.org/docs/current/motoko/main/actor-classes).
97-
- [Managing cycles](https://internetcomputer.org/docs/current/motoko/main/cycles).
98-
- [Composite queries](https://internetcomputer.org/docs/current/motoko/main/actors-async#composite-query-functions).
99-
10048
## Security considerations and best practices
10149

102-
If you base your application on this example, we recommend you familiarize yourself with and adhere to the [security best practices](https://internetcomputer.org/docs/current/references/security/) for developing on ICP. This example may not implement all the best practices.
50+
If you base your application on this example, it is recommended that you familiarize yourself with and adhere to the [security best practices](https://internetcomputer.org/docs/building-apps/security/overview) for developing on ICP. This example may not implement all the best practices.

0 commit comments

Comments
 (0)