Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Aeproject can already be used for testing and setup with the upcoming node versions.
Use aeproject init --next to initialize a new project that has the necessary adjustments to use the latest versions.
Use aeproject init --update --next to update an existing project with the adjustments to use the latest versions.
change occurrences of utils.getSdk() to use utils.getSdk({ ignoreVersion: true }) if needed or use the same option for manually initialized sdk Node and CompilerHttp
update docker-compose.yml to use the latest node and compiler tags or specify it manually in running with aeproject env --nodeVersion latest --compilerVersion latest
The command is responsible for setting up a healthy local environment. The env command helps developers run a local node and a local compiler in dev-mode using docker. To spawn a fully functional environment it can take a couple of minutes depending on your system.
If using Windows, WSL 2 needs to be used for AEproject to work normally, see https://docs.microsoft.com/en-us/windows/wsl/tutorials/wsl-containers
You can stop both the node and the compiler by running
There are optional parameters --nodeVersion and --compilerVersion. To specify a specific version of node or compiler, or both
This also applies to the commands aeproject node and aeproject compiler.
To see whether you have running instances of the nodes along with a compiler you could run the following command
latest-bundle tag of the official docker images.Compatibility:
the sdk from @aeternity/aepp-sdk@14 >= v14.0.0 is compatible with NODE_TAG >= v7.1.0 and COMPILER_TAG >= v8.0.0
due to a bug in the devmode plugin, NODE_TAG = v7.1.0 is not compatible with aeproject
Firewalls and any other security feature can block your docker/docker-compose requests. Please check that docker/docker-compose is NOT in its blocked list or has permission to make requests.
aeproject envaeproject env --stopaeproject env --nodeVersion v7.2.0
# or
aeproject env --compilerVersion v8.0.0
# or
aeproject env --nodeVersion v7.2.0 --compilerVersion v8.0.0aeproject env --infoIn order to have AEproject working you must have installed the following:
Note: on windows WSL 2 must be used
This will create the project scaffold with an example contract including tests as well as a sample deployment script inside the specified folder. If no folder is specified the artifacts will be initialized in the current directory.
Further explained in .
This will run a local æternity network in dev-mode (node, compiler and nginx-proxy).
To stop an already spawned local environment use aeproject env --stop
Further explained in .
This will run the tests located in ./test folder. Further explained in .
Run this command to give you all possible commands of aeproject with help and info
Running this command will give you the current installed aeproject version
nodejs >= 18
dockernpm install -g @aeternity/aeproject@aeternity/aeproject@4node@16 is no longer supported, please update to v18 or higher
updated to @aeternity/aepp-sdk@14 to the latest version, see the migration guide for additional reference.
the aeproject provided utils.getSdk({}) has to be adjusted to pass a reference to the sdk used utils.getSdk(AeppSdk, {}) where AeppSdk can be imported using import * as AeppSdk from "@aeternity/aepp-sdk";
@aeternity/aepp-sdk@14 requires aeternity node version >= 7.1.0
Following utils have been removed and cannot be used anymore:
utils.getFilesystem() discontinued, as it is now natively available in the sdk via import, e.g. const { getFileSystem } = require("@aeternity/aepp-sdk");
Create and wait for n number of key-blocks with the æternity node devmode, checked using the passed aeSdk.
Create a snapshot of the current chain state using the æternity node devmode, using the passed aeSdk.
Rollback to the latest snapshot using the æternity node devmode, using the passed aeSdk.
Rollback to the specified height using the æternity node devmode, using the passed aeSdk.
Get the pre-funded default accounts as MemoryAccount, so they can be used natively using the aeSdk.
List of configured keypairs that are pre-funded using the æternity node devmode as provided in AEproject.
Exposed URLs for commonly used nodeUrl and compilerUrl, per default local devmode and optionally hosted URLs for mainnet and testnet.
const { utils, wallets, networks } = require("@aeternity/aeproject");aeproject init [folder]aeproject envaeproject testaeproject helpaeproject --versionnpm install -g @aeternity/aeprojectutils.getContractContent(contractPath);import * as AeppSdk from "@aeternity/aepp-sdk";
utils.getSdk(AeppSdk, {});utils.awaitKeyBlocks(aeSdk, n);utils.createSnapshot(aeSdk);utils.rollbackSnapshot(aeSdk);utils.rollbackHeight(aeSdk, height);utils.getDefaultAccounts();Following commands have been removed and cannot be used anymore. Most of them didn't work properly or aren't used by anyone:
aeproject compatibility (discontinued)
aeproject deploy
deployment isn't supported in aeproject anymore, alternatively use the or the programmatically
aeproject export (discontinued)
aeproject tx-inspector
manual tx inspection is moved to the
aeproject init
added the folder argument to create a new folder for the project initialization
The latest available node and compiler will always be used with starting the testing environment.
Testing is now handled locally in the project using mocha and chai as direct dev dependencies.
@aeternity/aeproject is added itself as dependency and includes some library-functions that can be used in testing.
networks includes network definitions for local development, testnet and mainnet
wallets includes example wallets that are prefunded in local development
utils includes helper functions for testing
getFilesystem(source) to get the filesystem definition for a given contract for deployment
getSdk() get an instance of the SDK for local development
initialized with all prefunded wallets for onAccount to be used calling from different accounts
awaitKeyBlocks(aeSdk, number) await a certain number of key-blocks
createSnapshot(aeSdk) create a snapshot for local testing
rollbackSnapshot(aeSdk) rollback to previously created snapshot in local testing
Upgrade your project
adds new files needed
including new example contract and tests
prompts for files to replaced
docker setup for the node, compiler dev-mode setup should be accepted
example contract and example tests should not be accepted if used in your project for testing
automatically installs needed dependencies and removes unnecessary ones
Adapt Testing Setup (compare your tests with test/exampleTest.js) to
include const { assert } = require('chai'); for assertions
replace NETWORKS import with const { networks } = require('@aeternity/aeproject'); for networks definition
Optionally a folder can be specified for the project to be initialized in, otherwise the current directory is used.
Creates a new project structure with a few folders in which the developer can create contracts and tests, as well as installing needed dependencies.
For upgrade from old AEproject versions check out and .
Updates the project structure and needed artifacts to the latest version, as well as installing needed dependencies.
aeproject init --updatenpm install -g @aeternity/aeprojectconst { networks, utils, wallets } = require("@aeternity/aeproject");local testing network is now devmode instead of local
replace defaultWallets import with const { wallets } = require('@aeternity/aeproject'); for prefunded wallets
replace contractUtils import with const { utils } = require('@aeternity/aeproject'); for utils
consider using the new helpers for initializing an instance of the SDK and creating snapshots similar to test/exampleTest.js
The additional parameter --next can be used to either initialize or update a project with changes for an upcoming hard-fork if available.
aeproject init [folder]aeproject init --updateThe test command helps developers run their unit tests for æternity projects. The command executes the tests scripts that are located in the test folder of your æternity project.
In the test/exampleTest.js file you can find an example for unit testing using AEproject.
Javascript testing framework used with for assertions, documented at https://www.chaijs.com/api/assert/
Helper and utilities for AEproject use, e.g. prefunded wallets, network definition and utility functions for SDK initialization and snapshotting.
Read for a more detailed explanation about the usage of these imports.
Provide your initializations in mocha which need to be done once before all tests:
Initialize the default SDK instance with provided utils:
Get the filesystem definition for (custom) includes of the given contract:
Read the contract source from the filesystem:
Initialize the contract instance:
Deploy the contract:
Create a snapshot of the chain state once before all tests. This allows you to rollback to a clean state after each test if needed:
Rollback to the previously created snapshot after each test for a clean state in the following tests:
Use mocha for test setup and chai for assert. Then implement contract usage using the aeternity sdk as explained in the guide at https://github.com/aeternity/aepp-sdk-js/blob/develop/docs/guides/contracts.md#5-call-contract-entrypoints
aeproject testimport { assert } from "chai";
import { before, describe, afterEach, it } from "mocha";import { utils } from "@aeternity/aeproject";
import * as AeppSdk from "@aeternity/aepp-sdk";
import { Contract, getFileSystem } from "@aeternity/aepp-sdk";before(async () => ...)aeSdk = utils.getSdk(AeppSdk, {});const fileSystem = await getFileSystem(EXAMPLE_CONTRACT_SOURCE);const sourceCode = utils.getContractContent(EXAMPLE_CONTRACT_SOURCE);contract = await Contract.initialize({ ...aeSdk.getContext(), sourceCode, fileSystem });await contract.init();await utils.createSnapshot(aeSdk);afterEach(async () => {
await utils.rollbackSnapshot(aeSdk);
});it("ExampleContract: set and get", async () => {
const set = await contract.set(42, {
onAccount: utils.getDefaultAccounts()[1],
});
assert.equal(set.decodedEvents[0].name, "SetXEvent");
assert.equal(
set.decodedEvents[0].args[0],
utils.getDefaultAccounts()[1].address,
);
assert.equal(set.decodedEvents[0].args[1], 42);
const { decodedResult } = await contract.get();
assert.equal(decodedResult, 42);
});