Skip to content

Commit

Permalink
Merge pull request #944 from aeternity/release/7.2.0
Browse files Browse the repository at this point in the history
Release/7.2.0
  • Loading branch information
nduchak authored Mar 25, 2020
2 parents 51dbd20 + 7e9d9ff commit d28202b
Show file tree
Hide file tree
Showing 48 changed files with 5,833 additions and 33,915 deletions.
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
NODE_TAG=v5.4.0
NODE_TAG=v5.5.0
COMPILER_TAG=v4.2.0
21 changes: 21 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,27 @@
# [7.2.0](https://github.com/aeternity/aepp-sdk-js/compare/6.0.1...7.2.0) (2020-03-24)

### Docs

* **Guide:** Adjust guide for RPC Wallet/Aepp usage

### Code Refactoring

* **RPC:** Refactor rpc-related stuff ([#921](https://github.com/aeternity/aepp-sdk-js/pull/921))
* **Build:** Include amountFormatter and SCHEMA in bundle([#936](https://github.com/aeternity/aepp-sdk-js/pull/936))
* **Examples** Update examples apps

### Features

* **TX:** Introduce new stamp `TxObject`([#933](https://github.com/aeternity/aepp-sdk-js/pull/933))
This stamp give more flexibility on transaction serialization/deserialization process
* **Keystore:** Allow to store secret as hex or buffer ([#939](https://github.com/aeternity/aepp-sdk-js/pull/939))
* **AEX-2:** Add permission layer for account management ([#937](https://github.com/aeternity/aepp-sdk-js/pull/937))


## [7.1.1](https://github.com/aeternity/aepp-sdk-js/compare/6.0.1...7.1.1) (2020-02-27)



### Bug Fixes

* **TxBuilder:** Fix fee calculation for Oracles ([#924](https://github.com/aeternity/aepp-sdk-js/issues/924)) ([a9d784f](https://github.com/aeternity/aepp-sdk-js/commit/a9d784f))
Expand Down
49 changes: 20 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,35 +112,26 @@ import Ae from '@aeternity/aepp-sdk/es/ae/universal' // or other flavor
import Ae from '@aeternity/aepp-sdk/es/ae/universal' // or other flavor
import MemoryAccount from '@aeternity/aepp-sdk/es/account/memory' // or other flavor
import Node from '@aeternity/aepp-sdk/es/node' // or other flavor

Promise.all([
Node({ url, internalUrl })
]).then(nodes => {
Ae({
nodes: [
{ name: 'someNode', instance: nodes[0] },
// node2, node3, ...
],
compilerUrl: 'COMPILER_URL',
accounts: [
MemoryAccount({ keypair: { secretKey: 'A_PRIV_KEY', publicKey: 'A_PUB_ADDRESS' } }),
// acc2
],
address: 'SELECTED_ACCOUNT_PUB',
networkId: 'ae_uat' // or any other networkId your client should connect to
}).then(ae => {
// Interacting with the blockchain client
// getting the latest block height
ae.height().then(height => {
// logs current height
console.log('Current Block Height:', height)
}).catch(e => {
// logs error
console.log(e)
})
})
})

import { AE_AMOUNT_FORMATS } from '@aeternity/aepp-sdk/es/utils/amount-formatter'

const NODE_URL = 'https://sdk-testnet.aepps.com'
const COMPILER_URL = 'COMPILER_URL' // required for using Contract
const ACCOUNT = MemoryAccount({ keypair: { secretKey: 'A_PRIV_KEY', publicKey: 'A_PUB_ADDRESS' } })

(async function () {
const nodeInstance = await Node({ url: NODE_URL })
const sdkInstance = await Ae({
compilerUrl: COMPILER_URL,
nodes: [ { name: 'test-net', instance: nodeInstance } ],
accounts: [ ACCOUNT ]
})

await sdkInstance.height() // get top block height
console.log('Current Block Height:', height)

await sdkInstance.spend(1, 'ak_asd23dasdasda...', { denomination: AE_AMOUNT_FORMATS.AE }) // spend one AE

})()
```

## More: Guides & Examples
Expand Down
3 changes: 3 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,9 @@ You can use this URL with any releasee on [npmjs](https://www.npmjs.com/package/
- [AENS delegation signature](guides/delegate-signature-to-contract.md)
- [AENS usage](guides/aens-usage.md)

### New Wallet/Aepp API
- [How to build Wallet app/extension](guides/how-to-build-an-wallet-app-or-extension.md)
- [How to build Aepp](guides/how-to-build-aepp-using-new-wallet-api.md)

## Examples
Check out our [Examples](../examples/README.md) for more.
1 change: 1 addition & 0 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
* [@aeternity/aepp-sdk/es/tx/builder](api/tx/builder.md)
* [@aeternity/aepp-sdk/es/tx/builder/schema](api/tx/builder/schema.md)
* [@aeternity/aepp-sdk/es/tx](api/tx.md)
* [@aeternity/aepp-sdk/es/tx/tx-object](api/tx/tx-object.md)
* [@aeternity/aepp-sdk/es/tx/tx](api/tx/tx.md)
* [@aeternity/aepp-sdk/es/tx/validator](api/tx/validator.md)
* [@aeternity/aepp-sdk/es/utils/aepp-wallet-communication/connection/browser-runtime](api/utils/aepp-wallet-communication/connection/browser-runtime.md)
Expand Down
36 changes: 33 additions & 3 deletions docs/api/account.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ import Account from '@aeternity/aepp-sdk/es/account'
* [@aeternity/aepp-sdk/es/account](#module_@aeternity/aepp-sdk/es/account)
* [Account([options])](#exp_module_@aeternity/aepp-sdk/es/account--Account)`Object`
* [.signTransaction(tx, opt)](#module_@aeternity/aepp-sdk/es/account--Account+signTransaction)`String`
* [.getNetworkId()](#module_@aeternity/aepp-sdk/es/account--Account+getNetworkId)`String`
* [.signMessage(message, opt)](#module_@aeternity/aepp-sdk/es/account--Account+signMessage)`String`
* [.verifyMessage(message, signature, opt)](#module_@aeternity/aepp-sdk/es/account--Account+verifyMessage)`Boolean`
* [.getNetworkId()](#module_@aeternity/aepp-sdk/es/account--Account+getNetworkId)`String`
* *[.sign(data)](#module_@aeternity/aepp-sdk/es/account--Account+sign)`String`*
* *[.address()](#module_@aeternity/aepp-sdk/es/account--Account+address)`String`*

Expand Down Expand Up @@ -56,12 +56,42 @@ Sign encoded transaction
<a id="module_@aeternity/aepp-sdk/es/account--Account+getNetworkId"></a>

#### account.getNetworkId() ⇒ `String`
Obtain networkId for signing
Get network Id

**Kind**: instance method of [`Account`](#exp_module_@aeternity/aepp-sdk/es/account--Account)
**Returns**: `String` - NetworkId
**Returns**: `String` - Network Id
**Category**: async
**rtype**: `() => networkId: String`
<a id="module_@aeternity/aepp-sdk/es/account--Account+signMessage"></a>

#### account.signMessage(message, opt) ⇒ `String`
Sign message

**Kind**: instance method of [`Account`](#exp_module_@aeternity/aepp-sdk/es/account--Account)
**Returns**: `String` - Signature
**Category**: async
**rtype**: `(msg: String) => signature: Promise[String], throws: Error`

| Param | Type | Description |
| --- | --- | --- |
| message | `String` | Message to sign |
| opt | `Object` | Options |

<a id="module_@aeternity/aepp-sdk/es/account--Account+verifyMessage"></a>

#### account.verifyMessage(message, signature, opt) ⇒ `Boolean`
Verify message

**Kind**: instance method of [`Account`](#exp_module_@aeternity/aepp-sdk/es/account--Account)
**Category**: async
**rtype**: `(msg: String, signature: String, publicKey: String) => signature: Promise[String], throws: Error`

| Param | Type | Description |
| --- | --- | --- |
| message | `String` | Message to verify |
| signature | `String` | Signature |
| opt | `Object` | Options |

<a id="module_@aeternity/aepp-sdk/es/account--Account+sign"></a>

#### *account.sign(data) ⇒ `String`*
Expand Down
4 changes: 2 additions & 2 deletions docs/api/ae/oracle.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,8 @@ Register oracle
| [options.queryFee] | `String` \| `Number` | | queryFee Oracle query Fee |
| [options.oracleTtl] | `Object` | | oracleTtl OracleTtl object {type: 'delta|block', value: 'number'} |
| [options.abiVersion] | `Number` | | abiVersion Always 0 (do not use virtual machine) |
| [options.fee] | `Number` | | fee Transaction fee |
| [options.ttl] | `Number` | | Transaction time to leave |
| [options.fee] | `Number` \| `String` | | fee Transaction fee |
| [options.ttl] | `Number` \| `String` | | Transaction time to leave |

<a id="exp_module_@aeternity/aepp-sdk/es/ae/oracle--postQueryToOracle"></a>

Expand Down
19 changes: 18 additions & 1 deletion docs/api/tx/builder.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import Transaction from '@aeternity/aepp-sdk/es/tx/builder'
* [exports.validateParams(params, schema, excludeKeys)](#exp_module_@aeternity/aepp-sdk/es/tx/builder--exports.validateParams)`Object`
* [exports.buildRawTx(params, schema, [options])](#exp_module_@aeternity/aepp-sdk/es/tx/builder--exports.buildRawTx)`Array`
* [exports.unpackRawTx(binary, schema)](#exp_module_@aeternity/aepp-sdk/es/tx/builder--exports.unpackRawTx)`Object`
* [getSchema()](#exp_module_@aeternity/aepp-sdk/es/tx/builder--getSchema)`Object`
* [exports.buildTx(params, type, [options])](#exp_module_@aeternity/aepp-sdk/es/tx/builder--exports.buildTx)`Object`
* [exports.unpackTx(encodedTx, fromRlpBinary, prefix)](#exp_module_@aeternity/aepp-sdk/es/tx/builder--exports.unpackTx)`Object`
* [exports.buildTxHash(rawTx)](#exp_module_@aeternity/aepp-sdk/es/tx/builder--exports.buildTxHash)`String`
Expand Down Expand Up @@ -68,7 +69,7 @@ Build binary transaction
| params | `Object` | | Object with tx params |
| schema | `Array` | | Transaction schema |
| [options] | `Object` | <code>{}</code> | options |
| [options.excludeKeys] | `Object` | | excludeKeys Array of keys to exclude for validation and build |
| [options.excludeKeys] | `Array` | | excludeKeys Array of keys to exclude for validation and build |

<a id="exp_module_@aeternity/aepp-sdk/es/tx/builder--exports.unpackRawTx"></a>

Expand All @@ -83,6 +84,22 @@ Unpack binary transaction
| binary | `Array` | Array with binary transaction field's |
| schema | `Array` | Transaction schema |

<a id="exp_module_@aeternity/aepp-sdk/es/tx/builder--getSchema"></a>

### getSchema() ⇒ `Object`
Get transaction serialization/deserialization schema

**Kind**: Exported function
**Returns**: `Object` - Schema
**Throws**:

- `Error` Schema not found error


| Type |
| --- |
| `Object` |

<a id="exp_module_@aeternity/aepp-sdk/es/tx/builder--exports.buildTx"></a>

### exports.buildTx(params, type, [options]) ⇒ `Object`
Expand Down
2 changes: 1 addition & 1 deletion docs/api/tx/builder/schema.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import TxSchema from '@aeternity/aepp-sdk/es/tx/builder/schema'
```
<a id="exp_module_@aeternity/aepp-sdk/es/tx/builder/schema--exports.TX_TYPE"></a>

### exports.TX\_TYPE : `Object`
### exports.TX\_TYPE ⏏
Object with transaction types

**Kind**: Exported constant
Expand Down
161 changes: 161 additions & 0 deletions docs/api/tx/tx-object.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,161 @@
<a id="module_@aeternity/aepp-sdk/es/tx/tx-object"></a>

## @aeternity/aepp-sdk/es/tx/tx-object
TxObject module

**Example**
```js
import TxObject from '@aeternity/aepp-sdk/es/tx/tx-object'
```

* [@aeternity/aepp-sdk/es/tx/tx-object](#module_@aeternity/aepp-sdk/es/tx/tx-object)
* [buildTransaction(type, params, [options])](#exp_module_@aeternity/aepp-sdk/es/tx/tx-object--buildTransaction)`Object`
* [unpackTransaction(tx)](#exp_module_@aeternity/aepp-sdk/es/tx/tx-object--unpackTransaction)`Object`
* [initTransaction([tx], params, type, [options])](#exp_module_@aeternity/aepp-sdk/es/tx/tx-object--initTransaction)`Object`
* [exports.TxObject([options])](#exp_module_@aeternity/aepp-sdk/es/tx/tx-object--exports.TxObject)`Object`
* [setProp(props, options)](#exp_module_@aeternity/aepp-sdk/es/tx/tx-object--setProp)`TxObject`
* [getSignatures()](#exp_module_@aeternity/aepp-sdk/es/tx/tx-object--getSignatures)`Array`
* [addSignature(signature)](#exp_module_@aeternity/aepp-sdk/es/tx/tx-object--addSignature)`void`
* [calculateMinFee(props)](#exp_module_@aeternity/aepp-sdk/es/tx/tx-object--calculateMinFee)`String`
* _static_
* [.fromString(tx)](#exp_module_@aeternity/aepp-sdk/es/tx/tx-object--fromString)`TxObject`
* [.fromRlp(tx)](#exp_module_@aeternity/aepp-sdk/es/tx/tx-object--fromRlp)`TxObject`

<a id="exp_module_@aeternity/aepp-sdk/es/tx/tx-object--buildTransaction"></a>

### buildTransaction(type, params, [options]) ⇒ `Object`
Build transaction from object

**Kind**: Exported function
**Throws**:

- `Error` Arguments validation error's


| Param | Type | Default | Description |
| --- | --- | --- | --- |
| type | `String` | | Transaction type |
| params | `Object` | | Transaction params |
| [options] | `Object` | <code>{}</code> | Options |

<a id="exp_module_@aeternity/aepp-sdk/es/tx/tx-object--unpackTransaction"></a>

### unpackTransaction(tx) ⇒ `Object`
Unpack transaction from RLP encoded binary or base64c string

**Kind**: Exported function
**Throws**:

- `Error` Arguments validation error's


| Param | Type | Description |
| --- | --- | --- |
| tx | `Buffer` \| `String` | RLP encoded binary or base64c(rlpBinary) string |

<a id="exp_module_@aeternity/aepp-sdk/es/tx/tx-object--initTransaction"></a>

### initTransaction([tx], params, type, [options]) ⇒ `Object`
Helper which build or unpack transaction base on constructor arguments
Need to provide one of arguments: [tx] -> unpack flow or [params, type] -> build flow

**Kind**: Exported function
**Throws**:

- `Error` Arguments validation error's


| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [tx] | `Buffer` \| `String` | | Transaction rlp binary or vase64c string |
| params | `Object` | | Transaction params |
| type | `String` | | Transaction type |
| [options] | `Object` | <code>{}</code> | Options |

<a id="exp_module_@aeternity/aepp-sdk/es/tx/tx-object--exports.TxObject"></a>

### exports.TxObject([options]) ⇒ `Object`
Transaction Validator Stamp
This stamp give us possibility to unpack and validate some of transaction properties,
to make sure we can post it to the chain

**Kind**: Exported function
**Returns**: `Object` - TxObject instance
**rtype**: `Stamp`

| Param | Type | Default | Description |
| --- | --- | --- | --- |
| [options] | `Object` | <code>{}</code> | Initializer object |
| [options.tx] | `Buffer` \| `String` | | Rlp binary or base64c transaction |
| [options.params] | `Object` | | Transaction params |
| [options.type] | `String` | | Transaction type |
| [options.options] | `Object` | | Build options |

**Example**
```js
TxObject({ params: {...}, type: 'spendTx' })
```
<a id="exp_module_@aeternity/aepp-sdk/es/tx/tx-object--setProp"></a>

### setProp(props, options) ⇒ `TxObject`
Rebuild transaction with new params and recalculate fee

**Kind**: Exported function

| Param | Type | Description |
| --- | --- | --- |
| props | `Object` | Transaction properties for update |
| options | | |

<a id="exp_module_@aeternity/aepp-sdk/es/tx/tx-object--getSignatures"></a>

### getSignatures() ⇒ `Array`
Get signatures

**Kind**: Exported function
**Returns**: `Array` - Array of signatures
<a id="exp_module_@aeternity/aepp-sdk/es/tx/tx-object--addSignature"></a>

### addSignature(signature) ⇒ `void`
Add signature

**Kind**: Exported function

| Param | Type | Description |
| --- | --- | --- |
| signature | `Buffer` \| `String` | Signature to add ( Can be: Buffer | Uint8Array | HexString ) |

<a id="exp_module_@aeternity/aepp-sdk/es/tx/tx-object--calculateMinFee"></a>

### calculateMinFee(props) ⇒ `String`
Calculate fee

**Kind**: Exported function
**Returns**: `String` - fee

| Param | Type |
| --- | --- |
| props | `Object` |

<a id="exp_module_@aeternity/aepp-sdk/es/tx/tx-object--fromString"></a>

### .fromString(tx) ⇒ `TxObject`
Create txObject from base64c RLP encoded transaction string with 'tx_' prefix

**Kind**: static method of [`@aeternity/aepp-sdk/es/tx/tx-object`](#module_@aeternity/aepp-sdk/es/tx/tx-object)

| Param | Type | Description |
| --- | --- | --- |
| tx | `String` | Transaction string (tx_23fsdgsdfg...) |

<a id="exp_module_@aeternity/aepp-sdk/es/tx/tx-object--fromRlp"></a>

### .fromRlp(tx) ⇒ `TxObject`
Create txObject from transaction RLP binary

**Kind**: static method of [`@aeternity/aepp-sdk/es/tx/tx-object`](#module_@aeternity/aepp-sdk/es/tx/tx-object)

| Param | Type | Description |
| --- | --- | --- |
| tx | `Buffer` | Transaction RLP binary |

Loading

0 comments on commit d28202b

Please sign in to comment.