Skip to content

Commit 6a446c5

Browse files
committed
chore(release): Regenerate docs
1 parent 0af6075 commit 6a446c5

File tree

12 files changed

+164
-35
lines changed

12 files changed

+164
-35
lines changed

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

docs/bin/aecli-account.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,31 @@ program
322322
.action(async (walletPath, ...arguments) => await Account.getAccountNonce(walletPath, utils.cli.getCmdFromArguments(arguments)))
323323

324324

325+
```
326+
327+
328+
329+
330+
331+
332+
333+
## Initialize `generateKeyPairs` command
334+
335+
You can use this command to generate KeyPair's.
336+
337+
Example: `aecli account generate 10 --force
338+
339+
340+
341+
342+
```js
343+
program
344+
.command('generate <count>')
345+
.option('--forcePrompt', 'Force prompting')
346+
.description('Generate keyPairs')
347+
.action(async (count, ...arguments) => await Account.generateKeyPairs(count, utils.cli.getCmdFromArguments(arguments)))
348+
349+
325350

326351
```
327352

docs/bin/aecli-contract.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,7 @@ Example: `aecli contract compile ./mycontract.contract`
106106
```js
107107
program
108108
.command('compile <file>')
109+
.option('--backend [backend]', 'Compiler backend("fate" | "aevm")', utils.constant.COMPILER_BACKEND)
109110
.description('Compile a contract')
110111
.action(async (file, ...arguments) => await Contract.compile(file, utils.cli.getCmdFromArguments(arguments)))
111112

@@ -131,6 +132,7 @@ Example: `aecli contract encodeData ./mycontract.contract testFn 1 2`
131132
```js
132133
program
133134
.command('encodeData <source> <fn> [args...]')
135+
.option('--backend [backend]', 'Compiler backend("fate" | "aevm")', utils.constant.COMPILER_BACKEND)
134136
.description('Encode contract call data')
135137
.action(async (source, fn, args, ...arguments) => await Contract.encodeData(source, fn, args, utils.cli.getCmdFromArguments(arguments)))
136138

