Skip to content

Commit 735eb17

Browse files
committed
creating example page
1 parent 555e3c7 commit 735eb17

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+14991
-35
lines changed

dfx.json

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,26 @@
11
{
2-
"version": 1,
3-
"canisters": {
4-
"actor_test" : {
5-
"main": "tests/MemoryBuffer.ActorTest.mo",
6-
"type": "motoko"
7-
}
2+
"version": 1,
3+
"canisters": {
4+
"actor_test": {
5+
"main": "tests/MemoryBuffer.ActorTest.mo",
6+
"type": "motoko"
87
},
9-
"defaults": {
10-
"build": {
11-
"packtool": "mops sources",
12-
"args": "--incremental-gc"
13-
}
14-
},
15-
"networks": {
16-
"local": {
17-
"bind": "127.0.0.1:8000",
18-
"type": "ephemeral"
19-
}
8+
"stress_test": {
9+
"main": "tests/MemoryBTree/MemoryBTree.StressTest.Replica.mo",
10+
"type": "motoko",
11+
"args": "--max-stable-pages 1638400"
12+
}
13+
},
14+
"defaults": {
15+
"build": {
16+
"packtool": "mops sources",
17+
"args": "--incremental-gc"
18+
}
19+
},
20+
"networks": {
21+
"local": {
22+
"bind": "127.0.0.1:4943",
23+
"type": "ephemeral"
2024
}
25+
}
2126
}

example/MemoryBTree.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ actor {
3636
orders_sstore := MemoryBTree.upgrade(orders_sstore);
3737

3838
// If two orders are placed at the same timestamp, the second order will overwrite the first
39-
// so for this test we assume that no two orders are placed at the same timestamp
39+
// so for this test we assume that no two orders are placed at the same time
4040
let orders = MemoryBTree.MemoryBTree<Time, Order>(orders_sstore, orders_btree_utils);
4141

4242
let product_prices = [39.99, 7.23, 12.99, 87.00, 5.99];
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Tests
2+
3+
on:
4+
# push:
5+
# branches: [ "main" ]
6+
pull_request:
7+
8+
concurrency:
9+
group: ${{ github.head_ref || github.run_id }}
10+
cancel-in-progress: true
11+
12+
jobs:
13+
build:
14+
15+
runs-on: ubuntu-latest
16+
17+
strategy:
18+
matrix:
19+
node-version: [18.x]
20+
21+
steps:
22+
- uses: actions/checkout@v3
23+
- name: Use Node.js ${{ matrix.node-version }}
24+
uses: actions/setup-node@v3
25+
with:
26+
node-version: ${{ matrix.node-version }}
27+
cache: 'npm'
28+
- name: Install dfx
29+
uses: dfinity/setup-dfx@main
30+
- name: Start dfx
31+
run: |
32+
dfx cache install
33+
dfx start --background
34+
- run: npm run setup
35+
- run: npm test

example/txs/.gitignore

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
pnpm-debug.log*
8+
lerna-debug.log*
9+
10+
node_modules
11+
dist
12+
dist-ssr
13+
*.local
14+
15+
# Editor directories and files
16+
.vscode/*
17+
!.vscode/extensions.json
18+
!.vscode/settings.json
19+
.idea
20+
.DS_Store
21+
*.suo
22+
*.ntvs*
23+
*.njsproj
24+
*.sln
25+
*.sw?
26+
27+
# Canisters
28+
/src/declarations
29+
.dfx
30+
.vessel
31+
.mops
32+
33+
# Environment variables
34+
.env
35+
.env.local
36+
.env.development
37+
.env.test
38+
.env.production

example/txs/.gitpod.yml

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Online IDE configuration (safe to delete)
2+
3+
tasks:
4+
- before: |
5+
npm install &
6+
export MO_DEV_HIDE_URLS=1 # hide Candid UI links
7+
export PATH="$HOME/bin:$PATH"
8+
echo 'export PATH="$HOME/bin:$PATH"' >> ~/.bashrc
9+
sudo apt-get install -q -y libunwind-dev
10+
DFXVM_INIT_YES=1 sh -ci "$(curl -fsSL https://internetcomputer.org/install.sh)"
11+
source "$HOME/.local/share/dfx/env"
12+
dfx start --background --clean
13+
npm run setup
14+
init: |
15+
npm start
16+
command: |
17+
npm start
18+
19+
vscode:
20+
extensions:
21+
- dfinity-foundation.vscode-motoko
22+
23+
ports:
24+
- name: Replica
25+
port: 4943
26+
visibility: public
27+
onOpen: ignore
28+
- name: Dev Server
29+
port: 3000
30+
visibility: public
31+
onOpen: open-browser

example/txs/.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/src/declarations

example/txs/.prettierrc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
{
2+
"singleQuote": true,
3+
"semi": true,
4+
"tabWidth": 4,
5+
"bracketSpacing": true,
6+
"trailingComma": "all"
7+
}

example/txs/README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
# Vite + React + Motoko
2+
3+
### Get started directly in your browser:
4+
5+
[![Open in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/rvanasa/vite-react-motoko)
6+
7+
This template gives you everything you need to build a full-stack Web3 application on the [Internet Computer](https://internetcomputer.org/).
8+
9+
For an example of a real-world dapp built using this starter project, check out the [source code](https://github.com/dfinity/feedback) for DFINITY's [Developer Experience Feedback Board](https://dx.internetcomputer.org/).
10+
11+
## 📦 Create a New Project
12+
13+
Make sure that [Node.js](https://nodejs.org/en/) `>= 16` and [`dfx`](https://internetcomputer.org/docs/current/developer-docs/build/install-upgrade-remove) `>= 0.14` are installed on your system.
14+
15+
Run the following commands in a new, empty project directory:
16+
17+
```sh
18+
npx degit rvanasa/vite-react-motoko # Download this starter project
19+
dfx start --clean --background # Run dfx in the background
20+
npm run setup # Install packages, deploy canisters, and generate type bindings
21+
22+
npm start # Start the development server
23+
```
24+
25+
When ready, run `dfx deploy --network ic` to deploy your application to the Internet Computer.
26+
27+
## 🛠️ Technology Stack
28+
29+
- [Vite](https://vitejs.dev/): high-performance tooling for front-end web development
30+
- [React](https://reactjs.org/): a component-based UI library
31+
- [TypeScript](https://www.typescriptlang.org/): JavaScript extended with syntax for types
32+
- [Sass](https://sass-lang.com/): an extended syntax for CSS stylesheets
33+
- [Prettier](https://prettier.io/): code formatting for a wide range of supported languages
34+
- [Motoko](https://github.com/dfinity/motoko#readme): a safe and simple programming language for the Internet Computer
35+
- [Mops](https://mops.one): an on-chain community package manager for Motoko
36+
- [mo-dev](https://github.com/dfinity/motoko-dev-server#readme): a live reload development server for Motoko
37+
- [@ic-reactor](https://github.com/B3Pay/ic-reactor): A suite of JavaScript libraries for seamless frontend development on the Internet Computer
38+
39+
## 📚 Documentation
40+
41+
- [Vite developer docs](https://vitejs.dev/guide/)
42+
- [React quick start guide](https://react.dev/learn)
43+
- [Internet Computer docs](https://internetcomputer.org/docs/current/developer-docs/ic-overview)
44+
- [`dfx.json` reference schema](https://internetcomputer.org/docs/current/references/dfx-json-reference/)
45+
- [Motoko developer docs](https://internetcomputer.org/docs/current/developer-docs/build/cdks/motoko-dfinity/motoko/)
46+
- [Mops usage instructions](https://j4mwm-bqaaa-aaaam-qajbq-cai.ic0.app/#/docs/install)
47+
- [@ic-reactor/react](https://b3pay.github.io/ic-reactor/modules/react.html)
48+
49+
## 💡 Tips and Tricks
50+
51+
- Customize your project's code style by editing the `.prettierrc` file and then running `npm run format`.
52+
- Reduce the latency of update calls by passing the `--emulator` flag to `dfx start`.
53+
- Install a Motoko package by running `npx ic-mops add <package-name>`. Here is a [list of available packages](https://mops.one/).
54+
- Split your frontend and backend console output by running `npm run frontend` and `npm run backend` in separate terminals.

0 commit comments

Comments
 (0)