-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1912 from demergent-labs/new_command
add hello_world_candid_rpc example
- Loading branch information
Showing
22 changed files
with
10,917 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.azle | ||
.dfx | ||
dfx_generated | ||
node_modules |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
# Azle Hello World | ||
|
||
- [Installation](#installation) | ||
- [Deployment](#deployment) | ||
|
||
Azle helps you to build secure decentralized/replicated servers in TypeScript or JavaScript on [ICP](https://internetcomputer.org/). The current replication factor is [13-40 times](https://dashboard.internetcomputer.org/subnets). | ||
|
||
Please remember that Azle is in beta and thus it may have unknown security vulnerabilities due to the following: | ||
|
||
- Azle is built with various software packages that have not yet reached maturity | ||
- Azle does not yet have multiple independent security reviews/audits | ||
- Azle does not yet have many live, successful, continuously operating applications deployed to ICP | ||
|
||
## Installation | ||
|
||
> Windows is only supported through a Linux virtual environment of some kind, such as [WSL](https://learn.microsoft.com/en-us/windows/wsl/install) | ||
You will need [Node.js 20](#nodejs-20) and [dfx](#dfx) to develop ICP applications with Azle: | ||
|
||
### Node.js 20 | ||
|
||
It's recommended to use nvm to install Node.js 20: | ||
|
||
```bash | ||
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash | ||
``` | ||
|
||
Restart your terminal and then run: | ||
|
||
```bash | ||
nvm install 20 | ||
``` | ||
|
||
Check that the installation went smoothly by looking for clean output from the following command: | ||
|
||
```bash | ||
node --version | ||
``` | ||
|
||
### dfx | ||
|
||
Install the dfx command line tools for managing ICP applications: | ||
|
||
```bash | ||
DFX_VERSION=0.21.0 sh -ci "$(curl -fsSL https://internetcomputer.org/install.sh)" | ||
``` | ||
|
||
Check that the installation went smoothly by looking for clean output from the following command: | ||
|
||
```bash | ||
dfx --version | ||
``` | ||
|
||
## Deployment | ||
|
||
To create and deploy a simple sample application called `hello_world`: | ||
|
||
```bash | ||
# create a new default project called hello_world | ||
npx azle new hello_world | ||
cd hello_world | ||
``` | ||
|
||
```bash | ||
# install all npm dependencies including azle | ||
npm install | ||
``` | ||
|
||
```bash | ||
# install the azle dfx extension | ||
npx azle install-dfx-extension | ||
``` | ||
|
||
```bash | ||
# start up a local ICP replica | ||
dfx start --clean | ||
``` | ||
|
||
In a separate terminal in the `hello_world` directory: | ||
|
||
```bash | ||
# deploy your canister | ||
dfx deploy | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
{ | ||
"canisters": { | ||
"hello_world": { | ||
"type": "azle", | ||
"main": "src/index.ts", | ||
"candid_gen": "automatic", | ||
"declarations": { | ||
"output": "test/dfx_generated/hello_world", | ||
"node_compatibility": true | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/** @type {import('ts-jest').JestConfigWithTsJest} */ | ||
module.exports = { | ||
preset: 'ts-jest', | ||
testEnvironment: 'node', | ||
transform: { | ||
'^.+\\.ts$': 'ts-jest', | ||
'^.+\\.js$': 'ts-jest' | ||
}, | ||
transformIgnorePatterns: ['/node_modules/(?!(azle)/)'] // Make sure azle is transformed | ||
}; |
Oops, something went wrong.