Skip to content

Commit 60c59c0

Browse files
authored
Merge pull request #107 from aeternity/release/2.6.0
Release 2.6.0
2 parents d0c85c1 + 6a446c5 commit 60c59c0

28 files changed

+1365
-2326
lines changed

.env

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
1-
TAG=v5.0.0-rc.1
2-
COMPILER_TAG=v3.2.0
3-
1+
TAG=v5.0.0-rc.3
2+
COMPILER_TAG=v4.0.0-rc5

.github/ISSUE_TEMPLATE.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
**Note: for support questions, please use the [forum](https://forum.aeternity.com)**. This repository's issues are reserved for feature requests and bug reports.
2+
3+
* **I'm submitting a ...**
4+
- [ ] bug report
5+
- [ ] feature request
6+
- [ ] support request => Please do not submit support request here, see note at the top of this template.
7+
8+
9+
* **Do you want to request a *feature* or report a *bug*?**
10+
11+
* **What is the current behavior?**
12+
13+
* **If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem**
14+
15+
* **What is the expected behavior?**
16+
17+
* **What is the motivation / use case for changing the behavior?**
18+
19+
* **Please tell us about your environment:**
20+
21+
- Node Version: v0.0.0
22+
- Protocol Version: 1
23+
- Compiler version: v0.0.0
24+
- VM Version: aevm | fate
25+
- SDK Version: v0.0.0
26+
- Environment: browser | nodejs
27+
28+
29+
* **Other information** (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. forum, telegram, etc)

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,13 @@
1+
# [2.6.0](https://github.com/aeternity/aepp-cli-js/compare/2.5.0...2.6.0) (2019-10-07)
2+
3+
4+
### Features
5+
6+
* **Lima:** Add support for lima ([#105](https://github.com/aeternity/aepp-cli-js/issues/105)) ([f7b061a](https://github.com/aeternity/aepp-cli-js/commit/f7b061a))
7+
* **Compiler:** Add `backend` option to compiler(Can be `fate` or `aevm`. `fate` by default)
8+
* **AENS:** Add `nameFee` option to `claim` command
9+
10+
111
# 2.5.0 (2019-08-28)
212

313

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
[![npm](https://img.shields.io/npm/v/@aeternity/aepp-sdk.svg)](https://www.npmjs.com/package/@aeternity/aepp-cli)
33
[![npm](https://img.shields.io/npm/l/@aeternity/aepp-sdk.svg)](https://www.npmjs.com/package/@aeternity/aepp-cli)
44

5-
# ️⚠️ [WIP] aepp-cli-js
5+
# aepp-cli-js
66
Command Line Interface for the æternity blockchain.
77

88
## Disclaimer
@@ -16,8 +16,6 @@ check out the [develop branch].
1616

1717

1818
## Installation
19-
> ️⚠️ **TODO**: The package is not yet published, so you can only install it by cloning this project.
20-
>
2119
You can install this `CLI` using your preferred tool (`yarn` or `npm`). Here's an `npm` example
2220
```
2321
npm install --global @aeternity/aepp-cli

bin/aecli-contract.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ program
4141
// Example: `aecli contract compile ./mycontract.contract`
4242
program
4343
.command('compile <file>')
44+
.option('--backend [backend]', 'Compiler backend("fate" | "aevm")', utils.constant.COMPILER_BACKEND)
4445
.description('Compile a contract')
4546
.action(async (file, ...arguments) => await Contract.compile(file, utils.cli.getCmdFromArguments(arguments)))
4647

@@ -52,6 +53,7 @@ program
5253
// Example: `aecli contract encodeData ./mycontract.contract testFn 1 2`
5354
program
5455
.command('encodeData <source> <fn> [args...]')
56+
.option('--backend [backend]', 'Compiler backend("fate" | "aevm")', utils.constant.COMPILER_BACKEND)
5557
.description('Encode contract call data')
5658
.action(async (source, fn, args, ...arguments) => await Contract.encodeData(source, fn, args, utils.cli.getCmdFromArguments(arguments)))
5759

@@ -63,6 +65,7 @@ program
6365
// Example: `aecli contract decodeData cb_asdasdasdasdasdas int`
6466
program
6567
.command('decodeData <data> <returnType>')
68+
.option('--backend [backend]', 'Compiler backend("fate" | "aevm")', utils.constant.COMPILER_BACKEND)
6669
.description('Decode contract data')
6770
.action(async (data, returnType, ...arguments) => await Contract.decodeData(data, returnType, utils.cli.getCmdFromArguments(arguments)))
6871

@@ -78,6 +81,7 @@ program
7881
.option('--sourcePath [sourcePath]', 'Path to contract source')
7982
.option('--code [code]', 'Compiler contract code')
8083
.option('--fn [fn]', 'Function name')
84+
.option('--backend [backend]', 'Compiler backend("fate" | "aevm")', utils.constant.COMPILER_BACKEND)
8185
.description('Decode contract call data')
8286
.action(async (data, ...arguments) => await Contract.decodeCallData(data, utils.cli.getCmdFromArguments(arguments)))
8387

bin/aecli-tx.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,7 @@ program
8181
.command('name-claim <accountId> <salt> <domain> <nonce>')
8282
.option('-T, --ttl [ttl]', 'Validity of the transaction in number of blocks (default forever)', utils.constant.TX_TTL)
8383
.option('-F, --fee [fee]', 'Transaction fee.')
84+
.option('--nameFee [nameFee]', 'Name fee.', utils.constant.NAME_FEE)
8485
.description('Build name claim transaction.')
8586
.action(async (accountId, salt, domain, nonce, ...arguments) => await Transaction.nameClaim(accountId, salt, domain, nonce, utils.cli.getCmdFromArguments(arguments)))
8687

@@ -122,6 +123,7 @@ program
122123
.option('--deposit [deposit]', 'Deposit', 0)
123124
.option('-G --gas [gas]', 'Amount of gas to deploy the contract', utils.constant.GAS)
124125
.option('--vmVersion [vmVersion]', 'VM version', utils.constant.VM_VERSION)
126+
.option('--abiVersion [abiVersion]', 'ABI version', utils.constant.DEFAULT_CONTRACT_PARAMS.abiVersion)
125127
.description('Build contract create transaction.')
126128
.action(async (ownerId, contractBytecode, initCallData, nonce, ...arguments) => await Transaction.contractDeploy(ownerId, contractBytecode, initCallData, nonce, utils.cli.getCmdFromArguments(arguments)))
127129

@@ -135,6 +137,8 @@ program
135137
.option('-T, --ttl [ttl]', 'Validity of the transaction in number of blocks (default forever)', utils.constant.TX_TTL)
136138
.option('-F, --fee [fee]', 'Transaction fee.')
137139
.option('-G --gas [gas]', 'Amount of gas to deploy the contract', utils.constant.GAS)
140+
.option('--abiVersion [abiVersion]', 'VM version', utils.constant.DEFAULT_CONTRACT_PARAMS.abiVersion)
141+
.option('--vmVersion [vmVersion]', 'ABI version', utils.constant.VM_VERSION)
138142
.description('Build contract create transaction.')
139143
.action(async (callerId, contractId, callData, nonce, ...arguments) => await Transaction.contractCall(callerId, contractId, callData, nonce, utils.cli.getCmdFromArguments(arguments)))
140144

bin/commands/contract.js

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import { GAS_PRICE } from '../utils/constant'
3030

3131
// ## Function which compile your `source` code
3232
export async function compile (file, options) {
33+
const { backend } = options
3334
try {
3435
const code = readFile(path.resolve(process.cwd(), file), 'utf-8')
3536
if (!code) throw new Error('Contract file not found')
@@ -38,7 +39,7 @@ export async function compile (file, options) {
3839

3940
await handleApiError(async () => {
4041
// Call `node` API which return `compiled code`
41-
const contract = await client.compileContractAPI(code)
42+
const contract = await client.compileContractAPI(code, { backend })
4243
print(`Contract bytecode:
4344
${contract}`)
4445
})
@@ -49,6 +50,7 @@ export async function compile (file, options) {
4950

5051
// ## Function which compile your `source` code
5152
export async function encodeData (source, fn, args = [], options) {
53+
const { backend } = options
5254
try {
5355
const sourceCode = readFile(path.resolve(process.cwd(), source), 'utf-8')
5456
if (!sourceCode) throw new Error('Contract file not found')
@@ -57,7 +59,7 @@ export async function encodeData (source, fn, args = [], options) {
5759

5860
await handleApiError(async () => {
5961
// Call `node` API which return `compiled code`
60-
const callData = await client.contractEncodeCallDataAPI(sourceCode, fn, args, options)
62+
const callData = await client.contractEncodeCallDataAPI(sourceCode, fn, args, { backend })
6163
if (options.json) {
6264
print(JSON.stringify({ callData }))
6365
} else {
@@ -91,7 +93,7 @@ export async function decodeData (data, type, options) {
9193

9294
// ## Function which compile your `source` code
9395
export async function decodeCallData (data, options) {
94-
const { sourcePath, code, fn } = options
96+
const { sourcePath, code, fn, backend } = options
9597
let sourceCode
9698

9799
if (!sourcePath && !code) throw new Error('Contract source(--sourcePath) or contract code(--code) required!')
@@ -109,8 +111,8 @@ export async function decodeCallData (data, options) {
109111
await handleApiError(async () => {
110112
// Call `node` API which return `compiled code`
111113
const decoded = code
112-
? await client.contractDecodeCallDataByCodeAPI(code, data)
113-
: await client.contractDecodeCallDataBySourceAPI(sourceCode, fn, data)
114+
? await client.contractDecodeCallDataByCodeAPI(code, data, backend)
115+
: await client.contractDecodeCallDataBySourceAPI(sourceCode, fn, data, { backend })
114116

115117
if (options.json) {
116118
print(JSON.stringify({ decoded }))

bin/commands/transaction.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ async function namePreClaim (accountId, domain, nonce, options) {
9797

9898
// ## Build `nameClaim` transaction
9999
async function nameClaim (accountId, nameSalt, domain, nonce, options) {
100-
let { ttl, json, fee } = options
100+
const vsn = 2
101+
let { ttl, json, fee, nameFee } = options
101102
const nameHash = `nm_${encodeBase58Check(Buffer.from(domain))}`
102103

103104
try {
@@ -106,15 +107,16 @@ async function nameClaim (accountId, nameSalt, domain, nonce, options) {
106107
// Initialize `Ae`
107108
const txBuilder = initOfflineTxBuilder()
108109
const params = {
110+
nameFee,
109111
accountId,
110112
nameSalt,
111113
name: nameHash,
112114
ttl,
113115
nonce
114116
}
115-
fee = txBuilder.calculateFee(fee, TX_TYPE.nameClaim, { params })
117+
fee = txBuilder.calculateFee(fee, TX_TYPE.nameClaim, { params, vsn })
116118
// Build `claim` transaction's
117-
const { tx, txObject } = txBuilder.buildTx({ ...params, fee }, TX_TYPE.nameClaim)
119+
const { tx, txObject } = txBuilder.buildTx({ ...params, fee }, TX_TYPE.nameClaim, { vsn })
118120

119121
if (json) {
120122
print({ tx, txObject })
@@ -276,7 +278,7 @@ async function contractDeploy (ownerId, contractByteCode, initCallData, nonce, o
276278

277279
// ## Build `contractCall` transaction
278280
async function contractCall (callerId, contractId, callData, nonce, options) {
279-
let { ttl, json, fee, gas } = options
281+
const { ttl, json, fee, gas } = options
280282
nonce = parseInt(nonce)
281283
try {
282284
// Build `call` transaction's

bin/utils/constant.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,16 @@ export const PLAY_INTERVAL = 1000
4444
// ## CONTRACT
4545
export const GAS = 1600000 - 21000 // MAX GAS
4646
export const DEPOSIT = 0
47-
export const VM_VERSION = 4
47+
export const VM_VERSION = 5
48+
export const ABI_VERSION = 3
49+
export const COMPILER_BACKEND = 'fate'
4850
export const ORACLE_VM_VERSION = 0
4951
export const GAS_PRICE = 1000000000
5052
export const AMOUNT = 0
5153

5254
// ## AENS
5355
export const NAME_TTL = 50000
56+
export const NAME_FEE = '1000000000000000000000'
5457
export const CLIENT_TTL = 1
5558

5659
// ## ACCOUNT
@@ -64,4 +67,4 @@ export const QUERY_TTL = 10
6467
export const RESPONSE_TTL = 10
6568

6669
// ## Default transaction build param's
67-
export const DEFAULT_CONTRACT_PARAMS = { vmVersion: VM_VERSION, amount: AMOUNT, deposit: DEPOSIT, gasPrice: GAS_PRICE, abiVersion: 1 }
70+
export const DEFAULT_CONTRACT_PARAMS = { vmVersion: VM_VERSION, amount: AMOUNT, deposit: DEPOSIT, gasPrice: GAS_PRICE, abiVersion: ABI_VERSION }

bin/utils/helpers.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ export function isAvailable (name) { return name.status === 'AVAILABLE' }
169169

170170
// Validate `name`
171171
export function validateName (name) {
172-
if (R.last(name.split('.')) !== 'test') { throw new Error('AENS TLDs must end in .test') }
172+
if (!['test', 'aet'].includes(R.last(name.split('.')))) { throw new Error('AENS TLDs must end in .test') }
173173
}
174174

175175
// Grab contract descriptor by path

0 commit comments

Comments
 (0)