diff --git a/.env b/.env index 55c3f5b15e..12fbf6e279 100644 --- a/.env +++ b/.env @@ -1,2 +1,2 @@ -TAG=v5.0.0-rc.1 -COMPILER_TAG=v3.2.0 +TAG=v5.0.0-rc.3 +COMPILER_TAG=v4.0.0-rc5 diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md index fbf269d3c7..6481fed2b8 100644 --- a/.github/ISSUE_TEMPLATE.md +++ b/.github/ISSUE_TEMPLATE.md @@ -1,35 +1,29 @@ -Issue tracker is **ONLY** used for reporting bugs. NO NEW FEATURE ACCEPTED! Use [stackoverflow](https://stackoverflow.com/tags/aeternity) for supporting issues. +**Note: for support questions, please use the [forum](https://forum.aeternity.com)**. This repository's issues are reserved for feature requests and bug reports. - +* **I'm submitting a ...** + - [ ] bug report + - [ ] feature request + - [ ] support request => Please do not submit support request here, see note at the top of this template. -## Expected Behavior - -## Current Behavior - +* **Do you want to request a *feature* or report a *bug*?** -## Possible Solution - +* **What is the current behavior?** -## Steps to Reproduce - - -1. -2. -3. -4. +* **If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem** -## Environment / Context - - - +* **What is the expected behavior?** - +* **What is the motivation / use case for changing the behavior?** -## [Node](https://github.com/aeternity/aeternity/releases) Version +* **Please tell us about your environment:** + + - Node Version: v0.0.0 + - Protocol Version: 1 + - Compiler version: v0.0.0 + - VM Version: aevm | fate + - SDK Version: v0.0.0 + - Environment: browser | nodejs -## Detailed Description - -## Possible Implementation - +* **Other information** (e.g. detailed explanation, stacktraces, related issues, suggestions how to fix, links for us to have context, eg. forum, telegram, etc) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1592d1a1cc..bf26f71035 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,60 @@ -# [4.7.0](https://github.com/aeternity/aepp-sdk-js/compare/2.4.0...4.7.0) (2019-09-11) +# [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) + + +### Bug Fixes + +* **package:** update serialize-javascript to version 2.0.0 ([#647](https://github.com/aeternity/aepp-sdk-js/issues/647)) ([1ddb392](https://github.com/aeternity/aepp-sdk-js/commit/1ddb392)) + + +### Features + +* **Contract/ACI** Add `payable` feature +* **Compiler:** Compiler 4.0.0 compatibility ([#632](https://github.com/aeternity/aepp-sdk-js/issues/632)) ([d5f1632](https://github.com/aeternity/aepp-sdk-js/commit/d5f1632)) +* **Contract/ACI:** Add ability to use contract with external namespaces(`include "someLib"`) ([#653](https://github.com/aeternity/aepp-sdk-js/issues/653)) ([9708b43](https://github.com/aeternity/aepp-sdk-js/commit/9708b43)) + + + + +# [4.7.0](https://github.com/aeternity/aepp-sdk-js/compare/2.4.0...4.7.0) (2019-09-11) + + ### Features * **Oracle:** Add methods for polling queries [#637](https://github.com/aeternity/aepp-sdk-js/pull/637) diff --git a/docker-compose.yml b/docker-compose.yml index 153c6c96b1..3e2d28726d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -20,7 +20,7 @@ services: expose: [3013, 3113, 3014, 3114] environment: EPOCH_CONFIG: /home/aeternity/aeternity_node.yaml - command: -aecore expected_mine_rate ${EPOCH_MINE_RATE:-5000} + command: bin/aeternity console -noinput -aecore expected_mine_rate ${EPOCH_MINE_RATE:-5000} volumes: - ${PWD}/docker/aeternity_node_mean16.yaml:/home/aeternity/aeternity_node.yaml - ${PWD}/docker/keys/node:/home/aeternity/node/keys diff --git a/docker/aeternity_node_mean16.yaml b/docker/aeternity_node_mean16.yaml index a580c0198f..321023a4ba 100644 --- a/docker/aeternity_node_mean16.yaml +++ b/docker/aeternity_node_mean16.yaml @@ -24,6 +24,7 @@ chain: "1": 0 "2": 2 "3": 4 + "4": 6 mining: autostart: true 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 2d0ce74b73..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) @@ -17,19 +16,19 @@ import { Contract } from '@aeternity/aepp-sdk' (Using bundle) ``` * [@aeternity/aepp-sdk/es/ae/contract](#module_@aeternity/aepp-sdk/es/ae/contract) - * [exports.Contract([options])](#exp_module_@aeternity/aepp-sdk/es/ae/contract--exports.Contract) ⇒ `Object` ⏏ + * [exports.ContractAPI([options])](#exp_module_@aeternity/aepp-sdk/es/ae/contract--exports.ContractAPI) ⇒ `Object` ⏏ * _async_ * [handleCallError(result)](#exp_module_@aeternity/aepp-sdk/es/ae/contract--handleCallError) ⇒ `Promise.<void>` ⏏ - * [contractEncodeCall(source, name, args)](#exp_module_@aeternity/aepp-sdk/es/ae/contract--contractEncodeCall) ⇒ `Promise.<String>` ⏏ - * [contractDecodeData(source, fn, callValue, callResult, options)](#exp_module_@aeternity/aepp-sdk/es/ae/contract--contractDecodeData) ⇒ `Promise.<String>` ⏏ - * [contractCallStatic(source, address, name, args, options, top, options)](#exp_module_@aeternity/aepp-sdk/es/ae/contract--contractCallStatic) ⇒ `Promise.<Object>` ⏏ - * [contractCall(source, address, name, args, options)](#exp_module_@aeternity/aepp-sdk/es/ae/contract--contractCall) ⇒ `Promise.<Object>` ⏏ - * [contractDeploy(code, source, initState, options)](#exp_module_@aeternity/aepp-sdk/es/ae/contract--contractDeploy) ⇒ `Promise.<Object>` ⏏ - * [contractCompile(source, options)](#exp_module_@aeternity/aepp-sdk/es/ae/contract--contractCompile) ⇒ `Promise.<Object>` ⏏ + * [contractEncodeCall(source, name, args, [options])](#exp_module_@aeternity/aepp-sdk/es/ae/contract--contractEncodeCall) ⇒ `Promise.<String>` ⏏ + * [contractDecodeData(source, fn, callValue, callResult, [options])](#exp_module_@aeternity/aepp-sdk/es/ae/contract--contractDecodeData) ⇒ `Promise.<String>` ⏏ + * [contractCallStatic(source, address, name, args, [options], bytecode, options, filesystem)](#exp_module_@aeternity/aepp-sdk/es/ae/contract--contractCallStatic) ⇒ `Promise.<Object>` ⏏ + * [contractCall(source, address, name, args, [options])](#exp_module_@aeternity/aepp-sdk/es/ae/contract--contractCall) ⏏ + * [contractDeploy(code, source, initState, [options])](#exp_module_@aeternity/aepp-sdk/es/ae/contract--contractDeploy) ⇒ `Promise.<Object>` ⏏ + * [contractCompile(source, [options])](#exp_module_@aeternity/aepp-sdk/es/ae/contract--contractCompile) ⇒ `Promise.<Object>` ⏏ - + -### exports.Contract([options]) ⇒ `Object` ⏏ +### exports.ContractAPI([options]) ⇒ `Object` ⏏ Contract Stamp Provide contract implementation @@ -80,34 +79,38 @@ Handle contract call error -### contractEncodeCall(source, name, args) ⇒ `Promise.<String>` ⏏ +### contractEncodeCall(source, name, args, [options]) ⇒ `Promise.<String>` ⏏ Encode call data for contract call **Kind**: Exported function **Category**: async -| Param | Type | Description | -| --- | --- | --- | -| source | `String` | Contract source code | -| name | `String` | Name of function to call | -| args | `Array` | Argument's for call | +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| source | `String` | | Contract source code | +| name | `String` | | Name of function to call | +| args | `Array` | | Argument's for call | +| [options] | `Object` | {} | Options | +| [options.filesystem] | `Object` | {} | Contract external namespaces map | +| [options.backend] | `Object` | 'fate' | Compiler backend | -### contractDecodeData(source, fn, callValue, callResult, options) ⇒ `Promise.<String>` ⏏ +### contractDecodeData(source, fn, callValue, callResult, [options]) ⇒ `Promise.<String>` ⏏ Decode contract call result data **Kind**: Exported function **Returns**: `Promise.<String>` - Result object **Category**: async -| Param | Type | Description | -| --- | --- | --- | -| source | `String` | source code | -| fn | `String` | function name | -| callValue | `String` | result call data | -| callResult | `String` | result status | -| options | | | +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| source | `String` | | source code | +| fn | `String` | | function name | +| callValue | `String` | | result call data | +| callResult | `String` | | result status | +| [options] | `Object` | {} | Options | +| [options.filesystem] | `Object` | {} | Contract external namespaces map | **Example** ```js @@ -115,22 +118,24 @@ const decodedData = await client.contractDecodeData(SourceCode ,'functionName', ``` -### contractCallStatic(source, address, name, args, options, top, options) ⇒ `Promise.<Object>` ⏏ +### contractCallStatic(source, address, name, args, [options], bytecode, options, filesystem) ⇒ `Promise.<Object>` ⏏ Static contract call(using dry-run) **Kind**: Exported function **Returns**: `Promise.<Object>` - Result object **Category**: async -| Param | Type | Description | -| --- | --- | --- | -| source | `String` | Contract source code | -| address | `String` | Contract address | -| name | `String` | Name of function to call | -| args | `Array` | Argument's for call function | -| options | `Object` | [options={}] Options | -| top | `String` | [options.top] Block hash on which you want to call contract | -| options | `String` | [options.options] Transaction options (fee, ttl, gas, amount, deposit) | +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| source | `String` | | Contract source code | +| address | `String` | | Contract address | +| name | `String` | | Name of function to call | +| args | `Array` | | Argument's for call function | +| [options] | `Object` | {} | Options | +| [options.top] | `String` | | Block hash on which you want to call contract | +| bytecode | | | | +| options | `String` | | [options.options] Transaction options (fee, ttl, gas, amount, deposit) | +| filesystem | `Object` | | [options.options.filesystem] Contract external namespaces map | **Example** ```js @@ -142,20 +147,20 @@ const callResult = await client.contractCallStatic(source, address, fnName, args ``` -### contractCall(source, address, name, args, options) ⇒ `Promise.<Object>` ⏏ +### contractCall(source, address, name, args, [options]) ⏏ Call contract function **Kind**: Exported function -**Returns**: `Promise.<Object>` - Result object **Category**: async -| Param | Type | Description | -| --- | --- | --- | -| source | `String` | Contract source code | -| address | `String` | Contract address | -| name | `String` | Name of function to call | -| args | `Array` | Argument's for call function | -| options | `Object` | Transaction options (fee, ttl, gas, amount, deposit) | +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| source | `String` | | Contract source code | +| address | `String` | | Contract address | +| name | `String` | | Name of function to call | +| args | `Array` | | Argument's for call function | +| [options] | `Object` | {} | Transaction options (fee, ttl, gas, amount, deposit) | +| [options.filesystem] | `Object` | {} | Contract external namespaces map* @return {Promise} Result object | **Example** ```js @@ -168,19 +173,20 @@ const callResult = await client.contractCall(source, address, fnName, args = [], ``` -### contractDeploy(code, source, initState, options) ⇒ `Promise.<Object>` ⏏ +### contractDeploy(code, source, initState, [options]) ⇒ `Promise.<Object>` ⏏ Deploy contract to the node **Kind**: Exported function **Returns**: `Promise.<Object>` - Result object **Category**: async -| Param | Type | Description | -| --- | --- | --- | -| code | `String` | Compiled contract | -| source | `String` | Contract source code | -| initState | `Array` | Arguments of contract constructor(init) function | -| options | `Object` | Transaction options (fee, ttl, gas, amount, deposit) | +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| code | `String` | | Compiled contract | +| source | `String` | | Contract source code | +| initState | `Array` | | Arguments of contract constructor(init) function | +| [options] | `Object` | {} | Transaction options (fee, ttl, gas, amount, deposit) | +| [options.filesystem] | `Object` | {} | Contract external namespaces map* @return {Promise} Result object | **Example** ```js @@ -197,17 +203,19 @@ const deployed = await client.contractDeploy(bytecode, source, init = [], option ``` -### contractCompile(source, options) ⇒ `Promise.<Object>` ⏏ +### contractCompile(source, [options]) ⇒ `Promise.<Object>` ⏏ Compile contract source code **Kind**: Exported function **Returns**: `Promise.<Object>` - Result object **Category**: async -| Param | Type | Description | -| --- | --- | --- | -| source | `String` | Contract sourece code | -| options | `Object` | Transaction options (fee, ttl, gas, amount, deposit) | +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| 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.md b/docs/api/contract.md index 2287affc4c..832abf67d3 100644 --- a/docs/api/contract.md +++ b/docs/api/contract.md @@ -10,11 +10,12 @@ import ContractBase from '@aeternity/aepp-sdk/es/contract' * [@aeternity/aepp-sdk/es/contract](#module_@aeternity/aepp-sdk/es/contract) * [ContractBase([options])](#exp_module_@aeternity/aepp-sdk/es/contract--ContractBase) ⇒ `Object` ⏏ - * *[.contractEncodeCallDataAPI(source, name, args)](#module_@aeternity/aepp-sdk/es/contract--ContractBase+contractEncodeCallDataAPI) ⇒ `String`* + * *[.contractGetACI(source, [options])](#module_@aeternity/aepp-sdk/es/contract--ContractBase+contractGetACI) ⇒ `Object`* + * *[.contractEncodeCallDataAPI(source, name, args, [options])](#module_@aeternity/aepp-sdk/es/contract--ContractBase+contractEncodeCallDataAPI) ⇒ `String`* * *[.contractDecodeDataAPI(type, data)](#module_@aeternity/aepp-sdk/es/contract--ContractBase+contractDecodeDataAPI) ⇒ `String`* - * *[.contractDecodeCallResultAPI(source, fn, callValue, callResult)](#module_@aeternity/aepp-sdk/es/contract--ContractBase+contractDecodeCallResultAPI) ⇒ `String`* - * *[.contractDecodeCallDataBySourceAPI(source, function, callData)](#module_@aeternity/aepp-sdk/es/contract--ContractBase+contractDecodeCallDataBySourceAPI) ⇒ `String`* - * *[.contractDecodeCallDataByCodeAPI(code, callData)](#module_@aeternity/aepp-sdk/es/contract--ContractBase+contractDecodeCallDataByCodeAPI) ⇒ `String`* + * *[.contractDecodeCallResultAPI(source, fn, callValue, callResult, [options])](#module_@aeternity/aepp-sdk/es/contract--ContractBase+contractDecodeCallResultAPI) ⇒ `String`* + * *[.contractDecodeCallDataBySourceAPI(source, function, callData, [options])](#module_@aeternity/aepp-sdk/es/contract--ContractBase+contractDecodeCallDataBySourceAPI) ⇒ `String`* + * *[.contractDecodeCallDataByCodeAPI(code, callData, backend)](#module_@aeternity/aepp-sdk/es/contract--ContractBase+contractDecodeCallDataByCodeAPI) ⇒ `String`* * *[.compileContractAPI(code, [options])](#module_@aeternity/aepp-sdk/es/contract--ContractBase+compileContractAPI) ⇒ `Object`* * *[.setCompilerUrl(url)](#module_@aeternity/aepp-sdk/es/contract--ContractBase+setCompilerUrl) ⇒ `void`* * *[.getCompilerVersion()](#module_@aeternity/aepp-sdk/es/contract--ContractBase+getCompilerVersion) ⇒ `String`* @@ -36,21 +37,41 @@ abstract methods using composition will result in an exception. | --- | --- | --- | --- | | [options] | `Object` | {} | Initializer object | + + +#### *contractBase.contractGetACI(source, [options]) ⇒ `Object`* +Get contract ACI + +**Kind**: instance abstract method of [`ContractBase`](#exp_module_@aeternity/aepp-sdk/es/contract--ContractBase) +**Returns**: `Object` - - Contract aci object +**Category**: async +**rtype**: `(source: String, options: Array) => aciObject: Promise[Object]` + +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| source | `String` | | Contract source code | +| [options] | `Object` | {} | Options | +| [options.filesystem] | `Object` | | Contract external namespaces map | +| [options.backend] | `Object` | | Contract vm(default: aevm) | + -#### *contractBase.contractEncodeCallDataAPI(source, name, args) ⇒ `String`* +#### *contractBase.contractEncodeCallDataAPI(source, name, args, [options]) ⇒ `String`* Encode contract data **Kind**: instance abstract method of [`ContractBase`](#exp_module_@aeternity/aepp-sdk/es/contract--ContractBase) **Returns**: `String` - - Contract encoded data **Category**: async -**rtype**: `(source: String, name: String, args: Array) => callData: Promise[String]` +**rtype**: `(source: String, name: String, args: Array, options: Array) => callData: Promise[String]` -| Param | Type | Description | -| --- | --- | --- | -| source | `String` | Contract source code | -| name | `String` | Function name | -| args | `Array` | Function argument's | +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| source | `String` | | Contract source code | +| name | `String` | | Function name | +| args | `Array` | | Function argument's | +| [options] | `Object` | {} | Options | +| [options.filesystem] | `Object` | | Contract external namespaces map | +| [options.backend] | `Object` | | Contract vm(default: aevm) | @@ -69,40 +90,46 @@ Decode data -#### *contractBase.contractDecodeCallResultAPI(source, fn, callValue, callResult) ⇒ `String`* +#### *contractBase.contractDecodeCallResultAPI(source, fn, callValue, callResult, [options]) ⇒ `String`* Decode contract call result data **Kind**: instance abstract method of [`ContractBase`](#exp_module_@aeternity/aepp-sdk/es/contract--ContractBase) **Returns**: `String` - - Decoded contract call result **Category**: async -**rtype**: `(source: String, fn: String, callValue: String, callResult: String) => decodedResult: Promise[String]` +**rtype**: `(source: String, fn: String, callValue: String, callResult: String, options: Array) => decodedResult: Promise[String]` -| Param | Type | Description | -| --- | --- | --- | -| source | `String` | Contract source | -| fn | `String` | Fn name | -| callValue | `String` | result data (cb_das...) | -| callResult | `String` | contract call result status('ok', 'revert', ...) | +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| source | `String` | | Contract source | +| fn | `String` | | Fn name | +| callValue | `String` | | result data (cb_das...) | +| callResult | `String` | | contract call result status('ok', 'revert', ...) | +| [options] | `Object` | {} | Options | +| [options.filesystem] | `Object` | | Contract external namespaces map | +| [options.backend] | `Object` | | Contract vm(default: aevm) | -#### *contractBase.contractDecodeCallDataBySourceAPI(source, function, callData) ⇒ `String`* +#### *contractBase.contractDecodeCallDataBySourceAPI(source, function, callData, [options]) ⇒ `String`* Decode call data by source **Kind**: instance abstract method of [`ContractBase`](#exp_module_@aeternity/aepp-sdk/es/contract--ContractBase) **Returns**: `String` - - Decoded contract call data **Category**: async -**rtype**: `(source: String, function: String, callData: String) => decodedResult: Promise[String]` +**rtype**: `(source: String, function: String, callData: String, options: Array) => decodedResult: Promise[String]` -| Param | Type | Description | -| --- | --- | --- | -| source | `String` | contract source | -| function | `String` | function name | -| callData | `String` | Encoded contract call data | +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| source | `String` | | contract source | +| function | `String` | | function name | +| callData | `String` | | Encoded contract call data | +| [options] | `Object` | {} | Options | +| [options.filesystem] | `Object` | | Contract external namespaces map | +| [options.backend] | `Object` | | Contract vm(default: aevm) | -#### *contractBase.contractDecodeCallDataByCodeAPI(code, callData) ⇒ `String`* +#### *contractBase.contractDecodeCallDataByCodeAPI(code, callData, backend) ⇒ `String`* Decode call data by bytecode **Kind**: instance abstract method of [`ContractBase`](#exp_module_@aeternity/aepp-sdk/es/contract--ContractBase) @@ -114,6 +141,7 @@ Decode call data by bytecode | --- | --- | --- | | code | `String` | contract byte code | | callData | `String` | Encoded contract call data | +| backend | `String` | Contract vm(default: aevm) | @@ -129,6 +157,8 @@ Compile contract | --- | --- | --- | --- | | code | `String` | | Contract source code | | [options] | `Object` | {} | Options | +| [options.filesystem] | `Object` | | Contract external namespaces map | +| [options.backend] | `Object` | | Contract vm(default: aevm) | diff --git a/docs/api/contract/aci.md b/docs/api/contract/aci.md index b6e8f167ab..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' @@ -65,13 +64,14 @@ Generate contract ACI object with predefined js methods for contract usage - can **Kind**: Exported function **Returns**: `ContractInstance` - JS Contract API -| Param | Type | Description | -| --- | --- | --- | -| source | `String` | Contract source code | -| [options] | `Object` | Options object | -| [options.aci] | `Object` | Contract ACI | -| [options.contractAddress] | `Object` | Contract address | -| [options.opt] | `Object` | Contract options | +| Param | Type | Default | Description | +| --- | --- | --- | --- | +| source | `String` | | Contract source code | +| [options] | `Object` | {} | Options object | +| [options.aci] | `Object` | | Contract ACI | +| [options.contractAddress] | `Object` | | Contract address | +| [options.filesystem] | `Object` | | Contact source external namespaces map | +| [options.opt] | `Object` | | Contract options | **Example** ```js 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/es/account/memory.js b/es/account/memory.js index 894f54a20e..3873fe3fdd 100644 --- a/es/account/memory.js +++ b/es/account/memory.js @@ -30,6 +30,7 @@ import { decode } from '../tx/builder/helpers' const secrets = new WeakMap() async function sign (data) { + if (this.isGa) throw new Error('You are trying to sign data using GA account without keypair') return Promise.resolve(Crypto.sign(data, secrets.get(this).secretKey)) } @@ -72,15 +73,22 @@ function validateKeyPair (keyPair) { * @return {Account} */ const MemoryAccount = Account.compose({ - init ({ keypair }) { - validateKeyPair(keypair) - if (Object.prototype.hasOwnProperty.call(keypair, 'priv') && Object.prototype.hasOwnProperty.call(keypair, 'pub')) { - keypair = { secretKey: keypair.priv, publicKey: keypair.pub } - console.warn('pub/priv naming for accounts has been deprecated, please use secretKey/publicKey') - } + init ({ keypair, gaId }) { + this.isGa = !!gaId + if (gaId) { + if (!Crypto.isAddressValid(gaId)) throw new Error('Invalid GA address') + secrets.set(this, { publicKey: gaId }) + } else { + validateKeyPair(keypair) + if (Object.prototype.hasOwnProperty.call(keypair, 'priv') && Object.prototype.hasOwnProperty.call(keypair, 'pub')) { + keypair = { secretKey: keypair.priv, publicKey: keypair.pub } + console.warn('pub/priv naming for accounts has been deprecated, please use secretKey/publicKey') + } - this.setSecret(keypair) + this.setSecret(keypair) + } }, + props: { isGa: false }, methods: { sign, address, setSecret } }) diff --git a/es/accounts.js b/es/accounts.js index 7312d8fb89..1327b77125 100644 --- a/es/accounts.js +++ b/es/accounts.js @@ -142,12 +142,12 @@ const Accounts = stampit(AsyncInit, { this.accounts = R.fromPairs(await Promise.all(accounts.map(async a => [await a.address(), a]))) keypair = keypair || envKeypair(process.env, true) if (keypair) { - await this.addAccount(await MemoryAccount({ keypair }), { select: !this.Selector.address }) + await this.addAccount(MemoryAccount({ keypair }), { select: !this.Selector.address }) } // @Todo Remove after removing depricated `setKeypair` fn. // Prevent BREAKING CHANGES // Pre-init memoryAccount object to prevent async operation in `setKeypair` function - this._acc = await MemoryAccount({ keypair: generateKeyPair() }) + this._acc = MemoryAccount({ keypair: generateKeyPair() }) }, props: { accounts: {} diff --git a/es/ae/aens.js b/es/ae/aens.js index b375306cc7..6b176168f0 100644 --- a/es/ae/aens.js +++ b/es/ae/aens.js @@ -28,8 +28,9 @@ import * as R from 'ramda' import { encodeBase58Check, salt } from '../utils/crypto' -import { commitmentHash } from '../tx/builder/helpers' +import { commitmentHash, prelimaCommitmentHash, isNameValid } from '../tx/builder/helpers' import Ae from './' +import { CLIENT_TTL, NAME_TTL } from '../tx/builder/schema' /** * Transfer a domain to another account @@ -85,7 +86,9 @@ async function revoke (nameId, options = {}) { function classify (s) { const keys = { ak: 'account_pubkey', - ok: 'oracle_pubkey' + ok: 'oracle_pubkey', + ct: 'contract_pubkey', + ch: 'channel' } if (!s.match(/^[a-z]{2}_.+/)) { @@ -130,6 +133,7 @@ async function update (nameId, target, options = {}) { * @return {Promise} */ async function query (name, opt = {}) { + isNameValid(name) const o = await this.getName(name) const nameId = o.id @@ -163,6 +167,7 @@ async function query (name, opt = {}) { * @return {Promise} the result of the claim */ async function claim (name, salt, options = {}) { + isNameValid(name) const opt = R.merge(this.Ae.defaults, options) const claimTx = await this.nameClaimTx(R.merge(opt, { accountId: await this.address(opt), @@ -171,11 +176,11 @@ async function claim (name, salt, options = {}) { })) const result = await this.send(claimTx, opt) - - return { - ...result, - ...opt.waitMined && await this.aensQuery(name, opt) + if (opt.vsn === 1) { + const nameInter = this.Chain.defaults.waitMined ? await this.aensQuery(name, opt) : {} + return Object.assign(result, nameInter) } + return result } /** @@ -188,10 +193,18 @@ async function claim (name, salt, options = {}) { * @return {Promise} */ async function preclaim (name, options = {}) { + // TODO remove cross compatibility + const { version } = this.getNodeInfo() + const [majorVersion] = version.split('.') + const vsn = +majorVersion === 5 && version !== '5.0.0-rc.1' ? 2 : 1 + + isNameValid(name) const opt = R.merge(this.Ae.defaults, options) const _salt = salt() const height = await this.height() - const hash = await commitmentHash(name, _salt) + const hash = vsn === 1 + ? await prelimaCommitmentHash(name, _salt) + : await commitmentHash(name, _salt) const preclaimTx = await this.namePreclaimTx(R.merge(opt, { accountId: await this.address(opt), @@ -203,7 +216,7 @@ async function preclaim (name, options = {}) { return Object.freeze({ ...result, height, - claim: options => this.aensClaim(name, _salt, { ...options, onAccount: opt.onAccount }), + claim: options => this.aensClaim(name, _salt, { ...options, onAccount: opt.onAccount, vsn }), salt: _salt, commitmentId: hash }) @@ -232,8 +245,8 @@ const Aens = Ae.compose({ deepProps: { Ae: { defaults: { - clientTtl: 1, - nameTtl: 50000 // aec_governance:name_claim_max_expiration() => 50000 + clientTtl: CLIENT_TTL, + nameTtl: NAME_TTL // aec_governance:name_claim_max_expiration() => 50000 } } } diff --git a/es/ae/aepp.js b/es/ae/aepp.js index 6adac71790..557b4725ef 100644 --- a/es/ae/aepp.js +++ b/es/ae/aepp.js @@ -27,8 +27,7 @@ import Aens from './aens' import Rpc from '../rpc/client' import { ContractAPI } from './contract' import Oracle from './oracle' -// Todo Enable GA -// import GeneralizeAccount from '../contract/ga' +import GeneralizeAccount from '../contract/ga' /** * Aepp Stamp @@ -42,6 +41,6 @@ import Oracle from './oracle' * @param {Object} [options={}] - Initializer object * @return {Object} Aepp instance */ -const Aepp = Ae.compose(ContractAPI, Aens, Oracle, Rpc) +const Aepp = Ae.compose(ContractAPI, Aens, Oracle, GeneralizeAccount, Rpc) export default Aepp diff --git a/es/ae/contract.js b/es/ae/contract.js index 594c1a4ec1..5a60d868df 100644 --- a/es/ae/contract.js +++ b/es/ae/contract.js @@ -63,10 +63,13 @@ async function handleCallError (result) { * @param {String} source Contract source code * @param {String} name Name of function to call * @param {Array} args Argument's for call + * @param {Object} [options={}] Options + * @param {Object} [options.filesystem={}] Contract external namespaces map + * @param {Object} [options.backend='fate'] Compiler backend * @return {Promise} */ -async function contractEncodeCall (source, name, args) { - return this.contractEncodeCallDataAPI(source, name, args) +async function contractEncodeCall (source, name, args, options) { + return this.contractEncodeCallDataAPI(source, name, args, options) } /** @@ -78,10 +81,11 @@ async function contractEncodeCall (source, name, args) { * @param {String } fn - function name * @param {String} callValue - result call data * @param {String} callResult - result status + * @param {Object} [options={}] Options + * @param {Object} [options.filesystem={}] Contract external namespaces map * @return {Promise} Result object * @example * const decodedData = await client.contractDecodeData(SourceCode ,'functionName', 'cb_asdasdasd...', 'ok|revert')lt - * @param options */ async function contractDecodeData (source, fn, callValue, callResult, options) { return this.contractDecodeCallResultAPI(source, fn, callValue, callResult, options) @@ -96,10 +100,11 @@ async function contractDecodeData (source, fn, callValue, callResult, options) { * @param {String} address Contract address * @param {String} name Name of function to call * @param {Array} args Argument's for call function - * @param {Object} options [options={}] Options - * @param {String} top [options.top] Block hash on which you want to call contract + * @param {Object} [options={}] Options + * @param {String} [options.top] Block hash on which you want to call contract * @param bytecode * @param {String} options [options.options] Transaction options (fee, ttl, gas, amount, deposit) + * @param {Object} filesystem [options.options.filesystem] Contract external namespaces map * @return {Promise} Result object * @example * const callResult = await client.contractCallStatic(source, address, fnName, args = [], { top, options = {} }) @@ -115,7 +120,7 @@ async function contractCallStatic (source, address, name, args = [], { top, opti : await this.address().catch(e => opt.dryRunAccount.pub) // Prepare call-data - const callData = await this.contractEncodeCall(source, name, args) + const callData = await this.contractEncodeCall(source, name, args, opt) // Get block hash by height if (top && !isNaN(top)) { @@ -123,7 +128,6 @@ async function contractCallStatic (source, address, name, args = [], { top, opti } // Prepare nonce const nonce = top ? (await this.getAccount(callerId, { hash: top })).nonce + 1 : undefined - if (name === 'init') { // Prepare deploy transaction const { tx } = await this.contractCreateTx(R.merge(opt, { @@ -176,8 +180,8 @@ async function dryRunContractTx (tx, callerId, source, name, opt = {}) { * @param {String} address Contract address * @param {String} name Name of function to call * @param {Array} args Argument's for call function - * @param {Object} options Transaction options (fee, ttl, gas, amount, deposit) - * @return {Promise} Result object + * @param {Object} [options={}] Transaction options (fee, ttl, gas, amount, deposit) + * @param {Object} [options.filesystem={}] Contract external namespaces map* @return {Promise} Result object * @example * const callResult = await client.contractCall(source, address, fnName, args = [], options) * { @@ -192,7 +196,7 @@ async function contractCall (source, address, name, args = [], options = {}) { const tx = await this.contractCallTx(R.merge(opt, { callerId: await this.address(opt), contractId: address, - callData: await this.contractEncodeCall(source, name, args) + callData: await this.contractEncodeCall(source, name, args, opt) })) const { hash, rawTx } = await this.send(tx, opt) @@ -203,7 +207,7 @@ async function contractCall (source, address, name, args = [], options = {}) { hash, rawTx, result, - decode: () => this.contractDecodeData(source, name, result.returnValue, result.returnType) + decode: () => this.contractDecodeData(source, name, result.returnValue, result.returnType, opt) } } else { await this.handleCallError(result) @@ -218,7 +222,8 @@ async function contractCall (source, address, name, args = [], options = {}) { * @param {String} code Compiled contract * @param {String} source Contract source code * @param {Array} initState Arguments of contract constructor(init) function - * @param {Object} options Transaction options (fee, ttl, gas, amount, deposit) + * @param {Object} [options={}] Transaction options (fee, ttl, gas, amount, deposit) + * @param {Object} [options.filesystem={}] Contract external namespaces map* @return {Promise} Result object * @return {Promise} Result object * @example * const deployed = await client.contractDeploy(bytecode, source, init = [], options) @@ -234,7 +239,7 @@ async function contractCall (source, address, name, args = [], options = {}) { */ async function contractDeploy (code, source, initState = [], options = {}) { const opt = R.merge(this.Ae.defaults, options) - const callData = await this.contractEncodeCall(source, 'init', initState) + const callData = await this.contractEncodeCall(source, 'init', initState, opt) const ownerId = await this.address(opt) const { tx, contractId } = await this.contractCreateTx(R.merge(opt, { @@ -253,8 +258,8 @@ async function contractDeploy (code, source, initState = [], options = {}) { transaction: hash, rawTx, address: contractId, - call: async (name, args = [], options) => this.contractCall(source, contractId, name, args, R.merge(opt, options)), - callStatic: async (name, args = [], options = {}) => this.contractCallStatic(source, contractId, name, args, { ...options, options: { onAccount: opt.onAccount, ...options.options } }), + call: async (name, args = [], options = {}) => this.contractCall(source, contractId, name, args, R.merge(opt, options)), + callStatic: async (name, args = [], options = {}) => this.contractCallStatic(source, contractId, name, args, { ...options, options: { onAccount: opt.onAccount, ...R.merge(opt, options.options) } }), createdAt: new Date() }) } else { @@ -268,7 +273,9 @@ async function contractDeploy (code, source, initState = [], options = {}) { * @alias module:@aeternity/aepp-sdk/es/ae/contract * @category async * @param {String} source Contract sourece code - * @param {Object} options Transaction options (fee, ttl, gas, amount, deposit) + * @param {Object} [options={}] Transaction options (fee, ttl, gas, amount, deposit) + * @param {Object} [options.filesystem={}] Contract external namespaces map* @return {Promise} Result object + * @param {Object} [options.backend='aevm'] Contract backend version (aevm|fate) * @return {Promise} Result object * @example * const compiled = await client.contractCompile(SOURCE_CODE) @@ -279,11 +286,12 @@ async function contractDeploy (code, source, initState = [], options = {}) { * } */ async function contractCompile (source, options = {}) { - const bytecode = await this.compileContractAPI(source, options) + const opt = R.merge(this.Ae.defaults, options) + const bytecode = await this.compileContractAPI(source, opt) return Object.freeze(Object.assign({ - encodeCall: async (name, args) => this.contractEncodeCall(source, name, args), - deploy: async (init, options = {}) => this.contractDeploy(bytecode, source, init, options), - deployStatic: async (init, options = {}) => this.contractCallStatic(source, null, 'init', init, { bytecode, top: options.top, options }) + encodeCall: async (name, args) => this.contractEncodeCall(source, name, args, R.merge(opt, options)), + deploy: async (init, options = {}) => this.contractDeploy(bytecode, source, init, R.merge(opt, options)), + deployStatic: async (init, options = {}) => this.contractCallStatic(source, null, 'init', init, { bytecode, top: options.top, options: R.merge(opt, options) }) }, { bytecode })) } diff --git a/es/ae/index.js b/es/ae/index.js index bb74446258..56d111e725 100644 --- a/es/ae/index.js +++ b/es/ae/index.js @@ -29,6 +29,8 @@ import Account from '../account' import TxBuilder from '../tx/builder' import * as R from 'ramda' import { BigNumber } from 'bignumber.js' +import { isAddressValid } from '../utils/crypto' +import { isNameValid } from '../tx/builder/helpers' /** * Sign and post a transaction to the chain @@ -42,15 +44,13 @@ import { BigNumber } from 'bignumber.js' */ async function send (tx, options = {}) { const opt = R.merge(this.Ae.defaults, options) - // Todo Enable GA - // const { contractId: gaId, authFun } = await this.getAccount(await this.address(opt)) - // const signed = gaId - // ? await this.signUsingGA(tx, { ...opt, authFun }) - const signed = await this.signTransaction(tx, opt) + const { contractId: gaId, authFun } = await this.getAccount(await this.address(opt)) + const signed = gaId + ? await this.signUsingGA(tx, { ...opt, authFun }) + : await this.signTransaction(tx, opt) return this.sendTransaction(signed, opt) } -// Todo Enable GA // eslint-disable-next-line no-unused-vars async function signUsingGA (tx, options = {}) { const { authData, authFun } = options @@ -63,16 +63,34 @@ async function signUsingGA (tx, options = {}) { * @category async * @rtype (amount: Number|String, recipientId: String, options?: Object) => Promise[String] * @param {Number|String} amount - Amount to spend - * @param {String} recipientId - Address of recipient account + * @param {String} recipientId - Address or Name of recipient account * @param {Object} options - Options * @return {String|String} Transaction or transaction hash */ async function spend (amount, recipientId, options = {}) { const opt = R.merge(this.Ae.defaults, options) - const spendTx = await this.spendTx(R.merge(opt, { senderId: await this.address(opt), recipientId, amount: amount })) + recipientId = await this.resolveRecipientName(recipientId, options) + const spendTx = await this.spendTx(R.merge(opt, { senderId: await this.address(opt), recipientId, amount })) return this.send(spendTx, opt) } +/** + * Resolve AENS name and return name hash + * + * @param {String} nameOrAddress + * @param verify + * @return {String} Address or AENS name hash + */ +async function resolveRecipientName (nameOrAddress, { verify = false }) { + if (isAddressValid(nameOrAddress)) return nameOrAddress + if (isNameValid(nameOrAddress)) { + const { id, pointers } = await this.getName(nameOrAddress) + // Validation + if (verify && !pointers.find(({ id }) => id.split('_')[0] === 'ak')) throw new Error(`Name ${nameOrAddress} do not have pointers for account`) + return id + } +} + /** * Send a percentage of funds to another account * @instance @@ -135,10 +153,9 @@ function destroyInstance () { * @return {Object} Ae instance */ const Ae = stampit(Tx, Account, Chain, { - methods: { send, spend, transferFunds, destroyInstance }, - deepProps: { Ae: { defaults: {} } } - // Todo Enable GA - // deepConfiguration: { Ae: { methods: ['signUsingGA'] } } + methods: { send, spend, transferFunds, destroyInstance, resolveRecipientName, signUsingGA }, + deepProps: { Ae: { defaults: {} } }, + deepConfiguration: { Ae: { methods: ['signUsingGA'] } } }) export default Ae diff --git a/es/ae/universal.js b/es/ae/universal.js index a18ba042b9..c925f7189a 100644 --- a/es/ae/universal.js +++ b/es/ae/universal.js @@ -27,8 +27,7 @@ import Chain from '../chain/node' import Aens from './aens' import Transaction from '../tx/tx' import Oracle from './oracle' -// Todo Enable GA -// import GeneralizeAccount from '../contract/ga' +import GeneralizeAccount from '../contract/ga' import Accounts from '../accounts' import Contract from './contract' import NodePool from '../node-pool' @@ -44,7 +43,7 @@ import NodePool from '../node-pool' * @param {Object} [options={}] - Initializer object * @return {Object} Universal instance */ -export const Universal = Ae.compose(Accounts, Chain, NodePool, Transaction, Aens, Contract, Oracle, { +export const Universal = Ae.compose(Accounts, Chain, NodePool, Transaction, Aens, Contract, Oracle, GeneralizeAccount, { init () {}, props: { process: {} } }) diff --git a/es/ae/wallet.js b/es/ae/wallet.js index c0e08742a0..03644ad3b3 100644 --- a/es/ae/wallet.js +++ b/es/ae/wallet.js @@ -32,8 +32,7 @@ import * as R from 'ramda' import Tx from '../tx/tx' import Contract from './contract' import NodePool from '../node-pool' -// Todo Enable GA -// import GeneralizeAccount from '../contract/ga' +import GeneralizeAccount from '../contract/ga' const contains = R.flip(R.contains) const isTxMethod = contains(Tx.compose.deepConfiguration.Ae.methods) @@ -132,7 +131,7 @@ async function rpcAddress ({ params, session }) { onContract: confirm }) */ -const Wallet = Ae.compose(Accounts, Chain, NodePool, Tx, Contract, Rpc, { +const Wallet = Ae.compose(Accounts, Chain, NodePool, Tx, Contract, GeneralizeAccount, Rpc, { init ({ onTx = this.onTx, onChain = this.onChain, onAccount = this.onAccount, onContract = this.onContract }, { stamp }) { this.onTx = onTx this.onChain = onChain diff --git a/es/chain/node.js b/es/chain/node.js index 42845eca6e..661753a502 100644 --- a/es/chain/node.js +++ b/es/chain/node.js @@ -175,6 +175,12 @@ async function getMicroBlockHeader (hash) { } async function txDryRun (txs, accounts, top) { + // TODO remove cross compatibility + const { version } = this.getNodeInfo() + const [majorVersion] = version.split('.') + if (+majorVersion === 5 && version !== '5.0.0-rc.1') { + txs = txs.map(tx => ({ tx })) + } return this.api.dryRunTxs({ txs, accounts, top }) } diff --git a/es/contract/aci/index.js b/es/contract/aci/index.js index 793c70da84..d2b1217432 100644 --- a/es/contract/aci/index.js +++ b/es/contract/aci/index.js @@ -28,6 +28,7 @@ import * as R from 'ramda' import { validateArguments, transform, transformDecodedData } from './transformation' import { buildContractMethods, getFunctionACI } from './helpers' import AsyncInit from '../../utils/async-init' +import { BigNumber } from 'bignumber.js' /** * Validated contract call arguments using contract ACI @@ -56,9 +57,10 @@ async function prepareArgsForEncode (aci, params) { * Generate contract ACI object with predefined js methods for contract usage - can be used for creating a reference to already deployed contracts * @alias module:@aeternity/aepp-sdk/es/contract/aci * @param {String} source Contract source code - * @param {Object} [options] Options object + * @param {Object} [options={}] Options object * @param {Object} [options.aci] Contract ACI * @param {Object} [options.contractAddress] Contract address + * @param {Object} [options.filesystem] Contact source external namespaces map * @param {Object} [options.opt] Contract options * @return {ContractInstance} JS Contract API * @example @@ -69,8 +71,8 @@ async function prepareArgsForEncode (aci, params) { * Also you can call contract like: await contractIns.methods.setState(123, options) * Then sdk decide to make on-chain or static call(dry-run API) transaction based on function is stateful or not */ -async function getContractInstance (source, { aci, contractAddress, opt } = {}) { - aci = aci || await this.contractGetACI(source) +async function getContractInstance (source, { aci, contractAddress, filesystem = {}, opt } = {}) { + aci = aci || await this.contractGetACI(source, { filesystem }) const defaultOptions = { skipArgsConvert: false, skipTransformDecoded: false, @@ -81,7 +83,8 @@ async function getContractInstance (source, { aci, contractAddress, opt } = {}) gas: 1600000 - 21000, top: null, // using for contract call static waitMined: true, - verify: false + verify: false, + filesystem } const instance = { interface: R.defaultTo(null, R.prop('interface', aci)), @@ -146,7 +149,10 @@ const call = ({ client, instance }) => async (fn, params = [], options = {}) => if (!fn) throw new Error('Function name is required') if (!instance.deployInfo.address) throw new Error('You need to deploy contract before calling!') - + if ( + BigNumber(opt.amount).gt(0) && + (Object.prototype.hasOwnProperty.call(fnACI, 'payable') && !fnACI.payable) + ) throw new Error(`You try to pay "${opt.amount}" to function "${fn}" which is not payable. Only payable function can accept tokens`) params = !opt.skipArgsConvert ? await prepareArgsForEncode(fnACI, params) : params const result = opt.callStatic ? await client.contractCallStatic(source, instance.deployInfo.address, fn, params, { @@ -159,7 +165,7 @@ const call = ({ client, instance }) => async (fn, params = [], options = {}) => decodedResult: await transformDecodedData( fnACI.returns, await result.decode(), - { ...opt, compilerVersion: instance.compilerVersion, bindings: fnACI.bindings } + { ...opt, bindings: fnACI.bindings } ) } } @@ -169,7 +175,7 @@ const deploy = ({ client, instance }) => async (init = [], options = {}) => { const fnACI = getFunctionACI(instance.aci, 'init') const source = opt.source || instance.source - if (!instance.compiled) await instance.compile() + if (!instance.compiled) await instance.compile(opt) init = !opt.skipArgsConvert ? await prepareArgsForEncode(fnACI, init) : init if (opt.callStatic) { @@ -185,8 +191,8 @@ const deploy = ({ client, instance }) => async (init = [], options = {}) => { } } -const compile = ({ client, instance }) => async () => { - const { bytecode } = await client.contractCompile(instance.source) +const compile = ({ client, instance }) => async (options = {}) => { + const { bytecode } = await client.contractCompile(instance.source, { ...instance.options, ...options }) instance.compiled = bytecode return instance.compiled } diff --git a/es/contract/aci/transformation.js b/es/contract/aci/transformation.js index f3ab2eff01..59c9b7899a 100644 --- a/es/contract/aci/transformation.js +++ b/es/contract/aci/transformation.js @@ -94,21 +94,20 @@ export function readType (type, { bindings } = {}) { * @param bindings * @return {string} */ -export async function transform (type, value, { bindings } = {}) { +export function transform (type, value, { bindings } = {}) { const { t, generic } = readType(type, { bindings }) switch (t) { case SOPHIA_TYPES.string: return `"${value}"` case SOPHIA_TYPES.list: - return `[${await Promise.all(value.map(async el => transform(generic, el, { bindings })))}]` + return `[${value.map(el => transform(generic, el, { bindings }))}]` case SOPHIA_TYPES.tuple: - return `(${await Promise.all(value.map(async (el, i) => transform(generic[i], el, { + return `(${value.map((el, i) => transform(generic[i], el, { bindings - })))})` + }))})` case SOPHIA_TYPES.option: { - const optionV = await value.catch(e => undefined) - return optionV === undefined ? 'None' : `Some(${await transform(generic, optionV, { + return value === undefined ? 'None' : `Some(${transform(generic, value, { bindings })})` } @@ -117,10 +116,9 @@ export async function transform (type, value, { bindings } = {}) { case SOPHIA_TYPES.signature: return `#${typeof value === 'string' ? value : Buffer.from(value).toString('hex')}` case SOPHIA_TYPES.record: - return `{${await generic.reduce( - async (acc, { name, type }, i) => { - acc = await acc - acc += `${i !== 0 ? ',' : ''}${name} = ${await transform(type, value[name], { + return `{${generic.reduce( + (acc, { name, type }, i) => { + acc += `${i !== 0 ? ',' : ''}${name} = ${transform(type, value[name], { bindings })}` return acc @@ -136,18 +134,18 @@ export async function transform (type, value, { bindings } = {}) { return `${value}` } -async function transformVariant (value, generic, { bindings }) { +function transformVariant (value, generic, { bindings }) { const [[variant, variantArgs]] = typeof value === 'string' ? [[value, []]] : Object.entries(value) const [[v, type]] = Object.entries(generic.find(o => Object.keys(o)[0].toLowerCase() === variant.toLowerCase())) return `${v}${!type.length ? '' - : `(${await Promise.all(variantArgs.slice(0, type.length).map(async (el, i) => transform(type[i], el, { + : `(${variantArgs.slice(0, type.length).map((el, i) => transform(type[i], el, { bindings - })))})` + }))})` }` } -export async function transformMap (value, generic, { bindings }) { +export function transformMap (value, generic, { bindings }) { if (value instanceof Map) { value = Array.from(value.entries()) } @@ -155,14 +153,13 @@ export async function transformMap (value, generic, { bindings }) { value = Object.entries(value) } - return `{${await value + return `{${value .reduce( - async (acc, [key, value], i) => { - acc = await acc + (acc, [key, value], i) => { if (i !== 0) acc += ',' - acc += `[${await transform(generic[0], key, { + acc += `[${transform(generic[0], key, { bindings - })}] = ${await transform(generic[1], value, { bindings })}` + })}] = ${transform(generic[1], value, { bindings })}` return acc }, '' @@ -285,7 +282,7 @@ export function prepareSchema (type, { bindings } = {}) { case SOPHIA_TYPES.signature: return JoiBinary.binary().bufferCheck(64).error(getJoiErrorMsg) case SOPHIA_TYPES.option: - return Joi.object().type(Promise).error(getJoiErrorMsg) + return prepareSchema(generic, { bindings }).optional().error(getJoiErrorMsg) // @Todo Need to transform Map to Array of arrays before validating it // case SOPHIA_TYPES.map: // return Joi.array().items(Joi.array().ordered(generic.map(type => prepareSchema(type)))) @@ -373,7 +370,7 @@ export function validateArguments (aci, params) { const validationSchema = Joi.array().ordered( aci.arguments .map(({ type }, i) => prepareSchema(type, { bindings: aci.bindings }).label(`[${params[i]}]`)) - ).label('Argument') + ).sparse(true).label('Argument') const { error } = Joi.validate(params, validationSchema, { abortEarly: false }) if (error) { throw error diff --git a/es/contract/compiler.js b/es/contract/compiler.js index f31a2f8736..408b80c825 100644 --- a/es/contract/compiler.js +++ b/es/contract/compiler.js @@ -28,6 +28,7 @@ import Http from '../utils/http' import ContractBase from './index' import semverSatisfies from '../utils/semver-satisfies' import AsyncInit from '../utils/async-init' +import { VM_TYPE } from '../tx/builder/schema' async function getCompilerVersion (options = {}) { return this.http @@ -37,27 +38,30 @@ async function getCompilerVersion (options = {}) { async function contractEncodeCallDataAPI (source, name, args = [], options = {}) { this.isInit() + options = this.prepareCompilerOption(options) return this.http - .post('/encode-calldata', { source, function: name, arguments: args }, options) + .post('/encode-calldata', { source, function: name, arguments: args, options }, options) .then(({ calldata }) => calldata) } -async function contractDecodeCallDataByCodeAPI (bytecode, calldata, options = {}) { +async function contractDecodeCallDataByCodeAPI (bytecode, calldata, backend = this.compilerOptions.backend, options = {}) { this.isInit() return this.http - .post('/decode-calldata/bytecode', { bytecode, calldata }, options) + .post('/decode-calldata/bytecode', { bytecode, calldata, backend }, options) } async function contractDecodeCallDataBySourceAPI (source, fn, callData, options = {}) { this.isInit() + options = this.prepareCompilerOption(options) return this.http .post('/decode-calldata/source', { function: fn, source, calldata: callData }, options) } async function contractDecodeCallResultAPI (source, fn, callValue, callResult, options = {}) { this.isInit() + options = this.prepareCompilerOption(options) return this.http - .post('/decode-call-result', { function: fn, source, 'call-result': callResult, 'call-value': callValue }, options) + .post('/decode-call-result', { function: fn, source, 'call-result': callResult, 'call-value': callValue, options }, options) } async function contractDecodeDataAPI (type, data, options = {}) { @@ -69,16 +73,18 @@ async function contractDecodeDataAPI (type, data, options = {}) { async function compileContractAPI (code, options = {}) { this.isInit() + options = this.prepareCompilerOption(options) return this.http.post('/compile', { code, options }, options) .then(({ bytecode }) => bytecode) } async function contractGetACI (code, options = {}) { this.isInit() + options = this.prepareCompilerOption(options) return this.http.post('/aci', { code, options }, options) } -async function setCompilerUrl (url, { forceCompatibility } = {}) { +async function setCompilerUrl (url, { forceCompatibility = false } = {}) { this.http.changeBaseUrl(url) this.compilerVersion = null await this.checkCompatibility({ forceCompatibility }) @@ -95,6 +101,9 @@ async function checkCompatibility ({ force = false, forceCompatibility = false } } } +function prepareCompilerOption (options = {}) { + return { ...this.compilerOptions, ...options, file_system: options.filesystem || {} } +} function isInit () { if (this.compilerVersion === null) throw Error('Compiler not defined') return true @@ -128,14 +137,18 @@ const ContractCompilerAPI = AsyncInit.compose(ContractBase, { setCompilerUrl, getCompilerVersion, isInit, - checkCompatibility + checkCompatibility, + prepareCompilerOption }, props: { - compilerVersion: null + compilerVersion: null, + compilerOptions: { + backend: VM_TYPE.FATE + } } }) const COMPILER_GE_VERSION = '3.1.0' -const COMPILER_LT_VERSION = '4.0.0' +const COMPILER_LT_VERSION = '5.0.0' export default ContractCompilerAPI diff --git a/es/contract/ga/helpers.js b/es/contract/ga/helpers.js index 4a1d53f490..d9769f8a34 100644 --- a/es/contract/ga/helpers.js +++ b/es/contract/ga/helpers.js @@ -1,6 +1,7 @@ import BigNumber from 'bignumber.js' import { MAX_AUTH_FUN_GAS, TX_TYPE } from '../../tx/builder/schema' import { buildTx, unpackTx } from '../../tx/builder' +import { hash } from '../../utils/crypto' export const prepareGaParams = (ins) => async (authData, authFnName) => { if (typeof authData !== 'object') throw new Error('AuthData must be an object') @@ -17,8 +18,12 @@ export const prepareGaParams = (ins) => async (authData, authFnName) => { export const getContractAuthFan = (ins) => async (source, fnName) => { const { bytecode } = await ins.contractCompile(source) + // TODO remove + // Compiler backend cross compatibility const { tx: { typeInfo } } = await unpackTx(bytecode, false, 'cb') - if (!typeInfo[fnName]) throw new Error(`Can't find authFan for function "${fnName}"`) + if (!typeInfo[fnName]) { + return { bytecode, authFun: hash(fnName) } + } const { funHash: authFun } = typeInfo[fnName] return { bytecode, authFun } } diff --git a/es/contract/ga/index.js b/es/contract/ga/index.js index 71820ffc46..ab93621860 100644 --- a/es/contract/ga/index.js +++ b/es/contract/ga/index.js @@ -26,7 +26,7 @@ import * as R from 'ramda' import { ContractAPI } from '../../ae/contract' -import { ABI_VERSIONS, TX_TYPE } from '../../tx/builder/schema' +import { TX_TYPE } from '../../tx/builder/schema' import { buildTx } from '../../tx/builder' import { getContractAuthFan, prepareGaParams, wrapInEmptySignedTx } from './helpers' import { assertedType, decodeBase64Check } from '../../utils/crypto' @@ -121,8 +121,10 @@ async function createMetaTx (rawTransaction, authData, authFnName, options = {}) const rlpBinaryTx = decodeBase64Check(assertedType(rawTransaction, 'tx')) // Wrap in SIGNED tx with empty signatures const { rlpEncoded } = wrapInEmptySignedTx(rlpBinaryTx) + // Get abi + const { abiVersion } = await this.getVmVersion(TX_TYPE.contractCall) // Prepare params for META tx - const params = { ...opt, tx: rlpEncoded, gaId: await this.address(opt), abiVersion: ABI_VERSIONS.SOPHIA, authData: authCallData, gas } + const params = { ...opt, tx: rlpEncoded, gaId: await this.address(opt), abiVersion: abiVersion, authData: authCallData, gas } // Calculate fee, get absolute ttl (ttl + height), get account nonce const { fee, ttl } = await this.prepareTxParams(TX_TYPE.gaMeta, params) // Build META tx diff --git a/es/contract/index.js b/es/contract/index.js index f3afe20d9c..5fbc1f5fe3 100644 --- a/es/contract/index.js +++ b/es/contract/index.js @@ -65,16 +65,33 @@ const ContractBase = stampit({ } })) +/** + * Get contract ACI + * @function contractGetACI + * @instance + * @abstract + * @category async + * @rtype (source: String, options: Array) => aciObject: Promise[Object] + * @param {String} source - Contract source code + * @param {Object} [options={}] Options + * @param {Object} [options.filesystem] Contract external namespaces map + * @param {Object} [options.backend] Contract vm(default: aevm) + * @return {Object} - Contract aci object + */ + /** * Encode contract data * @function contractEncodeCallDataAPI * @instance * @abstract * @category async - * @rtype (source: String, name: String, args: Array) => callData: Promise[String] + * @rtype (source: String, name: String, args: Array, options: Array) => callData: Promise[String] * @param {String} source - Contract source code * @param {String} name - Function name * @param {Array} args - Function argument's + * @param {Object} [options={}] Options + * @param {Object} [options.filesystem] Contract external namespaces map + * @param {Object} [options.backend] Contract vm(default: aevm) * @return {String} - Contract encoded data */ @@ -96,11 +113,14 @@ const ContractBase = stampit({ * @instance * @abstract * @category async - * @rtype (source: String, fn: String, callValue: String, callResult: String) => decodedResult: Promise[String] + * @rtype (source: String, fn: String, callValue: String, callResult: String, options: Array) => decodedResult: Promise[String] * @param {String} source - Contract source * @param {String} fn - Fn name * @param {String} callValue - result data (cb_das...) * @param {String} callResult - contract call result status('ok', 'revert', ...) + * @param {Object} [options={}] Options + * @param {Object} [options.filesystem] Contract external namespaces map + * @param {Object} [options.backend] Contract vm(default: aevm) * @return {String} - Decoded contract call result */ @@ -110,10 +130,13 @@ const ContractBase = stampit({ * @instance * @abstract * @category async - * @rtype (source: String, function: String, callData: String) => decodedResult: Promise[String] + * @rtype (source: String, function: String, callData: String, options: Array) => decodedResult: Promise[String] * @param {String} source - contract source * @param {String} function - function name * @param {String} callData - Encoded contract call data + * @param {Object} [options={}] Options + * @param {Object} [options.filesystem] Contract external namespaces map + * @param {Object} [options.backend] Contract vm(default: aevm) * @return {String} - Decoded contract call data */ @@ -126,6 +149,7 @@ const ContractBase = stampit({ * @rtype (code: String, callData: String) => decodedResult: Promise[String] * @param {String} code - contract byte code * @param {String} callData - Encoded contract call data + * @param {String} backend - Contract vm(default: aevm) * @return {String} - Decoded contract call data */ @@ -137,7 +161,9 @@ const ContractBase = stampit({ * @category async * @rtype (code: String, options?: Object) => compiledContract: Object * @param {String} code - Contract source code - * @param {Object} [options={}] - Options + * @param {Object} [options={}] Options + * @param {Object} [options.filesystem] Contract external namespaces map + * @param {Object} [options.backend] Contract vm(default: aevm) * @return {Object} Object which contain bytecode of contract */ diff --git a/es/index.js b/es/index.js index db1135fc9c..1f953aa53c 100644 --- a/es/index.js +++ b/es/index.js @@ -34,8 +34,7 @@ import Accounts from './accounts' import MemoryAccount from './account/memory' import Aens from './ae/aens' import Contract from './ae/contract' -// Todo Enable GA -// import GeneralizeAccount from './contract/ga' +import GeneralizeAccount from './contract/ga' import ContractCompilerAPI from './contract/compiler' import Wallet from './ae/wallet' import Aepp from './ae/aepp' @@ -60,8 +59,7 @@ export { Channel, Crypto, Chain, - // Todo Enable GA - // GeneralizeAccount, + GeneralizeAccount, HdWallet, MemoryAccount, Node, diff --git a/es/node.js b/es/node.js index 8c5eeba3d4..f5ec7fc3c9 100644 --- a/es/node.js +++ b/es/node.js @@ -139,7 +139,7 @@ const Node = stampit(AsyncInit, { const { nodeRevision: revision, genesisKeyBlockHash: genesisHash, networkId, protocols } = await this.api.getStatus() this.consensusProtocolVersion = await this.getConsensusProtocolVersion(protocols) if ( - !(this.version === '5.0.0-rc.1' || semverSatisfies(this.version.split('-')[0], NODE_GE_VERSION, NODE_LT_VERSION)) && + !(semverSatisfies(this.version.split('-')[0], NODE_GE_VERSION, NODE_LT_VERSION)) && // Todo implement 'rc' version comparision in semverSatisfies !forceCompatibility ) { @@ -155,6 +155,6 @@ const Node = stampit(AsyncInit, { }) const NODE_GE_VERSION = '3.0.1' -const NODE_LT_VERSION = '5.0.0-rc.2' +const NODE_LT_VERSION = '6.0.0' export default Node diff --git a/es/rpc/client.js b/es/rpc/client.js index ea7db270c4..4303b30ef8 100644 --- a/es/rpc/client.js +++ b/es/rpc/client.js @@ -60,7 +60,7 @@ const RpcClient = stampit(AsyncInit, { const { result: { resolve, reject }, id } = data if (callbacks[id]) { - if (resolve) { + if (resolve !== undefined) { callbacks[id].resolve(resolve) } else if (reject) { callbacks[id].reject(reject) diff --git a/es/tx/builder/helpers.js b/es/tx/builder/helpers.js index 0d1f6f3c32..8e87e5ac23 100644 --- a/es/tx/builder/helpers.js +++ b/es/tx/builder/helpers.js @@ -1,3 +1,4 @@ +import * as R from 'ramda' import { assertedType, decodeBase58Check, @@ -8,7 +9,7 @@ import { salt } from '../../utils/crypto' import { toBytes } from '../../utils/bytes' -import { ID_TAG_PREFIX, PREFIX_ID_TAG } from './schema' +import { ID_TAG_PREFIX, PREFIX_ID_TAG, AENS_NAME_DOMAINS } from './schema' import { BigNumber } from 'bignumber.js' /** @@ -78,6 +79,22 @@ export function formatSalt (salt) { return Buffer.from(salt.toString(16).padStart(64, '0'), 'hex') } +/** + * Generate the commitment hash by hashing the formatted salt and + * name, base 58 encoding the result and prepending 'cm_' + * + * @alias module:@aeternity/aepp-sdk/es/tx/builder/helpers + * @function prelimaCommitmentHash + * @category async + * @rtype (name: String, salt?: String) => hash: Promise[String] + * @param {String} name - Name to be registered + * @param {Number} salt Random salt + * @return {String} Commitment hash + */ +export async function prelimaCommitmentHash (name, salt = createSalt()) { + return `cm_${encodeBase58Check(hash(Buffer.concat([nameId(name), formatSalt(salt)])))}` +} + /** * Generate the commitment hash by hashing the formatted salt and * name, base 58 encoding the result and prepending 'cm_' @@ -91,7 +108,7 @@ export function formatSalt (salt) { * @return {String} Commitment hash */ export async function commitmentHash (name, salt = createSalt()) { - return `cm_${encodeBase58Check(hash(Buffer.concat([nameId(name), formatSalt(salt)])))}` + return `cm_${encodeBase58Check(hash(Buffer.concat([Buffer.from(name), formatSalt(salt)])))}` } /** @@ -205,6 +222,24 @@ export function readPointers (pointers) { ) } +/** + * Is name valid + * @function + * @alias module:@aeternity/aepp-sdk/es/ae/aens + * @param {string} name + * @param {boolean} [throwError=true] Throw error on invalid + * @return Boolean + * @throws Error + */ +export function isNameValid (name, throwError = true) { + if ((!name || typeof name !== 'string') && throwError) throw new Error('AENS: Name must be a string') + if (!AENS_NAME_DOMAINS.includes(R.last(name.split('.')))) { + if (throwError) throw new Error(`AENS: Invalid name domain. Possible domains [${AENS_NAME_DOMAINS}]`) + return false + } + return true +} + export default { readPointers, buildPointers, @@ -219,5 +254,6 @@ export default { formatSalt, oracleQueryId, createSalt, - buildHash + buildHash, + isNameValid } diff --git a/es/tx/builder/index.js b/es/tx/builder/index.js index beb2635232..be1b3b1d9e 100644 --- a/es/tx/builder/index.js +++ b/es/tx/builder/index.js @@ -141,6 +141,10 @@ function validateField (value, key, type, prefix) { return assert((!isNaN(value) || BigNumber.isBigNumber(value)) && BigNumber(value).gte(0), { value, isMinusValue }) } case FIELD_TYPES.id: + if (Array.isArray(prefix)) { + const p = prefix.find(p => p === value.split('_')[0]) + return assert(p && PREFIX_ID_TAG[value.split('_')[0]], { value, prefix }) + } return assert(assertedType(value, prefix) && PREFIX_ID_TAG[value.split('_')[0]] && value.split('_')[0] === prefix, { value, prefix }) case FIELD_TYPES.binary: return assert(value.split('_')[0] === prefix, { prefix, value }) @@ -202,15 +206,15 @@ function getOracleRelativeTtl (params) { * @return {String|Number} * @example calculateMinFee('spendTx', { gas, params }) */ -export function calculateMinFee (txType, { gas = 0, params }) { +export function calculateMinFee (txType, { gas = 0, params, vsn }) { const multiplier = BigNumber(1e9) // 10^9 GAS_PRICE if (!params) return BigNumber(DEFAULT_FEE).times(multiplier).toString(10) - let actualFee = buildFee(txType, { params: { ...params, fee: 0 }, multiplier, gas }) + let actualFee = buildFee(txType, { params: { ...params, fee: 0 }, multiplier, gas, vsn }) let expected = BigNumber(0) while (!actualFee.eq(expected)) { - actualFee = buildFee(txType, { params: { ...params, fee: actualFee }, multiplier, gas }) + actualFee = buildFee(txType, { params: { ...params, fee: actualFee }, multiplier, gas, vsn }) expected = actualFee } return expected.toString(10) @@ -224,8 +228,8 @@ export function calculateMinFee (txType, { gas = 0, params }) { * @param multiplier * @return {BigNumber} */ -function buildFee (txType, { params, gas = 0, multiplier }) { - const { rlpEncoded: txWithOutFee } = buildTx({ ...params }, txType) +function buildFee (txType, { params, gas = 0, multiplier, vsn }) { + const { rlpEncoded: txWithOutFee } = buildTx({ ...params }, txType, { vsn }) const txSize = txWithOutFee.length return TX_FEE_BASE_GAS(txType) .plus(TX_FEE_OTHER_GAS(txType)({ txSize, relativeTtl: getOracleRelativeTtl(params) })) @@ -245,10 +249,10 @@ function buildFee (txType, { params, gas = 0, multiplier }) { * @return {String|Number} * @example calculateFee(null, 'spendTx', { gas, params }) */ -export function calculateFee (fee = 0, txType, { gas = 0, params, showWarning = true } = {}) { +export function calculateFee (fee = 0, txType, { gas = 0, params, showWarning = true, vsn } = {}) { if (!params && showWarning) console.warn(`Can't build transaction fee, we will use DEFAULT_FEE(${DEFAULT_FEE})`) - const minFee = calculateMinFee(txType, { params, gas }) + const minFee = calculateMinFee(txType, { params, gas, vsn }) if (fee && BigNumber(minFee).gt(BigNumber(fee)) && showWarning) console.warn(`Transaction fee is lower then min fee! Min fee: ${minFee}`) return fee || minFee @@ -329,15 +333,15 @@ export function unpackRawTx (binary, schema) { * @throws {Error} Validation error * @return {Object} { tx, rlpEncoded, binary } Object with tx -> Base64Check transaction hash with 'tx_' prefix, rlp encoded transaction and binary transaction */ -export function buildTx (params, type, { excludeKeys = [], prefix = 'tx' } = {}) { +export function buildTx (params, type, { excludeKeys = [], prefix = 'tx', vsn = VSN } = {}) { if (!TX_SERIALIZATION_SCHEMA[type]) { throw new Error('Transaction serialization not implemented for ' + type) } - if (!TX_SERIALIZATION_SCHEMA[type][VSN]) { - throw new Error('Transaction serialization not implemented for ' + type + ' version ' + VSN) + if (!TX_SERIALIZATION_SCHEMA[type][vsn]) { + throw new Error('Transaction serialization not implemented for ' + type + ' version ' + vsn) } - const [schema, tag] = TX_SERIALIZATION_SCHEMA[type][VSN] - const binary = buildRawTx({ ...params, VSN, tag }, schema, { excludeKeys }).filter(e => e !== undefined) + const [schema, tag] = TX_SERIALIZATION_SCHEMA[type][vsn] + const binary = buildRawTx({ ...params, VSN: vsn, tag }, schema, { excludeKeys }).filter(e => e !== undefined) const rlpEncoded = rlp.encode(binary) const tx = encode(rlpEncoded, prefix) @@ -360,11 +364,11 @@ export function unpackTx (encodedTx, fromRlpBinary = false, prefix = 'tx') { const objId = readInt(binary[0]) if (!TX_DESERIALIZATION_SCHEMA[objId]) { - return { message: 'Transaction deserialization not implemented for tag ' + objId } + throw new Error('Transaction deserialization not implemented for tag ' + objId) } const vsn = readInt(binary[1]) if (!TX_DESERIALIZATION_SCHEMA[objId][vsn]) { - return { message: 'Transaction deserialization not implemented for tag ' + objId + ' version ' + vsn } + throw new Error('Transaction deserialization not implemented for tag ' + objId + ' version ' + vsn) } const [schema] = TX_DESERIALIZATION_SCHEMA[objId][vsn] diff --git a/es/tx/builder/schema.js b/es/tx/builder/schema.js index 8ece8f1727..26ce382964 100644 --- a/es/tx/builder/schema.js +++ b/es/tx/builder/schema.js @@ -11,6 +11,12 @@ import BigNumber from 'bignumber.js' export const VSN = 1 +export const VSN_2 = 2 + +// # AENS +export const AENS_NAME_DOMAINS = ['aet', 'test'] +export const CLIENT_TTL = 1 +export const NAME_TTL = 50000 // # Tag constant for ids (type uint8) // # see https://github.com/aeternity/protocol/blob/master/serializations.md#the-id-type @@ -157,15 +163,20 @@ export const VM_VERSIONS = { SOLIDITY: 2, SOPHIA_IMPROVEMENTS_MINERVA: 3, SOPHIA_IMPROVEMENTS_FORTUNA: 4, + FATE: 5, SOPHIA_IMPROVEMENTS_LIMA: 6 } // # see https://github.com/aeternity/protocol/blob/minerva/contracts/contract_vms.md#virtual-machines-on-the-%C3%A6ternity-blockchain export const ABI_VERSIONS = { NO_ABI: 0, SOPHIA: 1, - SOLIDITY: 2 + SOLIDITY: 2, + FATE: 3 } +export const VM_TYPE = { FATE: 'fate', AEVM: 'aevm' } + +// First abi/vm by default export const VM_ABI_MAP_ROMA = { [TX_TYPE.contractCreate]: { vmVersion: [VM_VERSIONS.SOPHIA], abiVersion: [ABI_VERSIONS.SOPHIA] }, [TX_TYPE.contractCall]: { vmVersion: [VM_VERSIONS.SOPHIA], abiVersion: [ABI_VERSIONS.SOPHIA] }, @@ -185,8 +196,8 @@ export const VM_ABI_MAP_FORTUNA = { } export const VM_ABI_MAP_LIMA = { - [TX_TYPE.contractCreate]: { vmVersion: [VM_VERSIONS.SOPHIA_IMPROVEMENTS_LIMA], abiVersion: [ABI_VERSIONS.SOPHIA] }, - [TX_TYPE.contractCall]: { vmVersion: [VM_VERSIONS.SOPHIA_IMPROVEMENTS_LIMA, VM_VERSIONS.SOPHIA_IMPROVEMENTS_FORTUNA, VM_VERSIONS.SOPHIA, VM_VERSIONS.SOPHIA_IMPROVEMENTS_MINERVA], abiVersion: [ABI_VERSIONS.SOPHIA] }, + [TX_TYPE.contractCreate]: { vmVersion: [VM_VERSIONS.FATE, VM_VERSIONS.SOPHIA_IMPROVEMENTS_LIMA], abiVersion: [ABI_VERSIONS.FATE, ABI_VERSIONS.SOPHIA] }, + [TX_TYPE.contractCall]: { vmVersion: [VM_VERSIONS.FATE, VM_VERSIONS.SOPHIA_IMPROVEMENTS_LIMA, VM_VERSIONS.SOPHIA_IMPROVEMENTS_FORTUNA, VM_VERSIONS.SOPHIA, VM_VERSIONS.SOPHIA_IMPROVEMENTS_MINERVA], abiVersion: [ABI_VERSIONS.FATE, ABI_VERSIONS.SOPHIA] }, [TX_TYPE.oracleRegister]: { vmVersion: [], abiVersion: [ABI_VERSIONS.NO_ABI, ABI_VERSIONS.SOPHIA] } } @@ -354,6 +365,15 @@ const ACCOUNT_TX = [ TX_FIELD('balance', FIELD_TYPES.int) ] +export const CONTRACT_BYTE_CODE_LIMA = [ + ...BASE_TX, + TX_FIELD('sourceCodeHash', FIELD_TYPES.rawBinary), + TX_FIELD('typeInfo', FIELD_TYPES.sophiaCodeTypeInfo), + TX_FIELD('byteCode', FIELD_TYPES.rawBinary), + TX_FIELD('compilerVersion', FIELD_TYPES.string), + TX_FIELD('payable', FIELD_TYPES.bool) +] + export const CONTRACT_BYTE_CODE_MINERVA = [ ...BASE_TX, TX_FIELD('sourceCodeHash', FIELD_TYPES.rawBinary), @@ -374,14 +394,14 @@ const ACCOUNT_TX_2 = [ TX_FIELD('flags', FIELD_TYPES.int), TX_FIELD('nonce', FIELD_TYPES.int), TX_FIELD('balance', FIELD_TYPES.int), - TX_FIELD('gaContract', FIELD_TYPES.id, 'ct'), + TX_FIELD('gaContract', FIELD_TYPES.id, ['ct', 'nm']), TX_FIELD('gaAuthFun', FIELD_TYPES.binary, 'cb') ] const SPEND_TX = [ ...BASE_TX, TX_FIELD('senderId', FIELD_TYPES.id, 'ak'), - TX_FIELD('recipientId', FIELD_TYPES.id, 'ak'), + TX_FIELD('recipientId', FIELD_TYPES.id, ['ak', 'nm']), TX_FIELD('amount', FIELD_TYPES.int), TX_FIELD('fee', FIELD_TYPES.int), TX_FIELD('ttl', FIELD_TYPES.int), @@ -414,6 +434,17 @@ const NAME_CLAIM_TX = [ TX_FIELD('ttl', FIELD_TYPES.int) ] +const NAME_CLAIM_TX_2 = [ + ...BASE_TX, + TX_FIELD('accountId', FIELD_TYPES.id, 'ak'), + TX_FIELD('nonce', FIELD_TYPES.int), + TX_FIELD('name', FIELD_TYPES.binary, 'nm'), + TX_FIELD('nameSalt', FIELD_TYPES.int), + TX_FIELD('nameFee', FIELD_TYPES.int), + TX_FIELD('fee', FIELD_TYPES.int), + TX_FIELD('ttl', FIELD_TYPES.int) +] + const NAME_UPDATE_TX = [ ...BASE_TX, TX_FIELD('accountId', FIELD_TYPES.id, 'ak'), @@ -431,7 +462,7 @@ const NAME_TRANSFER_TX = [ TX_FIELD('accountId', FIELD_TYPES.id, 'ak'), TX_FIELD('nonce', FIELD_TYPES.int), TX_FIELD('nameId', FIELD_TYPES.id, 'nm'), - TX_FIELD('recipientId', FIELD_TYPES.id, 'ak'), + TX_FIELD('recipientId', FIELD_TYPES.id, ['ak', 'nm']), TX_FIELD('fee', FIELD_TYPES.int), TX_FIELD('ttl', FIELD_TYPES.int) ] @@ -501,7 +532,7 @@ const CONTRACT_CALL_TX = [ ...BASE_TX, TX_FIELD('callerId', FIELD_TYPES.id, 'ak'), TX_FIELD('nonce', FIELD_TYPES.int), - TX_FIELD('contractId', FIELD_TYPES.id, 'ct'), + TX_FIELD('contractId', FIELD_TYPES.id, ['ct', 'nm']), TX_FIELD('abiVersion', FIELD_TYPES.int), TX_FIELD('fee', FIELD_TYPES.int), TX_FIELD('ttl', FIELD_TYPES.int), @@ -541,7 +572,7 @@ const ORACLE_REGISTER_TX = [ const ORACLE_EXTEND_TX = [ ...BASE_TX, - TX_FIELD('oracleId', FIELD_TYPES.id, 'ok'), + TX_FIELD('oracleId', FIELD_TYPES.id, ['ok', 'nm']), TX_FIELD('nonce', FIELD_TYPES.int), TX_FIELD('oracleTtlType', FIELD_TYPES.int), TX_FIELD('oracleTtlValue', FIELD_TYPES.int), @@ -553,7 +584,7 @@ const ORACLE_QUERY_TX = [ ...BASE_TX, TX_FIELD('senderId', FIELD_TYPES.id, 'ak'), TX_FIELD('nonce', FIELD_TYPES.int), - TX_FIELD('oracleId', FIELD_TYPES.id, 'ok'), + TX_FIELD('oracleId', FIELD_TYPES.id, ['ok', 'nm']), TX_FIELD('query', FIELD_TYPES.string), TX_FIELD('queryFee', FIELD_TYPES.int), TX_FIELD('queryTtlType', FIELD_TYPES.int), @@ -841,7 +872,8 @@ export const TX_SERIALIZATION_SCHEMA = { 1: TX_SCHEMA_FIELD(NAME_PRE_CLAIM_TX, OBJECT_TAG_NAME_SERVICE_PRECLAIM_TRANSACTION) }, [TX_TYPE.nameClaim]: { - 1: TX_SCHEMA_FIELD(NAME_CLAIM_TX, OBJECT_TAG_NAME_SERVICE_CLAIM_TRANSACTION) + 1: TX_SCHEMA_FIELD(NAME_CLAIM_TX, OBJECT_TAG_NAME_SERVICE_CLAIM_TRANSACTION), + 2: TX_SCHEMA_FIELD(NAME_CLAIM_TX_2, OBJECT_TAG_NAME_SERVICE_CLAIM_TRANSACTION) }, [TX_TYPE.nameUpdate]: { 1: TX_SCHEMA_FIELD(NAME_UPDATE_TX, OBJECT_TAG_NAME_SERVICE_UPDATE_TRANSACTION) @@ -979,7 +1011,8 @@ export const TX_DESERIALIZATION_SCHEMA = { 1: TX_SCHEMA_FIELD(NAME_PRE_CLAIM_TX, OBJECT_TAG_NAME_SERVICE_PRECLAIM_TRANSACTION) }, [OBJECT_TAG_NAME_SERVICE_CLAIM_TRANSACTION]: { - 1: TX_SCHEMA_FIELD(NAME_CLAIM_TX, OBJECT_TAG_NAME_SERVICE_CLAIM_TRANSACTION) + 1: TX_SCHEMA_FIELD(NAME_CLAIM_TX, OBJECT_TAG_NAME_SERVICE_CLAIM_TRANSACTION), + 2: TX_SCHEMA_FIELD(NAME_CLAIM_TX_2, OBJECT_TAG_NAME_SERVICE_CLAIM_TRANSACTION) }, [OBJECT_TAG_NAME_SERVICE_UPDATE_TRANSACTION]: { 1: TX_SCHEMA_FIELD(NAME_UPDATE_TX, OBJECT_TAG_NAME_SERVICE_UPDATE_TRANSACTION) @@ -1102,7 +1135,8 @@ export const TX_DESERIALIZATION_SCHEMA = { }, [OBJECT_TAG_SOPHIA_BYTE_CODE]: { 1: TX_SCHEMA_FIELD(CONTRACT_BYTE_CODE_ROMA, OBJECT_TAG_SOPHIA_BYTE_CODE), - 2: TX_SCHEMA_FIELD(CONTRACT_BYTE_CODE_MINERVA, OBJECT_TAG_SOPHIA_BYTE_CODE) + 2: TX_SCHEMA_FIELD(CONTRACT_BYTE_CODE_MINERVA, OBJECT_TAG_SOPHIA_BYTE_CODE), + 3: TX_SCHEMA_FIELD(CONTRACT_BYTE_CODE_LIMA, OBJECT_TAG_SOPHIA_BYTE_CODE) } } diff --git a/es/tx/tx.js b/es/tx/tx.js index 6a8fea314b..30a1dfa8dc 100644 --- a/es/tx/tx.js +++ b/es/tx/tx.js @@ -28,7 +28,7 @@ import ChainNode from '../chain/node' import Tx from './' import { buildTx, calculateFee } from './builder' -import { MIN_GAS_PRICE, PROTOCOL_VM_ABI, TX_TYPE } from './builder/schema' +import { ABI_VERSIONS, MIN_GAS_PRICE, PROTOCOL_VM_ABI, TX_TYPE, VM_TYPE } from './builder/schema' import { buildContractId, oracleQueryId } from './builder/helpers' async function spendTx ({ senderId, recipientId, amount, payload = '' }) { @@ -69,13 +69,13 @@ async function namePreclaimTx ({ accountId, commitmentId }) { return tx } -async function nameClaimTx ({ accountId, name, nameSalt }) { +async function nameClaimTx ({ accountId, name, nameSalt, vsn = 2 }) { // Calculate fee, get absolute ttl (ttl + height), get account nonce - const { fee, ttl, nonce } = await this.prepareTxParams(TX_TYPE.nameClaim, { senderId: accountId, ...R.head(arguments) }) + const { fee, ttl, nonce } = await this.prepareTxParams(TX_TYPE.nameClaim, { senderId: accountId, ...R.head(arguments), vsn }) // Build transaction using sdk (if nativeMode) or build on `AETERNITY NODE` side const { tx } = this.nativeMode - ? buildTx(R.merge(R.head(arguments), { nonce, ttl, fee }), TX_TYPE.nameClaim) + ? buildTx(R.merge(R.head(arguments), { nonce, ttl, fee }), TX_TYPE.nameClaim, { vsn }) : await this.api.postNameClaim(R.merge(R.head(arguments), { nonce, ttl, fee: parseInt(fee) })) return tx @@ -117,7 +117,7 @@ async function nameRevokeTx ({ accountId, nameId }) { return tx } -async function contractCreateTx ({ ownerId, code, vmVersion, abiVersion, deposit, amount, gas, gasPrice = MIN_GAS_PRICE, callData }) { +async function contractCreateTx ({ ownerId, code, vmVersion, abiVersion, deposit, amount, gas, gasPrice = MIN_GAS_PRICE, callData, backend }) { // Get VM_ABI version const ctVersion = this.getVmVersion(TX_TYPE.contractCreate, R.head(arguments)) // Calculate fee, get absolute ttl (ttl + height), get account nonce @@ -131,7 +131,7 @@ async function contractCreateTx ({ ownerId, code, vmVersion, abiVersion, deposit : this.api.postContractCreate(R.merge(R.head(arguments), { nonce, ttl, fee: parseInt(fee), gas: parseInt(gas), gasPrice, vmVersion: ctVersion.vmVersion, abiVersion: ctVersion.abiVersion })) } -async function contractCallTx ({ callerId, contractId, abiVersion, amount, gas, gasPrice = MIN_GAS_PRICE, callData }) { +async function contractCallTx ({ callerId, contractId, abiVersion, amount, gas, gasPrice = MIN_GAS_PRICE, callData, backend }) { const ctVersion = this.getVmVersion(TX_TYPE.contractCall, R.head(arguments)) // Calculate fee, get absolute ttl (ttl + height), get account nonce const { fee, ttl, nonce } = await this.prepareTxParams(TX_TYPE.contractCall, { senderId: callerId, ...R.head(arguments), gasPrice, abiVersion: ctVersion.abiVersion }) @@ -151,16 +151,16 @@ async function contractCallTx ({ callerId, contractId, abiVersion, amount, gas, return tx } -async function oracleRegisterTx ({ accountId, queryFormat, responseFormat, queryFee, oracleTtl, abiVersion }) { - const { abiVersion: abi } = this.getVmVersion(TX_TYPE.oracleRegister, R.head(arguments)) +async function oracleRegisterTx ({ accountId, queryFormat, responseFormat, queryFee, oracleTtl, abiVersion = ABI_VERSIONS.NO_ABI }) { + // const { abiVersion: abi } = this.getVmVersion(TX_TYPE.oracleRegister, R.head(arguments)) // Calculate fee, get absolute ttl (ttl + height), get account nonce - const { fee, ttl, nonce } = await this.prepareTxParams(TX_TYPE.oracleRegister, { senderId: accountId, ...R.head(arguments), abiVersion: abi }) + const { fee, ttl, nonce } = await this.prepareTxParams(TX_TYPE.oracleRegister, { senderId: accountId, ...R.head(arguments), abiVersion }) // Build transaction using sdk (if nativeMode) or build on `AETERNITY NODE` side const { tx } = this.nativeMode ? buildTx({ accountId, queryFee, - abiVersion: abi, + abiVersion, fee, oracleTtl, nonce, @@ -171,7 +171,7 @@ async function oracleRegisterTx ({ accountId, queryFormat, responseFormat, query : await this.api.postOracleRegister({ accountId, queryFee, - abiVersion: abi, + abiVersion, fee: parseInt(fee), oracleTtl, nonce, @@ -339,7 +339,7 @@ async function channelSnapshotSoloTx ({ channelId, fromId, payload }) { } // eslint-disable-next-line no-unused-vars -async function gaAttachTx ({ ownerId, code, vmVersion, abiVersion, authFun, gas, gasPrice = MIN_GAS_PRICE, callData }) { +async function gaAttachTx ({ ownerId, code, vmVersion, abiVersion, authFun, gas, gasPrice = MIN_GAS_PRICE, callData, backend }) { // Get VM_ABI version const ctVersion = this.getVmVersion(TX_TYPE.contractCreate, R.head(arguments)) // Calculate fee, get absolute ttl (ttl + height), get account nonce @@ -356,21 +356,31 @@ async function gaAttachTx ({ ownerId, code, vmVersion, abiVersion, authFun, gas, * * @param {string} txType Type of transaction * @param {object} vmAbi Object with vm and abi version fields - * @return {object} Object with vm/abi version ({ vmVersion: number, abiVersion: number }) + * @return {object} Object with vm/abi version ({ vmVersion: number, abiVersion: number, backend: string }) */ -function getVmVersion (txType, { vmVersion, abiVersion } = {}) { - const version = this.getNodeInfo().consensusProtocolVersion - const supportedProtocol = PROTOCOL_VM_ABI[version] +function getVmVersion (txType, { vmVersion, abiVersion, backend } = {}) { + const { consensusProtocolVersion } = this.getNodeInfo() + const supportedProtocol = PROTOCOL_VM_ABI[consensusProtocolVersion] if (!supportedProtocol) throw new Error('Not supported consensus protocol version') const protocolForTX = supportedProtocol[txType] if (!protocolForTX) throw new Error('Not supported tx type') + // TODO remove + // Cross node/compiler compatibility + if (this.compilerVersion) { + const [compilerMajor] = this.compilerVersion.split('.') + if (+compilerMajor === 4 && consensusProtocolVersion !== 4) throw new Error(`Compiler ${this.compilerVersion} support only consensus protocol 4(Lima)`) + if (+compilerMajor <= 3 && consensusProtocolVersion > 3) throw new Error(`Compiler ${this.compilerVersion} support only consensus protocol less then 3(Fortuna)`) + if (backend === VM_TYPE.FATE && consensusProtocolVersion < 4) throw new Error('You can use FATE only after Lima HF') + backend = backend || this.compilerOptions.backend + } + const ctVersion = { - abiVersion: abiVersion !== undefined ? abiVersion : protocolForTX.abiVersion[0], - vmVersion: vmVersion !== undefined ? vmVersion : protocolForTX.vmVersion[0] + abiVersion: abiVersion !== undefined ? abiVersion : backend === VM_TYPE.AEVM ? protocolForTX.abiVersion[1] : backend === VM_TYPE.FATE ? protocolForTX.abiVersion[0] : protocolForTX.abiVersion[0], + vmVersion: vmVersion !== undefined ? vmVersion : backend === VM_TYPE.AEVM ? protocolForTX.vmVersion[1] : backend === VM_TYPE.FATE ? protocolForTX.vmVersion[0] : protocolForTX.vmVersion[0] } if (protocolForTX.vmVersion.length && !R.contains(ctVersion.vmVersion, protocolForTX.vmVersion)) throw new Error(`VM VERSION ${ctVersion.vmVersion} do not support by this node. Supported: [${protocolForTX.vmVersion}]`) - if (!R.contains(ctVersion.abiVersion, protocolForTX.abiVersion)) throw new Error(`ABI VERSION ${ctVersion.abiVersion} do not support by this node. Supported: [${protocolForTX.abiVersion}]`) + if (protocolForTX.abiVersion.length && !R.contains(ctVersion.abiVersion, protocolForTX.abiVersion)) throw new Error(`ABI VERSION ${ctVersion.abiVersion} do not support by this node. Supported: [${protocolForTX.abiVersion}]`) return ctVersion } @@ -413,7 +423,7 @@ async function getAccountNonce (accountId, nonce) { * @param {Object} params Object which contains all tx data * @return {Object} { ttl, nonce, fee } Object with account nonce, absolute ttl and transaction fee */ -async function prepareTxParams (txType, { senderId, nonce: n, ttl: t, fee: f, gas, absoluteTtl }) { +async function prepareTxParams (txType, { senderId, nonce: n, ttl: t, fee: f, gas, absoluteTtl, vsn }) { const account = await this.getAccount(senderId).catch(e => ({ nonce: 0 })) // Is GA account if (account.contractId) { @@ -422,7 +432,7 @@ async function prepareTxParams (txType, { senderId, nonce: n, ttl: t, fee: f, ga n = n || (account.nonce + 1) } const ttl = await (calculateTtl.bind(this)(t, !absoluteTtl)) - const fee = calculateFee(f, txType, { showWarning: this.showWarning, gas, params: R.merge(R.last(arguments), { nonce: n, ttl }) }) + const fee = calculateFee(f, txType, { showWarning: this.showWarning, gas, params: R.merge(R.last(arguments), { nonce: n, ttl }), vsn }) return { fee, ttl, nonce: n } } @@ -474,8 +484,7 @@ const Transaction = ChainNode.compose(Tx, { channelSlashTx, channelSettleTx, channelSnapshotSoloTx, - // Todo Enable GA - // gaAttachTx, + gaAttachTx, getAccountNonce, getVmVersion } diff --git a/es/utils/swagger.js b/es/utils/swagger.js index acff207989..c46f3ad2d3 100644 --- a/es/utils/swagger.js +++ b/es/utils/swagger.js @@ -327,12 +327,32 @@ function assertOne (coll) { */ function destructureClientError (error) { const { method, url } = error.config - const { status, data } = error.response - const reason = R.has('reason', data) ? data.reason : R.toString(data) + const { status, data, statusText } = error.response + const reason = R.has('reason', data) ? data.reason : data ? R.toString(data) : statusText return `${method.toUpperCase()} to ${url} failed with ${status}: ${reason}` } +/** + * Resolve reference + * @rtype (ref: String, swag: Object) => Object + * @param {String} ref - Reference to resolve + * @param {Object} swag + * @return {Object} Resolved reference definition + */ +function resolveRef (ref, swag) { + const match = ref.match(/^#\/(.+)$/) + // eslint-disable-next-line no-void + if (match !== void 0) { + const value = R.path(match[1].split('/'), swag) + if (value != null) { + return value + } + } + + throw Error(`Could not resolve reference: ${ref}`) +} + /** * Generate callable operation * @function @@ -344,11 +364,13 @@ function destructureClientError (error) { * @param {Object} types - Swagger types * @return {Function} */ -const operation = (path, method, definition, types, { config, errorHandler } = {}) => { +const operation = (path, method, definition, swag, { config, errorHandler } = {}) => { config = config || {} delete config.transformResponse // Prevent of overwriting transform response const { operationId, description } = definition - const { parameters } = definition + const parameters = (definition.parameters || []).map(param => + param.$ref ? resolveRef(param.$ref, swag) : param + ) const name = `${R.head(operationId).toLowerCase()}${R.drop(1, operationId)}` const pascalized = pascalizeParameters(parameters) @@ -381,7 +403,7 @@ const operation = (path, method, definition, types, { config, errorHandler } = { const values = R.merge(R.reject(R.isNil, R.pick(optNames, opt)), R.zipObj(R.pluck('name', req), arg)) const conformed = R.mapObjIndexed((val, key) => { try { - return conform(val, indexedParameters[key], types) + return conform(val, indexedParameters[key], swag.definitions) } catch (e) { const path = [key].concat(e.path || []) throw Object.assign(e, { @@ -408,7 +430,7 @@ const operation = (path, method, definition, types, { config, errorHandler } = { try { const response = await client(`${url}${expandedPath}`, params).catch(this.axiosError(errorHandler)) - // return opt.fullResponse ? response : conform(pascalizeKeys(response.data), responses['200'], types) + // return opt.fullResponse ? response : conform(pascalizeKeys(response.data), responses['200'], swag.definitions) return opt.fullResponse ? response : pascalizeKeys(response.data) } catch (e) { if (R.path(['response', 'data'], e)) { @@ -453,7 +475,7 @@ const operation = (path, method, definition, types, { config, errorHandler } = { */ const Swagger = stampit({ init ({ swag = this.swag, axiosConfig }, { stamp }) { - const { paths, definitions } = swag + const { paths } = swag const methods = R.indexBy( R.prop('name'), R.flatten( @@ -461,7 +483,7 @@ const Swagger = stampit({ R.mapObjIndexed( (methods, path) => R.values( R.mapObjIndexed((definition, method) => { - const op = operation(path, method, definition, definitions, axiosConfig) + const op = operation(path, method, definition, swag, axiosConfig) return op(this, this.urlFor(swag.basePath, definition)) }, methods)), paths diff --git a/examples/README.md b/examples/README.md index 5556d76fde..d62cba76ae 100644 --- a/examples/README.md +++ b/examples/README.md @@ -117,7 +117,7 @@ Wallet({ ### 2. Aepp Example (Aepp <--> Wallet via RPC) > interact with aeternity's blockchain's [**Aepp flavor**](docs/usage.md) – For _Aepps_ development AKA DApp development -> You can find a more [complete example using VueJS here](browser/connect-two-ae) +> You can find a more [complete example using VueJS here](browser/vuejs/connect-two-ae/README.md) ```js diff --git a/examples/browser/vuejs/connect-two-ae/aepp/package.json b/examples/browser/vuejs/connect-two-ae/aepp/package.json index db89a3e6cf..bc46a109b4 100644 --- a/examples/browser/vuejs/connect-two-ae/aepp/package.json +++ b/examples/browser/vuejs/connect-two-ae/aepp/package.json @@ -13,7 +13,7 @@ "author": "Enrico Icardi ", "license": "ISC", "dependencies": { - "@aeternity/aepp-sdk": "4.6.0", + "@aeternity/aepp-sdk": "4.7.0", "purgecss-webpack-plugin": "^1.2.0", "vue": "^2.5.16", "vue-router": "^3.0.1", @@ -21,15 +21,15 @@ "vuex": "^3.0.1" }, "devDependencies": { - "@babel/cli": "7.6.0", - "@babel/core": "7.6.0", - "@babel/node": "7.6.1", + "@babel/cli": "7.6.2", + "@babel/core": "7.6.2", + "@babel/node": "7.6.2", "@babel/plugin-proposal-export-default-from": "7.5.2", - "@babel/plugin-proposal-object-rest-spread": "7.5.5", - "@babel/plugin-transform-runtime": "7.6.0", - "@babel/preset-env": "7.6.0", - "@babel/register": "7.6.0", - "@babel/runtime": "7.6.0", + "@babel/plugin-proposal-object-rest-spread": "7.6.2", + "@babel/plugin-transform-runtime": "7.6.2", + "@babel/preset-env": "7.6.2", + "@babel/register": "7.6.2", + "@babel/runtime": "7.6.2", "autoprefixer": "^9.0.2", "babel-core": "^7.0.0-beta.3", "babel-loader": "^8.0.0-beta.3", diff --git a/examples/browser/vuejs/connect-two-ae/identity/package.json b/examples/browser/vuejs/connect-two-ae/identity/package.json index db89a3e6cf..bc46a109b4 100644 --- a/examples/browser/vuejs/connect-two-ae/identity/package.json +++ b/examples/browser/vuejs/connect-two-ae/identity/package.json @@ -13,7 +13,7 @@ "author": "Enrico Icardi ", "license": "ISC", "dependencies": { - "@aeternity/aepp-sdk": "4.6.0", + "@aeternity/aepp-sdk": "4.7.0", "purgecss-webpack-plugin": "^1.2.0", "vue": "^2.5.16", "vue-router": "^3.0.1", @@ -21,15 +21,15 @@ "vuex": "^3.0.1" }, "devDependencies": { - "@babel/cli": "7.6.0", - "@babel/core": "7.6.0", - "@babel/node": "7.6.1", + "@babel/cli": "7.6.2", + "@babel/core": "7.6.2", + "@babel/node": "7.6.2", "@babel/plugin-proposal-export-default-from": "7.5.2", - "@babel/plugin-proposal-object-rest-spread": "7.5.5", - "@babel/plugin-transform-runtime": "7.6.0", - "@babel/preset-env": "7.6.0", - "@babel/register": "7.6.0", - "@babel/runtime": "7.6.0", + "@babel/plugin-proposal-object-rest-spread": "7.6.2", + "@babel/plugin-transform-runtime": "7.6.2", + "@babel/preset-env": "7.6.2", + "@babel/register": "7.6.2", + "@babel/runtime": "7.6.2", "autoprefixer": "^9.0.2", "babel-core": "^7.0.0-beta.3", "babel-loader": "^8.0.0-beta.3", diff --git a/examples/browser/vuejs/connect-two-ae/identity/src/components/Home.vue b/examples/browser/vuejs/connect-two-ae/identity/src/components/Home.vue index 5edda7099a..2b70d8b7d4 100644 --- a/examples/browser/vuejs/connect-two-ae/identity/src/components/Home.vue +++ b/examples/browser/vuejs/connect-two-ae/identity/src/components/Home.vue @@ -44,15 +44,14 @@ diff --git a/package-lock.json b/package-lock.json index 2cf6b9a1ed..910d4e1c7e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aeternity/aepp-sdk", - "version": "4.6.0", + "version": "5.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -16,12 +16,12 @@ } }, "@babel/cli": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/@babel/cli/-/cli-7.5.5.tgz", - "integrity": "sha512-UHI+7pHv/tk9g6WXQKYz+kmXTI77YtuY3vqC59KIqcoWEjsJJSG6rAxKaLsgj3LDyadsPrCB929gVOKM6Hui0w==", + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/@babel/cli/-/cli-7.6.2.tgz", + "integrity": "sha512-JDZ+T/br9pPfT2lmAMJypJDTTTHM9ePD/ED10TRjRzJVdEVy+JB3iRlhzYmTt5YkNgHvxWGlUVnLtdv6ruiDrQ==", "dev": true, "requires": { - "chokidar": "^2.0.4", + "chokidar": "^2.1.8", "commander": "^2.8.1", "convert-source-map": "^1.1.0", "fs-readdir-recursive": "^1.1.0", @@ -57,18 +57,18 @@ } }, "@babel/core": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.5.5.tgz", - "integrity": "sha512-i4qoSr2KTtce0DmkuuQBV4AuQgGPUcPXMr9L5MyYAtk06z068lQ10a4O009fe5OB/DfNV+h+qqT7ddNV8UnRjg==", + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.6.2.tgz", + "integrity": "sha512-l8zto/fuoZIbncm+01p8zPSDZu/VuuJhAfA7d/AbzM09WR7iVhavvfNDYCNpo1VvLk6E6xgAoP9P+/EMJHuRkQ==", "dev": true, "requires": { "@babel/code-frame": "^7.5.5", - "@babel/generator": "^7.5.5", - "@babel/helpers": "^7.5.5", - "@babel/parser": "^7.5.5", - "@babel/template": "^7.4.4", - "@babel/traverse": "^7.5.5", - "@babel/types": "^7.5.5", + "@babel/generator": "^7.6.2", + "@babel/helpers": "^7.6.2", + "@babel/parser": "^7.6.2", + "@babel/template": "^7.6.0", + "@babel/traverse": "^7.6.2", + "@babel/types": "^7.6.0", "convert-source-map": "^1.1.0", "debug": "^4.1.0", "json5": "^2.1.0", @@ -78,6 +78,23 @@ "source-map": "^0.5.0" }, "dependencies": { + "@babel/parser": { + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.6.2.tgz", + "integrity": "sha512-mdFqWrSPCmikBoaBYMuBulzTIKuXVPtEISFbRRVNwMWpCms/hmE2kRq0bblUHaNRKrjRlmVbx1sDHmjmRgD2Xg==", + "dev": true + }, + "@babel/types": { + "version": "7.6.1", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.6.1.tgz", + "integrity": "sha512-X7gdiuaCmA0uRjCmRtYJNAVCc/q+5xSgsfKJHqMN4iNLILX39677fJE1O40arPMh0TTtS9ItH67yre6c7k6t0g==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + }, "debug": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", @@ -102,18 +119,28 @@ } }, "@babel/generator": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.5.5.tgz", - "integrity": "sha512-ETI/4vyTSxTzGnU2c49XHv2zhExkv9JHLTwDAFz85kmcwuShvYG2H08FwgIguQf4JC75CBnXAUM5PqeF4fj0nQ==", + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.6.2.tgz", + "integrity": "sha512-j8iHaIW4gGPnViaIHI7e9t/Hl8qLjERI6DcV9kEpAIDJsAOrcnXqRS7t+QbhL76pwbtqP+QCQLL0z1CyVmtjjQ==", "dev": true, "requires": { - "@babel/types": "^7.5.5", + "@babel/types": "^7.6.0", "jsesc": "^2.5.1", "lodash": "^4.17.13", - "source-map": "^0.5.0", - "trim-right": "^1.0.1" + "source-map": "^0.5.0" }, "dependencies": { + "@babel/types": { + "version": "7.6.1", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.6.1.tgz", + "integrity": "sha512-X7gdiuaCmA0uRjCmRtYJNAVCc/q+5xSgsfKJHqMN4iNLILX39677fJE1O40arPMh0TTtS9ItH67yre6c7k6t0g==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + }, "source-map": { "version": "0.5.7", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.5.7.tgz", @@ -315,14 +342,27 @@ } }, "@babel/helpers": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.5.5.tgz", - "integrity": "sha512-nRq2BUhxZFnfEn/ciJuhklHvFOqjJUD5wpx+1bxUF2axL9C+v4DE/dmp5sT2dKnpOs4orZWzpAZqlCy8QqE/7g==", + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.6.2.tgz", + "integrity": "sha512-3/bAUL8zZxYs1cdX2ilEE0WobqbCmKWr/889lf2SS0PpDcpEIY8pb1CCyz0pEcX3pEb+MCbks1jIokz2xLtGTA==", "dev": true, "requires": { - "@babel/template": "^7.4.4", - "@babel/traverse": "^7.5.5", - "@babel/types": "^7.5.5" + "@babel/template": "^7.6.0", + "@babel/traverse": "^7.6.2", + "@babel/types": "^7.6.0" + }, + "dependencies": { + "@babel/types": { + "version": "7.6.1", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.6.1.tgz", + "integrity": "sha512-X7gdiuaCmA0uRjCmRtYJNAVCc/q+5xSgsfKJHqMN4iNLILX39677fJE1O40arPMh0TTtS9ItH67yre6c7k6t0g==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + } } }, "@babel/highlight": { @@ -337,16 +377,17 @@ } }, "@babel/node": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/@babel/node/-/node-7.5.5.tgz", - "integrity": "sha512-xsW6il+yY+lzXMsQuvIJNA7tU8ix/f4G6bDt4DrnCkVpsR6clk9XgEbp7QF+xGNDdoD7M7QYokCH83pm+UjD0w==", + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/@babel/node/-/node-7.6.2.tgz", + "integrity": "sha512-59UxvVtRpVpL5i0KTcw41FqLNPT/Jc9k/48Rq00wfN49lAIQeRKGwZ6xX1FWlCfcIGP+5l4rfZajORvmYkhfGg==", "dev": true, "requires": { - "@babel/polyfill": "^7.0.0", - "@babel/register": "^7.5.5", + "@babel/register": "^7.6.2", "commander": "^2.8.1", + "core-js": "^3.2.1", "lodash": "^4.17.13", "node-environment-flags": "^1.0.5", + "regenerator-runtime": "^0.13.3", "v8flags": "^3.1.1" }, "dependencies": { @@ -355,6 +396,12 @@ "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==", "dev": true + }, + "core-js": { + "version": "3.2.1", + "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.2.1.tgz", + "integrity": "sha512-Qa5XSVefSVPRxy2XfUC13WbvqkxhkwB3ve+pgCQveNgYzbM/UxZeu1dcOX/xr4UmfUd+muuvsaxilQzCyUurMw==", + "dev": true } } }, @@ -406,9 +453,9 @@ } }, "@babel/plugin-proposal-object-rest-spread": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.5.5.tgz", - "integrity": "sha512-F2DxJJSQ7f64FyTVl5cw/9MWn6naXGdk3Q3UhDbFEEHv+EilCPoeRD3Zh/Utx1CJz4uyKlQ4uH+bJPbEhMV7Zw==", + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.6.2.tgz", + "integrity": "sha512-LDBXlmADCsMZV1Y9OQwMc0MyGZ8Ta/zlD9N67BfQT8uYwkRswiu2hU6nJKrjrt/58aH/vqfQlR/9yId/7A2gWw==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0", @@ -426,14 +473,14 @@ } }, "@babel/plugin-proposal-unicode-property-regex": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.4.4.tgz", - "integrity": "sha512-j1NwnOqMG9mFUOH58JTFsA/+ZYzQLUZ/drqWUqxCYLGeu2JFZL8YrNC9hBxKmWtAuOCHPcRpgv7fhap09Fb4kA==", + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-unicode-property-regex/-/plugin-proposal-unicode-property-regex-7.6.2.tgz", + "integrity": "sha512-NxHETdmpeSCtiatMRYWVJo7266rrvAC3DTeG5exQBIH/fMIUK7ejDNznBbn3HQl/o9peymRRg7Yqkx6PdUXmMw==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0", "@babel/helper-regex": "^7.4.4", - "regexpu-core": "^4.5.4" + "regexpu-core": "^4.6.0" } }, "@babel/plugin-syntax-async-generators": { @@ -520,9 +567,9 @@ } }, "@babel/plugin-transform-block-scoping": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.5.5.tgz", - "integrity": "sha512-82A3CLRRdYubkG85lKwhZB0WZoHxLGsJdux/cOVaJCJpvYFl1LVzAIFyRsa7CvXqW8rBM4Zf3Bfn8PHt5DP0Sg==", + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-block-scoping/-/plugin-transform-block-scoping-7.6.2.tgz", + "integrity": "sha512-zZT8ivau9LOQQaOGC7bQLQOT4XPkPXgN2ERfUgk1X8ql+mVkLc4E8eKk+FO3o0154kxzqenWCorfmEXpEZcrSQ==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0", @@ -555,23 +602,23 @@ } }, "@babel/plugin-transform-destructuring": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.5.0.tgz", - "integrity": "sha512-YbYgbd3TryYYLGyC7ZR+Tq8H/+bCmwoaxHfJHupom5ECstzbRLTch6gOQbhEY9Z4hiCNHEURgq06ykFv9JZ/QQ==", + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-destructuring/-/plugin-transform-destructuring-7.6.0.tgz", + "integrity": "sha512-2bGIS5P1v4+sWTCnKNDZDxbGvEqi0ijeqM/YqHtVGrvG2y0ySgnEEhXErvE9dA0bnIzY9bIzdFK0jFA46ASIIQ==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0" } }, "@babel/plugin-transform-dotall-regex": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.4.4.tgz", - "integrity": "sha512-P05YEhRc2h53lZDjRPk/OektxCVevFzZs2Gfjd545Wde3k+yFDbXORgl2e0xpbq8mLcKJ7Idss4fAg0zORN/zg==", + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-dotall-regex/-/plugin-transform-dotall-regex-7.6.2.tgz", + "integrity": "sha512-KGKT9aqKV+9YMZSkowzYoYEiHqgaDhGmPNZlZxX6UeHC4z30nC1J9IrZuGqbYFB1jaIGdv91ujpze0exiVK8bA==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0", "@babel/helper-regex": "^7.4.4", - "regexpu-core": "^4.5.4" + "regexpu-core": "^4.6.0" } }, "@babel/plugin-transform-duplicate-keys": { @@ -642,9 +689,9 @@ } }, "@babel/plugin-transform-modules-commonjs": { - "version": "7.5.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.5.0.tgz", - "integrity": "sha512-xmHq0B+ytyrWJvQTc5OWAC4ii6Dhr0s22STOoydokG51JjWhyYo5mRPXoi+ZmtHQhZZwuXNN+GG5jy5UZZJxIQ==", + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-modules-commonjs/-/plugin-transform-modules-commonjs-7.6.0.tgz", + "integrity": "sha512-Ma93Ix95PNSEngqomy5LSBMAQvYKVe3dy+JlVJSHEXZR5ASL9lQBedMiCyVtmTLraIDVRE3ZjTZvmXXD2Ozw3g==", "dev": true, "requires": { "@babel/helper-module-transforms": "^7.4.4", @@ -675,12 +722,12 @@ } }, "@babel/plugin-transform-named-capturing-groups-regex": { - "version": "7.4.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.4.5.tgz", - "integrity": "sha512-z7+2IsWafTBbjNsOxU/Iv5CvTJlr5w4+HGu1HovKYTtgJ362f7kBcQglkfmlspKKZ3bgrbSGvLfNx++ZJgCWsg==", + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-named-capturing-groups-regex/-/plugin-transform-named-capturing-groups-regex-7.6.2.tgz", + "integrity": "sha512-xBdB+XOs+lgbZc2/4F5BVDVcDNS4tcSKQc96KmlqLEAwz6tpYPEvPdmDfvVG0Ssn8lAhronaRs6Z6KSexIpK5g==", "dev": true, "requires": { - "regexp-tree": "^0.1.6" + "regexpu-core": "^4.6.0" } }, "@babel/plugin-transform-new-target": { @@ -741,9 +788,9 @@ } }, "@babel/plugin-transform-runtime": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.5.5.tgz", - "integrity": "sha512-6Xmeidsun5rkwnGfMOp6/z9nSzWpHFNVr2Jx7kwoq4mVatQfQx5S56drBgEHF+XQbKOdIaOiMIINvp/kAwMN+w==", + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.6.2.tgz", + "integrity": "sha512-cqULw/QB4yl73cS5Y0TZlQSjDvNkzDbu0FurTZyHlJpWE5T3PCMdnyV+xXoH1opr1ldyHODe3QAX3OMAii5NxA==", "dev": true, "requires": { "@babel/helper-module-imports": "^7.0.0", @@ -762,9 +809,9 @@ } }, "@babel/plugin-transform-spread": { - "version": "7.2.2", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.2.2.tgz", - "integrity": "sha512-KWfky/58vubwtS0hLqEnrWJjsMGaOeSBn90Ezn5Jeg9Z8KKHmELbP1yGylMlm5N6TPKeY9A2+UaSYLdxahg01w==", + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-spread/-/plugin-transform-spread-7.6.2.tgz", + "integrity": "sha512-DpSvPFryKdK1x+EDJYCy28nmAaIMdxmhot62jAXF/o99iA33Zj2Lmcp3vDmz+MUh0LNYVPvfj5iC3feb3/+PFg==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0" @@ -800,30 +847,20 @@ } }, "@babel/plugin-transform-unicode-regex": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.4.4.tgz", - "integrity": "sha512-il+/XdNw01i93+M9J9u4T7/e/Ue/vWfNZE4IRUQjplu2Mqb/AFTDimkw2tdEdSH50wuQXZAbXSql0UphQke+vA==", + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-regex/-/plugin-transform-unicode-regex-7.6.2.tgz", + "integrity": "sha512-orZI6cWlR3nk2YmYdb0gImrgCUwb5cBUwjf6Ks6dvNVvXERkwtJWOQaEOjPiu0Gu1Tq6Yq/hruCZZOOi9F34Dw==", "dev": true, "requires": { "@babel/helper-plugin-utils": "^7.0.0", "@babel/helper-regex": "^7.4.4", - "regexpu-core": "^4.5.4" - } - }, - "@babel/polyfill": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/polyfill/-/polyfill-7.4.4.tgz", - "integrity": "sha512-WlthFLfhQQhh+A2Gn5NSFl0Huxz36x86Jn+E9OW7ibK8edKPq+KLy4apM1yDpQ8kJOVi1OVjpP4vSDLdrI04dg==", - "dev": true, - "requires": { - "core-js": "^2.6.5", - "regenerator-runtime": "^0.13.2" + "regexpu-core": "^4.6.0" } }, "@babel/preset-env": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.5.5.tgz", - "integrity": "sha512-GMZQka/+INwsMz1A5UEql8tG015h5j/qjptpKY2gJ7giy8ohzU710YciJB5rcKsWGWHiW3RUnHib0E5/m3Tp3A==", + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/@babel/preset-env/-/preset-env-7.6.2.tgz", + "integrity": "sha512-Ru7+mfzy9M1/YTEtlDS8CD45jd22ngb9tXnn64DvQK3ooyqSw9K4K9DUWmYknTTVk4TqygL9dqCrZgm1HMea/Q==", "dev": true, "requires": { "@babel/helper-module-imports": "^7.0.0", @@ -831,9 +868,9 @@ "@babel/plugin-proposal-async-generator-functions": "^7.2.0", "@babel/plugin-proposal-dynamic-import": "^7.5.0", "@babel/plugin-proposal-json-strings": "^7.2.0", - "@babel/plugin-proposal-object-rest-spread": "^7.5.5", + "@babel/plugin-proposal-object-rest-spread": "^7.6.2", "@babel/plugin-proposal-optional-catch-binding": "^7.2.0", - "@babel/plugin-proposal-unicode-property-regex": "^7.4.4", + "@babel/plugin-proposal-unicode-property-regex": "^7.6.2", "@babel/plugin-syntax-async-generators": "^7.2.0", "@babel/plugin-syntax-dynamic-import": "^7.2.0", "@babel/plugin-syntax-json-strings": "^7.2.0", @@ -842,11 +879,11 @@ "@babel/plugin-transform-arrow-functions": "^7.2.0", "@babel/plugin-transform-async-to-generator": "^7.5.0", "@babel/plugin-transform-block-scoped-functions": "^7.2.0", - "@babel/plugin-transform-block-scoping": "^7.5.5", + "@babel/plugin-transform-block-scoping": "^7.6.2", "@babel/plugin-transform-classes": "^7.5.5", "@babel/plugin-transform-computed-properties": "^7.2.0", - "@babel/plugin-transform-destructuring": "^7.5.0", - "@babel/plugin-transform-dotall-regex": "^7.4.4", + "@babel/plugin-transform-destructuring": "^7.6.0", + "@babel/plugin-transform-dotall-regex": "^7.6.2", "@babel/plugin-transform-duplicate-keys": "^7.5.0", "@babel/plugin-transform-exponentiation-operator": "^7.2.0", "@babel/plugin-transform-for-of": "^7.4.4", @@ -854,10 +891,10 @@ "@babel/plugin-transform-literals": "^7.2.0", "@babel/plugin-transform-member-expression-literals": "^7.2.0", "@babel/plugin-transform-modules-amd": "^7.5.0", - "@babel/plugin-transform-modules-commonjs": "^7.5.0", + "@babel/plugin-transform-modules-commonjs": "^7.6.0", "@babel/plugin-transform-modules-systemjs": "^7.5.0", "@babel/plugin-transform-modules-umd": "^7.2.0", - "@babel/plugin-transform-named-capturing-groups-regex": "^7.4.5", + "@babel/plugin-transform-named-capturing-groups-regex": "^7.6.2", "@babel/plugin-transform-new-target": "^7.4.4", "@babel/plugin-transform-object-super": "^7.5.5", "@babel/plugin-transform-parameters": "^7.4.4", @@ -865,26 +902,38 @@ "@babel/plugin-transform-regenerator": "^7.4.5", "@babel/plugin-transform-reserved-words": "^7.2.0", "@babel/plugin-transform-shorthand-properties": "^7.2.0", - "@babel/plugin-transform-spread": "^7.2.0", + "@babel/plugin-transform-spread": "^7.6.2", "@babel/plugin-transform-sticky-regex": "^7.2.0", "@babel/plugin-transform-template-literals": "^7.4.4", "@babel/plugin-transform-typeof-symbol": "^7.2.0", - "@babel/plugin-transform-unicode-regex": "^7.4.4", - "@babel/types": "^7.5.5", + "@babel/plugin-transform-unicode-regex": "^7.6.2", + "@babel/types": "^7.6.0", "browserslist": "^4.6.0", "core-js-compat": "^3.1.1", "invariant": "^2.2.2", "js-levenshtein": "^1.1.3", "semver": "^5.5.0" + }, + "dependencies": { + "@babel/types": { + "version": "7.6.1", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.6.1.tgz", + "integrity": "sha512-X7gdiuaCmA0uRjCmRtYJNAVCc/q+5xSgsfKJHqMN4iNLILX39677fJE1O40arPMh0TTtS9ItH67yre6c7k6t0g==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + } } }, "@babel/register": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/@babel/register/-/register-7.5.5.tgz", - "integrity": "sha512-pdd5nNR+g2qDkXZlW1yRCWFlNrAn2PPdnZUB72zjX4l1Vv4fMRRLwyf+n/idFCLI1UgVGboUU8oVziwTBiyNKQ==", + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/@babel/register/-/register-7.6.2.tgz", + "integrity": "sha512-xgZk2LRZvt6i2SAUWxc7ellk4+OYRgS3Zpsnr13nMS1Qo25w21Uu8o6vTOAqNaxiqrnv30KTYzh9YWY2k21CeQ==", "dev": true, "requires": { - "core-js": "^3.0.0", "find-cache-dir": "^2.0.0", "lodash": "^4.17.13", "mkdirp": "^0.5.1", @@ -892,12 +941,6 @@ "source-map-support": "^0.5.9" }, "dependencies": { - "core-js": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.2.1.tgz", - "integrity": "sha512-Qa5XSVefSVPRxy2XfUC13WbvqkxhkwB3ve+pgCQveNgYzbM/UxZeu1dcOX/xr4UmfUd+muuvsaxilQzCyUurMw==", - "dev": true - }, "find-cache-dir": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-2.1.0.tgz", @@ -912,41 +955,77 @@ } }, "@babel/runtime": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.5.5.tgz", - "integrity": "sha512-28QvEGyQyNkB0/m2B4FU7IEZGK2NUrcMtT6BZEFALTguLk+AUT6ofsHtPk5QyjAdUkpMJ+/Em+quwz4HOt30AQ==", + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.6.2.tgz", + "integrity": "sha512-EXxN64agfUqqIGeEjI5dL5z0Sw0ZwWo1mLTi4mQowCZ42O59b7DRpZAnTC6OqdF28wMBMFKNb/4uFGrVaigSpg==", "requires": { "regenerator-runtime": "^0.13.2" } }, "@babel/template": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.4.4.tgz", - "integrity": "sha512-CiGzLN9KgAvgZsnivND7rkA+AeJ9JB0ciPOD4U59GKbQP2iQl+olF1l76kJOupqidozfZ32ghwBEJDhnk9MEcw==", + "version": "7.6.0", + "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.6.0.tgz", + "integrity": "sha512-5AEH2EXD8euCk446b7edmgFdub/qfH1SN6Nii3+fyXP807QRx9Q73A2N5hNwRRslC2H9sNzaFhsPubkS4L8oNQ==", "dev": true, "requires": { "@babel/code-frame": "^7.0.0", - "@babel/parser": "^7.4.4", - "@babel/types": "^7.4.4" + "@babel/parser": "^7.6.0", + "@babel/types": "^7.6.0" + }, + "dependencies": { + "@babel/parser": { + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.6.2.tgz", + "integrity": "sha512-mdFqWrSPCmikBoaBYMuBulzTIKuXVPtEISFbRRVNwMWpCms/hmE2kRq0bblUHaNRKrjRlmVbx1sDHmjmRgD2Xg==", + "dev": true + }, + "@babel/types": { + "version": "7.6.1", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.6.1.tgz", + "integrity": "sha512-X7gdiuaCmA0uRjCmRtYJNAVCc/q+5xSgsfKJHqMN4iNLILX39677fJE1O40arPMh0TTtS9ItH67yre6c7k6t0g==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + } } }, "@babel/traverse": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.5.5.tgz", - "integrity": "sha512-MqB0782whsfffYfSjH4TM+LMjrJnhCNEDMDIjeTpl+ASaUvxcjoiVCo/sM1GhS1pHOXYfWVCYneLjMckuUxDaQ==", + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.6.2.tgz", + "integrity": "sha512-8fRE76xNwNttVEF2TwxJDGBLWthUkHWSldmfuBzVRmEDWOtu4XdINTgN7TDWzuLg4bbeIMLvfMFD9we5YcWkRQ==", "dev": true, "requires": { "@babel/code-frame": "^7.5.5", - "@babel/generator": "^7.5.5", + "@babel/generator": "^7.6.2", "@babel/helper-function-name": "^7.1.0", "@babel/helper-split-export-declaration": "^7.4.4", - "@babel/parser": "^7.5.5", - "@babel/types": "^7.5.5", + "@babel/parser": "^7.6.2", + "@babel/types": "^7.6.0", "debug": "^4.1.0", "globals": "^11.1.0", "lodash": "^4.17.13" }, "dependencies": { + "@babel/parser": { + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.6.2.tgz", + "integrity": "sha512-mdFqWrSPCmikBoaBYMuBulzTIKuXVPtEISFbRRVNwMWpCms/hmE2kRq0bblUHaNRKrjRlmVbx1sDHmjmRgD2Xg==", + "dev": true + }, + "@babel/types": { + "version": "7.6.1", + "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.6.1.tgz", + "integrity": "sha512-X7gdiuaCmA0uRjCmRtYJNAVCc/q+5xSgsfKJHqMN4iNLILX39677fJE1O40arPMh0TTtS9ItH67yre6c7k6t0g==", + "dev": true, + "requires": { + "esutils": "^2.0.2", + "lodash": "^4.17.13", + "to-fast-properties": "^2.0.0" + } + }, "debug": { "version": "4.1.1", "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", @@ -2386,14 +2465,14 @@ } }, "browserslist": { - "version": "4.6.6", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.6.6.tgz", - "integrity": "sha512-D2Nk3W9JL9Fp/gIcWei8LrERCS+eXu9AM5cfXA8WEZ84lFks+ARnZ0q/R69m2SV3Wjma83QDDPxsNKXUwdIsyA==", + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.7.0.tgz", + "integrity": "sha512-9rGNDtnj+HaahxiVV38Gn8n8Lr8REKsel68v1sPFfIGEK6uSXTY3h9acgiT1dZVtOOUtifo/Dn8daDQ5dUgVsA==", "dev": true, "requires": { - "caniuse-lite": "^1.0.30000984", - "electron-to-chromium": "^1.3.191", - "node-releases": "^1.1.25" + "caniuse-lite": "^1.0.30000989", + "electron-to-chromium": "^1.3.247", + "node-releases": "^1.1.29" } }, "bs58": { @@ -2586,9 +2665,9 @@ "integrity": "sha1-MvxLn82vhF/N9+c7uXysImHwqwo=" }, "caniuse-lite": { - "version": "1.0.30000989", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000989.tgz", - "integrity": "sha512-vrMcvSuMz16YY6GSVZ0dWDTJP8jqk3iFQ/Aq5iqblPwxSVVZI+zxDyTX0VPqtQsDnfdrBDcsmhgTEOh5R8Lbpw==", + "version": "1.0.30000997", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30000997.tgz", + "integrity": "sha512-BQLFPIdj2ntgBNWp9Q64LGUIEmvhKkzzHhUHR3CD5A9Lb7ZKF20/+sgadhFap69lk5XmK1fTUleDclaRFvgVUA==", "dev": true }, "caseless": { @@ -2740,12 +2819,6 @@ "safe-buffer": "^5.0.1" } }, - "circular-json": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/circular-json/-/circular-json-0.3.3.tgz", - "integrity": "sha512-UZK3NBx2Mca+b5LsG7bY183pHWt5Y1xts4P3Pz7ENTwGVnJOUWbRb3ocjvX7hx9tq/yTAdclXm9sZ38gNuem4A==", - "dev": true - }, "class-utils": { "version": "0.3.6", "resolved": "https://registry.npmjs.org/class-utils/-/class-utils-0.3.6.tgz", @@ -2878,9 +2951,9 @@ "integrity": "sha512-qiBjkpbMLO/HL68y+lh4q0/O1MZFj2RX6X/KmMa3+gJD3z+WwI1ZzDHysvqHGS3mP6mznPckpXmw1nI9cJjyRg==" }, "colors": { - "version": "1.3.3", - "resolved": "https://registry.npmjs.org/colors/-/colors-1.3.3.tgz", - "integrity": "sha512-mmGt/1pZqYRjMxB1axhTo16/snVZ5krrKkcmMeVKxzECMMXoCgnvTPp10QgHfcbQZw8Dq2jMNG6je4JlWU0gWg==", + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz", + "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==", "dev": true }, "combined-stream": { @@ -3523,23 +3596,23 @@ } }, "deglob": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/deglob/-/deglob-2.1.1.tgz", - "integrity": "sha512-2kjwuGGonL7gWE1XU4Fv79+vVzpoQCl0V+boMwWtOQJV2AGDabCwez++nB1Nli/8BabAfZQ/UuHPlp6AymKdWw==", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/deglob/-/deglob-4.0.1.tgz", + "integrity": "sha512-/g+RDZ7yf2HvoW+E5Cy+K94YhgcFgr6C8LuHZD1O5HoNPkf3KY6RfXJ0DBGlB/NkLi5gml+G9zqRzk9S0mHZCg==", "dev": true, "requires": { "find-root": "^1.0.0", "glob": "^7.0.5", - "ignore": "^3.0.9", + "ignore": "^5.0.0", "pkg-config": "^1.1.0", "run-parallel": "^1.1.2", "uniq": "^1.0.1" }, "dependencies": { "ignore": { - "version": "3.3.10", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz", - "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==", + "version": "5.1.4", + "resolved": "https://registry.npmjs.org/ignore/-/ignore-5.1.4.tgz", + "integrity": "sha512-MzbUSahkTW1u7JpKKjY7LCARd1fU5W2rLdxlM4kdkayuCwZImjkpluF9CM1aLewYJguPDqewLam18Y6AU69A8A==", "dev": true } } @@ -3751,9 +3824,9 @@ "dev": true }, "electron-to-chromium": { - "version": "1.3.243", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.243.tgz", - "integrity": "sha512-+edFdHGxLSmAKftXa5xZIg19rHkkJLiW+tRu0VMVG3RKztyeKX7d3pXf707lS6+BxB9uBun3RShbxCI1PtBAgQ==", + "version": "1.3.267", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.267.tgz", + "integrity": "sha512-9Q2ixAJC+oHjWNtJV0MQ4vJMCWSowIrC6V6vcr+bwPddTDHj2ddv9xxXCzf4jT/fy6HP7maPoW0gifXkRxCttQ==", "dev": true }, "elliptic": { @@ -4327,15 +4400,15 @@ } }, "eslint-config-standard": { - "version": "13.0.1", - "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-13.0.1.tgz", - "integrity": "sha512-zLKp4QOgq6JFgRm1dDCVv1Iu0P5uZ4v5Wa4DTOkg2RFMxdCX/9Qf7lz9ezRj2dBRa955cWQF/O/LWEiYWAHbTw==", + "version": "14.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-14.1.0.tgz", + "integrity": "sha512-EF6XkrrGVbvv8hL/kYa/m6vnvmUT+K82pJJc4JJVMM6+Qgqh0pnwprSxdduDLB9p/7bIxD+YV5O0wfb8lmcPbA==", "dev": true }, "eslint-config-standard-jsx": { - "version": "6.0.2", - "resolved": "https://registry.npmjs.org/eslint-config-standard-jsx/-/eslint-config-standard-jsx-6.0.2.tgz", - "integrity": "sha512-D+YWAoXw+2GIdbMBRAzWwr1ZtvnSf4n4yL0gKGg7ShUOGXkSOLerI17K4F6LdQMJPNMoWYqepzQD/fKY+tXNSg==", + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/eslint-config-standard-jsx/-/eslint-config-standard-jsx-8.1.0.tgz", + "integrity": "sha512-ULVC8qH8qCqbU792ZOO6DaiaZyHNS/5CZt3hKqHkEhVlhPEPN3nfBqqxJCyp59XrjIBZPu1chMYe9T2DXZ7TMw==", "dev": true }, "eslint-import-resolver-node": { @@ -4439,13 +4512,21 @@ } }, "eslint-plugin-es": { - "version": "1.4.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-1.4.1.tgz", - "integrity": "sha512-5fa/gR2yR3NxQf+UXkeLeP8FBBl6tSgdrAz1+cF84v1FMM4twGwQoqTnn+QxFLcPOrF4pdKEJKDB/q9GoyJrCA==", + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-es/-/eslint-plugin-es-2.0.0.tgz", + "integrity": "sha512-f6fceVtg27BR02EYnBhgWLFQfK6bN4Ll0nQFrBHOlCsAyxeZkn0NHns5O0YZOPrV1B3ramd6cgFwaoFLcSkwEQ==", "dev": true, "requires": { "eslint-utils": "^1.4.2", - "regexpp": "^2.0.1" + "regexpp": "^3.0.0" + }, + "dependencies": { + "regexpp": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-3.0.0.tgz", + "integrity": "sha512-Z+hNr7RAVWxznLPuA7DIh8UNX1j9CDrUQxskw9IrBE1Dxue2lyXT+shqEIeLUjrokxIP8CMy1WkjgG3rTsd5/g==", + "dev": true + } } }, "eslint-plugin-import": { @@ -4586,13 +4667,13 @@ } }, "eslint-plugin-node": { - "version": "9.1.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-9.1.0.tgz", - "integrity": "sha512-ZwQYGm6EoV2cfLpE1wxJWsfnKUIXfM/KM09/TlorkukgCAwmkgajEJnPCmyzoFPQQkmvo5DrW/nyKutNIw36Mw==", + "version": "10.0.0", + "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-10.0.0.tgz", + "integrity": "sha512-1CSyM/QCjs6PXaT18+zuAXsjXGIGo5Rw630rSKwokSs2jrYURQc4R5JZpoanNCqwNmepg+0eZ9L7YiRUJb8jiQ==", "dev": true, "requires": { - "eslint-plugin-es": "^1.4.0", - "eslint-utils": "^1.3.1", + "eslint-plugin-es": "^2.0.0", + "eslint-utils": "^1.4.2", "ignore": "^5.1.1", "minimatch": "^3.0.4", "resolve": "^1.10.1", @@ -6139,9 +6220,9 @@ } }, "handlebars": { - "version": "4.1.2", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.1.2.tgz", - "integrity": "sha512-nvfrjqvt9xQ8Z/w0ijewdD/vvWDTOweBUm96NTr66Wfvo1mJenBLwcYmPs3TIBP5ruzYGD7Hx/DaM9RmhroGPw==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.4.0.tgz", + "integrity": "sha512-xkRtOt3/3DzTKMOt3xahj2M/EqNhY988T+imYSlMgs5fVhLN2fmKVVj0LtEGmb+3UUYV5Qmm1052Mm3dIQxOvw==", "dev": true, "requires": { "neo-async": "^2.6.0", @@ -6151,9 +6232,9 @@ }, "dependencies": { "commander": { - "version": "2.20.0", - "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", - "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==", + "version": "2.20.1", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.1.tgz", + "integrity": "sha512-cCuLsMhJeWQ/ZpsFTbE765kvVfoeSddc4nU3up4fV+fDBcfUXnbITJ+JzhkdjzOqhURjZgujxaioam4RM9yGUg==", "dev": true, "optional": true }, @@ -6873,12 +6954,6 @@ "is-unc-path": "^1.0.0" } }, - "is-resolvable": { - "version": "1.1.0", - "resolved": "https://registry.npmjs.org/is-resolvable/-/is-resolvable-1.1.0.tgz", - "integrity": "sha512-qgDYXFSR5WvEfuS5dMj6oTMEbrrSaM0CrFk2Yiq/gXnBvD9pMa2jGXxyhGLfvhZpuMZe18CJpFxAt3CRs42NMg==", - "dev": true - }, "is-stream": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-1.1.0.tgz", @@ -8332,9 +8407,9 @@ "dev": true }, "node-releases": { - "version": "1.1.28", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.28.tgz", - "integrity": "sha512-AQw4emh6iSXnCpDiFe0phYcThiccmkNWMZnFZ+lDJjAP8J0m2fVd59duvUUyuTirQOhIAajTFkzG6FHCLBO59g==", + "version": "1.1.32", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-1.1.32.tgz", + "integrity": "sha512-VhVknkitq8dqtWoluagsGPn3dxTvN9fwgR59fV3D7sLBHe0JfDramsMI8n8mY//ccq/Kkrf8ZRHRpsyVZ3qw1A==", "dev": true, "requires": { "semver": "^5.3.0" @@ -8825,12 +8900,6 @@ "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18=" }, - "path-is-inside": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/path-is-inside/-/path-is-inside-1.0.2.tgz", - "integrity": "sha1-NlQX3t5EQw0cEa9hAn+s8HS9/FM=", - "dev": true - }, "path-key": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/path-key/-/path-key-2.0.1.tgz", @@ -8935,70 +9004,37 @@ } }, "pkg-conf": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/pkg-conf/-/pkg-conf-2.1.0.tgz", - "integrity": "sha1-ISZRTKbyq/69FoWW3xi6V4Z/AFg=", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/pkg-conf/-/pkg-conf-3.1.0.tgz", + "integrity": "sha512-m0OTbR/5VPNPqO1ph6Fqbj7Hv6QU7gR/tQW40ZqrL1rjgCU85W6C1bJn0BItuJqnR98PWzw7Z8hHeChD1WrgdQ==", "dev": true, "requires": { - "find-up": "^2.0.0", - "load-json-file": "^4.0.0" + "find-up": "^3.0.0", + "load-json-file": "^5.2.0" }, "dependencies": { "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-up/-/find-up-3.0.0.tgz", + "integrity": "sha512-1yD6RmLI1XBfxugvORwlck6f75tYL+iR0jqwsOrOxMZyGYqUuDhJ0l4AXdO1iX/FTs9cBAMEk1gWSEx1kSbylg==", "dev": true, "requires": { - "locate-path": "^2.0.0" + "locate-path": "^3.0.0" } }, "load-json-file": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-4.0.0.tgz", - "integrity": "sha1-L19Fq5HjMhYjT9U62rZo607AmTs=", + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-5.3.0.tgz", + "integrity": "sha512-cJGP40Jc/VXUsp8/OrnyKyTZ1y6v/dphm3bioS+RrKXjK2BB6wHUd6JptZEFDGgGahMT+InnZO5i1Ei9mpC8Bw==", "dev": true, "requires": { - "graceful-fs": "^4.1.2", + "graceful-fs": "^4.1.15", "parse-json": "^4.0.0", - "pify": "^3.0.0", - "strip-bom": "^3.0.0" + "pify": "^4.0.1", + "strip-bom": "^3.0.0", + "type-fest": "^0.3.0" } }, - "locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", - "dev": true, - "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - } - }, - "p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "dev": true, - "requires": { - "p-try": "^1.0.0" - } - }, - "p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", - "dev": true, - "requires": { - "p-limit": "^1.1.0" - } - }, - "p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", - "dev": true - }, "parse-json": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-4.0.0.tgz", @@ -9009,16 +9045,10 @@ "json-parse-better-errors": "^1.0.1" } }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", - "dev": true - }, "pify": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/pify/-/pify-3.0.0.tgz", - "integrity": "sha1-5aSs0sEB/fPZpNB/DbxNtJ3SgXY=", + "version": "4.0.1", + "resolved": "https://registry.npmjs.org/pify/-/pify-4.0.1.tgz", + "integrity": "sha512-uB80kBFb/tfd68bVleG9T5GGsGPjJrLAUpR5PZIrhBnIaRTQRjqdJSsIKkOP6OAIFbj7GOrcudc5pNjZ+geV2g==", "dev": true }, "strip-bom": { @@ -9060,12 +9090,6 @@ } } }, - "pluralize": { - "version": "7.0.0", - "resolved": "https://registry.npmjs.org/pluralize/-/pluralize-7.0.0.tgz", - "integrity": "sha512-ARhBOdzS3e41FbkW/XWrTEtukqqLoK5+Z/4UeDaLuSW+39JPeFgs4gCGqsrJHVZX0fUrx//4OF0K1CUGwlIFow==", - "dev": true - }, "posix-character-classes": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/posix-character-classes/-/posix-character-classes-0.1.1.tgz", @@ -9309,9 +9333,9 @@ } }, "recursive-rename": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/recursive-rename/-/recursive-rename-2.0.0.tgz", - "integrity": "sha1-da66Q08kJk1QjR2Dr5U9iYknMec=", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/recursive-rename/-/recursive-rename-3.0.0.tgz", + "integrity": "sha512-7yO+/XwBlzg31IEIGZ+pyS9BmkLsanMlavjc96/Ps0Pnq43hciKMK0Ivo/FblKHwmCjHXpdYiSxsj472nO1y2g==", "dev": true, "requires": { "babel-runtime": "^6.23.0", @@ -9439,12 +9463,6 @@ "safe-regex": "^1.1.0" } }, - "regexp-tree": { - "version": "0.1.12", - "resolved": "https://registry.npmjs.org/regexp-tree/-/regexp-tree-0.1.12.tgz", - "integrity": "sha512-TsXZ8+cv2uxMEkLfgwO0E068gsNMLfuYwMMhiUxf0Kw2Vcgzq93vgl6wIlIYuPmfMqMjfQ9zAporiozqCnwLuQ==", - "dev": true - }, "regexpp": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/regexpp/-/regexpp-2.0.1.tgz", @@ -9452,9 +9470,9 @@ "dev": true }, "regexpu-core": { - "version": "4.5.5", - "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.5.5.tgz", - "integrity": "sha512-FpI67+ky9J+cDizQUJlIlNZFKual/lUkFr1AG6zOCpwZ9cLrg8UUVakyUQJD7fCDIe9Z2nwTQJNPyonatNmDFQ==", + "version": "4.6.0", + "resolved": "https://registry.npmjs.org/regexpu-core/-/regexpu-core-4.6.0.tgz", + "integrity": "sha512-YlVaefl8P5BnFYOITTNzDvan1ulLOiXJzCNZxduTIosN17b87h3bvG9yHMoHaRuo88H4mQ06Aodj5VtYGGGiTg==", "dev": true, "requires": { "regenerate": "^1.4.0", @@ -9612,39 +9630,6 @@ "resolved": "https://registry.npmjs.org/require-main-filename/-/require-main-filename-1.0.1.tgz", "integrity": "sha1-l/cXtp1IeE9fUmpsWqj/3aBVpNE=" }, - "require-uncached": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/require-uncached/-/require-uncached-1.0.3.tgz", - "integrity": "sha1-Tg1W1slmL9MeQwEcS5WqSZVUIdM=", - "dev": true, - "requires": { - "caller-path": "^0.1.0", - "resolve-from": "^1.0.0" - }, - "dependencies": { - "caller-path": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/caller-path/-/caller-path-0.1.0.tgz", - "integrity": "sha1-lAhe9jWB7NPaqSREqP6U6CV3dR8=", - "dev": true, - "requires": { - "callsites": "^0.2.0" - } - }, - "callsites": { - "version": "0.2.0", - "resolved": "https://registry.npmjs.org/callsites/-/callsites-0.2.0.tgz", - "integrity": "sha1-r6uWJikQp/M8GaV3WCXGnzTjUMo=", - "dev": true - }, - "resolve-from": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/resolve-from/-/resolve-from-1.0.1.tgz", - "integrity": "sha1-Jsv+k10a7uq7Kbw/5a6wHpPUQiY=", - "dev": true - } - } - }, "requizzle": { "version": "0.2.3", "resolved": "https://registry.npmjs.org/requizzle/-/requizzle-0.2.3.tgz", @@ -9896,9 +9881,9 @@ } }, "serialize-javascript": { - "version": "1.8.0", - "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-1.8.0.tgz", - "integrity": "sha512-3tHgtF4OzDmeKYj6V9nSyceRS0UJ3C7VqyD2Yj28vC/z2j6jG5FmFGahOKMD9CrglxTm3tETr87jEypaYV8DUg==" + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-2.1.0.tgz", + "integrity": "sha512-a/mxFfU00QT88umAJQsNWOnUKckhNCqOl028N48e7wFmo2/EHpTo9Wso+iJJCMrQnmFvcjto5RJdAHEvVhcyUQ==" }, "serve-static": { "version": "1.14.1", @@ -10364,435 +10349,130 @@ "integrity": "sha1-VHxws0fo0ytOEI6hoqFZ5f3eGcA=" }, "standard": { - "version": "12.0.1", - "resolved": "https://registry.npmjs.org/standard/-/standard-12.0.1.tgz", - "integrity": "sha512-UqdHjh87OG2gUrNCSM4QRLF5n9h3TFPwrCNyVlkqu31Hej0L/rc8hzKqVvkb2W3x0WMq7PzZdkLfEcBhVOR6lg==", - "dev": true, - "requires": { - "eslint": "~5.4.0", - "eslint-config-standard": "12.0.0", - "eslint-config-standard-jsx": "6.0.2", - "eslint-plugin-import": "~2.14.0", - "eslint-plugin-node": "~7.0.1", - "eslint-plugin-promise": "~4.0.0", - "eslint-plugin-react": "~7.11.1", + "version": "14.3.1", + "resolved": "https://registry.npmjs.org/standard/-/standard-14.3.1.tgz", + "integrity": "sha512-TUQwU7znlZLfgKH1Zwn/D84FitWZkUTfbxSiz/vFx+4c9GV+clSfG/qLiLZOlcdyzhw3oF5/pZydNjbNDfHPEw==", + "dev": true, + "requires": { + "eslint": "~6.4.0", + "eslint-config-standard": "14.1.0", + "eslint-config-standard-jsx": "8.1.0", + "eslint-plugin-import": "~2.18.0", + "eslint-plugin-node": "~10.0.0", + "eslint-plugin-promise": "~4.2.1", + "eslint-plugin-react": "~7.14.2", "eslint-plugin-standard": "~4.0.0", - "standard-engine": "~9.0.0" + "standard-engine": "^12.0.0" }, "dependencies": { - "acorn": { - "version": "6.3.0", - "resolved": "https://registry.npmjs.org/acorn/-/acorn-6.3.0.tgz", - "integrity": "sha512-/czfa8BwS88b9gWQVhc8eknunSA2DoJpJyTQkhheIf5E48u1N0R4q/YxxsAeqRrmK9TQ/uYfgLDfZo91UlANIA==", - "dev": true - }, "ansi-regex": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-3.0.0.tgz", - "integrity": "sha1-7QMXwyIGT3lGbAKWa922Bas32Zg=", - "dev": true - }, - "chardet": { - "version": "0.4.2", - "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.4.2.tgz", - "integrity": "sha1-tUc7M9yXxCTl2Y3IfVXU2KKci/I=", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-4.1.0.tgz", + "integrity": "sha512-1apePfXM1UOSqw0o9IiFAovVz9M5S1Dg+4TrDwfMewQ6p/rmMueb7tWZjQ1rx4Loy1ArBggoqGpfqqdI4rondg==", "dev": true }, - "doctrine": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", - "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", + "debug": { + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/debug/-/debug-4.1.1.tgz", + "integrity": "sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==", "dev": true, "requires": { - "esutils": "^2.0.2" + "ms": "^2.1.1" } }, "eslint": { - "version": "5.4.0", - "resolved": "https://registry.npmjs.org/eslint/-/eslint-5.4.0.tgz", - "integrity": "sha512-UIpL91XGex3qtL6qwyCQJar2j3osKxK9e3ano3OcGEIRM4oWIpCkDg9x95AXEC2wMs7PnxzOkPZ2gq+tsMS9yg==", + "version": "6.4.0", + "resolved": "https://registry.npmjs.org/eslint/-/eslint-6.4.0.tgz", + "integrity": "sha512-WTVEzK3lSFoXUovDHEbkJqCVPEPwbhCq4trDktNI6ygs7aO41d4cDT0JFAT5MivzZeVLWlg7vHL+bgrQv/t3vA==", "dev": true, "requires": { - "ajv": "^6.5.0", - "babel-code-frame": "^6.26.0", + "@babel/code-frame": "^7.0.0", + "ajv": "^6.10.0", "chalk": "^2.1.0", "cross-spawn": "^6.0.5", - "debug": "^3.1.0", - "doctrine": "^2.1.0", - "eslint-scope": "^4.0.0", - "eslint-utils": "^1.3.1", - "eslint-visitor-keys": "^1.0.0", - "espree": "^4.0.0", + "debug": "^4.0.1", + "doctrine": "^3.0.0", + "eslint-scope": "^5.0.0", + "eslint-utils": "^1.4.2", + "eslint-visitor-keys": "^1.1.0", + "espree": "^6.1.1", "esquery": "^1.0.1", "esutils": "^2.0.2", - "file-entry-cache": "^2.0.0", + "file-entry-cache": "^5.0.1", "functional-red-black-tree": "^1.0.1", - "glob": "^7.1.2", + "glob-parent": "^5.0.0", "globals": "^11.7.0", - "ignore": "^4.0.2", + "ignore": "^4.0.6", + "import-fresh": "^3.0.0", "imurmurhash": "^0.1.4", - "inquirer": "^5.2.0", - "is-resolvable": "^1.1.0", - "js-yaml": "^3.11.0", + "inquirer": "^6.4.1", + "is-glob": "^4.0.0", + "js-yaml": "^3.13.1", "json-stable-stringify-without-jsonify": "^1.0.1", "levn": "^0.3.0", - "lodash": "^4.17.5", + "lodash": "^4.17.14", "minimatch": "^3.0.4", "mkdirp": "^0.5.1", "natural-compare": "^1.4.0", "optionator": "^0.8.2", - "path-is-inside": "^1.0.2", - "pluralize": "^7.0.0", "progress": "^2.0.0", - "regexpp": "^2.0.0", - "require-uncached": "^1.0.3", - "semver": "^5.5.0", - "strip-ansi": "^4.0.0", - "strip-json-comments": "^2.0.1", - "table": "^4.0.3", - "text-table": "^0.2.0" - } - }, - "eslint-config-standard": { - "version": "12.0.0", - "resolved": "https://registry.npmjs.org/eslint-config-standard/-/eslint-config-standard-12.0.0.tgz", - "integrity": "sha512-COUz8FnXhqFitYj4DTqHzidjIL/t4mumGZto5c7DrBpvWoie+Sn3P4sLEzUGeYhRElWuFEf8K1S1EfvD1vixCQ==", - "dev": true - }, - "eslint-plugin-import": { - "version": "2.14.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.14.0.tgz", - "integrity": "sha512-FpuRtniD/AY6sXByma2Wr0TXvXJ4nA/2/04VPlfpmUDPOpOY264x+ILiwnrk/k4RINgDAyFZByxqPUbSQ5YE7g==", - "dev": true, - "requires": { - "contains-path": "^0.1.0", - "debug": "^2.6.8", - "doctrine": "1.5.0", - "eslint-import-resolver-node": "^0.3.1", - "eslint-module-utils": "^2.2.0", - "has": "^1.0.1", - "lodash": "^4.17.4", - "minimatch": "^3.0.3", - "read-pkg-up": "^2.0.0", - "resolve": "^1.6.0" - }, - "dependencies": { - "debug": { - "version": "2.6.9", - "resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz", - "integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==", - "dev": true, - "requires": { - "ms": "2.0.0" - } - }, - "doctrine": { - "version": "1.5.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-1.5.0.tgz", - "integrity": "sha1-N53Ocw9hZvds76TmcHoVmwLFpvo=", - "dev": true, - "requires": { - "esutils": "^2.0.2", - "isarray": "^1.0.0" - } - } - } - }, - "eslint-plugin-node": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-node/-/eslint-plugin-node-7.0.1.tgz", - "integrity": "sha512-lfVw3TEqThwq0j2Ba/Ckn2ABdwmL5dkOgAux1rvOk6CO7A6yGyPI2+zIxN6FyNkp1X1X/BSvKOceD6mBWSj4Yw==", - "dev": true, - "requires": { - "eslint-plugin-es": "^1.3.1", - "eslint-utils": "^1.3.1", - "ignore": "^4.0.2", - "minimatch": "^3.0.4", - "resolve": "^1.8.1", - "semver": "^5.5.0" - } - }, - "eslint-plugin-promise": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-promise/-/eslint-plugin-promise-4.0.1.tgz", - "integrity": "sha512-Si16O0+Hqz1gDHsys6RtFRrW7cCTB6P7p3OJmKp3Y3dxpQE2qwOA7d3xnV+0mBmrPoi0RBnxlCKvqu70te6wjg==", - "dev": true - }, - "eslint-plugin-react": { - "version": "7.11.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.11.1.tgz", - "integrity": "sha512-cVVyMadRyW7qsIUh3FHp3u6QHNhOgVrLQYdQEB1bPWBsgbNCHdFAeNMquBMCcZJu59eNthX053L70l7gRt4SCw==", - "dev": true, - "requires": { - "array-includes": "^3.0.3", - "doctrine": "^2.1.0", - "has": "^1.0.3", - "jsx-ast-utils": "^2.0.1", - "prop-types": "^15.6.2" - } - }, - "eslint-scope": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-4.0.3.tgz", - "integrity": "sha512-p7VutNr1O/QrxysMo3E45FjYDTeXBy0iTltPFNSqKAIfjDSXC+4dj+qfyuD8bfAXrW/y6lW3O76VaYNPKfpKrg==", - "dev": true, - "requires": { - "esrecurse": "^4.1.0", - "estraverse": "^4.1.1" - } - }, - "espree": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/espree/-/espree-4.1.0.tgz", - "integrity": "sha512-I5BycZW6FCVIub93TeVY1s7vjhP9CY6cXCznIRfiig7nRviKZYdRnj/sHEWC6A7WE9RDWOFq9+7OsWSYz8qv2w==", - "dev": true, - "requires": { - "acorn": "^6.0.2", - "acorn-jsx": "^5.0.0", - "eslint-visitor-keys": "^1.0.0" - } - }, - "external-editor": { - "version": "2.2.0", - "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-2.2.0.tgz", - "integrity": "sha512-bSn6gvGxKt+b7+6TKEv1ZycHleA7aHhRHyAqJyp5pbUFuYYNIzpZnQDk7AsYckyWdEnTeAnay0aCy2aV6iTk9A==", - "dev": true, - "requires": { - "chardet": "^0.4.0", - "iconv-lite": "^0.4.17", - "tmp": "^0.0.33" - } - }, - "file-entry-cache": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/file-entry-cache/-/file-entry-cache-2.0.0.tgz", - "integrity": "sha1-w5KZDD5oR4PYOLjISkXYoEhFg2E=", - "dev": true, - "requires": { - "flat-cache": "^1.2.1", - "object-assign": "^4.0.1" - } - }, - "find-up": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/find-up/-/find-up-2.1.0.tgz", - "integrity": "sha1-RdG35QbHF93UgndaK3eSCjwMV6c=", - "dev": true, - "requires": { - "locate-path": "^2.0.0" - } - }, - "flat-cache": { - "version": "1.3.4", - "resolved": "https://registry.npmjs.org/flat-cache/-/flat-cache-1.3.4.tgz", - "integrity": "sha512-VwyB3Lkgacfik2vhqR4uv2rvebqmDvFu4jlN/C1RzWoJEo8I7z4Q404oiqYCkq41mni8EzQnm95emU9seckwtg==", - "dev": true, - "requires": { - "circular-json": "^0.3.1", - "graceful-fs": "^4.1.2", - "rimraf": "~2.6.2", - "write": "^0.2.1" - } - }, - "inquirer": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-5.2.0.tgz", - "integrity": "sha512-E9BmnJbAKLPGonz0HeWHtbKf+EeSP93paWO3ZYoUpq/aowXvYGjjCSuashhXPpzbArIjBbji39THkxTz9ZeEUQ==", - "dev": true, - "requires": { - "ansi-escapes": "^3.0.0", - "chalk": "^2.0.0", - "cli-cursor": "^2.1.0", - "cli-width": "^2.0.0", - "external-editor": "^2.1.0", - "figures": "^2.0.0", - "lodash": "^4.3.0", - "mute-stream": "0.0.7", - "run-async": "^2.2.0", - "rxjs": "^5.5.2", - "string-width": "^2.1.0", - "strip-ansi": "^4.0.0", - "through": "^2.3.6" - } - }, - "is-fullwidth-code-point": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-2.0.0.tgz", - "integrity": "sha1-o7MKXE8ZkYMWeqq5O+764937ZU8=", - "dev": true - }, - "load-json-file": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", - "integrity": "sha1-eUfkIUmvgNaWy/eXvKq8/h/inKg=", - "dev": true, - "requires": { - "graceful-fs": "^4.1.2", - "parse-json": "^2.2.0", - "pify": "^2.0.0", - "strip-bom": "^3.0.0" - } - }, - "locate-path": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/locate-path/-/locate-path-2.0.0.tgz", - "integrity": "sha1-K1aLJl7slExtnA3pw9u7ygNUzY4=", - "dev": true, - "requires": { - "p-locate": "^2.0.0", - "path-exists": "^3.0.0" - } - }, - "p-limit": { - "version": "1.3.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-1.3.0.tgz", - "integrity": "sha512-vvcXsLAJ9Dr5rQOPk7toZQZJApBl2K4J6dANSsEuh6QI41JYcsS/qhTGa9ErIUUgK3WNQoJYvylxvjqmiqEA9Q==", - "dev": true, - "requires": { - "p-try": "^1.0.0" + "regexpp": "^2.0.1", + "semver": "^6.1.2", + "strip-ansi": "^5.2.0", + "strip-json-comments": "^3.0.1", + "table": "^5.2.3", + "text-table": "^0.2.0", + "v8-compile-cache": "^2.0.3" } }, - "p-locate": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/p-locate/-/p-locate-2.0.0.tgz", - "integrity": "sha1-IKAQOyIqcMj9OcwuWAaA893l7EM=", + "glob-parent": { + "version": "5.1.0", + "resolved": "https://registry.npmjs.org/glob-parent/-/glob-parent-5.1.0.tgz", + "integrity": "sha512-qjtRgnIVmOfnKUE3NJAQEdk+lKrxfw8t5ke7SXtfMTHcjsBfOfWXCQfdb30zfDoZQ2IRSIiidmjtbHZPZ++Ihw==", "dev": true, "requires": { - "p-limit": "^1.1.0" + "is-glob": "^4.0.1" } }, - "p-try": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/p-try/-/p-try-1.0.0.tgz", - "integrity": "sha1-y8ec26+P1CKOE/Yh8rGiN8GyB7M=", + "ms": { + "version": "2.1.2", + "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", + "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", "dev": true }, - "path-exists": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-exists/-/path-exists-3.0.0.tgz", - "integrity": "sha1-zg6+ql94yxiSXqfYENe1mwEP1RU=", + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", "dev": true }, - "path-type": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-2.0.0.tgz", - "integrity": "sha1-8BLMuEFbcJb8LaoQVMPXI4lZTHM=", - "dev": true, - "requires": { - "pify": "^2.0.0" - } - }, - "read-pkg": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg/-/read-pkg-2.0.0.tgz", - "integrity": "sha1-jvHAYjxqbbDcZxPEv6xGMysjaPg=", - "dev": true, - "requires": { - "load-json-file": "^2.0.0", - "normalize-package-data": "^2.3.2", - "path-type": "^2.0.0" - } - }, - "read-pkg-up": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/read-pkg-up/-/read-pkg-up-2.0.0.tgz", - "integrity": "sha1-a3KoBImE4MQeeVEP1en6mbO1Sb4=", - "dev": true, - "requires": { - "find-up": "^2.0.0", - "read-pkg": "^2.0.0" - } - }, - "rxjs": { - "version": "5.5.12", - "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-5.5.12.tgz", - "integrity": "sha512-xx2itnL5sBbqeeiVgNPVuQQ1nC8Jp2WfNJhXWHmElW9YmrpS9UVnNzhP3EH3HFqexO5Tlp8GhYY+WEcqcVMvGw==", - "dev": true, - "requires": { - "symbol-observable": "1.0.1" - } - }, - "slice-ansi": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-1.0.0.tgz", - "integrity": "sha512-POqxBK6Lb3q6s047D/XsDVNPnF9Dl8JSaqe9h9lURl0OdNqy/ujDrOiIHtsqXMGbWWTIomRzAMaTyawAU//Reg==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0" - } - }, - "string-width": { - "version": "2.1.1", - "resolved": "https://registry.npmjs.org/string-width/-/string-width-2.1.1.tgz", - "integrity": "sha512-nOqH59deCq9SRHlxq1Aw85Jnt4w6KvLKqWVik6oA9ZklXLNIOlqg4F2yrT1MVaTjAqvVwdfeZ7w7aCvJD7ugkw==", - "dev": true, - "requires": { - "is-fullwidth-code-point": "^2.0.0", - "strip-ansi": "^4.0.0" - } - }, "strip-ansi": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-4.0.0.tgz", - "integrity": "sha1-qEeQIusaw2iocTibY1JixQXuNo8=", - "dev": true, - "requires": { - "ansi-regex": "^3.0.0" - } - }, - "strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha1-IzTBjpx1n3vdVv3vfprj1YjmjtM=", - "dev": true - }, - "strip-json-comments": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-2.0.1.tgz", - "integrity": "sha1-PFMZQukIwml8DsNEhYwobHygpgo=", - "dev": true - }, - "table": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/table/-/table-4.0.3.tgz", - "integrity": "sha512-S7rnFITmBH1EnyKcvxBh1LjYeQMmnZtCXSEbHcH6S0NoKit24ZuFO/T1vDcLdYsLQkM188PVVhQmzKIuThNkKg==", - "dev": true, - "requires": { - "ajv": "^6.0.1", - "ajv-keywords": "^3.0.0", - "chalk": "^2.1.0", - "lodash": "^4.17.4", - "slice-ansi": "1.0.0", - "string-width": "^2.1.1" - } - }, - "write": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/write/-/write-0.2.1.tgz", - "integrity": "sha1-X8A4KOJkzqP+kUVUdvejxWbLB1c=", + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-5.2.0.tgz", + "integrity": "sha512-DuRs1gKbBqsMKIZlrffwlug8MHkcnpjs5VPmL1PAh+mA30U0DTotfDZ0d2UUsXpPmPmMMJ6W773MaA3J+lbiWA==", "dev": true, "requires": { - "mkdirp": "^0.5.1" + "ansi-regex": "^4.1.0" } } } }, "standard-engine": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/standard-engine/-/standard-engine-9.0.0.tgz", - "integrity": "sha512-ZfNfCWZ2Xq67VNvKMPiVMKHnMdvxYzvZkf1AH8/cw2NLDBm5LRsxMqvEJpsjLI/dUosZ3Z1d6JlHDp5rAvvk2w==", + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/standard-engine/-/standard-engine-12.0.0.tgz", + "integrity": "sha512-gJIIRb0LpL7AHyGbN9+hJ4UJns37lxmNTnMGRLC8CFrzQ+oB/K60IQjKNgPBCB2VP60Ypm6f8DFXvhVWdBOO+g==", "dev": true, "requires": { - "deglob": "^2.1.0", - "get-stdin": "^6.0.0", + "deglob": "^4.0.0", + "get-stdin": "^7.0.0", "minimist": "^1.1.0", - "pkg-conf": "^2.0.0" + "pkg-conf": "^3.1.0" }, "dependencies": { "get-stdin": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-6.0.0.tgz", - "integrity": "sha512-jp4tHawyV7+fkkSKyvjuLZswblUtz+SQKzSWnBbii16BuZksJlU1wuBYXY75r+duh/llF1ur6oNwi+2ZzjKZ7g==", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/get-stdin/-/get-stdin-7.0.0.tgz", + "integrity": "sha512-zRKcywvrXlXsA0v0i9Io4KDRaAw7+a1ZpjRwl9Wox8PFlVCCHra7E9c4kqXCoCM9nR5tBkaTTZRBoCm60bFqTQ==", "dev": true }, "minimist": { @@ -11021,12 +10701,6 @@ "es6-symbol": "^3.1.1" } }, - "symbol-observable": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/symbol-observable/-/symbol-observable-1.0.1.tgz", - "integrity": "sha1-g0D8RwLDEi310iKI+IKD9RPT/dQ=", - "dev": true - }, "symbol-tree": { "version": "3.2.4", "resolved": "https://registry.npmjs.org/symbol-tree/-/symbol-tree-3.2.4.tgz", @@ -11175,6 +10849,12 @@ "pkg-dir": "^3.0.0" } }, + "serialize-javascript": { + "version": "1.9.1", + "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-1.9.1.tgz", + "integrity": "sha512-0Vb/54WJ6k5v8sSWN09S0ora+Hnr+cX40r9F170nT+mSkaxltoE/7R3OrIdBSUv1OoiobH1QoWQbCnAO+e8J1A==", + "dev": true + }, "source-map": { "version": "0.6.1", "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz", @@ -11420,6 +11100,12 @@ "integrity": "sha512-0fr/mIH1dlO+x7TlcMy+bIDqKPsw/70tVyeHW787goQjhmqaZe10uwLujubK9q9Lg6Fiho1KUKDYz0Z7k7g5/g==", "dev": true }, + "type-fest": { + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.3.1.tgz", + "integrity": "sha512-cUGJnCdr4STbePCgqNFbpVNCepa+kAVohJs1sLhxzdH+gnEoOd8VhbYa7pD3zZYGiURWM2xzEII3fQcRizDkYQ==", + "dev": true + }, "type-is": { "version": "1.6.18", "resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz", @@ -11918,9 +11604,9 @@ } }, "webpack-cli": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-3.3.6.tgz", - "integrity": "sha512-0vEa83M7kJtxK/jUhlpZ27WHIOndz5mghWL2O53kiDoA9DIxSKnfqB92LoqEn77cT4f3H2cZm1BMEat/6AZz3A==", + "version": "3.3.8", + "resolved": "https://registry.npmjs.org/webpack-cli/-/webpack-cli-3.3.8.tgz", + "integrity": "sha512-RANYSXwikSWINjHMd/mtesblNSpjpDLoYTBtP99n1RhXqVI/wxN40Auqy42I7y4xrbmRBoA5Zy5E0JSBD5XRhw==", "dev": true, "requires": { "chalk": "2.4.2", diff --git a/package.json b/package.json index 04c5b73ce8..46ce5216d0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@aeternity/aepp-sdk", - "version": "4.7.0", + "version": "5.0.0", "description": "SDK for the æternity blockchain", "main": "dist/aepp-sdk.js", "browser": "dist/aepp-sdk.browser.js", @@ -27,7 +27,7 @@ ], "dependencies": { "@aeternity/bip39": "^0.1.0", - "@babel/runtime": "^7.6.0", + "@babel/runtime": "^7.6.2", "@stamp/it": "^1.0.3", "@stamp/required": "^1.0.1", "aes-js": "^3.1.1", @@ -54,14 +54,14 @@ "url": "https://github.com/aeternity/aepp-sdk-js" }, "devDependencies": { - "@babel/cli": "7.6.0", - "@babel/core": "7.6.0", - "@babel/node": "7.6.1", + "@babel/cli": "7.6.2", + "@babel/core": "7.6.2", + "@babel/node": "7.6.2", "@babel/plugin-proposal-export-default-from": "7.5.2", - "@babel/plugin-proposal-object-rest-spread": "7.5.5", - "@babel/plugin-transform-runtime": "7.6.0", - "@babel/preset-env": "7.6.0", - "@babel/register": "7.6.0", + "@babel/plugin-proposal-object-rest-spread": "7.6.2", + "@babel/plugin-transform-runtime": "7.6.2", + "@babel/preset-env": "7.6.2", + "@babel/register": "7.6.2", "babel-core": "6", "babel-loader": "^8.0.0-beta.2", "babel-plugin-ramda": "^2.0.0", diff --git a/test/integration/aens.js b/test/integration/aens.js index f88165b3c2..0a7f51d104 100644 --- a/test/integration/aens.js +++ b/test/integration/aens.js @@ -20,34 +20,52 @@ import { configure, plan, ready, BaseAe } from './' import * as R from 'ramda' import { generateKeyPair } from '../../es/utils/crypto' -function randomName () { - return Math.floor(Math.random() * Number.MAX_SAFE_INTEGER).toString(36) + '.test' +function randomName (length, namespace = '.aet') { + return randomString(length).toLowerCase() + namespace } -plan('10000000000000000') +function randomString (len, charSet) { + charSet = charSet || 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789' + let randomString = '' + for (let i = 0; i < len; i++) { + const randomPoz = Math.floor(Math.random() * charSet.length) + randomString += charSet.substring(randomPoz, randomPoz + 1) + } + return randomString +} + +plan('9000000000000000000000') describe('Aens', function () { configure(this) let aens + let nameAuctionsSupported const account = generateKeyPair() - const name = randomName() + let name + let name2 + const nameFee = '1000000000000000000000' before(async function () { aens = await ready(this) await aens.spend('1000000000000000', account.publicKey) + const { version } = aens.getNodeInfo() + const [majorVersion] = version.split('.') + nameAuctionsSupported = +majorVersion === 5 && version !== '5.0.0-rc.1' + name = randomName(13, nameAuctionsSupported ? '.aet' : '.test') // 13 name length doesn't trigger auction + name2 = randomName(13, nameAuctionsSupported ? '.aet' : '.test') }) - describe('fails on', () => { - const name = randomName() + const lima = fn => async () => nameAuctionsSupported ? fn() : undefined + describe('fails on', () => { it('querying non-existent names', async () => { - return aens.aensQuery(name).should.eventually.be.rejected + return aens.aensQuery(name2).should.eventually.be.rejected }) it('updating names not owned by the account', async () => { - const preclaim = await aens.aensPreclaim(name) - const claim = await preclaim.claim() + const preclaim = await aens.aensPreclaim(name2) + const claim = await preclaim.claim({ nameFee }) const newAccount = generateKeyPair() const aens2 = await BaseAe() @@ -59,13 +77,31 @@ describe('Aens', function () { it('claims names', async () => { const preclaim = await aens.aensPreclaim(name) preclaim.should.be.an('object') - return preclaim.claim().should.eventually.be.an('object') + return preclaim.claim({ nameFee }).catch(e => { + console.log(e) + return {} + }).should.eventually.be.an('object') }) it('queries names', async () => { + // For some reason the node will return 404 when name is queried + // just right after claim tx has been mined so we wait 0.5s + await new Promise(resolve => setTimeout(resolve, 500)) return aens.aensQuery(name).should.eventually.be.an('object') }) + it('Spend using name with invalid pointers', async () => { + const current = await aens.address() + const onAccount = aens.addresses().find(acc => acc !== current) + const { pointers } = await aens.getName(name) + pointers.length.should.be.equal(0) + try { + await aens.spend(100, name, { onAccount, verify: true }) + } catch (e) { + e.message.should.be.equal(`Name ${name} do not have pointers for account`) + } + }) + it('updates names', async () => { const claim = await aens.aensQuery(name) const address = await aens.address() @@ -74,6 +110,12 @@ describe('Aens', function () { }) }) + it('Spend by name', async () => { + const current = await aens.address() + const onAccount = aens.addresses().find(acc => acc !== current) + await aens.spend(100, name, { onAccount, verify: true }) + }) + it('transfers names', async () => { const claim = await aens.aensQuery(name) @@ -107,4 +149,18 @@ describe('Aens', function () { preclaim.should.be.an('object') preclaim.tx.accountId.should.be.equal(onAccount) }) + + describe('name auctions', function () { + it('claims names', lima(async () => { + const name = randomName(11, '.aet') + const preclaim = await aens.aensPreclaim(name) + preclaim.should.be.an('object') + const claim = await preclaim.claim({ nameFee: '1000000000000000000000' }) + claim.should.be.an('object') + const bid = await aens.aensClaim(name, 0, { nameFee: '2000000000000000000000' }) + bid.should.be.an('object') + const isAuctionFinished = await aens.getName(name).catch(e => false) + isAuctionFinished.should.be.equal(false) + })) + }) }) diff --git a/test/integration/channel.js b/test/integration/channel.js index 123c3e4fcc..4fabcad6d5 100644 --- a/test/integration/channel.js +++ b/test/integration/channel.js @@ -29,9 +29,8 @@ const wsUrl = process.env.TEST_WS_URL || 'ws://localhost:3014/channel' plan(BigNumber('1000e18').toString()) const identityContract = ` -contract Identity = - type state = () - entrypoint main(x : int) = x +payable contract Identity = + payable entrypoint main(x : int): int = x ` function waitForChannel (channel) { @@ -44,7 +43,7 @@ function waitForChannel (channel) { ) } -describe('Channel', function () { +describe.skip('Channel', function () { configure(this) this.timeout(120000) diff --git a/test/integration/contract.js b/test/integration/contract.js index d560b921e8..be701cc4b0 100644 --- a/test/integration/contract.js +++ b/test/integration/contract.js @@ -23,7 +23,7 @@ import * as R from 'ramda' const identityContract = ` contract Identity = - entrypoint main(x : int) = x + entrypoint main(x : int) = x ` const stateContract = ` contract StateContract = @@ -31,14 +31,24 @@ contract StateContract = entrypoint init(value) : state = { value = value } entrypoint retrieve() : string = state.value ` +const libContract = ` +namespace TestLib = + function sum(x: int, y: int) : int = x + y +` +const contractWithLib = ` +include "testLib" +contract Voting = + entrypoint sumNumbers(x: int, y: int) : int = TestLib.sum(x, y) +` const testContract = ` namespace Test = function double(x: int): int = x*2 contract Voting = - entrypoint test() : int = 1 + entrypoint test : () => int +include "testLib" contract StateContract = type number = int record state = { value: string, key: number, testOption: option(string) } @@ -47,32 +57,32 @@ contract StateContract = datatype dateUnit = Year | Month | Day entrypoint init(value: string, key: int, testOption: option(string)) : state = { value = value, key = key, testOption = testOption } - entrypoint retrieve() : (string, int) = (state.value, state.key) + entrypoint retrieve() : string*int = (state.value, state.key) entrypoint intFn(a: int) : int = a - entrypoint stringFn(a: string) : string = a + payable entrypoint stringFn(a: string) : string = a entrypoint boolFn(a: bool) : bool = a entrypoint addressFn(a: address) : address = a entrypoint contractAddress (ct: address) : address = ct entrypoint accountAddress (ak: address) : address = ak - entrypoint tupleFn (a: (string, int)) : (string, int) = a - entrypoint tupleInTupleFn (a: ((string, string), int)) : ((string, string), int) = a - entrypoint tupleWithList (a: (list(int), int)) : (list(int), int) = a + entrypoint tupleFn (a: string*int) : string*int = a + entrypoint tupleInTupleFn (a: (string*string)*int) : (string*string)*int = a + entrypoint tupleWithList (a: list(int)*int) : list(int)*int = a entrypoint listFn(a: list(int)) : list(int) = a entrypoint listInListFn(a: list(list(int))) : list(list(int)) = a - entrypoint mapFn(a: map(address, (string, int))) : map(address, (string, int)) = a - entrypoint mapOptionFn(a: map(address, (string, option(int)))) : map(address, (string, option(int))) = a + entrypoint mapFn(a: map(address, string*int)) : map(address, string*int) = a + entrypoint mapOptionFn(a: map(address, string*option(int))) : map(address, string*option(int)) = a entrypoint getRecord() : state = state stateful entrypoint setRecord(s: state) = put(s) entrypoint intOption(s: option(int)) : option(int) = s - entrypoint listOption(s: option(list((int, string)))) : option(list((int ,string))) = s + entrypoint listOption(s: option(list(int*string))) : option(list(int*string)) = s - entrypoint testFn(a: list(int), b: bool) : (list(int), bool) = (a, b) + entrypoint testFn(a: list(int), b: bool) : list(int)*bool = (a, b) entrypoint approve(tx_id: int, voting_contract: Voting) : int = tx_id entrypoint hashFn(s: hash): hash = s @@ -84,8 +94,10 @@ contract StateContract = entrypoint datTypeFn(s: dateUnit): dateUnit = s ` -const encodedNumberSix = 'cb_AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAaKNdnK' - +const encodedNumberSix = 'cb_DA6sWJo=' +const filesystem = { + testLib: libContract +} plan('1000000000000000000000') describe('Contract', function () { @@ -100,6 +112,8 @@ describe('Contract', function () { }) it('precompiled bytecode can be deployed', async () => { + const { version, consensusProtocolVersion } = contract.getNodeInfo() + console.log(`Node => ${version}, consensus => ${consensusProtocolVersion}, compiler => ${contract.compilerVersion}`) const code = await contract.contractCompile(identityContract) return contract.contractDeploy(code.bytecode, identityContract).should.eventually.have.property('address') }) @@ -110,7 +124,7 @@ describe('Contract', function () { }) it('deploy static compiled contract', async () => { - const res = await bytecode.deployStatic() + const res = await bytecode.deployStatic([]) res.result.should.have.property('gasUsed') res.result.should.have.property('returnType') }) @@ -143,6 +157,8 @@ describe('Contract', function () { const client = await BaseAe() client.removeAccount('ak_2a1j2Mk9YSmC1gioUq4PWRm3bsv887MbuRVwyv4KaUGoR1eiKi') client.addresses().length.should.be.equal(0) + const address = await client.address().catch(e => false) + address.should.be.equal(false) const { result } = await client.contractCallStatic(identityContract, deployed.address, 'main', ['42']) result.callerId.should.be.equal(client.Ae.defaults.dryRunAccount.pub) }) @@ -158,7 +174,7 @@ describe('Contract', function () { }) it('initializes contract state', async () => { - const data = `"Hello World!"` + const data = '"Hello World!"' return contract.contractCompile(stateContract) .then(bytecode => bytecode.deploy([data])) .then(deployed => deployed.call('retrieve')) @@ -169,6 +185,47 @@ describe('Contract', function () { }) .should.eventually.become('Hello World!') }) + describe('Namespaces', () => { + let deployed + it('Can compiler contract with external deps', async () => { + const filesystem = { + testLib: libContract + } + const compiled = await contract.contractCompile(contractWithLib, { filesystem }) + compiled.should.have.property('bytecode') + }) + it('Throw error when try to compile contract without providing external deps', async () => { + try { + await contract.contractCompile(contractWithLib) + } catch (e) { + e.message.indexOf('Couldn\'t find include file').should.not.be.equal(-1) + } + }) + it('Can deploy contract with external deps', async () => { + const filesystem = { + testLib: libContract + } + const compiled = await contract.contractCompile(contractWithLib, { filesystem }) + deployed = await compiled.deploy() + deployed.should.have.property('address') + + const deployedStatic = await compiled.deployStatic([]) + deployedStatic.result.should.have.property('gasUsed') + deployedStatic.result.should.have.property('returnType') + + const encodedCallData = await compiled.encodeCall('sumNumbers', ['1', '2']) + encodedCallData.indexOf('cb_').should.not.be.equal(-1) + }) + it('Can call contract with external deps', async () => { + const callResult = await deployed.call('sumNumbers', ['1', '2']) + const decoded = await callResult.decode() + decoded.should.be.equal(3) + + const callStaticResult = await deployed.callStatic('sumNumbers', ['1', '2']) + const decoded2 = await callStaticResult.decode() + decoded2.should.be.equal(3) + }) + }) describe('Sophia Compiler', function () { it('compile', async () => { @@ -190,7 +247,7 @@ describe('Contract', function () { isString.should.be.equal(true) }) it('decode call-data', async () => { - return contract.contractDecodeCallResultAPI(identityContract, 'main', encodedNumberSix, 'ok').should.eventually.become(6) + return contract.contractDecodeCallResultAPI(identityContract, 'main', encodedNumberSix, 'ok', { backend: 'fate' }).should.eventually.become(6) }) it('Use invalid compiler url', async () => { try { @@ -206,7 +263,7 @@ describe('Contract', function () { let contractObject it('Generate ACI object', async () => { - contractObject = await contract.getContractInstance(testContract, { opt: { amount: 10000, ttl: 10 } }) + contractObject = await contract.getContractInstance(testContract, { filesystem, opt: { ttl: 0 } }) contractObject.should.have.property('interface') contractObject.should.have.property('aci') contractObject.should.have.property('source') @@ -215,7 +272,9 @@ describe('Contract', function () { contractObject.should.have.property('compile') contractObject.should.have.property('call') contractObject.should.have.property('deploy') - contractObject.options.amount.should.be.equal(10000) + contractObject.options.ttl.should.be.equal(0) + contractObject.options.should.have.property('filesystem') + contractObject.options.filesystem.should.have.property('testLib') const functionsFromACI = contractObject.aci.functions.map(({ name }) => name) const methods = Object.keys(contractObject.methods) R.equals(methods, functionsFromACI).should.be.equal(true) @@ -226,25 +285,48 @@ describe('Contract', function () { isCompiled.should.be.equal(true) }) it('Dry-run deploy fn', async () => { - const res = await contractObject.methods.init.get('123', 1, Promise.resolve('hahahaha')) + const res = await contractObject.methods.init.get('123', 1, 'hahahaha') res.result.should.have.property('gasUsed') res.result.should.have.property('returnType') }) it('Dry-run deploy fn on specific account', async () => { const current = await contract.address() const onAccount = contract.addresses().find(acc => acc !== current) - const { result } = await contractObject.methods.init.get('123', 1, Promise.resolve('hahahaha'), { onAccount }) + const { result } = await contractObject.methods.init.get('123', 1, 'hahahaha', { onAccount }) result.should.have.property('gasUsed') result.should.have.property('returnType') result.callerId.should.be.equal(onAccount) }) + it('Can deploy using AEVM', async () => { + await contractObject.compile({ backend: 'aevm' }) + const deployStatic = await contractObject.methods.init.get('123', 1, 'hahahaha', { backend: 'aevm' }) + deployStatic.should.be.an('object') + deployed = await contractObject.methods.init('123', 1, 'hahahaha', { backend: 'aevm' }) + deployed.should.be.an('object') + await contractObject.compile() + }) + it('Deploy contract before compile', async () => { contractObject.compiled = null - await contractObject.methods.init('123', 1, Promise.resolve('hahahaha')) + await contractObject.methods.init('123', 1, 'hahahaha') const isCompiled = contractObject.compiled.length && contractObject.compiled.slice(0, 3) === 'cb_' isCompiled.should.be.equal(true) }) + it('Fail on paying to not payable function', async () => { + const amount = 100 + try { + await contractObject.methods.intFn.send(1, { amount }) + } catch (e) { + e.message.should.be.equal(`You try to pay "${amount}" to function "intFn" which is not payable. Only payable function can accept tokens`) + } + }) + it('Can pay to payable function', async () => { + const contractBalance = await contract.balance(contractObject.deployInfo.address) + await contractObject.methods.stringFn.send('1', { amount: 100 }) + const balanceAfter = await contract.balance(contractObject.deployInfo.address) + balanceAfter.should.be.equal(`${+contractBalance + 100}`) + }) it('Call contract on specific account', async () => { const current = await contract.address() const onAccount = contract.addresses().find(acc => acc !== current) @@ -383,22 +465,22 @@ describe('Contract', function () { }) it('Map With Option Value', async () => { const address = await contract.address() - let mapArgWithSomeValue = new Map( + const mapArgWithSomeValue = new Map( [ - [address, ['someStringV', Promise.resolve(123)]] + [address, ['someStringV', 123]] ] ) - let mapArgWithNoneValue = new Map( + const mapArgWithNoneValue = new Map( [ - [address, ['someStringV', Promise.reject(Error()).catch(e => undefined)]] + [address, ['someStringV', undefined]] ] ) - let returnArgWithSomeValue = new Map( + const returnArgWithSomeValue = new Map( [ [address, ['someStringV', 123]] ] ) - let returnArgWithNoneValue = new Map( + const returnArgWithNoneValue = new Map( [ [address, ['someStringV', undefined]] ] @@ -435,7 +517,7 @@ describe('Contract', function () { describe('RECORD/STATE', function () { const objEq = (obj, obj2) => !Object.entries(obj).find(([key, val]) => JSON.stringify(obj2[key]) !== JSON.stringify(val)) it('Valid Set Record (Cast from JS object)', async () => { - await contractObject.methods.setRecord({ value: 'qwe', key: 1234, testOption: Promise.resolve('test') }) + await contractObject.methods.setRecord({ value: 'qwe', key: 1234, testOption: 'test' }) const state = await contractObject.methods.getRecord() objEq(state.decodedResult, { value: 'qwe', key: 1234, testOption: 'test' }).should.be.equal(true) @@ -445,7 +527,7 @@ describe('Contract', function () { objEq(result.decodedResult, { value: 'qwe', key: 1234, testOption: 'test' }).should.be.equal(true) }) it('Get Record With Option (Convert to JS object)', async () => { - await contractObject.methods.setRecord({ key: 1234, value: 'qwe', testOption: Promise.resolve('resolved string') }) + await contractObject.methods.setRecord({ key: 1234, value: 'qwe', testOption: 'resolved string' }) const result = await contractObject.methods.getRecord() objEq(result.decodedResult, { value: 'qwe', key: 1234, testOption: 'resolved string' }).should.be.equal(true) }) @@ -459,25 +541,25 @@ describe('Contract', function () { }) describe('OPTION', function () { it('Set Some Option Value(Cast from JS value/Convert result to JS)', async () => { - const optionRes = await contractObject.methods.intOption(Promise.resolve(123)) + const optionRes = await contractObject.methods.intOption(123) optionRes.decodedResult.should.be.equal(123) }) it('Set Some Option List Value(Cast from JS value/Convert result to JS)', async () => { - const optionRes = await contractObject.methods.listOption(Promise.resolve([[1, 'testString']])) + const optionRes = await contractObject.methods.listOption([[1, 'testString']]) JSON.stringify(optionRes.decodedResult).should.be.equal(JSON.stringify([[1, 'testString']])) }) it('Set None Option Value(Cast from JS value/Convert to JS)', async () => { - const optionRes = await contractObject.methods.intOption(Promise.reject(Error())) + const optionRes = await contractObject.methods.intOption(undefined) const isUndefined = optionRes.decodedResult === undefined isUndefined.should.be.equal(true) }) it('Invalid option type', async () => { try { - await contractObject.methods.intOption({ s: 2 }) + await contractObject.methods.intOption('string') } catch (e) { - e.message.should.be.equal('"Argument" at position 0 fails because [Value \'[[object Object]]\' at path: [0] not a Promise]') + e.message.should.be.equal('"Argument" at position 0 fails because [Value "[string]" at path: [0] not a number]') } }) }) @@ -599,14 +681,14 @@ describe('Contract', function () { return res.decode().should.eventually.become([1, 2]) }) it('Call contract using using js type arguments', async () => { - const res = await contractObject.methods.listFn([ 1, 2 ]) + const res = await contractObject.methods.listFn([1, 2]) return res.decode().should.eventually.become([1, 2]) }) it('Call contract using using js type arguments and skip result transform', async () => { contractObject.setOptions({ skipTransformDecoded: true }) - const res = await contractObject.methods.listFn([ 1, 2 ]) + const res = await contractObject.methods.listFn([1, 2]) const decoded = await res.decode() - const decodedJSON = JSON.stringify([ 1, 2 ]) + const decodedJSON = JSON.stringify([1, 2]) contractObject.setOptions({ skipTransformDecoded: false }) JSON.stringify(decoded).should.be.equal(decodedJSON) }) diff --git a/test/integration/ga.js b/test/integration/ga.js index 8dbc6d8026..a741084ece 100644 --- a/test/integration/ga.js +++ b/test/integration/ga.js @@ -29,8 +29,7 @@ const authContract = `contract BlindAuth = None => abort("Not in Auth context") Some(tx_hash) => true ` -// Todo Enable GA -describe.skip('Generalize Account', function () { +describe('Generalize Account', function () { configure(this) let client @@ -54,15 +53,17 @@ describe.skip('Generalize Account', function () { e.message.should.be.equal(`Account ${gaAccount.publicKey} is already GA`) } }) - it('Spend Using Meta Tx', async () => { + it('Init MemoryAccount for GA and Spend using GA', async () => { const r = Math.floor(Math.random() * 20) const r2 = Math.floor(Math.random() * 20) const callData = await client.contractEncodeCall(authContract, 'authorize', [`${r}`]) const { publicKey } = generateKeyPair() + client.removeAccount(gaAccount.publicKey) + await client.addAccount(MemoryAccount({ gaId: gaAccount.publicKey })) await client.spend(10000, publicKey, { authData: { callData }, onAccount: gaAccount.publicKey }) await client.spend(10000, publicKey, { authData: { source: authContract, args: [`${r2}`] }, onAccount: gaAccount.publicKey }) const balanceAfter = await client.balance(publicKey) - balanceAfter.should.be.equal(`20000`) + balanceAfter.should.be.equal('20000') }) }) diff --git a/test/integration/transaction.js b/test/integration/transaction.js index a641ccecfa..39a333503b 100644 --- a/test/integration/transaction.js +++ b/test/integration/transaction.js @@ -23,12 +23,13 @@ import { commitmentHash } from '../../es/tx/builder/helpers' const nonce = 1 const nameTtl = 1 const clientTtl = 1 -const amount = 1 +const amount = 0 const senderId = 'ak_2iBPH7HUz3cSDVEUWiHg76MZJ6tZooVNBmmxcgVK6VV8KAE688' const recipientId = 'ak_2iBPH7HUz3cSDVEUWiHg76MZJ6tZooVNBmmxcgVK6VV8KAE688' const name = 'test123test.test' const nameHash = `nm_${encodeBase58Check(Buffer.from(name))}` const nameId = 'nm_2sFnPHi5ziAqhdApSpRBsYdomCahtmk3YGNZKYUTtUNpVSMccC' +const nameFee = '1000000000000000000000' const pointers = [{ key: 'account_pubkey', id: senderId }] // Oracle @@ -44,7 +45,6 @@ const queryResponse = '{\'tmp\': 101}' // Contract test data const contractCode = ` contract Identity = - type state = () entrypoint main(x : int) = x ` let contractId @@ -92,13 +92,15 @@ describe('Native Transaction', function () { accountId: senderId, nonce, name: nameHash, - nameSalt: _salt + nameSalt: _salt, + nameFee }) const nativeTx = await clientNative.nameClaimTx({ accountId: senderId, nonce, name: nameHash, - nameSalt: _salt + nameSalt: _salt, + nameFee }) txFromAPI.should.be.equal(nativeTx) })