@@ -156,6 +158,7 @@ Example: `aecli contract decodeData cb_asdasdasdasdasdas int`
156158
```js
157159
program
158160
.command('decodeData <data> <returnType>')
161+
.option('--backend [backend]', 'Compiler backend("fate" | "aevm")', utils.constant.COMPILER_BACKEND)
159162
.description('Decode contract data')
160163
.action(async (data, returnType, ...arguments) => await Contract.decodeData(data, returnType, utils.cli.getCmdFromArguments(arguments)))
161164

@@ -185,6 +188,7 @@ program
185188
.option('--sourcePath [sourcePath]', 'Path to contract source')
186189
.option('--code [code]', 'Compiler contract code')
187190
.option('--fn [fn]', 'Function name')
191+
.option('--backend [backend]', 'Compiler backend("fate" | "aevm")', utils.constant.COMPILER_BACKEND)
188192
.description('Decode contract call data')
189193
.action(async (data, ...arguments) => await Contract.decodeCallData(data, utils.cli.getCmdFromArguments(arguments)))
190194

docs/bin/aecli-tx.md

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

@@ -285,6 +286,7 @@ program
285286
.option('--deposit [deposit]', 'Deposit', 0)
286287
.option('-G --gas [gas]', 'Amount of gas to deploy the contract', utils.constant.GAS)
287288
.option('--vmVersion [vmVersion]', 'VM version', utils.constant.VM_VERSION)
289+
.option('--abiVersion [abiVersion]', 'ABI version', utils.constant.DEFAULT_CONTRACT_PARAMS.abiVersion)
288290
.description('Build contract create transaction.')
289291
.action(async (ownerId, contractBytecode, initCallData, nonce, ...arguments) => await Transaction.contractDeploy(ownerId, contractBytecode, initCallData, nonce, utils.cli.getCmdFromArguments(arguments)))
290292

@@ -312,6 +314,8 @@ program
312314
.option('-T, --ttl [ttl]', 'Validity of the transaction in number of blocks (default forever)', utils.constant.TX_TTL)
313315
.option('-F, --fee [fee]', 'Transaction fee.')
314316
.option('-G --gas [gas]', 'Amount of gas to deploy the contract', utils.constant.GAS)
317+
.option('--abiVersion [abiVersion]', 'VM version', utils.constant.DEFAULT_CONTRACT_PARAMS.abiVersion)
318+
.option('--vmVersion [vmVersion]', 'ABI version', utils.constant.VM_VERSION)
315319
.description('Build contract create transaction.')
316320
.action(async (callerId, contractId, callData, nonce, ...arguments) => await Transaction.contractCall(callerId, contractId, callData, nonce, utils.cli.getCmdFromArguments(arguments)))
317321

docs/bin/commands/account.md

Lines changed: 103 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ This script initialize all `account` function
4242
* PERFORMANCE OF THIS SOFTWARE.
4343
*/
4444

45+
import { generateKeyPair } from '@aeternity/aepp-sdk/es/utils/crypto'
4546
import { generateSecureWallet, generateSecureWalletFromPrivKey } from '../utils/account'
4647
import { HASH_TYPES } from '../utils/constant'
4748
import { initClientByWalletFile } from '../utils/cli'
@@ -67,7 +68,7 @@ this function allow you to `sign` transaction's
6768

6869
```js
6970
async function sign (walletPath, tx, options) {
70-
let { json } = options
71+
const { json } = options
7172
try {
7273

7374
```
@@ -113,6 +114,7 @@ Get `keyPair` by `walletPath`, decrypt using password and initialize `Account` f
113114
printUnderscored('Unsigned', tx)
114115
printUnderscored('Signed', signedTx)
115116
}
117+
process.exit(0)
116118
})
117119
} catch (e) {
118120
printError(e.message)
@@ -184,6 +186,7 @@ if waitMined false
184186
json
185187
? print({ tx })
186188
: printTransaction(tx, json)
189+
process.exit(0)
187190
})
188191
} catch (e) {
189192
printError(e.message)
@@ -258,6 +261,7 @@ if waitMined false
258261
} else {
259262
printTransaction(tx, json)
260263
}
264+
process.exit(0)
261265
})
262266
} catch (e) {
263267
printError(e.message)
@@ -305,6 +309,7 @@ Get `keyPair` by `walletPath`, decrypt using password and initialize `Ae` client
305309
printUnderscored('Balance', await client.balance(keypair.publicKey, { height: +height, hash }))
306310
printUnderscored('ID', await client.address())
307311
printUnderscored('Nonce', nonce)
312+
process.exit(0)
308313
}
309314
)
310315
} catch (e) {
@@ -329,7 +334,7 @@ This function allow you retrieve account `public` and `private` keys
329334

330335
```js
331336
async function getAddress (walletPath, options) {
332-
const { privateKey, forcePrompt = false } = options
337+
const { privateKey, forcePrompt = false, json } = options
333338
try {
334339

335340
```
@@ -350,12 +355,24 @@ Get `keyPair` by `walletPath`, decrypt using password and initialize `Ae` client
350355

351356
await handleApiError(
352357
async () => {
353-
printUnderscored('Address', await client.address())
354-
if (privateKey) {
355-
if (forcePrompt || await prompt(PROMPT_TYPE.confirm, { message: 'Are you sure you want print your secret key?' })) {
356-
printUnderscored('Secret Key', keypair.secretKey)
358+
if (json) {
359+
if (privateKey) {
360+
if (forcePrompt || await prompt(PROMPT_TYPE.confirm, { message: 'Are you sure you want print your secret key?' })) {
361+
printUnderscored('Secret Key', keypair.secretKey)
362+
print({ publicKey: await client.address(), secretKey: keypair.secretKey })
363+
}
364+
} else {
365+
print({ publicKey: await client.address() })
366+
}
367+
} else {
368+
printUnderscored('Address', await client.address())
369+
if (privateKey) {
370+
if (forcePrompt || await prompt(PROMPT_TYPE.confirm, { message: 'Are you sure you want print your secret key?' })) {
371+
printUnderscored('Secret Key', keypair.secretKey)
372+
}
357373
}
358374
}
375+
process.exit(0)
359376
}
360377
)
361378
} catch (e) {
@@ -380,6 +397,7 @@ This function allow you retrieve account `nonce`
380397

381398
```js
382399
async function getAccountNonce (walletPath, options) {
400+
const { json } = options
383401
try {
384402

385403
```
@@ -401,9 +419,18 @@ Get `keyPair` by `walletPath`, decrypt using password and initialize `Ae` client
401419
await handleApiError(
402420
async () => {
403421
const nonce = await client.getAccountNonce(keypair.publicKey)
404-
printUnderscored('ID', keypair.publicKey)
405-
printUnderscored('Nonce', nonce - 1)
406-
printUnderscored('Next Nonce', nonce)
422+
if (json) {
423+
print({
424+
id: keypair.publicKey,
425+
nonce: nonce - 1,
426+
nextNonce: nonce
427+
})
428+
} else {
429+
printUnderscored('ID', keypair.publicKey)
430+
printUnderscored('Nonce', nonce - 1)
431+
printUnderscored('Next Nonce', nonce)
432+
}
433+
process.exit(0)
407434
}
408435
)
409436
} catch (e) {
@@ -427,9 +454,52 @@ This function allow you to generate `keypair` and write it to secure `ethereum`
427454

428455

429456
```js
430-
async function createSecureWallet (walletPath, { output, password, overwrite }) {
457+
async function createSecureWallet (walletPath, { output, password, overwrite, json }) {
458+
try {
459+
const { publicKey, path } = await generateSecureWallet(walletPath, { output, password, overwrite })
460+
if (json) {
461+
print({
462+
publicKey,
463+
path
464+
})
465+
} else {
466+
printUnderscored('Address', publicKey)
467+
printUnderscored('Path', path)
468+
}
469+
process.exit(0)
470+
} catch (e) {
471+
printError(e.message)
472+
}
473+
}
474+
475+
476+
```
477+
478+
479+
480+
481+
482+
483+
484+
## Create secure `wallet` file from `private-key`
485+
This function allow you to generate `keypair` from `private-key` and write it to secure `ethereum` like key-file
486+
487+
488+
489+
490+
```js
491+
async function createSecureWalletByPrivKey (walletPath, priv, { output, password, overwrite, json }) {
431492
try {
432-
await generateSecureWallet(walletPath, { output, password, overwrite })
493+
const { publicKey, path } = await generateSecureWalletFromPrivKey(walletPath, priv, { output, password, overwrite })
494+
if (json) {
495+
print({
496+
publicKey,
497+
path
498+
})
499+
} else {
500+
printUnderscored('Address', publicKey)
501+
printUnderscored('Path', path)
502+
}
433503
process.exit(0)
434504
} catch (e) {
435505
printError(e.message)
@@ -452,12 +522,30 @@ This function allow you to generate `keypair` from `private-key` and write it to
452522

453523

454524
```js
455-
async function createSecureWalletByPrivKey (walletPath, priv, { output, password, overwrite }) {
525+
async function generateKeyPairs (count = 1, { forcePrompt, json }) {
456526
try {
457-
await generateSecureWalletFromPrivKey(walletPath, priv, { output, password, overwrite })
527+
if (!Number.isInteger(+count)) {
528+
throw new Error('Count must be an Number')
529+
}
530+
if (forcePrompt || await prompt(PROMPT_TYPE.confirm, { message: 'Are you sure you want print your secret key?' })) {
531+
const accounts = Array.from(Array(parseInt(count))).map(_ => generateKeyPair(false))
532+
if (json) {
533+
print(JSON.stringify(accounts, null, 2))
534+
} else {
535+
accounts.forEach((acc, i) => {
536+
printUnderscored('Account index', i)
537+
printUnderscored('Public Key', acc.publicKey)
538+
printUnderscored('Secret Key', acc.secretKey)
539+
print('')
540+
})
541+
}
542+
} else {
543+
process.exit(0)
544+
}
458545
process.exit(0)
459546
} catch (e) {
460547
printError(e.message)
548+
process.exit(1)
461549
}
462550
}
463551

@@ -469,7 +557,8 @@ export const Account = {
469557
createSecureWallet,
470558
createSecureWalletByPrivKey,
471559
sign,
472-
transferFunds
560+
transferFunds,
561+
generateKeyPairs
473562
}
474563

475564

docs/bin/commands/aens.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,7 @@ Update `name` pointer
194194
195195
print(`Name ${domain} claimed`)
196196
printUnderscored('Transaction hash', hash)
197+
process.exit(0)
197198
})
198199
} catch (e) {
199200
printError(e.message)
@@ -298,6 +299,7 @@ Create `transferName` transaction
298299
const transferTX = await client.aensTransfer(name.id, address, { ttl, nameTtl, nonce })
299300
print('Transfer Success')
300301
printUnderscored('Transaction hash', transferTX.hash)
302+
process.exit(0)
301303
})
302304
} catch (e) {
303305
printError(e.message)
@@ -403,6 +405,7 @@ Create `updateName` transaction
403405
const updateNameTx = await client.aensUpdate(name.id, address, { ttl, nameTtl, nonce })
404406
print('Update Success')
405407
printUnderscored('Transaction Hash', updateNameTx.hash)
408+
process.exit(0)
406409
})
407410
} catch (e) {
408411
printError(e.message)
@@ -502,6 +505,7 @@ Create `revokeName` transaction
502505
const revokeTx = await client.aensRevoke(name.id, { ttl, nonce })
503506
print('Revoke Success')
504507
printUnderscored('Transaction hash', revokeTx.hash)
508+
process.exit(0)
505509
})
506510
} catch (e) {
507511
printError(e.message)
@@ -550,6 +554,7 @@ Check if `name` is unavailable and we can revoke it
550554
await updateNameStatus(domain)(client),
551555
json
552556
)
557+
process.exit(0)
553558
})
554559
} catch (e) {
555560
printError(e.message)

0 commit comments

Comments
 (0)