From abaa36460466ece306d0f31d23901d3b22fb0bee Mon Sep 17 00:00:00 2001 From: Philipp Piwo Date: Wed, 12 Apr 2023 12:04:21 +0200 Subject: [PATCH] fix: minor fixes, adjust docs --- docs/cli/env.md | 8 ++++--- docs/cli/test.md | 22 +++++++++---------- src/init/constants.json | 2 +- src/init/update-artifacts/test/exampleTest.js | 2 +- 4 files changed, 18 insertions(+), 16 deletions(-) diff --git a/docs/cli/env.md b/docs/cli/env.md index e833f135..9548d427 100644 --- a/docs/cli/env.md +++ b/docs/cli/env.md @@ -15,11 +15,11 @@ aeproject env --stop There are optional parameters **\-\-nodeVersion** and **\-\-compilerVersion**. To specify a specific version of node or compiler, or both ```text -aeproject env --nodeVersion v6.4.0 +aeproject env --nodeVersion v6.8.1 # or -aeproject env --compilerVersion v6.1.0 +aeproject env --compilerVersion v7.3.0 # or -aeproject env --nodeVersion v6.4.0 --compilerVersion v6.1.0 +aeproject env --nodeVersion v6.8.1 --compilerVersion v7.3.0 ``` This also applies to the commands `aeproject node` and `aeproject compiler`. @@ -30,5 +30,7 @@ aeproject env --info **Note**: By default AEproject uses the `latest-bundle` tag of the official [docker images](https://hub.docker.com/r/aeternity/aeternity/tags). +**Compatibility**: AEproject uses `@aeternity/aepp-sdk@13` which is only compatible using `node >= v6` and `compiler >= v7`, the only tested and recommended configuration, which also works on ARM64/Apple Silicon is from images `node v6.8.1` and `compiler v7.3.0`, upcoming newer versions with the same major version should work without issues. + ## Disclaimer - 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. diff --git a/docs/cli/test.md b/docs/cli/test.md index 89f1377a..c90576d4 100644 --- a/docs/cli/test.md +++ b/docs/cli/test.md @@ -32,12 +32,12 @@ Read [AEproject Library](../lib.md) for a more detailed explanation about the us Provide your initializations in mocha which need to be done once before all tests: ```js -before(...) +before(async () => ...) ``` Initialize the default SDK instance with provided utils: ```js -const aeSdk = await utils.getSdk(); +aeSdk = await utils.getSdk(); ``` Get the filesystem definition for (custom) `includes` of the given contract: @@ -47,17 +47,17 @@ const filesystem = utils.getFilesystem(EXAMPLE_CONTRACT_SOURCE); Read the contract source from the filesystem: ```js -const source = utils.getContractContent(EXAMPLE_CONTRACT_SOURCE); +const sourceCode = utils.getContractContent(EXAMPLE_CONTRACT_SOURCE); ``` Initialize the contract instance: ```js -const contract = await aeSdk.getContractInstance({ source, filesystem }); +contract = await aeSdk.initializeContract({ sourceCode, filesystem }); ``` Deploy the contract: ```js -await contract.deploy(); +await contract.init(); ``` 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: @@ -76,13 +76,13 @@ afterEach(async () => { ```javascript it('ExampleContract: set and get', async () => { - const set = await contract.methods.set(42, { onAccount: wallets[1].publicKey }); - assert.equal(set.decodedEvents[0].name, 'SetXEvent'); - assert.equal(set.decodedEvents[0].decoded[0], wallets[1].publicKey); - assert.equal(set.decodedEvents[0].decoded[1], 42); + 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.methods.get(); - assert.equal(decodedResult, 42); + const {decodedResult} = await contract.get(); + assert.equal(decodedResult, 42); }); ``` diff --git a/src/init/constants.json b/src/init/constants.json index 07f6091c..11f24d6c 100644 --- a/src/init/constants.json +++ b/src/init/constants.json @@ -9,7 +9,7 @@ "devDependencies": [ "@aeternity/aeproject@4", "chai@4", - "mocha@9" + "mocha@10" ], "uninstallDependencies": [ "aeproject", diff --git a/src/init/update-artifacts/test/exampleTest.js b/src/init/update-artifacts/test/exampleTest.js index 01002d47..f38363a6 100644 --- a/src/init/update-artifacts/test/exampleTest.js +++ b/src/init/update-artifacts/test/exampleTest.js @@ -32,7 +32,7 @@ describe('ExampleContract', () => { 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], await utils.getDefaultAccounts()[1].address); + assert.equal(set.decodedEvents[0].args[0], utils.getDefaultAccounts()[1].address); assert.equal(set.decodedEvents[0].args[1], 42); const { decodedResult } = await contract.get();