Skip to content

Commit 59b977d

Browse files
authored
Merge pull request #854 from aeternity/release/7.0.0-next.2
Release 7.0.0-next.2
2 parents 6bdaa9c + 21b1b38 commit 59b977d

40 files changed

+4320
-1877
lines changed

CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,25 @@
1+
# [7.0.0-next.2](https://github.com/aeternity/aepp-sdk-js/compare/6.0.1...7.0.0-next.2) (2020-01-10)
2+
3+
4+
### Bug Fixes
5+
6+
* **codecov:** Adjust codecov badge. Move @babel/runtime to dev-deps ([#848](https://github.com/aeternity/aepp-sdk-js/issues/848)) ([109b851](https://github.com/aeternity/aepp-sdk-js/commit/109b851))
7+
* **AEX-2:** Fix `getBrowserAPI` function for firefox ([#853](https://github.com/aeternity/aepp-sdk-js/pull/853))
8+
9+
10+
### Features
11+
12+
* **Account:** Add ability to pass `keypair` or `MemoryAccount` as nAccount` option ([#847](https://github.com/aeternity/aepp-sdk-js/issues/847)) ([75d8ad8](https://github.com/aeternity/aepp-sdk-js/commit/75d8ad8))
13+
* **Test:** Increase code coverage ([#830](https://github.com/aeternity/aepp-sdk-js/issues/830)) ([6f760fb](https://github.com/aeternity/aepp-sdk-js/commit/6f760fb))
14+
* **Chain:** Extend transaction verification error ([#849](https://github.com/aeternity/aepp-sdk-js/pull/849))
15+
* **Aepp<->Wallet:** Add tests for Aepp<->Wallet communication ([#834](https://github.com/aeternity/aepp-sdk-js/pull/834))
16+
17+
### Documentation
18+
19+
* **Guide:** Add guide for Contract ACI usage ([#852](https://github.com/aeternity/aepp-sdk-js/pull/852))
20+
21+
22+
123
# [7.0.0-next.1](https://github.com/aeternity/aepp-sdk-js/compare/6.0.1...7.0.0-next.1) (2019-12-18)
224

325

README.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# [Æternity](https://aeternity.com/)'s Javascript SDK
22

33
[![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/aeternity/aepp-sdk-js.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/aeternity/aepp-sdk-js/context:javascript)
4-
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
4+
[![codecov](https://codecov.io/gh/aeternity/aepp-sdk-js/branch/develop/graph/badge.svg)](https://codecov.io/gh/aeternity/aepp-sdk-js)
55
[![Build Status](https://travis-ci.com/aeternity/aepp-sdk-js.svg?branch=develop)](http://travis-ci.com/aeternity/aepp-sdk-js?branch=develop)
6+
[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
67
[![npm](https://img.shields.io/npm/v/@aeternity/aepp-sdk.svg)](https://www.npmjs.com/package/@aeternity/aepp-sdk)
7-
[![npm](https://img.shields.io/npm/l/@aeternity/aepp-sdk.svg)](https://www.npmjs.com/package/@aeternity/aepp-sdk) [![Greenkeeper badge](https://badges.greenkeeper.io/aeternity/aepp-sdk-js.svg)](https://greenkeeper.io/)
8-
8+
[![npm](https://img.shields.io/npm/l/@aeternity/aepp-sdk.svg)](https://www.npmjs.com/package/@aeternity/aepp-sdk)
9+
[![Greenkeeper badge](https://badges.greenkeeper.io/aeternity/aepp-sdk-js.svg)](https://greenkeeper.io/)
910
JavaScript SDK for the revolutionary [æternity] blockchain, targeting the
1011
[æternity node] implementation. Aepp-sdk is [hosted on GitHub].
1112

docs/api/accounts.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import Accounts from '@aeternity/aepp-sdk/es/accounts'
1313
* [addresses()](#exp_module_@aeternity/aepp-sdk/es/accounts--addresses)`Array.&lt;String&gt;`
1414
* [Accounts([options])](#exp_module_@aeternity/aepp-sdk/es/accounts--Accounts)`Object`
1515
* _async_
16-
* [signWith(address, data)](#exp_module_@aeternity/aepp-sdk/es/accounts--signWith)`String`
1716
* [addAccount(account, [options])](#exp_module_@aeternity/aepp-sdk/es/accounts--addAccount)`Void`
1817

1918
<a id="exp_module_@aeternity/aepp-sdk/es/accounts--removeAccount"></a>
@@ -70,21 +69,6 @@ accounts.removeAccount(address) // Remove account
7069
accounts.selectAccount(address) // Select account
7170
accounts.addresses() // Get available accounts
7271
```
73-
<a id="exp_module_@aeternity/aepp-sdk/es/accounts--signWith"></a>
74-
75-
### signWith(address, data) ⇒ `String`
76-
Sign data blob with specific key
77-
78-
**Kind**: Exported function
79-
**Returns**: `String` - Signed data blob
80-
**Category**: async
81-
**rtype**: `(address: String, data: String) => data: Promise[String], throws: Error`
82-
83-
| Param | Type | Description |
84-
| --- | --- | --- |
85-
| address | `String` | Public key of account to sign with |
86-
| data | `String` | Data blob to sign |
87-
8872
<a id="exp_module_@aeternity/aepp-sdk/es/accounts--addAccount"></a>
8973

9074
### addAccount(account, [options]) ⇒ `Void`

docs/api/tx/builder.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ Unpack transaction hash
113113

114114
| Param | Type | Description |
115115
| --- | --- | --- |
116-
| encodedTx | `String` \| `Array` | String or RLP encoded transaction array (if fromRlpBinary flag is true) |
116+
| encodedTx | `String` \| `Buffer` | String or RLP encoded transaction array (if fromRlpBinary flag is true) |
117117
| fromRlpBinary | `Boolean` | Unpack from RLP encoded transaction (default: false) |
118118
| prefix | `String` | Prefix of data |
119119

docs/api/utils/aepp-wallet-communication/rpc/aepp-rpc.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import ContentScriptBridge from '@aeternity/aepp-sdk/es/utils/aepp-wallet-commun
1616
* [.subscribeAddress(type, value)](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc--exports.AeppRpc+subscribeAddress)`Promise`
1717
* [.signTransaction()](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc--exports.AeppRpc+signTransaction)`Promise.&lt;String&gt;`
1818
* [.sendConnectRequest()](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc--exports.AeppRpc+sendConnectRequest)`Promise`
19-
* [.send()](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc--exports.AeppRpc+send)`Promise.&lt;Object&gt;`
19+
* [.send(tx, [options])](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc--exports.AeppRpc+send)`Promise.&lt;Object&gt;`
2020

2121
<a id="exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc--exports.AeppRpc"></a>
2222

@@ -100,11 +100,18 @@ Send connection request to wallet
100100
**rtype**: `() => Promise`
101101
<a id="module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc--exports.AeppRpc+send"></a>
102102

103-
#### exports.AeppRpc.send() ⇒ `Promise.&lt;Object&gt;`
103+
#### exports.AeppRpc.send(tx, [options]) ⇒ `Promise.&lt;Object&gt;`
104104
Overwriting of `send` AE method
105105
All sdk API which use it will be send notification to wallet and wait for callBack
106106
This method will sign, broadcast and wait until transaction will be accepted using rpc communication with wallet
107107

108108
**Kind**: instance method of [`exports.AeppRpc`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/aepp-rpc--exports.AeppRpc)
109109
**Returns**: `Promise.&lt;Object&gt;` - Transaction broadcast result
110110
**rtype**: `(tx: String, options = {}) => Promise`
111+
112+
| Param | Type | Default |
113+
| --- | --- | --- |
114+
| tx | `String` | |
115+
| [options] | `Object` | <code>{}</code> |
116+
| [options.walletBroadcast] | `Object` | <code>{}</code> |
117+

docs/api/utils/aepp-wallet-communication/rpc/rpc-client.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import RpcClients from '@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/r
2121
* [.isConnected()](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient+isConnected)`Boolean`
2222
* [.getCurrentAccount(options)](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient+getCurrentAccount)`String`
2323
* [.disconnect()](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient+disconnect)`void`
24-
* [.updateSubscription(type, value)](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient+updateSubscription)`void`
24+
* [.updateSubscription(type, value)](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient+updateSubscription)`Array.&lt;String&gt;`
2525
* [.addAction(action, resolvers)](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient+addAction)`Object`
2626
* [.addCallback(msgId)](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient+addCallback)`Promise`
2727
* [.processResponse(msg, [transformResult])](#module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient+processResponse)`void`
@@ -125,7 +125,7 @@ Disconnect
125125
**rtype**: `() => void`
126126
<a id="module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient+updateSubscription"></a>
127127

128-
#### exports.RpcClient.updateSubscription(type, value) ⇒ `void`
128+
#### exports.RpcClient.updateSubscription(type, value) ⇒ `Array.&lt;String&gt;`
129129
Update subsription
130130

131131
**Kind**: instance method of [`exports.RpcClient`](#exp_module_@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/rpc/rpc-client--exports.RpcClient)

docs/api/utils/crypto.md

Lines changed: 11 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,11 @@ import * as Crypto from '@aeternity/aepp-sdk/es/utils/crypto'
1111
* [@aeternity/aepp-sdk/es/utils/crypto](#module_@aeternity/aepp-sdk/es/utils/crypto)
1212
* _static_
1313
* [.decode](#module_@aeternity/aepp-sdk/es/utils/crypto.decode)`Array`
14-
* [.isBase64(str)](#module_@aeternity/aepp-sdk/es/utils/crypto.isBase64)`boolean`
1514
* [.formatAddress(format, address)](#module_@aeternity/aepp-sdk/es/utils/crypto.formatAddress)`String`
1615
* [.isAddressValid(address, prefix)](#module_@aeternity/aepp-sdk/es/utils/crypto.isAddressValid)`Boolean`
1716
* [.addressToHex(base58CheckAddress)](#module_@aeternity/aepp-sdk/es/utils/crypto.addressToHex)`String`
1817
* [.addressFromDecimal(decimalAddress)](#module_@aeternity/aepp-sdk/es/utils/crypto.addressFromDecimal)`String`
1918
* [.hash(input)](#module_@aeternity/aepp-sdk/es/utils/crypto.hash)`Buffer`
20-
* [.nameId(input)](#module_@aeternity/aepp-sdk/es/utils/crypto.nameId)`Buffer`
2119
* [.sha256hash(input)](#module_@aeternity/aepp-sdk/es/utils/crypto.sha256hash)`String`
2220
* [.salt()](#module_@aeternity/aepp-sdk/es/utils/crypto.salt)`Number`
2321
* [.encodeBase64Check(input)](#module_@aeternity/aepp-sdk/es/utils/crypto.encodeBase64Check)`Buffer`
@@ -41,11 +39,10 @@ import * as Crypto from '@aeternity/aepp-sdk/es/utils/crypto'
4139
* [.decryptPrivateKey(password)](#module_@aeternity/aepp-sdk/es/utils/crypto.decryptPrivateKey)`Buffer`
4240
* [.decryptPubKey(password)](#module_@aeternity/aepp-sdk/es/utils/crypto.decryptPubKey)`Buffer`
4341
* [.assertedType(data, type, forceError)](#module_@aeternity/aepp-sdk/es/utils/crypto.assertedType)`String` \| `Boolean`
44-
* [.decodeTx(password)](#module_@aeternity/aepp-sdk/es/utils/crypto.decodeTx)`Array`
42+
* [.decodeTx(txHash)](#module_@aeternity/aepp-sdk/es/utils/crypto.decodeTx)`Buffer`
4543
* [.encodeTx(txData)](#module_@aeternity/aepp-sdk/es/utils/crypto.encodeTx)`String`
4644
* [.isValidKeypair(privateKey, publicKey)](#module_@aeternity/aepp-sdk/es/utils/crypto.isValidKeypair)`Boolean`
47-
* [.envKeypair(env)](#module_@aeternity/aepp-sdk/es/utils/crypto.envKeypair)`Object`
48-
* [.deserialize(binary, opts)](#module_@aeternity/aepp-sdk/es/utils/crypto.deserialize)`Object`
45+
* [.envKeypair(env, [force])](#module_@aeternity/aepp-sdk/es/utils/crypto.envKeypair)`Object`
4946
* [.encryptData(msg, publicKey)](#module_@aeternity/aepp-sdk/es/utils/crypto.encryptData)`Object`
5047
* [.decryptData(secretKey, encryptedData)](#module_@aeternity/aepp-sdk/es/utils/crypto.decryptData)`Buffer` \| `null`
5148
* _inner_
@@ -64,18 +61,6 @@ RLP decode
6461
| --- | --- | --- |
6562
| data | `Buffer` \| `String` \| `Integer` \| `Array` | Data to decode |
6663

67-
<a id="module_@aeternity/aepp-sdk/es/utils/crypto.isBase64"></a>
68-
69-
### @aeternity/aepp-sdk/es/utils/crypto.isBase64(str) ⇒ `boolean`
70-
Check whether a string is valid base-64.
71-
72-
**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto)
73-
**Returns**: `boolean` - True if the string is valid base-64, false otherwise.
74-
75-
| Param | Type | Description |
76-
| --- | --- | --- |
77-
| str | `string` | String to validate. |
78-
7964
<a id="module_@aeternity/aepp-sdk/es/utils/crypto.formatAddress"></a>
8065

8166
### @aeternity/aepp-sdk/es/utils/crypto.formatAddress(format, address) ⇒ `String`
@@ -143,20 +128,6 @@ Calculate 256bits Blake2b hash of `input`
143128
| --- | --- | --- |
144129
| input | `String` \| `Buffer` | Data to hash |
145130

146-
<a id="module_@aeternity/aepp-sdk/es/utils/crypto.nameId"></a>
147-
148-
### @aeternity/aepp-sdk/es/utils/crypto.nameId(input) ⇒ `Buffer`
149-
Calculate 256bits Blake2b nameId of `input`
150-
as defined in https://github.com/aeternity/protocol/blob/master/AENS.md#hashing
151-
152-
**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto)
153-
**Returns**: `Buffer` - Hash
154-
**rtype**: `(input: String) => hash: String`
155-
156-
| Param | Type | Description |
157-
| --- | --- | --- |
158-
| input | `String` | Data to hash |
159-
160131
<a id="module_@aeternity/aepp-sdk/es/utils/crypto.sha256hash"></a>
161132

162133
### @aeternity/aepp-sdk/es/utils/crypto.sha256hash(input) ⇒ `String`
@@ -378,7 +349,7 @@ Verify that signature was signed by public key
378349

379350
| Param | Type | Description |
380351
| --- | --- | --- |
381-
| str | `String` | Data to verify |
352+
| str | `String` \| `Buffer` | Data to verify |
382353
| signature | `Buffer` | Signature to verify |
383354
| publicKey | `Buffer` | Key to verify against |
384355

@@ -466,16 +437,16 @@ Assert base58 encoded type and return its payload
466437

467438
<a id="module_@aeternity/aepp-sdk/es/utils/crypto.decodeTx"></a>
468439

469-
### @aeternity/aepp-sdk/es/utils/crypto.decodeTx(password) ⇒ `Array`
440+
### @aeternity/aepp-sdk/es/utils/crypto.decodeTx(txHash) ⇒ `Buffer`
470441
Decode a transaction
471442

472443
**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto)
473-
**Returns**: `Array` - Decoded transaction
444+
**Returns**: `Buffer` - Decoded transaction
474445
**rtype**: `(txHash: String) => Buffer`
475446

476447
| Param | Type | Description |
477448
| --- | --- | --- |
478-
| password | `String` | Password to decrypt with |
449+
| txHash | `String` | Transaction hash |
479450

480451
<a id="module_@aeternity/aepp-sdk/es/utils/crypto.encodeTx"></a>
481452

@@ -508,7 +479,7 @@ Sign a message, and then verifying that signature
508479

509480
<a id="module_@aeternity/aepp-sdk/es/utils/crypto.envKeypair"></a>
510481

511-
### @aeternity/aepp-sdk/es/utils/crypto.envKeypair(env) ⇒ `Object`
482+
### @aeternity/aepp-sdk/es/utils/crypto.envKeypair(env, [force]) ⇒ `Object`
512483
Obtain key pair from `env`
513484

514485
Designed to be used with `env` from nodejs. Assumes enviroment variables
@@ -518,23 +489,10 @@ Designed to be used with `env` from nodejs. Assumes enviroment variables
518489
**Returns**: `Object` - Key pair
519490
**rtype**: `(env: Object) => {publicKey: String, secretKey: String}, throws: Error`
520491

521-
| Param | Type | Description |
522-
| --- | --- | --- |
523-
| env | `Object` | Environment |
524-
525-
<a id="module_@aeternity/aepp-sdk/es/utils/crypto.deserialize"></a>
526-
527-
### @aeternity/aepp-sdk/es/utils/crypto.deserialize(binary, opts) ⇒ `Object`
528-
Deserialize `binary` state channel transaction
529-
530-
**Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto)
531-
**Returns**: `Object` - Channel data
532-
**rtype**: `(binary: String) => Object`
533-
534-
| Param | Type | Description |
535-
| --- | --- | --- |
536-
| binary | `String` | Data to deserialize |
537-
| opts | `Object` | Options |
492+
| Param | Type | Default | Description |
493+
| --- | --- | --- | --- |
494+
| env | `Object` | | Environment |
495+
| [force] | `Boolean` | <code>false</code> | Force throwing error |
538496

539497
<a id="module_@aeternity/aepp-sdk/es/utils/crypto.encryptData"></a>
540498

docs/api/utils/keystore.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
## @aeternity/aepp-sdk/es/utils/keystore
44
KeyStore module
5-
!!!Work only in node.js!!!
65

76
**Example**
87
```js

docs/examples/node/aecontract.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -62,18 +62,18 @@ We'll need the main client module `Ae` in the `Universal` flavor from the SDK.
6262

6363

6464
```js
65-
const { Universal: Ae } = require('@aeternity/aepp-sdk')
65+
const { Universal: Ae, Node } = require('@aeternity/aepp-sdk')
6666
const program = require('commander')
6767
const fs = require('fs')
6868

69-
function exec (infile, fn, args) {
69+
async function exec (infile, fn, args) {
7070
if (!infile || !fn) {
7171
program.outputHelp()
7272
process.exit(1)
7373
}
7474

7575
const code = fs.readFileSync(infile, 'utf-8')
76-
76+
const node = await Node({ url: program.host })
7777

7878
```
7979
@@ -107,7 +107,7 @@ implementation directly in the SDK.
107107
108108
109109
```js
110-
Ae({ url: program.host, debug: program.debug, compilerUrl: program.compilerUrl, process }).then(ae => {
110+
Ae({ debug: program.debug, process, nodes: [{ name: 'testNode', instance: node }] }).then(ae => {
111111
return ae.contractCompile(code)
112112

113113
```
@@ -197,7 +197,6 @@ program
197197
.arguments('<infile> <function> [args...]')
198198
.option('-i, --init [state]', 'Arguments to contructor function')
199199
.option('-H, --host [hostname]', 'Node to connect to', 'http://localhost:3013')
200-
.option('-C, --compilerUrl [compilerUrl]', 'Compiler to connect to', 'http://localhost:3088')
201200
.option('--debug', 'Switch on debugging')
202201
.action(exec)
203202
.parse(process.argv)

0 commit comments

Comments
 (0)