Skip to content

Commit

Permalink
Merge pull request #242 from aeternity/feature/update-sdk
Browse files Browse the repository at this point in the history
Update sdk to 13.3.0
  • Loading branch information
davidyuk authored Apr 9, 2024
2 parents e960697 + 3c22e58 commit 797186c
Show file tree
Hide file tree
Showing 32 changed files with 168 additions and 184 deletions.
5 changes: 2 additions & 3 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
version: '3'
services:
node:
image: aeternity/aeternity:v6.8.1
image: aeternity/aeternity:v6.13.0
ports: [3013:3013]
# TODO: remove after releasing https://github.com/aeternity/aeternity/pull/4292
healthcheck:
interval: 2s
volumes:
- ./docker/aeternity.yaml:/home/aeternity/node/aeternity.yaml
- ./docker/accounts.json:/home/aeternity/node/data/aecore/.genesis/accounts_test.json
stop_grace_period: 0s

compiler:
image: aeternity/aesophia_http:v7.4.0
image: aeternity/aesophia_http:v7.6.1
ports: [3080:3080]
# TODO: remove after releasing https://github.com/aeternity/aesophia_http/pull/133
healthcheck:
Expand Down
3 changes: 0 additions & 3 deletions docker/accounts.json

This file was deleted.

23 changes: 8 additions & 15 deletions docker/aeternity.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# yaml-language-server: $schema=https://github.com/aeternity/aeternity/raw/master/apps/aeutils/priv/aeternity_config_schema.json

system:
dev_mode: true

dev_mode:
auto_emit_microblocks: true

http:
endpoints:
dry-run: true
Expand All @@ -9,18 +15,5 @@ chain:
hard_forks:
"1": 0
"5": 1

mining:
autostart: true
beneficiary: "ak_2iBPH7HUz3cSDVEUWiHg76MZJ6tZooVNBmmxcgVK6VV8KAE688"
expected_mine_rate: 1000
micro_block_cycle: 300
strictly_follow_top: true
cuckoo:
miner:
executable: mean15-generic
extra_args: ""
edge_bits: 15

fork_management:
network_id: "ae_devnet"
genesis_accounts:
ak_21A27UVVt3hDkBE5J7rhhqnH5YNb4Y1dqo4PnSybrH85pnWo7E: 10000000000000001000000000000000000000
105 changes: 36 additions & 69 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
},
"type": "module",
"dependencies": {
"@aeternity/aepp-sdk": "^13.2.2",
"@aeternity/aepp-sdk": "^13.3.0",
"bignumber.js": "^9.1.2",
"commander": "^12.0.0",
"env-paths": "^3.0.0",
Expand Down
Empty file modified src/aecli-account.js
100644 → 100755
Empty file.
Empty file modified src/aecli-contract.js
100644 → 100755
Empty file.
Empty file modified src/aecli-inspect.js
100644 → 100755
Empty file.
Empty file modified src/aecli-name.js
100644 → 100755
Empty file.
Empty file modified src/aecli-oracle.js
100644 → 100755
Empty file.
Empty file modified src/aecli-tx.js
100644 → 100755
Empty file.
15 changes: 7 additions & 8 deletions src/arguments.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Argument, Option } from 'commander';
import BigNumber from 'bignumber.js';
import { MIN_GAS_PRICE } from '@aeternity/aepp-sdk';
import { NODE_URL, COMPILER_URL } from './utils/constant.js';
import { noValue } from './utils/default-option-description.js';

