Skip to content

Commit

Permalink
Deployed eee28ef to main with MkDocs 1.5.3 and mike 2.0.0
Browse files Browse the repository at this point in the history
GitHub Action committed Jul 22, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 58dbbc3 commit 7792ca9
Showing 3 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions main/cli/env/index.html
Original file line number Diff line number Diff line change
@@ -503,11 +503,11 @@ <h1 id="local-environment">Local Environment</h1>
<div class="highlight"><pre><span></span><code>aeproject env --stop
</code></pre></div>
<p>There are optional parameters <strong>--nodeVersion</strong> and <strong>--compilerVersion</strong>. To specify a specific version of node or compiler, or both</p>
<div class="highlight"><pre><span></span><code>aeproject env --nodeVersion v7.0.0
<div class="highlight"><pre><span></span><code>aeproject env --nodeVersion v7.2.0
# or
aeproject env --compilerVersion v8.0.0
# or
aeproject env --nodeVersion v7.0.0 --compilerVersion v8.0.0
aeproject env --nodeVersion v7.2.0 --compilerVersion v8.0.0
</code></pre></div>
<p>This also applies to the commands <code>aeproject node</code> and <code>aeproject compiler</code>.</p>
<p>To see whether you have running instances of the nodes along with a compiler you could run the following command</p>
@@ -522,6 +522,7 @@ <h1 id="local-environment">Local Environment</h1>
<li>the latest <code>@aeternity/aepp-sdk@13</code> is only compatible using <code>NODE_TAG &gt;= v6.0.0</code> and <code>COMPILER_TAG &gt;= v7.5.0</code></li>
<li>the sdk from <code>@aeternity/aepp-sdk@13 &gt;= v13.3.2</code> is compatible with <code>NODE_TAG &gt;= v7.0.0-rc1</code> and <code>COMPILER_TAG &gt;= v8.0.0-rc1</code></li>
<li>ARM64/Apple Silicon is supported from images <code>NODE_TAG &gt;= v6.8.1</code> and <code>COMPILER_TAG &gt;= v7.3.0</code></li>
<li>due to a bug, <code>NODE_TAG = v7.1.0</code> is not compatible with aeproject</li>
</ul>
<h2 id="disclaimer">Disclaimer</h2>
<ul>
2 changes: 1 addition & 1 deletion main/search/search_index.json
Original file line number Diff line number Diff line change
@@ -1 +1 @@
{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Quick Start","text":""},{"location":"#requirements","title":"Requirements","text":"<p>In order to have AEproject working you must have installed the following:</p> <pre><code>nodejs &gt;= 16\ndocker\n</code></pre> <p>Note: on windows WSL 2 must be used</p>"},{"location":"#install","title":"Install","text":"<pre><code>npm install -g @aeternity/aeproject\n</code></pre>"},{"location":"#init-a-project","title":"Init a project","text":"<pre><code>aeproject init [folder]\n</code></pre> <p>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.</p> <p>Further explained in Initialization Documentation.</p>"},{"location":"#running-a-local-environment","title":"Running a local environment","text":"<pre><code>aeproject env\n</code></pre> <p>This will run a local \u00e6ternity network in dev-mode (node, compiler and nginx-proxy).</p> <p>To stop an already spawned local environment use <code>aeproject env --stop</code></p> <p>Further explained in Environment Documentation.</p>"},{"location":"#testing","title":"Testing","text":"<pre><code>aeproject test\n</code></pre> <p>This will run the tests located in <code>./test</code> folder. Further explained in Testing Documentation.</p>"},{"location":"#help","title":"Help","text":"<pre><code>aeproject help\n</code></pre> <p>Run this command to give you all possible commands of <code>aeproject</code> with help and info</p>"},{"location":"#version","title":"Version","text":"<pre><code>aeproject --version\n</code></pre> <p>Running this command will give you the current installed <code>aeproject</code> version</p>"},{"location":"lib/","title":"AEproject Library","text":"<p>Installed automatically with each project initialized with <code>aeproject init</code>, otherwise can be installed using <code>npm i @aeternity/aeproject</code>.</p> <p>Available imports include helper definitions and utils using:</p> <pre><code>const { utils, wallets, networks } = require(\"@aeternity/aeproject\");\n</code></pre>"},{"location":"lib/#utils","title":"Utils","text":"<pre><code>utils.getContractContent(contractPath);\n</code></pre> <p>Read the contract source from given path, just a wrapper for <code>fs.readFileSync</code> using <code>utf-8</code> encoding.</p> <pre><code>utils.getFilesystem(contractPath);\n</code></pre> <p>Add the required filesystem imports for contract from given path, excluding the Sophia provided library imports.</p> <pre><code>utils.get(url);\n</code></pre> <p>Promisified zero dependencies http <code>GET</code> request, usually used to control \u00e6ternity node devmode endpoints.</p> <pre><code>utils.getSdk();\n</code></pre> <p>Initialize the \u00e6ternity SDK, pre-configured for optimal use in an AEproject project using \u00e6ternity node devmode.</p> <pre><code>utils.awaitKeyBlocks(aeSdk, n);\n</code></pre> <p>Create and wait for <code>n</code> number of key-blocks with the \u00e6ternity node devmode, checked using the passed <code>aeSdk</code>.</p> <pre><code>utils.createSnapshot(aeSdk);\n</code></pre> <p>Create a snapshot of the current chain state using the \u00e6ternity node devmode, using the passed <code>aeSdk</code>.</p> <pre><code>utils.rollbackSnapshot(aeSdk);\n</code></pre> <p>Rollback to the latest snapshot using the \u00e6ternity node devmode, using the passed <code>aeSdk</code>.</p> <pre><code>utils.rollbackHeight(aeSdk, height);\n</code></pre> <p>Rollback to the specified height using the \u00e6ternity node devmode, using the passed <code>aeSdk</code>.</p> <pre><code>utils.getDefaultAccounts();\n</code></pre> <p>Get the pre-funded default accounts as <code>MemoryAccount</code>, so they can be used natively using the <code>aeSdk</code>.</p>"},{"location":"lib/#wallets","title":"Wallets","text":"<p>List of configured keypairs that are pre-funded using the \u00e6ternity node devmode as provided in AEproject.</p>"},{"location":"lib/#networks","title":"Networks","text":"<p>Exposed URLs for commonly used <code>nodeUrl</code> and <code>compilerUrl</code>, per default local <code>devmode</code> and optionally hosted URLs for <code>mainnet</code> and <code>testnet</code>.</p>"},{"location":"migration-from-3.x.x-to-4.x.x/","title":"Migration from 3.x.x to 4.x.x","text":""},{"location":"migration-from-3.x.x-to-4.x.x/#changes","title":"Changes","text":"<p>AEproject <code>v4.0.0</code> underwent some bigger changes, is now available as official package of the \u00e6ternity organization on NPM and is compatible to the recently published node v6.4.0.</p> <p>Install the new AEproject version</p> <pre><code>npm install -g @aeternity/aeproject\n</code></pre>"},{"location":"migration-from-3.x.x-to-4.x.x/#removed-commands","title":"Removed commands","text":"<p>Following commands have been removed and cannot be used anymore. Most of them didn't work properly or aren't used by anyone:</p> <ul> <li><code>aeproject compatibility</code> (discontinued)</li> <li><code>aeproject compile</code></li> <li>manual compilation isn't needed for use of aeproject, alternatively use the CLI or the SDK programmatically</li> <li><code>aeproject deploy</code></li> <li>deployment isn't supported in aeproject anymore, alternatively use the CLI or the SDK programmatically</li> <li><code>aeproject export</code> (discontinued)</li> <li><code>aeproject tx-inspector</code></li> <li>manual tx inspection is moved to the CLI</li> </ul>"},{"location":"migration-from-3.x.x-to-4.x.x/#updated-commands","title":"Updated commands","text":"<ul> <li><code>aeproject init</code></li> <li>added the <code>folder</code> argument to create a new folder for the project initialization</li> </ul>"},{"location":"migration-from-3.x.x-to-4.x.x/#project-structure","title":"Project structure","text":"<p>The latest available node and compiler will always be used with starting the testing environment.</p> <p>Testing is now handled locally in the project using <code>mocha</code> and <code>chai</code> as direct dev dependencies.</p> <p><code>@aeternity/aeproject</code> is added itself as dependency and includes some library-functions that can be used in testing.</p> <pre><code>const { networks, utils, wallets } = require(\"@aeternity/aeproject\");\n</code></pre> <ul> <li><code>networks</code> includes network definitions for local development, testnet and mainnet</li> <li><code>wallets</code> includes example wallets that are prefunded in local development</li> <li><code>utils</code> includes helper functions for testing</li> <li><code>getFilesystem(source)</code> to get the filesystem definition for a given contract for deployment</li> <li><code>getSdk()</code> get an instance of the SDK for local development<ul> <li>initialized with all prefunded wallets for <code>onAccount</code> to be used calling from different accounts</li> </ul> </li> <li><code>awaitKeyBlocks(aeSdk, number)</code> await a certain number of key-blocks</li> <li><code>createSnapshot(aeSdk)</code> create a snapshot for local testing</li> <li><code>rollbackSnapshot(aeSdk)</code> rollback to previously created snapshot in local testing</li> </ul>"},{"location":"migration-from-3.x.x-to-4.x.x/#instructions","title":"Instructions","text":"<ol> <li>Upgrade your project</li> </ol> <pre><code>aeproject init --update\n</code></pre> <ul> <li>adds new files needed<ul> <li>including new example contract and tests</li> </ul> </li> <li>prompts for files to replaced<ul> <li>docker setup for the node, compiler dev-mode setup should be accepted</li> <li>example contract and example tests should not be accepted if used in your project for testing</li> </ul> </li> <li> <p>automatically installs needed dependencies and removes unnecessary ones</p> </li> <li> <p>Adapt Testing Setup (compare your tests with <code>test/exampleTest.js</code>) to</p> </li> <li>include <code>const { assert } = require('chai');</code> for assertions</li> <li>replace <code>NETWORKS</code> import with <code>const { networks } = require('@aeternity/aeproject');</code> for networks definition<ul> <li>local testing network is now <code>devmode</code> instead of <code>local</code></li> </ul> </li> <li>replace <code>defaultWallets</code> import with <code>const { wallets } = require('@aeternity/aeproject');</code> for prefunded wallets</li> <li>replace <code>contractUtils</code> import with <code>const { utils } = require('@aeternity/aeproject');</code> for utils<ul> <li>consider using the new helpers for initializing an instance of the SDK and creating snapshots similar to <code>test/exampleTest.js</code></li> </ul> </li> </ul>"},{"location":"next-support/","title":"Upcoming Version Support","text":"<p>Aeproject can already be used for testing and setup with the upcoming node versions.</p>"},{"location":"next-support/#automatic-update","title":"Automatic update","text":"<p>Use <code>aeproject init --next</code> to initialize a new project that has the necessary adjustments to use the latest versions.</p> <p>Use <code>aeproject init --update --next</code> to update an existing project with the adjustments to use the latest versions. </p>"},{"location":"next-support/#manual-update","title":"Manual update","text":"<ul> <li>change occurrences of <code>utils.getSdk()</code> to use <code>utils.getSdk({ ignoreVersion: true })</code> if needed or use the same option for manually initialized sdk <code>Node</code> and <code>CompilerHttp</code></li> <li>update <code>docker-compose.yml</code> to use the <code>latest</code> node and compiler tags or specify it manually in running with <code>aeproject env --nodeVersion latest --compilerVersion latest</code></li> </ul>"},{"location":"cli/env/","title":"Local Environment","text":"<pre><code>aeproject env\n</code></pre> <p>The command is responsible for setting up a healthy local environment. The <code>env</code> 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.</p> <p>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</p> <p>You can stop both the node and the compiler by running</p> <pre><code>aeproject env --stop\n</code></pre> <p>There are optional parameters --nodeVersion and --compilerVersion. To specify a specific version of node or compiler, or both</p> <pre><code>aeproject env --nodeVersion v7.0.0\n# or\naeproject env --compilerVersion v8.0.0\n# or\naeproject env --nodeVersion v7.0.0 --compilerVersion v8.0.0\n</code></pre> <p>This also applies to the commands <code>aeproject node</code> and <code>aeproject compiler</code>.</p> <p>To see whether you have running instances of the nodes along with a compiler you could run the following command</p> <pre><code>aeproject env --info\n</code></pre> <p>Note: By default AEproject uses the <code>latest-bundle</code> tag of the official docker images.</p> <p>Compatibility:</p> <ul> <li>aeproject until <code>v4.8.3</code> is only compatible with node versions <code>NODE_TAG &lt;= v6.11.0</code> due to some changes in the devmode plugin</li> <li>aeproject uses the <code>-bundle</code> node docker images including dev mode, which are only published from <code>NODE_TAG &gt;= v6.3.0</code></li> <li>the default <code>aeternity.yaml</code> config file that ships with aeproject supports <code>NODE_TAG &gt;= v6.8.0</code></li> <li>the latest <code>@aeternity/aepp-sdk@13</code> is only compatible using <code>NODE_TAG &gt;= v6.0.0</code> and <code>COMPILER_TAG &gt;= v7.5.0</code></li> <li>the sdk from <code>@aeternity/aepp-sdk@13 &gt;= v13.3.2</code> is compatible with <code>NODE_TAG &gt;= v7.0.0-rc1</code> and <code>COMPILER_TAG &gt;= v8.0.0-rc1</code></li> <li>ARM64/Apple Silicon is supported from images <code>NODE_TAG &gt;= v6.8.1</code> and <code>COMPILER_TAG &gt;= v7.3.0</code></li> </ul>"},{"location":"cli/env/#disclaimer","title":"Disclaimer","text":"<ul> <li>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.</li> </ul>"},{"location":"cli/init/","title":"Project Initialization","text":"<pre><code>aeproject init [folder]\n</code></pre> <p>Optionally a <code>folder</code> can be specified for the project to be initialized in, otherwise the current directory is used.</p> <p>Creates a new project structure with a few folders in which the developer can create contracts and tests, as well as installing needed dependencies.</p>"},{"location":"cli/init/#update-existing-project","title":"Update existing project","text":"<p>For upgrade from old AEproject versions check out Migration from 3.x.x to 4.x.x.</p> <pre><code>aeproject init --update\n</code></pre> <p>Updates the project structure and needed artifacts to the latest version, as well as installing needed dependencies.</p>"},{"location":"cli/init/#upcoming-hard-fork-initialization","title":"Upcoming Hard-fork initialization","text":"<p>The additional parameter <code>--next</code> can be used to either initialize or update a project with changes for an upcoming hard-fork if available.</p>"},{"location":"cli/test/","title":"Unit Testing","text":""},{"location":"cli/test/#run-unit-tests","title":"Run unit tests","text":"<pre><code>aeproject test\n</code></pre> <p>The <code>test</code> command helps developers run their unit tests for \u00e6ternity projects. The command executes the tests scripts that are located in the test folder of your \u00e6ternity project.</p>"},{"location":"cli/test/#implement-unit-tests","title":"Implement unit tests","text":"<p>In the <code>test/exampleTest.js</code> file you can find an example for unit testing using AEproject.</p>"},{"location":"cli/test/#1-dependencies","title":"1. Dependencies","text":"<p>Javascript testing framework used with mocha for assertions, documented at https://www.chaijs.com/api/assert/</p> <pre><code>const { assert } = require(\"chai\");\n</code></pre> <p>Helper and utilities for AEproject use, e.g. prefunded wallets, network definition and utility functions for SDK initialization and snapshotting.</p> <pre><code>const { networks, utils, wallets } = require(\"@aeternity/aeproject\");\n</code></pre> <p>Read AEproject Library for a more detailed explanation about the usage of these imports.</p>"},{"location":"cli/test/#2-sdk-and-snapshotting-setup","title":"2. SDK and Snapshotting Setup","text":"<p>Provide your initializations in mocha which need to be done once before all tests:</p> <pre><code>before(async () =&gt; ...)\n</code></pre> <p>Initialize the default SDK instance with provided utils:</p> <pre><code>aeSdk = utils.getSdk();\n</code></pre> <p>Get the filesystem definition for (custom) <code>includes</code> of the given contract:</p> <pre><code>const filesystem = utils.getFilesystem(EXAMPLE_CONTRACT_SOURCE);\n</code></pre> <p>Read the contract source from the filesystem:</p> <pre><code>const sourceCode = utils.getContractContent(EXAMPLE_CONTRACT_SOURCE);\n</code></pre> <p>Initialize the contract instance:</p> <pre><code>contract = await aeSdk.initializeContract({ sourceCode, filesystem });\n</code></pre> <p>Deploy the contract:</p> <pre><code>await contract.init();\n</code></pre> <p>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:</p> <pre><code>await utils.createSnapshot(aeSdk);\n</code></pre> <p>Rollback to the previously created snapshot after each test for a clean state in the following tests:</p> <pre><code>afterEach(async () =&gt; {\n await utils.rollbackSnapshot(aeSdk);\n});\n</code></pre>"},{"location":"cli/test/#3-example-test","title":"3. Example Test","text":"<pre><code>it(\"ExampleContract: set and get\", async () =&gt; {\n const set = await contract.set(42, {\n onAccount: utils.getDefaultAccounts()[1],\n });\n assert.equal(set.decodedEvents[0].name, \"SetXEvent\");\n assert.equal(\n set.decodedEvents[0].args[0],\n utils.getDefaultAccounts()[1].address,\n );\n assert.equal(set.decodedEvents[0].args[1], 42);\n\n const { decodedResult } = await contract.get();\n assert.equal(decodedResult, 42);\n});\n</code></pre> <p>Use mocha for test setup and chai for <code>assert</code>. 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</p>"}]}
{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"Quick Start","text":""},{"location":"#requirements","title":"Requirements","text":"<p>In order to have AEproject working you must have installed the following:</p> <pre><code>nodejs &gt;= 16\ndocker\n</code></pre> <p>Note: on windows WSL 2 must be used</p>"},{"location":"#install","title":"Install","text":"<pre><code>npm install -g @aeternity/aeproject\n</code></pre>"},{"location":"#init-a-project","title":"Init a project","text":"<pre><code>aeproject init [folder]\n</code></pre> <p>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.</p> <p>Further explained in Initialization Documentation.</p>"},{"location":"#running-a-local-environment","title":"Running a local environment","text":"<pre><code>aeproject env\n</code></pre> <p>This will run a local \u00e6ternity network in dev-mode (node, compiler and nginx-proxy).</p> <p>To stop an already spawned local environment use <code>aeproject env --stop</code></p> <p>Further explained in Environment Documentation.</p>"},{"location":"#testing","title":"Testing","text":"<pre><code>aeproject test\n</code></pre> <p>This will run the tests located in <code>./test</code> folder. Further explained in Testing Documentation.</p>"},{"location":"#help","title":"Help","text":"<pre><code>aeproject help\n</code></pre> <p>Run this command to give you all possible commands of <code>aeproject</code> with help and info</p>"},{"location":"#version","title":"Version","text":"<pre><code>aeproject --version\n</code></pre> <p>Running this command will give you the current installed <code>aeproject</code> version</p>"},{"location":"lib/","title":"AEproject Library","text":"<p>Installed automatically with each project initialized with <code>aeproject init</code>, otherwise can be installed using <code>npm i @aeternity/aeproject</code>.</p> <p>Available imports include helper definitions and utils using:</p> <pre><code>const { utils, wallets, networks } = require(\"@aeternity/aeproject\");\n</code></pre>"},{"location":"lib/#utils","title":"Utils","text":"<pre><code>utils.getContractContent(contractPath);\n</code></pre> <p>Read the contract source from given path, just a wrapper for <code>fs.readFileSync</code> using <code>utf-8</code> encoding.</p> <pre><code>utils.getFilesystem(contractPath);\n</code></pre> <p>Add the required filesystem imports for contract from given path, excluding the Sophia provided library imports.</p> <pre><code>utils.get(url);\n</code></pre> <p>Promisified zero dependencies http <code>GET</code> request, usually used to control \u00e6ternity node devmode endpoints.</p> <pre><code>utils.getSdk();\n</code></pre> <p>Initialize the \u00e6ternity SDK, pre-configured for optimal use in an AEproject project using \u00e6ternity node devmode.</p> <pre><code>utils.awaitKeyBlocks(aeSdk, n);\n</code></pre> <p>Create and wait for <code>n</code> number of key-blocks with the \u00e6ternity node devmode, checked using the passed <code>aeSdk</code>.</p> <pre><code>utils.createSnapshot(aeSdk);\n</code></pre> <p>Create a snapshot of the current chain state using the \u00e6ternity node devmode, using the passed <code>aeSdk</code>.</p> <pre><code>utils.rollbackSnapshot(aeSdk);\n</code></pre> <p>Rollback to the latest snapshot using the \u00e6ternity node devmode, using the passed <code>aeSdk</code>.</p> <pre><code>utils.rollbackHeight(aeSdk, height);\n</code></pre> <p>Rollback to the specified height using the \u00e6ternity node devmode, using the passed <code>aeSdk</code>.</p> <pre><code>utils.getDefaultAccounts();\n</code></pre> <p>Get the pre-funded default accounts as <code>MemoryAccount</code>, so they can be used natively using the <code>aeSdk</code>.</p>"},{"location":"lib/#wallets","title":"Wallets","text":"<p>List of configured keypairs that are pre-funded using the \u00e6ternity node devmode as provided in AEproject.</p>"},{"location":"lib/#networks","title":"Networks","text":"<p>Exposed URLs for commonly used <code>nodeUrl</code> and <code>compilerUrl</code>, per default local <code>devmode</code> and optionally hosted URLs for <code>mainnet</code> and <code>testnet</code>.</p>"},{"location":"migration-from-3.x.x-to-4.x.x/","title":"Migration from 3.x.x to 4.x.x","text":""},{"location":"migration-from-3.x.x-to-4.x.x/#changes","title":"Changes","text":"<p>AEproject <code>v4.0.0</code> underwent some bigger changes, is now available as official package of the \u00e6ternity organization on NPM and is compatible to the recently published node v6.4.0.</p> <p>Install the new AEproject version</p> <pre><code>npm install -g @aeternity/aeproject\n</code></pre>"},{"location":"migration-from-3.x.x-to-4.x.x/#removed-commands","title":"Removed commands","text":"<p>Following commands have been removed and cannot be used anymore. Most of them didn't work properly or aren't used by anyone:</p> <ul> <li><code>aeproject compatibility</code> (discontinued)</li> <li><code>aeproject compile</code></li> <li>manual compilation isn't needed for use of aeproject, alternatively use the CLI or the SDK programmatically</li> <li><code>aeproject deploy</code></li> <li>deployment isn't supported in aeproject anymore, alternatively use the CLI or the SDK programmatically</li> <li><code>aeproject export</code> (discontinued)</li> <li><code>aeproject tx-inspector</code></li> <li>manual tx inspection is moved to the CLI</li> </ul>"},{"location":"migration-from-3.x.x-to-4.x.x/#updated-commands","title":"Updated commands","text":"<ul> <li><code>aeproject init</code></li> <li>added the <code>folder</code> argument to create a new folder for the project initialization</li> </ul>"},{"location":"migration-from-3.x.x-to-4.x.x/#project-structure","title":"Project structure","text":"<p>The latest available node and compiler will always be used with starting the testing environment.</p> <p>Testing is now handled locally in the project using <code>mocha</code> and <code>chai</code> as direct dev dependencies.</p> <p><code>@aeternity/aeproject</code> is added itself as dependency and includes some library-functions that can be used in testing.</p> <pre><code>const { networks, utils, wallets } = require(\"@aeternity/aeproject\");\n</code></pre> <ul> <li><code>networks</code> includes network definitions for local development, testnet and mainnet</li> <li><code>wallets</code> includes example wallets that are prefunded in local development</li> <li><code>utils</code> includes helper functions for testing</li> <li><code>getFilesystem(source)</code> to get the filesystem definition for a given contract for deployment</li> <li><code>getSdk()</code> get an instance of the SDK for local development<ul> <li>initialized with all prefunded wallets for <code>onAccount</code> to be used calling from different accounts</li> </ul> </li> <li><code>awaitKeyBlocks(aeSdk, number)</code> await a certain number of key-blocks</li> <li><code>createSnapshot(aeSdk)</code> create a snapshot for local testing</li> <li><code>rollbackSnapshot(aeSdk)</code> rollback to previously created snapshot in local testing</li> </ul>"},{"location":"migration-from-3.x.x-to-4.x.x/#instructions","title":"Instructions","text":"<ol> <li>Upgrade your project</li> </ol> <pre><code>aeproject init --update\n</code></pre> <ul> <li>adds new files needed<ul> <li>including new example contract and tests</li> </ul> </li> <li>prompts for files to replaced<ul> <li>docker setup for the node, compiler dev-mode setup should be accepted</li> <li>example contract and example tests should not be accepted if used in your project for testing</li> </ul> </li> <li> <p>automatically installs needed dependencies and removes unnecessary ones</p> </li> <li> <p>Adapt Testing Setup (compare your tests with <code>test/exampleTest.js</code>) to</p> </li> <li>include <code>const { assert } = require('chai');</code> for assertions</li> <li>replace <code>NETWORKS</code> import with <code>const { networks } = require('@aeternity/aeproject');</code> for networks definition<ul> <li>local testing network is now <code>devmode</code> instead of <code>local</code></li> </ul> </li> <li>replace <code>defaultWallets</code> import with <code>const { wallets } = require('@aeternity/aeproject');</code> for prefunded wallets</li> <li>replace <code>contractUtils</code> import with <code>const { utils } = require('@aeternity/aeproject');</code> for utils<ul> <li>consider using the new helpers for initializing an instance of the SDK and creating snapshots similar to <code>test/exampleTest.js</code></li> </ul> </li> </ul>"},{"location":"next-support/","title":"Upcoming Version Support","text":"<p>Aeproject can already be used for testing and setup with the upcoming node versions.</p>"},{"location":"next-support/#automatic-update","title":"Automatic update","text":"<p>Use <code>aeproject init --next</code> to initialize a new project that has the necessary adjustments to use the latest versions.</p> <p>Use <code>aeproject init --update --next</code> to update an existing project with the adjustments to use the latest versions. </p>"},{"location":"next-support/#manual-update","title":"Manual update","text":"<ul> <li>change occurrences of <code>utils.getSdk()</code> to use <code>utils.getSdk({ ignoreVersion: true })</code> if needed or use the same option for manually initialized sdk <code>Node</code> and <code>CompilerHttp</code></li> <li>update <code>docker-compose.yml</code> to use the <code>latest</code> node and compiler tags or specify it manually in running with <code>aeproject env --nodeVersion latest --compilerVersion latest</code></li> </ul>"},{"location":"cli/env/","title":"Local Environment","text":"<pre><code>aeproject env\n</code></pre> <p>The command is responsible for setting up a healthy local environment. The <code>env</code> 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.</p> <p>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</p> <p>You can stop both the node and the compiler by running</p> <pre><code>aeproject env --stop\n</code></pre> <p>There are optional parameters --nodeVersion and --compilerVersion. To specify a specific version of node or compiler, or both</p> <pre><code>aeproject env --nodeVersion v7.2.0\n# or\naeproject env --compilerVersion v8.0.0\n# or\naeproject env --nodeVersion v7.2.0 --compilerVersion v8.0.0\n</code></pre> <p>This also applies to the commands <code>aeproject node</code> and <code>aeproject compiler</code>.</p> <p>To see whether you have running instances of the nodes along with a compiler you could run the following command</p> <pre><code>aeproject env --info\n</code></pre> <p>Note: By default AEproject uses the <code>latest-bundle</code> tag of the official docker images.</p> <p>Compatibility:</p> <ul> <li>aeproject until <code>v4.8.3</code> is only compatible with node versions <code>NODE_TAG &lt;= v6.11.0</code> due to some changes in the devmode plugin</li> <li>aeproject uses the <code>-bundle</code> node docker images including dev mode, which are only published from <code>NODE_TAG &gt;= v6.3.0</code></li> <li>the default <code>aeternity.yaml</code> config file that ships with aeproject supports <code>NODE_TAG &gt;= v6.8.0</code></li> <li>the latest <code>@aeternity/aepp-sdk@13</code> is only compatible using <code>NODE_TAG &gt;= v6.0.0</code> and <code>COMPILER_TAG &gt;= v7.5.0</code></li> <li>the sdk from <code>@aeternity/aepp-sdk@13 &gt;= v13.3.2</code> is compatible with <code>NODE_TAG &gt;= v7.0.0-rc1</code> and <code>COMPILER_TAG &gt;= v8.0.0-rc1</code></li> <li>ARM64/Apple Silicon is supported from images <code>NODE_TAG &gt;= v6.8.1</code> and <code>COMPILER_TAG &gt;= v7.3.0</code></li> <li>due to a bug, <code>NODE_TAG = v7.1.0</code> is not compatible with aeproject</li> </ul>"},{"location":"cli/env/#disclaimer","title":"Disclaimer","text":"<ul> <li>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.</li> </ul>"},{"location":"cli/init/","title":"Project Initialization","text":"<pre><code>aeproject init [folder]\n</code></pre> <p>Optionally a <code>folder</code> can be specified for the project to be initialized in, otherwise the current directory is used.</p> <p>Creates a new project structure with a few folders in which the developer can create contracts and tests, as well as installing needed dependencies.</p>"},{"location":"cli/init/#update-existing-project","title":"Update existing project","text":"<p>For upgrade from old AEproject versions check out Migration from 3.x.x to 4.x.x.</p> <pre><code>aeproject init --update\n</code></pre> <p>Updates the project structure and needed artifacts to the latest version, as well as installing needed dependencies.</p>"},{"location":"cli/init/#upcoming-hard-fork-initialization","title":"Upcoming Hard-fork initialization","text":"<p>The additional parameter <code>--next</code> can be used to either initialize or update a project with changes for an upcoming hard-fork if available.</p>"},{"location":"cli/test/","title":"Unit Testing","text":""},{"location":"cli/test/#run-unit-tests","title":"Run unit tests","text":"<pre><code>aeproject test\n</code></pre> <p>The <code>test</code> command helps developers run their unit tests for \u00e6ternity projects. The command executes the tests scripts that are located in the test folder of your \u00e6ternity project.</p>"},{"location":"cli/test/#implement-unit-tests","title":"Implement unit tests","text":"<p>In the <code>test/exampleTest.js</code> file you can find an example for unit testing using AEproject.</p>"},{"location":"cli/test/#1-dependencies","title":"1. Dependencies","text":"<p>Javascript testing framework used with mocha for assertions, documented at https://www.chaijs.com/api/assert/</p> <pre><code>const { assert } = require(\"chai\");\n</code></pre> <p>Helper and utilities for AEproject use, e.g. prefunded wallets, network definition and utility functions for SDK initialization and snapshotting.</p> <pre><code>const { networks, utils, wallets } = require(\"@aeternity/aeproject\");\n</code></pre> <p>Read AEproject Library for a more detailed explanation about the usage of these imports.</p>"},{"location":"cli/test/#2-sdk-and-snapshotting-setup","title":"2. SDK and Snapshotting Setup","text":"<p>Provide your initializations in mocha which need to be done once before all tests:</p> <pre><code>before(async () =&gt; ...)\n</code></pre> <p>Initialize the default SDK instance with provided utils:</p> <pre><code>aeSdk = utils.getSdk();\n</code></pre> <p>Get the filesystem definition for (custom) <code>includes</code> of the given contract:</p> <pre><code>const filesystem = utils.getFilesystem(EXAMPLE_CONTRACT_SOURCE);\n</code></pre> <p>Read the contract source from the filesystem:</p> <pre><code>const sourceCode = utils.getContractContent(EXAMPLE_CONTRACT_SOURCE);\n</code></pre> <p>Initialize the contract instance:</p> <pre><code>contract = await aeSdk.initializeContract({ sourceCode, filesystem });\n</code></pre> <p>Deploy the contract:</p> <pre><code>await contract.init();\n</code></pre> <p>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:</p> <pre><code>await utils.createSnapshot(aeSdk);\n</code></pre> <p>Rollback to the previously created snapshot after each test for a clean state in the following tests:</p> <pre><code>afterEach(async () =&gt; {\n await utils.rollbackSnapshot(aeSdk);\n});\n</code></pre>"},{"location":"cli/test/#3-example-test","title":"3. Example Test","text":"<pre><code>it(\"ExampleContract: set and get\", async () =&gt; {\n const set = await contract.set(42, {\n onAccount: utils.getDefaultAccounts()[1],\n });\n assert.equal(set.decodedEvents[0].name, \"SetXEvent\");\n assert.equal(\n set.decodedEvents[0].args[0],\n utils.getDefaultAccounts()[1].address,\n );\n assert.equal(set.decodedEvents[0].args[1], 42);\n\n const { decodedResult } = await contract.get();\n assert.equal(decodedResult, 42);\n});\n</code></pre> <p>Use mocha for test setup and chai for <code>assert</code>. 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</p>"}]}
Binary file modified main/sitemap.xml.gz
Binary file not shown.

0 comments on commit 7792ca9

Please sign in to comment.