diff --git a/CHANGELOG.md b/CHANGELOG.md index ff0bc29701..bf26f71035 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,40 @@ +# [5.0.0](https://github.com/aeternity/aepp-sdk-js/compare/4.7.0...5.0.0) (2019-10-04) + + +### Bug Fixes + +* **rpc:** fix resolution rpc ops ([#669](https://github.com/aeternity/aepp-sdk-js/issues/669)) ([abd7c56](https://github.com/aeternity/aepp-sdk-js/commit/abd7c56)) + + +### Code Refactoring + +* **ACI:** rework Sophia Option type representation ([#691](https://github.com/aeternity/aepp-sdk-js/issues/691)) ([0dbb2fe](https://github.com/aeternity/aepp-sdk-js/commit/0dbb2fe)) + + +### Features + +* **AENS:** Add ability to spend by name ([#682](https://github.com/aeternity/aepp-sdk-js/issues/682)) ([0d43804](https://github.com/aeternity/aepp-sdk-js/commit/0d43804)) +* **AENS:** Add ability to claim contract, oracle, SC ([#671](https://github.com/aeternity/aepp-sdk-js/issues/671)) ([49fd0fd](https://github.com/aeternity/aepp-sdk-js/commit/49fd0fd)) +* **GA:** enbale GA ([#692](https://github.com/aeternity/aepp-sdk-js/issues/692)) ([eded912](https://github.com/aeternity/aepp-sdk-js/commit/eded912)) +* **Lima:** Lima compatibility ([#683](https://github.com/aeternity/aepp-sdk-js/issues/683)) ([a88042e](https://github.com/aeternity/aepp-sdk-js/commit/a88042e)), closes [#632](https://github.com/aeternity/aepp-sdk-js/issues/632) [#653](https://github.com/aeternity/aepp-sdk-js/issues/653) [#658](https://github.com/aeternity/aepp-sdk-js/issues/658) [#660](https://github.com/aeternity/aepp-sdk-js/issues/660) [#680](https://github.com/aeternity/aepp-sdk-js/issues/680) [#693](https://github.com/aeternity/aepp-sdk-js/issues/693) [#687](https://github.com/aeternity/aepp-sdk-js/issues/687) + - AENS auction support + - compiler 4.0.0 support + - node 5.0.0 support + - SDK use `FATE` for contract by default +* **AE**: Add pointers verification for spend by name + +### BREAKING CHANGES + +* **aci:** Change Sophia option type representation in ACI +```js +// from +await contract.methods.optionFn(Promise.resolve(1) || Promise.reject()) +// to +await contract.methods.optionFn(1 || undefined) +``` + + + # [5.0.0-next.1](https://github.com/aeternity/aepp-sdk-js/compare/4.6.0...4.7.0-next.1) (2019-09-10) diff --git a/docs/api/account.md b/docs/api/account.md index 78052f2148..29738947e9 100644 --- a/docs/api/account.md +++ b/docs/api/account.md @@ -3,7 +3,6 @@ ## @aeternity/aepp-sdk/es/account Account module -**Export**: Account **Example** ```js import Account from '@aeternity/aepp-sdk/es/account' diff --git a/docs/api/account/memory.md b/docs/api/account/memory.md index 264ce55716..2e3fa0cd1f 100644 --- a/docs/api/account/memory.md +++ b/docs/api/account/memory.md @@ -3,7 +3,6 @@ ## @aeternity/aepp-sdk/es/account/memory Memory Account module -**Export**: MemoryAccount **Example** ```js import MemoryAccount from '@aeternity/aepp-sdk/es/account/memory' diff --git a/docs/api/account/selector.md b/docs/api/account/selector.md index a270959d7f..316ccc2ac6 100644 --- a/docs/api/account/selector.md +++ b/docs/api/account/selector.md @@ -5,7 +5,6 @@ Accounts Selector module This is the complement to [@aeternity/aepp-sdk/es/accounts](#module_@aeternity/aepp-sdk/es/accounts). -**Export**: Selector **Example** ```js import Selector from '@aeternity/aepp-sdk/es/account/selector' diff --git a/docs/api/accounts.md b/docs/api/accounts.md index f507246bed..88bb506b60 100644 --- a/docs/api/accounts.md +++ b/docs/api/accounts.md @@ -3,7 +3,6 @@ ## @aeternity/aepp-sdk/es/accounts Accounts module -**Export**: Accounts **Example** ```js import Accounts from '@aeternity/aepp-sdk/es/accounts' diff --git a/docs/api/ae.md b/docs/api/ae.md index 5e79fc6f81..41686321d7 100644 --- a/docs/api/ae.md +++ b/docs/api/ae.md @@ -3,7 +3,6 @@ ## @aeternity/aepp-sdk/es/ae Ae module -**Export**: Ae **Example** ```js import Ae from '@aeternity/aepp-sdk/es/ae' @@ -11,11 +10,14 @@ import Ae from '@aeternity/aepp-sdk/es/ae' * [@aeternity/aepp-sdk/es/ae](#module_@aeternity/aepp-sdk/es/ae) * [Ae([options])](#exp_module_@aeternity/aepp-sdk/es/ae--Ae) ⇒ `Object` ⏏ - * [.destroyInstance()](#module_@aeternity/aepp-sdk/es/ae--Ae+destroyInstance) ⇒ `void` - * _async_ - * [.send(tx, [options])](#module_@aeternity/aepp-sdk/es/ae--Ae+send) ⇒ `String` \| `String` - * [.spend(amount, recipientId, options)](#module_@aeternity/aepp-sdk/es/ae--Ae+spend) ⇒ `String` \| `String` - * [.transferFunds(percentage, recipientId, options)](#module_@aeternity/aepp-sdk/es/ae--Ae+transferFunds) ⇒ `String` \| `String` + * _instance_ + * [.destroyInstance()](#module_@aeternity/aepp-sdk/es/ae--Ae+destroyInstance) ⇒ `void` + * _async_ + * [.send(tx, [options])](#module_@aeternity/aepp-sdk/es/ae--Ae+send) ⇒ `String` \| `String` + * [.spend(amount, recipientId, options)](#module_@aeternity/aepp-sdk/es/ae--Ae+spend) ⇒ `String` \| `String` + * [.transferFunds(percentage, recipientId, options)](#module_@aeternity/aepp-sdk/es/ae--Ae+transferFunds) ⇒ `String` \| `String` + * _inner_ + * [~resolveRecipientName(nameOrAddress, verify)](#module_@aeternity/aepp-sdk/es/ae--Ae..resolveRecipientName) ⇒ `String` @@ -76,7 +78,7 @@ Send tokens to another account | Param | Type | Description | | --- | --- | --- | | amount | `Number` \| `String` | Amount to spend | -| recipientId | `String` | Address of recipient account | +| recipientId | `String` | Address or Name of recipient account | | options | `Object` | Options | @@ -95,3 +97,16 @@ Send a percentage of funds to another account | recipientId | `String` | Address of recipient account | | options | `Object` | Options | + + +#### Ae~resolveRecipientName(nameOrAddress, verify) ⇒ `String` +Resolve AENS name and return name hash + +**Kind**: inner method of [`Ae`](#exp_module_@aeternity/aepp-sdk/es/ae--Ae) +**Returns**: `String` - Address or AENS name hash + +| Param | Type | +| --- | --- | +| nameOrAddress | `String` | +| verify | | + diff --git a/docs/api/ae/aens.md b/docs/api/ae/aens.md index cf7dd0aac9..3190ef29c5 100644 --- a/docs/api/ae/aens.md +++ b/docs/api/ae/aens.md @@ -7,7 +7,6 @@ The high-level description of the naming system is https://github.com/aeternity/protocol/blob/master/AENS.md in the protocol repository. -**Export**: Aens **Example** ```js import Aens from '@aeternity/aepp-sdk/es/ae/aens' @@ -15,6 +14,8 @@ import Aens from '@aeternity/aepp-sdk/es/ae/aens' * [@aeternity/aepp-sdk/es/ae/aens](#module_@aeternity/aepp-sdk/es/ae/aens) * [Aens([options])](#exp_module_@aeternity/aepp-sdk/es/ae/aens--Aens) ⇒ `Object` ⏏ + * _global_ + * [exports.isNameValid(name, [throwError])](#exp_module_@aeternity/aepp-sdk/es/ae/aens--exports.isNameValid) ⇒ ⏏ * _instance_ * [.update(nameId, target, options)](#exp_module_@aeternity/aepp-sdk/es/ae/aens--update) ⇒ `Object` ⏏ * [.query(name)](#exp_module_@aeternity/aepp-sdk/es/ae/aens--query) ⇒ `Promise.<Object>` ⏏ @@ -40,6 +41,23 @@ Aens provides name-system related methods atop | --- | --- | --- | --- | | [options] | `Object` | {} | Initializer object | + + +### exports.isNameValid(name, [throwError]) ⇒ ⏏ +Is name valid + +**Kind**: global method of [`@aeternity/aepp-sdk/es/ae/aens`](#module_@aeternity/aepp-sdk/es/ae/aens) +**Returns**: Boolean +**Throws**: + +- Error + + +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| name | `string` | | | +| [throwError] | `boolean` | true | Throw error on invalid | + ### .update(nameId, target, options) ⇒ `Object` ⏏ diff --git a/docs/api/ae/aepp.md b/docs/api/ae/aepp.md index b39d6cd4a0..16f59e8f6e 100644 --- a/docs/api/ae/aepp.md +++ b/docs/api/ae/aepp.md @@ -3,7 +3,6 @@ ## @aeternity/aepp-sdk/es/ae/aepp Aepp module -**Export**: Aepp **Example** ```js import Ae from '@aeternity/aepp-sdk/es/ae/aepp' diff --git a/docs/api/ae/contract.md b/docs/api/ae/contract.md index 21de19f06e..8292ecb9e7 100644 --- a/docs/api/ae/contract.md +++ b/docs/api/ae/contract.md @@ -6,7 +6,6 @@ Contract module - routines to interact with the æternity contract High level documentation of the contracts are available at https://github.com/aeternity/protocol/tree/master/contracts and -**Export**: Contract **Example** ```js import Contract from '@aeternity/aepp-sdk/es/ae/contract' (Using tree-shaking) @@ -93,6 +92,7 @@ Encode call data for contract call | args | `Array` | | Argument's for call | | [options] | `Object` | {} | Options | | [options.filesystem] | `Object` | {} | Contract external namespaces map | +| [options.backend] | `Object` | 'fate' | Compiler backend | @@ -215,6 +215,7 @@ Compile contract source code | source | `String` | | Contract sourece code | | [options] | `Object` | {} | Transaction options (fee, ttl, gas, amount, deposit) | | [options.filesystem] | `Object` | {} | Contract external namespaces map* @return {Promise} Result object | +| [options.backend] | `Object` | 'aevm' | Contract backend version (aevm|fate) | **Example** ```js diff --git a/docs/api/ae/oracle.md b/docs/api/ae/oracle.md index a93dffd1d6..ab523b7c27 100644 --- a/docs/api/ae/oracle.md +++ b/docs/api/ae/oracle.md @@ -7,7 +7,6 @@ The high-level description of the oracle system is https://github.com/aeternity/protocol/blob/master/ORACLE.md in the protocol repository. -**Export**: Oracle **Example** ```js import Oracle from '@aeternity/aepp-sdk/es/ae/oracle' @@ -18,6 +17,7 @@ import Oracle from '@aeternity/aepp-sdk/es/ae/oracle' * _instance_ * _async_ * [.getOracleObject(oracleId)](#exp_module_@aeternity/aepp-sdk/es/ae/oracle--getOracleObject) ⇒ `Promise.<Object>` ⏏ + * [.exports.pollForQueries(oracleId, onQuery, [options])](#exp_module_@aeternity/aepp-sdk/es/ae/oracle--exports.pollForQueries) ⇒ `function` ⏏ * [.getQueryObject(oracleId, queryId)](#exp_module_@aeternity/aepp-sdk/es/ae/oracle--getQueryObject) ⇒ `Promise.<Object>` ⏏ * [.exports.pollForQueryResponse(oracleId, queryId, [options])](#exp_module_@aeternity/aepp-sdk/es/ae/oracle--exports.pollForQueryResponse) ⇒ `Promise.<Object>` ⏏ * [.registerOracle(queryFormat, responseFormat, [options])](#exp_module_@aeternity/aepp-sdk/es/ae/oracle--registerOracle) ⇒ `Promise.<Object>` ⏏ @@ -54,6 +54,22 @@ Constructor for Oracle Object (helper object for using Oracle) | --- | --- | --- | | oracleId | `String` | Oracle public key | + + +### .exports.pollForQueries(oracleId, onQuery, [options]) ⇒ `function` ⏏ +Poll for oracle queries + +**Kind**: instance method of [`@aeternity/aepp-sdk/es/ae/oracle`](#module_@aeternity/aepp-sdk/es/ae/oracle) +**Returns**: `function` - stopPolling - Stop polling function +**Category**: async + +| Param | Type | Description | +| --- | --- | --- | +| oracleId | `String` | Oracle public key | +| onQuery | `function` | OnQuery callback | +| [options] | `Object` | Options object | +| [options.interval] | `Object` | Poll interval(default: 5000) | + ### .getQueryObject(oracleId, queryId) ⇒ `Promise.<Object>` ⏏ diff --git a/docs/api/ae/universal.md b/docs/api/ae/universal.md index c3578edde1..19c73c33e7 100644 --- a/docs/api/ae/universal.md +++ b/docs/api/ae/universal.md @@ -3,7 +3,6 @@ ## @aeternity/aepp-sdk/es/ae/universal Universal module -**Export**: Universal **Example** ```js import Ae from '@aeternity/aepp-sdk/es/ae/universal' diff --git a/docs/api/chain.md b/docs/api/chain.md index 8d9f6b1292..c23ebad674 100644 --- a/docs/api/chain.md +++ b/docs/api/chain.md @@ -3,7 +3,6 @@ ## @aeternity/aepp-sdk/es/chain Chain module -**Export**: Chain **Example** ```js import Chain from '@aeternity/aepp-sdk/es/chain' diff --git a/docs/api/chain/node.md b/docs/api/chain/node.md index 26a152dc3b..85f2ff8bd6 100644 --- a/docs/api/chain/node.md +++ b/docs/api/chain/node.md @@ -5,7 +5,6 @@ ChainNode module This is the complement to [@aeternity/aepp-sdk/es/chain](#module_@aeternity/aepp-sdk/es/chain). -**Export**: ChainNode **Example** ```js import ChainNode from '@aeternity/aepp-sdk/es/chain/node' diff --git a/docs/api/channel/index.md b/docs/api/channel/index.md index 432490fc16..5f900cea64 100644 --- a/docs/api/channel/index.md +++ b/docs/api/channel/index.md @@ -3,7 +3,6 @@ ## @aeternity/aepp-sdk/es/channel/index Channel module -**Export**: Channel **Example** ```js import Channel from '@aeternity/aepp-sdk/es/channel/index' diff --git a/docs/api/contract/aci.md b/docs/api/contract/aci.md index 30c93f6c17..e4cd0564f5 100644 --- a/docs/api/contract/aci.md +++ b/docs/api/contract/aci.md @@ -3,7 +3,6 @@ ## @aeternity/aepp-sdk/es/contract/aci ContractACI module -**Export**: ContractACI **Example** ```js import ContractACI from '@aeternity/aepp-sdk/es/contract/aci' diff --git a/docs/api/contract/compiler.md b/docs/api/contract/compiler.md index 6a7d209717..70105feb9c 100644 --- a/docs/api/contract/compiler.md +++ b/docs/api/contract/compiler.md @@ -5,7 +5,6 @@ ContractCompilerAPI module This is the complement to [@aeternity/aepp-sdk/es/contract](#module_@aeternity/aepp-sdk/es/contract). -**Export**: ContractCompilerAPI **Example** ```js import ContractCompilerAPI from '@aeternity/aepp-sdk/es/contract/compiler' diff --git a/docs/api/contract/ga.md b/docs/api/contract/ga.md index 4eb92f52fe..74fae2afb3 100644 --- a/docs/api/contract/ga.md +++ b/docs/api/contract/ga.md @@ -23,7 +23,7 @@ import { GeneralizeAccount } from '@aeternity/aepp-sdk' (Using bundle) GeneralizeAccount Stamp Provide Generalize Account implementation -[module:@aeternity/aepp-sdk/es/contract.ga](module:@aeternity/aepp-sdk/es/contract.ga) clients. +[@aeternity/aepp-sdk/es/contract/ga](#module_@aeternity/aepp-sdk/es/contract/ga) clients. **Kind**: Exported function **Returns**: `Object` - GeneralizeAccount instance diff --git a/docs/api/node.md b/docs/api/node.md index 4bbbdbcd40..abd0e8e37c 100644 --- a/docs/api/node.md +++ b/docs/api/node.md @@ -3,7 +3,6 @@ ## @aeternity/aepp-sdk/es/node Node module -**Export**: Node **Example** ```js import Node from '@aeternity/aepp-sdk/es/node' diff --git a/docs/api/oracle.md b/docs/api/oracle.md index fbb8ce6698..4468e5f5fd 100644 --- a/docs/api/oracle.md +++ b/docs/api/oracle.md @@ -3,7 +3,6 @@ ## @aeternity/aepp-sdk/es/oracle Oracle Base module -**Export**: Contract **Example** ```js import ContractBase from '@aeternity/aepp-sdk/es/oracle' diff --git a/docs/api/oracle/node.md b/docs/api/oracle/node.md index 7718b6f6bc..fc6d4e6c67 100644 --- a/docs/api/oracle/node.md +++ b/docs/api/oracle/node.md @@ -5,7 +5,6 @@ OracleNodeAPI module This is the complement to [@aeternity/aepp-sdk/es/oracle](#module_@aeternity/aepp-sdk/es/oracle). -**Export**: OracleNodeAPI **Example** ```js import OracleNodeAPI from '@aeternity/aepp-sdk/es/oracle/node' diff --git a/docs/api/rpc/client.md b/docs/api/rpc/client.md index 5fe8e5101c..333b2bb052 100644 --- a/docs/api/rpc/client.md +++ b/docs/api/rpc/client.md @@ -3,7 +3,6 @@ ## @aeternity/aepp-sdk/es/rpc/client RPC client module -**Export**: RpcClient **Example** ```js import RpcClient from '@aeternity/aepp-sdk/es/rpc/client' diff --git a/docs/api/tx.md b/docs/api/tx.md index d235d133ec..100bcab7bb 100644 --- a/docs/api/tx.md +++ b/docs/api/tx.md @@ -3,7 +3,6 @@ ## @aeternity/aepp-sdk/es/tx Tx module -**Export**: Tx **Example** ```js import Tx from '@aeternity/aepp-sdk/es/tx' diff --git a/docs/api/tx/builder.md b/docs/api/tx/builder.md index 33b4bbf907..631840f8d7 100644 --- a/docs/api/tx/builder.md +++ b/docs/api/tx/builder.md @@ -3,7 +3,6 @@ ## @aeternity/aepp-sdk/es/tx/builder JavaScript-based Transaction builder -**Export**: TxBuilder **Example** ```js import Transaction from '@aeternity/aepp-sdk/es/tx/builder' diff --git a/docs/api/tx/builder/helpers.md b/docs/api/tx/builder/helpers.md index 92312d6d4a..1acef0522b 100644 --- a/docs/api/tx/builder/helpers.md +++ b/docs/api/tx/builder/helpers.md @@ -3,7 +3,6 @@ ## @aeternity/aepp-sdk/es/tx/builder/helpers JavaScript-based Transaction builder helper function's -**Export**: TxBuilderHelper **Example** ```js import TxBuilderHelper from '@aeternity/aepp-sdk/es/tx/builder/helpers' diff --git a/docs/api/tx/builder/schema.md b/docs/api/tx/builder/schema.md index 982b969517..ccf1a5ddf3 100644 --- a/docs/api/tx/builder/schema.md +++ b/docs/api/tx/builder/schema.md @@ -3,7 +3,6 @@ ## @aeternity/aepp-sdk/es/tx/builder/schema Transaction Schema for TxBuilder -**Export**: TxSchema **Example** ```js import TxSchema from '@aeternity/aepp-sdk/es/tx/builder/schema' diff --git a/docs/api/tx/tx.md b/docs/api/tx/tx.md index 2268687bfe..4b1f8389c0 100644 --- a/docs/api/tx/tx.md +++ b/docs/api/tx/tx.md @@ -3,7 +3,6 @@ ## @aeternity/aepp-sdk/es/tx/tx Transaction module -**Export**: Transaction **Example** ```js import Transaction from '@aeternity/aepp-sdk/es/tx/tx' diff --git a/docs/api/tx/validator.md b/docs/api/tx/validator.md index 465dfbc75f..b131cdf75e 100644 --- a/docs/api/tx/validator.md +++ b/docs/api/tx/validator.md @@ -3,7 +3,6 @@ ## @aeternity/aepp-sdk/es/tx/validator Transaction validator -**Export**: TransactionValidator **Example** ```js import TransactionValidator from '@aeternity/aepp-sdk/es/tx/validator' diff --git a/docs/api/utils/swagger.md b/docs/api/utils/swagger.md index 706c19b18b..dbb3bc22dc 100644 --- a/docs/api/utils/swagger.md +++ b/docs/api/utils/swagger.md @@ -3,7 +3,6 @@ ## @aeternity/aepp-sdk/es/utils/swagger Swagger module -**Export**: Swagger **Example** ```js import Swagger from '@aeternity/aepp-sdk/es/utils/swagger' @@ -30,6 +29,7 @@ import Swagger from '@aeternity/aepp-sdk/es/utils/swagger' * [~pascalizeParameters(parameters)](#module_@aeternity/aepp-sdk/es/utils/swagger--Swagger..pascalizeParameters) ⇒ `Array.<Object>` * [~operationSignature(name, req, opts)](#module_@aeternity/aepp-sdk/es/utils/swagger--Swagger..operationSignature) ⇒ `String` * [~destructureClientError(error)](#module_@aeternity/aepp-sdk/es/utils/swagger--Swagger..destructureClientError) ⇒ `String` + * [~resolveRef(ref, swag)](#module_@aeternity/aepp-sdk/es/utils/swagger--Swagger..resolveRef) ⇒ `Object` @@ -277,3 +277,17 @@ Destructure HTTP client `error` | --- | --- | | error | `Error` | + + +#### Swagger~resolveRef(ref, swag) ⇒ `Object` +Resolve reference + +**Kind**: inner method of [`Swagger`](#exp_module_@aeternity/aepp-sdk/es/utils/swagger--Swagger) +**Returns**: `Object` - Resolved reference definition +**rtype**: `(ref: String, swag: Object) => Object` + +| Param | Type | Description | +| --- | --- | --- | +| ref | `String` | Reference to resolve | +| swag | `Object` | | + diff --git a/docs/examples/node/aecrypto.md b/docs/examples/node/aecrypto.md index b65d0e57bb..545f51d118 100644 --- a/docs/examples/node/aecrypto.md +++ b/docs/examples/node/aecrypto.md @@ -115,7 +115,7 @@ const promptSchema = { function extractReadableKeys (dir, options) { const pwd = options.input prompt.start() - prompt.get(promptSchema, (err, { password }) => { + prompt.get(promptSchema, (_, { password }) => { const key = fs.readFileSync(path.join(pwd, dir, 'sign_key')) const pubKey = fs.readFileSync(path.join(pwd, dir, 'sign_key.pub')) @@ -178,6 +178,21 @@ transaction and turn it into an RLP-encoded tuple ready for mining ```js function signTx (tx, privKey) { + +``` + + + + + + + +eslint-disable-next-line no-useless-escape + + + + +```js if (!tx.match(/^tx\_.+/)) { throw Error('Not a valid transaction') } diff --git a/package-lock.json b/package-lock.json index f23ed82310..910d4e1c7e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aeternity/aepp-sdk", - "version": "5.0.0-next.1", + "version": "5.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index 95a76458e2..46ce5216d0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@aeternity/aepp-sdk", - "version": "5.0.0-next.1", + "version": "5.0.0", "description": "SDK for the æternity blockchain", "main": "dist/aepp-sdk.js", "browser": "dist/aepp-sdk.browser.js",