export const coinAmountParser = (amount) => {
if (amount.endsWith('ae')) return new BigNumber(amount.slice(0, -2)).shiftedBy(18);
Expand All @@ -15,27 +15,26 @@ export const nonceArgument = new Argument('<nonce>', 'Unique number that is requ
.argParser((nonce) => +nonce);

export const nodeOption = new Option('-u, --url [nodeUrl]', 'Node to connect to')
.default(NODE_URL, 'Aeternity testnet')
.default('https://mainnet.aeternity.io', 'mainnet')
.env('AECLI_NODE_URL');

export const compilerOption = new Option('--compilerUrl [compilerUrl]', 'Compiler to connect to')
.default(COMPILER_URL, 'Stable compiler')
.default('https://v7.compiler.aepps.com', 'stable compiler')
.env('AECLI_COMPILER_URL');

export const jsonOption = new Option('--json', 'Print result in json format');

export const gasOption = new Option('-G, --gas [gas]', 'Amount of gas to call/deploy the contract')
.argParser((gas) => +gas);

export const gasPriceOption = new Option('--gasPrice [gasPrice]', 'Gas price to call/deploy the contract')
.default(MIN_GAS_PRICE, 'Minimum gas price') // TODO: use gas price from the node after updating sdk to 13.3.0
.argParser(coinAmountParser);
export const gasPriceOption = (usingNode) => new Option('--gasPrice [gasPrice]', 'Gas price to call/deploy the contract')
.default(noValue, usingNode ? 'based on network demand' : MIN_GAS_PRICE);

export const forceOption = new Option('-f, --force', 'Ignore node version compatibility check');

export const passwordOption = new Option('-P, --password [password]', 'Wallet Password');

export const ttlOption = new Option('-T, --ttl [ttl]', 'Validity of the transaction in number of blocks')
.default(0, 'forever');
export const ttlOption = (usingNode) => new Option('-T, --ttl [ttl]', 'Validity of the transaction in number of blocks')
.default(noValue, usingNode ? 'current height increased by 3' : 'infinity');

export const networkIdOption = new Option('--networkId [networkId]', 'Network id');
2 changes: 1 addition & 1 deletion src/commands/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ addCommonOptions(program
.addOption(networkIdOption)
.option('--payload [payload]', 'Transaction payload.', '')
.addOption(feeOption)
.addOption(ttlOption)
.addOption(ttlOption(true))
.option('-N, --nonce [nonce]', 'Override the nonce that the transaction is going to be sent with')
.action(Account.spend));

Expand Down
6 changes: 3 additions & 3 deletions src/commands/contract.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ addCommonOptions(program
.option('-s, --callStatic', 'Call static')
.option('-t, --topHash', 'Hash of block to make call')
.addOption(feeOption)
.addOption(ttlOption)
.addOption(ttlOption(true))
.option('-N, --nonce [nonce]', 'Override the nonce that the transaction is going to be sent with')
.description('Execute a function of the contract')
.action(Contract.call));
Expand All @@ -137,9 +137,9 @@ addCommonOptions(program
.option('-W, --no-waitMined', 'Force waiting until transaction will be mined')
.addOption(passwordOption)
.addOption(gasOption)
.addOption(gasPriceOption)
.addOption(gasPriceOption(true))
.addOption(feeOption)
.addOption(ttlOption)
.addOption(ttlOption(true))
.option('-N, --nonce [nonce]', 'Override the nonce that the transaction is going to be sent with')
.description('Deploy a contract on the chain')
.action(Contract.deploy));
Expand Down
22 changes: 12 additions & 10 deletions src/commands/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ import fs from 'fs-extra';
import { fileURLToPath } from 'url';
import { resolve } from 'path';
import updateNotifier from 'update-notifier';
import { Node, CompilerCli, CompilerHttpNode } from '@aeternity/aepp-sdk';
import { Node, ConsensusProtocolVersion } from '@aeternity/aepp-sdk';
import { compilerOption, nodeOption } from '../arguments.js';
import { getCompilerByUrl } from '../utils/cli.js';
import { addToConfig } from '../utils/config.js';
import CliError from '../utils/CliError.js';

Expand Down Expand Up @@ -41,18 +42,18 @@ const EXECUTABLE_CMD = [
EXECUTABLE_CMD.forEach(({ name, desc }) => program.command(name, desc));

async function getNodeDescription(url) {
// TODO: remove after fixing https://github.com/aeternity/aepp-sdk-js/issues/1673
const omitUncaughtExceptions = () => {};
process.on('uncaughtException', omitUncaughtExceptions);
const nodeInfo = await (new Node(url)).getNodeInfo().catch(() => {});
process.off('uncaughtException', omitUncaughtExceptions);
const nodeInfo = await new Node(url).getNodeInfo().catch(() => {});
return nodeInfo
? `network id ${nodeInfo.nodeNetworkId}, version ${nodeInfo.version}`
? [
`network id ${nodeInfo.nodeNetworkId}`,
`version ${nodeInfo.version}`,
`protocol ${nodeInfo.consensusProtocolVersion} (${ConsensusProtocolVersion[nodeInfo.consensusProtocolVersion]})`,
].join(', ')
: 'can\'t get node info';
}

async function getCompilerDescription(url) {
const compiler = url === 'cli' ? new CompilerCli() : new CompilerHttpNode(url);
const compiler = getCompilerByUrl(url);
const version = await compiler.version().catch(() => {});
return version ? `version ${version}` : 'can\'t get compiler version';
}
Expand Down Expand Up @@ -122,6 +123,7 @@ program
const nodes = [
{ name: 'Mainnet', url: 'https://mainnet.aeternity.io/' },
{ name: 'Testnet', url: 'https://testnet.aeternity.io/' },
{ name: 'Next', url: 'https://next.aeternity.io/' },
];
await addToConfig({ url: await askUrl('node', nodes, getNodeDescription, url) });
});
Expand All @@ -133,8 +135,8 @@ program
.action(async (url) => {
const compilers = [
{ name: 'Stable v7', url: 'https://v7.compiler.aepps.com/' },
{ name: 'Integrated compiler (requires Erlang installed)', url: 'cli' },
{ name: 'Latest', url: 'https://latest.compiler.aeternity.io/' },
{ name: 'Integrated compiler, FATE 2 (requires Erlang)', url: 'cli' },
{ name: 'Integrated compiler, FATE 3 (requires Erlang)', url: 'cli8' },
];
await addToConfig({
compilerUrl: await askUrl('compiler', compilers, getCompilerDescription, url),
Expand Down
2 changes: 1 addition & 1 deletion src/commands/name.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const program = new Command().name('aecli name');
// ## Initialize `options`
const addCommonOptions = (p) => p
.addOption(nodeOption)
.addOption(ttlOption)
.addOption(ttlOption(true))
.addOption(feeOption)
.option('--nonce [nonce]', 'Override the nonce that the transaction is going to be sent with')
.addOption(passwordOption)
Expand Down
2 changes: 1 addition & 1 deletion src/commands/oracle.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const program = new Command().name('aecli oracle');
// ## Initialize `options`
const addCommonOptions = (p) => p
.addOption(nodeOption)
.addOption(ttlOption)
.addOption(ttlOption(true))
.addOption(feeOption)
.option('--nonce [nonce]', 'Override the nonce that the transaction is going to be sent with')
.addOption(passwordOption)
Expand Down
Loading

0 comments on commit 797186c

Please sign in to comment.