From 1642c6c73e748fe5889e005046af7e94f45d6aab Mon Sep 17 00:00:00 2001 From: nduchak Date: Wed, 10 Apr 2019 18:17:01 +0300 Subject: [PATCH 01/40] chore(package): Bump version to 2.4.1 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index d1866c089a..5e4356d9ef 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@aeternity/aepp-sdk", - "version": "2.4.0", + "version": "2.4.1", "description": "SDK for the æternity blockchain", "main": "dist/aepp-sdk.js", "browser": "dist/aepp-sdk.browser.js", From d0b2dce179a1dd76eaa33b934f1f468a5d8ab89f Mon Sep 17 00:00:00 2001 From: nduchak Date: Thu, 11 Apr 2019 13:45:24 +0300 Subject: [PATCH 02/40] chore(Adjust CHANGELOG): --- CHANGELOG.md | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2b759024e..667b2c8470 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,37 @@ All notable changes to this project will be documented in this file. This change log follows the conventions of [keepachangelog.com](http://keepachangelog.com/). +## [2.4.1] +### Added +- feat(ACI): Add transform decoded data for 'address' type +- feat(Aepp): Add Compiler to Aepp rpc methods. Update example app +- Add getContractState method +- feat(Channel): Add call contract static support +- feat(Channel): Add get contract state support +- feat(Channel): Get full channel state support +- docs(*): Adjust ACI, Contract nad Usage +### Changed +- refactor(Http): Handle no response in http stamp error handler +- fix(Crypto): Fix crypto `formatAddress` +- fix(Crypto): Move ADDRESS_FORMAT to crypto + + ### Removed +- none + + ### Breaking Changes +- State Channel: + - `channel.state()` now returns offchain state instead of last co-signed offchain transaction + - `channel.update(...).state` has been renamed to `signedTx` + - `channel.withdraw(...).state` has been renamed to `signedTx` + - `channel.deposit(...).state` has been renamed to `signedTx` + - `channel.leave().state` has been renamed to `signedTx` + - `channel.createContract(...).state` has been renamed to `signedTx` + - `channel.callContract(...).state` has been renamed to `signedTx` + + ### Notes and known Issues +- none + + ## [2.4.0] ### Added - Install and configure `commitizen` @@ -628,4 +659,5 @@ await account.address(format: ADDRESS_FORMAT) // default ADDRESS_FORMAT.api [2.3.0]: https://github.com/aeternity/aepp-sdk-js/compare/2.3.0-next...2.3.0 [2.3.1]: https://github.com/aeternity/aepp-sdk-js/compare/2.3.0...2.3.1 [2.3.2]: https://github.com/aeternity/aepp-sdk-js/compare/2.3.1...2.3.2 -[2.4.0.]: https://github.com/aeternity/aepp-sdk-js/compare/2.3.2...2.4.0 +[2.4.0]: https://github.com/aeternity/aepp-sdk-js/compare/2.3.2...2.4.0 +[2.4.1]: https://github.com/aeternity/aepp-sdk-js/compare/2.4.0...2.4.1 From fa4fdd3e89ae9de834f9f38691dab9dade9ca42f Mon Sep 17 00:00:00 2001 From: nduchak Date: Thu, 11 Apr 2019 13:48:02 +0300 Subject: [PATCH 03/40] chore(CAHNGELOG): Fix typo --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 667b2c8470..a6c5a9faac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,6 @@ log follows the conventions of [keepachangelog.com](http://keepachangelog.com/). ### Added - feat(ACI): Add transform decoded data for 'address' type - feat(Aepp): Add Compiler to Aepp rpc methods. Update example app -- Add getContractState method - feat(Channel): Add call contract static support - feat(Channel): Add get contract state support - feat(Channel): Get full channel state support From 5914b229b04b8c0a757227006bc2e95b2c238022 Mon Sep 17 00:00:00 2001 From: nduchak Date: Thu, 11 Apr 2019 14:14:38 +0300 Subject: [PATCH 04/40] docs(USAGE): Fix networkId in Wallet example --- docs/usage.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/usage.md b/docs/usage.md index f16a196ac2..cdd0561741 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -235,7 +235,7 @@ Example spend function, using aeternity's SDK abstraction onChain: confirm, // guard returning boolean onAccount: confirm, // guard returning boolean onContract: confirm, // guard returning boolean - networkId: 'aet_ua' // or any other networkId your client should connect to + networkId: 'ae_uat' // or any other networkId your client should connect to }).then(ae => ae.spend(parseInt(amount), receiver_pub_key)) ``` From 31d4955a091560acf00d9fa4bfba9dd64c402a83 Mon Sep 17 00:00:00 2001 From: nduchak Date: Thu, 11 Apr 2019 14:30:48 +0300 Subject: [PATCH 05/40] fix(Http): Remove userAgent from axios --- es/utils/http.js | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/es/utils/http.js b/es/utils/http.js index 812bbf6c0c..b3e75dbab7 100644 --- a/es/utils/http.js +++ b/es/utils/http.js @@ -1,15 +1,8 @@ -import ax from 'axios' -import https from 'https' +import axios from 'axios' import JSONbig from 'json-bigint' import * as R from 'ramda' import stampit from '@stamp/it' -const axios = ax.create({ - httpsAgent: new https.Agent({ - rejectUnauthorized: true // For develop - }) -}) - async function get (url, options) { return processResponse( axios.get(`${this.baseUrl}${url}`, R.merge(this.httpConfig, options)) From 14f03642819f5af981b30f85aff58cdda5ec6860 Mon Sep 17 00:00:00 2001 From: nduchak Date: Thu, 11 Apr 2019 14:33:41 +0300 Subject: [PATCH 06/40] chore(CHANGELOG): Fix typo --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a6c5a9faac..daa98f540c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,7 +9,7 @@ log follows the conventions of [keepachangelog.com](http://keepachangelog.com/). - feat(Channel): Add call contract static support - feat(Channel): Add get contract state support - feat(Channel): Get full channel state support -- docs(*): Adjust ACI, Contract nad Usage +- docs(*): Adjust ACI, Contract and Usage ### Changed - refactor(Http): Handle no response in http stamp error handler - fix(Crypto): Fix crypto `formatAddress` From cb69a29b798a993d985703d192eea7edc646db14 Mon Sep 17 00:00:00 2001 From: nduchak Date: Thu, 11 Apr 2019 14:45:21 +0300 Subject: [PATCH 07/40] docs(*): Regenrate docs --- docs/api/channel/index.md | 60 ++++++++++++++++++++++++++++++++++----- 1 file changed, 53 insertions(+), 7 deletions(-) diff --git a/docs/api/channel/index.md b/docs/api/channel/index.md index 246d6f384a..7219ee5d6f 100644 --- a/docs/api/channel/index.md +++ b/docs/api/channel/index.md @@ -23,7 +23,9 @@ import Channel from '@aeternity/aepp-sdk/es/channel/index' * [~deposit(amount, sign, [callbacks])](#module_@aeternity/aepp-sdk/es/channel/index--Channel..deposit) ⇒ `Promise.<object>` * [~createContract(options, sign)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..createContract) ⇒ `Promise.<object>` * [~callContract(options, sign)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..callContract) ⇒ `Promise.<object>` + * [~callContractStatic(options)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..callContractStatic) ⇒ `Promise.<object>` * [~getContractCall(options)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..getContractCall) ⇒ `Promise.<object>` + * [~getContractState(contract)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..getContractState) ⇒ `Promise.<object>` * [~sendMessage(message, recipient)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..sendMessage) @@ -117,7 +119,7 @@ channel.update( 'ak$Gi42jcRm9DcZjk72UWQQBSxi43BG3285C9n4QSvP5JdzDyH2o', 10, async (tx) => await account.signTransaction(tx) -).then({ accepted, state } => +).then({ accepted, signedTx } => if (accepted) { console.log('Update has been accepted') } @@ -175,7 +177,7 @@ Leave channel **Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) **Example** ```js -channel.leave().then(({channelId, state}) => +channel.leave().then(({ channelId, signedTx }) => console.log(channelId) console.log(state) ) @@ -219,10 +221,9 @@ channel.withdraw( 100, async (tx) => await account.signTransaction(tx), { onOnChainTx: (tx) => console.log('on_chain_tx', tx) } -).then(({ accepted, state }) => { +).then(({ accepted, signedTx }) => { if (accepted) { console.log('Withdrawal has been accepted') - console.log('The new state is:', state) } else { console.log('Withdrawal has been rejected') } @@ -284,7 +285,7 @@ channel.createContract({ deposit: 10, vmVersion: 3, abiVersion: 1 -}).then(({ accepted, state, address }) => { +}).then(({ accepted, signedTx, address }) => { if (accepted) { console.log('New contract has been created') console.log('Contract address:', address) @@ -316,15 +317,41 @@ channel.callContract({ callData: 'cb_1111111111111111...', amount: 0, abiVersion: 1 -}).then(({ accepted, state }) => { +}).then(({ accepted, signedTx }) => { if (accepted) { console.log('Contract called succesfully') - console.log('The new state is:', state) } else { console.log('Contract call has been rejected') } }) ``` + + +#### Channel~callContractStatic(options) ⇒ `Promise.<object>` +Call contract using dry-run + +**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) + +| Param | Type | Description | +| --- | --- | --- | +| options | `object` | | +| [options.amount] | `string` | Amount the caller of the contract commits to it | +| [options.callData] | `string` | ABI encoded compiled AEVM call data for the code | +| [options.contract] | `number` | Address of the contract to call | +| [options.abiVersion] | `number` | Version of the ABI | + +**Example** +```js +channel.callContractStatic({ + contract: 'ct_9sRA9AVE4BYTAkh5RNfJYmwQe1NZ4MErasQLXZkFWG43TPBqa', + callData: 'cb_1111111111111111...', + amount: 0, + abiVersion: 1 +}).then(({ returnValue, gasUsed }) => { + console.log('Returned value:', returnValue) + console.log('Gas used:', gasUsed) +}) +``` #### Channel~getContractCall(options) ⇒ `Promise.<object>` @@ -349,6 +376,25 @@ channel.getContractCall({ if (returnType === 'ok') console.log(returnValue) }) ``` + + +#### Channel~getContractState(contract) ⇒ `Promise.<object>` +Get contract latest state + +**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) + +| Param | Type | Description | +| --- | --- | --- | +| contract | `string` | Address of the contract | + +**Example** +```js +channel.getContractState( + 'ct_9sRA9AVE4BYTAkh5RNfJYmwQe1NZ4MErasQLXZkFWG43TPBqa', +).then(({ contract }) => { + console.log('deposit:', contract.deposit) +}) +``` #### Channel~sendMessage(message, recipient) From 9e4221791648fc459749f2c9e7ee38067a50e532 Mon Sep 17 00:00:00 2001 From: nduchak Date: Tue, 16 Apr 2019 18:20:01 +0300 Subject: [PATCH 08/40] chore(bump version in package): --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 5e4356d9ef..0f60bff7ac 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@aeternity/aepp-sdk", - "version": "2.4.1", + "version": "3.0.0", "description": "SDK for the æternity blockchain", "main": "dist/aepp-sdk.js", "browser": "dist/aepp-sdk.browser.js", From 525f5ea1a0ab933642cbf3789705e771e8d64f45 Mon Sep 17 00:00:00 2001 From: nduchak Date: Wed, 17 Apr 2019 14:54:07 +0300 Subject: [PATCH 09/40] chore(CHANGELOG): Adjust changelog to conventional changelog style --- CHANGELOG.md | 1007 +++++++++++++++++++++++++------------------------- 1 file changed, 495 insertions(+), 512 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index daa98f540c..acf01d4482 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,25 +1,42 @@ -# Change Log -All notable changes to this project will be documented in this file. This change -log follows the conventions of [keepachangelog.com](http://keepachangelog.com/). - -## [2.4.1] -### Added -- feat(ACI): Add transform decoded data for 'address' type -- feat(Aepp): Add Compiler to Aepp rpc methods. Update example app -- feat(Channel): Add call contract static support -- feat(Channel): Add get contract state support -- feat(Channel): Get full channel state support -- docs(*): Adjust ACI, Contract and Usage -### Changed -- refactor(Http): Handle no response in http stamp error handler -- fix(Crypto): Fix crypto `formatAddress` -- fix(Crypto): Move ADDRESS_FORMAT to crypto +# [3.0.0](https://github.com/aeternity/aepp-sdk-js/compare/2.4.1...3.0.0) (2019-04-17) + + +### Bug Fixes + +* **ACI:** Fix address type transformation when decoding data ([#335](https://github.com/aeternity/aepp-sdk-js/issues/335)) ([e37cdfc](https://github.com/aeternity/aepp-sdk-js/commit/e37cdfc)) + + +### Features + +* **ACI:** Update due to compiler API changes ([#331](https://github.com/aeternity/aepp-sdk-js/issues/331)) ([e047f3b](https://github.com/aeternity/aepp-sdk-js/commit/e047f3b)) +* **Aepp:** Add Compiler to Aepp rpc methods. Update example app ([#312](https://github.com/aeternity/aepp-sdk-js/issues/312)) ([9c72521](https://github.com/aeternity/aepp-sdk-js/commit/9c72521)) +* **State Channels:** Add cleanContractCalls method ([#338](https://github.com/aeternity/aepp-sdk-js/issues/338)) ([778159a](https://github.com/aeternity/aepp-sdk-js/commit/778159a)) + + + +# [2.4.1](https://github.com/aeternity/aepp-sdk-js/compare/2.4.0...2.4.1) (2019-04-17) + + +### Features + +* **ACI:** Add transform decoded data for 'address' type +* **AEPP:** Add Compiler to Aepp rpc methods. Update example app +* **Channel:** Add call contract static support +* **Channel:** Add get contract state support +* **Channel:** Get full channel state support +* **DOCS:** Adjust ACI, Contract and Usage - ### Removed -- none - ### Breaking Changes -- State Channel: +### Bug Fixes + +* **HTTP:** Handle no response in http stamp error handler +* **Crypto:** Fix crypto `formatAddress` +* **Crypto:** Move ADDRESS_FORMAT to crypto + + +### BREAKING CHANGES + +* **Channels:** - `channel.state()` now returns offchain state instead of last co-signed offchain transaction - `channel.update(...).state` has been renamed to `signedTx` - `channel.withdraw(...).state` has been renamed to `signedTx` @@ -28,635 +45,601 @@ log follows the conventions of [keepachangelog.com](http://keepachangelog.com/). - `channel.createContract(...).state` has been renamed to `signedTx` - `channel.callContract(...).state` has been renamed to `signedTx` - ### Notes and known Issues -- none - - -## [2.4.0] -### Added -- Install and configure `commitizen` -- Add `formatAddress` function to `Crypto` -- Add Contract Compiler API stamp to `es/contract` (now using instead contract node API) -- Add basic `http` client stamp (`es/utils/http`) -- ACI stamp (New Contract interface base on contract ACI schema) -Usage: -``` -const contractIns = await client.getContractInstance(contractSourceCode) -console.log(contract) - { - interface: String, // Contract interface source code - aci: String, // Contract interface json schema - source: String, // Contract source code - compiled: String, // Compiled contract code - deployInfo: { address: contractAddress } // Object with deploy transaction, - // Function - compile: () => this, // Compile contract, - deploy: (init = [], options = { skipArgsConvert: false }) => this, // Deploy contract (compile before if needed) - call: (fn, params = [], options = { skipArgsConvert: false, skipTransformDecoded: false, callStatic: false } => CallRersult: Object // Call contract function - } -``` -### Changed -- Extend `Account.address()` with `accountFormatter` now you can do -``` -export const ADDRESS_FORMAT = { - sophia: 1, // return address like `0xHEX_ADDRESS` - api: 2, // return address like `ak_9LJ8ne9tks78hTD2Tp571f7w2MJmzQMRsiZxKCkMA2d2Sbrc4` -} - -// - -export { ADDRESS_FORMAT } from 'es/account' -await account.address(format: ADDRESS_FORMAT) // default ADDRESS_FORMAT.api -``` -- decode node error coming from contract `call` and `callStatic` -- Throw native error instead of object in chain `chain.sendTransaction` -- fix arguments parsing in `Crypto.sing` -- Add `{ compilerUrl }` to `Universal, Contract, Wallet` stamp initialization -- Add ability to get `account/balance` on specific block `hash/height` -- Fix `name hash` function arguments parsing in `Crypto` -- Improve channel rpc usage -- Improve channel tests and error handling -- Improve state channel params handling - - ### Removed -- `ContractNodeAPI` stamp - - ### Breaking Changes -- Contract stamp API -``` -1) Use Compiler instead of node API for encode/decode call-data and compile. -2) Change Contract interface: - - contractCallStatic (address, abi = 'sophia-address', name, { top, args = '()', call, options = {} } = {}) -> (source, address, name, args = [], { top, options = {} } = {})) - - contractCall (code, abi, address, name, { args = '()', options = {}, call } = {}) -> (source, address, name, args = [], options = {}) - - contractDeploy (code, abi, { initState = '()', options = {} } = {}) -> (code, source, initState = [], options = {}) - - contractEncodeCall (code, abi, name, args, call) -> (source, name, args) // 'source' is -> Contract source code or ACI interface source -``` - - ### Notes and known Issues -- none - -## [2.3.2] -### Added -- none +# [2.4.0](https://github.com/aeternity/aepp-sdk-js/compare/2.3.2...2.4.0) (2019-04-17) -### Changed -- Change default `gasPrice` from `1e6` to `1e9z -- Fix `AEPP` example app -- Force `image` pull before `builds` - ### Removed -- none +### Features - ### Breaking Changes -- none +* **Chore:** Install and configure `commitizen` +* **Crypto:** Add `formatAddress` function to `Crypto` +* **Contract:** Add Contract Compiler API stamp to `es/contract` (now using instead contract node API) +* **Utils:** Add basic `http` client stamp (`es/utils/http`) +* **Contract:** ACI stamp (New Contract interface base on contract ACI schema) + ``` + const contractIns = await client.getContractInstance(contractSourceCode) + console.log(contract) + { + interface: String, // Contract interface source code + aci: String, // Contract interface json schema + source: String, // Contract source code + compiled: String, // Compiled contract code + deployInfo: { address: contractAddress } // Object with deploy transaction, + // Function + compile: () => this, // Compile contract, + deploy: (init = [], options = { skipArgsConvert: false }) => this, // Deploy contract (compile before if needed) + call: (fn, params = [], options = { skipArgsConvert: false, skipTransformDecoded: false, callStatic: false } => CallRersult: Object // Call contract function + } + ``` +* **Account:** Extend `Account.address()` with `accountFormatter` now you can do + ``` + export const ADDRESS_FORMAT = { + sophia: 1, // return address like `0xHEX_ADDRESS` + api: 2, // return address like `ak_9LJ8ne9tks78hTD2Tp571f7w2MJmzQMRsiZxKCkMA2d2Sbrc4` + } + + // + + export { ADDRESS_FORMAT } from 'es/account' + await account.address(format: ADDRESS_FORMAT) // default ADDRESS_FORMAT.api + ``` +* **Channel:** Improve channel rpc usage +* **Channel:** Improve channel tests and error handling +* **Channel:** Improve state channel params handling +* **Chain:** Add ability to get `account/balance` on specific block `hash/height` +* **Universal:** Add `{ compilerUrl }` to `Universal, Contract, Wallet` stamp initialization - ### Notes and known Issues -- none -## [2.3.1] -### Added -- `Oracle` fee calculation -- `getAccountNonce` function to `tx` stamp +### Bug Fixes -### Changed -- Change `FEE_BYTE_SIZE` from 1 to 8 bytes in `fee` calculation -- Improve error handling in `tx` builder +* **Contract:** decode node error coming from contract `call` and `callStatic` +* **Chain:** Throw native error instead of object in chain `chain.sendTransaction` +* **Crypto:** fix arguments parsing in `Crypto.sing` +* **Crypto:** Fix `name hash` function arguments parsing in `Crypto` - ### Removed -- none - ### Breaking Changes -- none + ### BREAKING CHANGES + * **Contract:** Remove `ContractNodeAPI` stamp + * **Contract:** Change Contract stamp API + ``` + 1) Use Compiler instead of node API for encode/decode call-data and compile. + 2) Change Contract interface: + - contractCallStatic (address, abi = 'sophia-address', name, { top, args = '()', call, options = {} } = {}) -> (source, address, name, args = [], { top, options = {} } = {})) + - contractCall (code, abi, address, name, { args = '()', options = {}, call } = {}) -> (source, address, name, args = [], options = {}) + - contractDeploy (code, abi, { initState = '()', options = {} } = {}) -> (code, source, initState = [], options = {}) + - contractEncodeCall (code, abi, name, args, call) -> (source, name, args) // 'source' is -> Contract source code or ACI interface source + ``` - ### Notes and known Issues -- none -## [2.3.0] -### Added -- `Minerva` comparability -- Add `Mnemonic` wallet implementation `es/utils/hd-wallet` +## [2.3.2](https://github.com/aeternity/aepp-sdk-js/compare/2.3.1...2.3.2) (2019-03-04) - ### Changed -- Change Channel `legacy` API to `JSON RPC` -- Change default `gasPrice` to `1e6` -- Change `minFee` calculation, multiply min fee by `1e9` - ### Removed -- none +### Features - ### Breaking Changes -- none +* **Contract:** Change default `gasPrice` from `1e6` to `1e9z +* **AEPP:** Fix `AEPP` example app +* **Build:** Force `image` pull before `builds` - ### Notes and known Issues -- Change supported node version range to `1.4.0 <= version < 3.0.0` -- This release contain changes from: [2.3.0-next](https://github.com/aeternity/aepp-sdk-js/releases/tag/2.3.0-next), [2.2.1-next](https://github.com/aeternity/aepp-sdk-js/releases/tag/2.2.1-next), [2.1.1-0.1.0-next](https://github.com/aeternity/aepp-sdk-js/releases/tag/2.1.1-0.1.0-next), [2.1.0](https://github.com/aeternity/aepp-sdk-js/releases/tag/2.1.0) - ## [2.3.0-next] -### Added -- Add `channel` `withdraw` and `deposit` methods +# [2.3.1](https://github.com/aeternity/aepp-sdk-js/compare/2.3.0...2.3.1) (2019-02-22) - ### Changed -- Change default `gasPrice` in `Contract` stamp and `Tx` stamp to `1e9` -- Fix `contract` tx `fee` calculation -- Refactor error handling in `sendTransaction` function -- Change default `gasPrice` to `1e9` -- Change `Fee` byte_size to 1 - ### Removed -- none +### Features - ### Breaking Changes -- none +* **Oracle:** `Oracle` fee calculation +* **Tx:** `getAccountNonce` function to `tx` stamp +* **TX_BUILDER:** Change `FEE_BYTE_SIZE` from 1 to 8 bytes in `fee` calculation +* **TX_BUILDER:** Improve error handling in `tx` builder - ### Notes and known Issues -- none -## [2.2.1-next] -### Added -- Add `deserialization` schema for `Channel` transactions(`channelCreate`, `channelCloseMutual`, `channelDeposit`, `channelWithdraw`, `channelSettle`) -- Add `rawTx` and `verifyTx` to error from poll function(when you wait for transaction will mined) +# [2.3.0](https://github.com/aeternity/aepp-sdk-js/compare/2.3.0-next...2.3.0) (2019-02-22) -### Changed -- Change Channel `legacy` API to `JSON RPC` -- Change `minFee` calculation, multiply min fee by 10^9 -### Removed -- none +### Features -### Breaking Changes -- none +* **Node:** `Minerva` comparability +* **Utils:** `Mnemonic` wallet implementation `es/utils/hd-wallet` +* **Oracle:** Change Channel `legacy` API to `JSON RPC` +* **Oracle:** Change default `gasPrice` to `1e6` +* **Oracle:** Change `minFee` calculation, multiply min fee by `1e9` -### Notes and known Issues -- Depend on `bip39` from npm instead of git repo +### BREAKING CHANGES +* **Node:** Change supported node version range to `1.4.0 <= version < 3.0.0` +* This release contain changes from: [2.3.0-next](https://github.com/aeternity/aepp-sdk-js/releases/tag/2.3.0-next), [2.2.1-next](https://github.com/aeternity/aepp-sdk-js/releases/tag/2.2.1-next), [2.1.1-0.1.0-next](https://github.com/aeternity/aepp-sdk-js/releases/tag/2.1.1-0.1.0-next), [2.1.0](https://github.com/aeternity/aepp-sdk-js/releases/tag/2.1.0) -## [2.1.1-0.1.0-next] -### Added -- none -### Changed -- Fix linter errors -### Removed -- none +# [2.3.0-next](https://github.com/aeternity/aepp-sdk-js/compare/2.2.1-next...2.3.0-next) (2019-02-21) -### Breaking Changes -- none -### Notes and known Issues -- none +### Features -## [2.1.0] -### Added -- `Minerva` comparability -- Add `Mnemonic` wallet implementation `es/utils/hd-wallet` +* **Channel:** `channel` `withdraw` and `deposit` methods +* **TX_BUILDER:** Change default `gasPrice` in `Contract` stamp and `Tx` stamp to `1e9` +* **TX:** Fix `contract` tx `fee` calculation +* **Chain:** Refactor error handling in `sendTransaction` function +* **Contract:** Change default `gasPrice` to `1e9` +* **TX_BUILDER:** Change `Fee` byte_size to 1 -### Changed -- Change supported node version range to `1.4.0 <= version < 3.0.0` -### Removed -- none -### Breaking Changes -- none +# [2.2.1-next](https://github.com/aeternity/aepp-sdk-js/compare/2.1.1-0.1.0-next...2.2.1-next) (2019-02-21) -### Notes and known Issues -- Broken build(linter errors) - fixed in next release +### Feature -## [2.0.0] -### Added -- Add `unpackedTx`, `txType` and `signature` to `validate` transaction function -- Add `top` param to contract `static call(dry-run)` -- Add errors handling for `dry-run` -- Add `keystore` docs -- Add `verify` options to `send` function which verify tx before broadcasting and throw error if tx is invalid -- Add `dryRun` to `RPC` methods -- Add `Oracle` transaction creation to `Aepp` rpc -- Add `tx builder` docs -- Add doc's for `utils/bytes` and tx builder `schema` +* **TX_BUILDER:** Add `deserialization` schema for `Channel` transactions(`channelCreate`, `channelCloseMutual`, `channelDeposit`, `channelWithdraw`, `channelSettle`) +* **Chain:** Add `rawTx` and `verifyTx` to error from poll function(when you wait for transaction will mined) +* **Chore:** Depend on `bip39` from npm instead of git repo +* **Channel:** Change Channel `legacy` API to `JSON RPC` +* **TX_BUILDER:** Change `minFee` calculation, multiply min fee by 10^9 -### Changed -- refactor `calculateFee` function in `TxBuilder`(use BigNumber) -- `RpcServer`: Avoid storing of `window` in `instance` properties -- Disable `balance formatting` by default -- Extend response of `Oracle`, `Aens`, `Contrat` with `rawTx` -- Change response of `send` function now it's and object with transaction data(hash, rawTxHash, ...) -- Move `verification of transaction` to `chain` stamp -- Move `Contract` and `Oracle` API wrapper's to `Chain` stamp -- Rename `epoch` in `CHANGELOG`, `README`, `HACKING` -- Retrieve `node` version from `/api` -- Fix unpack tx example in `bin/aecrypto.js` - -### Removed -- Remove unused function's from `crypto.js` -### Breaking Changes -- Remove old transaction builder `es/tx/js.js` (Please use `es/tx/builder` instead) -- Rename `es/epoch.js` to `es/node.js` -- Rename `Oracle`, `Contract`, `Chain` API wrapper files from `epoch` to `node` -- Rename `Contract` api wrapper method's +# [2.1.1-0.1.0-next](https://github.com/aeternity/aepp-sdk-js/compare/2.1.0...2.1.1-0.1.0-next) (2019-02-21) -### Notes and known Issues -- none +### Bug Fixes +* **Chore:** Fix linter errors -## [1.3.2] -### Added -- Add `destroyInstance` function to `Ae` stamp which remove all listeners for RPC event's -- Add docs for `TransactionValidator` and `TxBuilder` stamp's -- Add `TxBuilderHelper` to bundle -### Changed -- Adjust doc's for `Contract` and `Aens` stamp's -- Fix decoding of address from contract call -- Contract call static now using `dry-run` API -- Improve test's for Transaction verification -### Removed -- none -### Breaking Changes -- none +# [2.1.0](https://github.com/aeternity/aepp-sdk-js/compare/2.0.0...2.1.0) (2019-02-21) -### Notes and known Issues -- none +### Features -## [1.3.1] +* **Node:** `Minerva` comparability +* **Utils:** Add `Mnemonic` wallet implementation `es/utils/hd-wallet` + + +### BREAKING CHANGES + +* **Node:** Change supported node version range to `1.4.0 <= version < 3.0.0` + + + +# [2.0.0](https://github.com/aeternity/aepp-sdk-js/compare/1.3.2...2.0.0) (2019-02-21) + + +### Features + +* **TX_BUILDER:** Add `unpackedTx`, `txType` and `signature` to `validate` transaction function +* **Contract:** Add `top` param to contract `static call(dry-run)` +* **Contract:** Add errors handling for `dry-run` +* **Docs:** Add `keystore` docs +* **Ae:** Add `verify` options to `send` function which verify tx before broadcasting and throw error if tx is invalid +* **Rpc:** Add `dryRun` to `RPC` methods +* **Rpc:** Add `Oracle` transaction creation to `Aepp` rpc +* **Docs:** Add `tx builder` docs +* **Docs:** Add doc's for `utils/bytes` and tx builder `schema` +* **TX_BUILDER:** refactor `calculateFee` function in `TxBuilder`(use BigNumber) +* **TX_BUILDER:** Extend response of `Oracle`, `Aens`, `Contrat` with `rawTx` +* **Ae:** Change response of `send` function now it's and object with transaction data(hash, rawTxHash, ...) +* **Chain:** Move `Contract` and `Oracle` API wrapper's to `Chain` stamp +* **Chore:** Rename `epoch` in `CHANGELOG`, `README`, `HACKING` + + +### Bug Fixes + +* **Rpc:** `RpcServer`: Avoid storing of `window` in `instance` properties +* **Chain:** Disable `balance formatting` by default +* **Chain:** Move `verification of transaction` to `chain` stamp +* **Node:** Retrieve `node` version from `/api` +* **Chore:** Fix unpack tx example in `bin/aecrypto.js` +* **Chore:** Remove unused function's from `crypto.js` + + +### BREAKING CHANGES + +* **TX:** Remove old transaction builder `es/tx/js.js` (Please use `es/tx/builder` instead) +* **Chore:** Rename `es/epoch.js` to `es/node.js` +* **Chore:** Rename `Oracle`, `Contract`, `Chain` API wrapper files from `epoch` to `node` +* **Chore:** Rename `Contract` api wrapper method's -### Changed -- Remove KeyStore from bundle due to build issue(for now you can export it only using tree-shaking `import * as Keystore from '@aeternity/aepp-sdk/utils/keystore'`) -## [1.3.0] -### Added -- Add support for State Channels -- New transaction builder going through schema(build, unpack) -- Add new stamp `TransactionValidator` which can verify your transaction +## [1.3.2](https://github.com/aeternity/aepp-sdk-js/compare/1.3.1...1.3.2) (2019-02-01) + + +### Features + +* **Ae:** Add `destroyInstance` function to `Ae` stamp which remove all listeners for RPC event's +* **Docs:** Add docs for `TransactionValidator` and `TxBuilder` stamp's +* **Build:** Add `TxBuilderHelper` to bundle +* **Chore:** Contract call static now using `dry-run` API +* **Test:** Improve test's for Transaction verification + + ### Changed -- Rename epoch to aeternity node(docker configs, some docs) -- Use new tx builder in TX stamp -- Set default values for amount and deposit to 0 for `contract` transaction -- Improve RPC server -### Removed -- none -### Breaking Changes -- none +* **Docs:** Adjust doc's for `Contract` and `Aens` stamp's +* **Chore:** Fix decoding of address from contract call + + + +## [1.3.1](https://github.com/aeternity/aepp-sdk-js/compare/1.3.0...1.3.1) (2019-01-29) + + +### Features + +* **Build:** Remove KeyStore from bundle due to build issue(for now you can export it only using tree-shaking `import * as Keystore from '@aeternity/aepp-sdk/utils/keystore'`) + + + +# [1.3.0](https://github.com/aeternity/aepp-sdk-js/compare/1.2.1...1.3.0) (2019-01-29) + + +### Features + +* **Channel:** Add support for State Channels +* **TX_BUILDER:** New transaction builder going through schema(build, unpack) +* **TX_VALIDATOR:** Add new stamp `TransactionValidator` which can verify your transaction +* **Chore:** Rename epoch to aeternity node(docker configs, some docs) +* **Tx:** Use new tx builder in TX stamp +* **Contract:** Set default values for amount and deposit to 0 for `contract` transaction +* **Rpc:** Improve RPC server + ### Notes and known Issues - Old transaction builder `es/tx/js.js` will be removed in next major release. -## [1.2.1] -### Added -- amount formatter -- amount format balance `client.balance('AK_PUBLICKEY', { format: true })` -- Oracle and Contracts API to Aepp stamp -### Changed -- Use `prepare` instead of `postinstall-build` (thanks @davidyuk) -- Fix Import RLP package (thanks @davidyuk) -- Fix for NetworkId propagation and override -- TxJS is not a stamp anymore, and instead: it exports helper functions -- Refreshed Docs: README.md + docs/usage.md -### Removed -- TxJs stamp (not a stamp anymore) +## [1.2.1](https://github.com/aeternity/aepp-sdk-js/compare/1.1.2...1.2.1) (2018-12-21) -### Breaking Changes -- TxJs stamp (not a stamp anymore) -- balance now answer a formatted string composed of `AMOUNT + ' ' + unit` (eg. `10 exa` for 10 AE) -### Notes and known Issues -- `10 exa` should be `10 ae` -- format shouldn't be a flag, but a request for `unit` eg. `{ format: `ae` }` +### Features +* **Chain:** amount formatter +* **Chain:** amount format balance `client.balance('AK_PUBLICKEY', { format: true })` +* **Aepp:** Oracle and Contracts API to Aepp stamp +* **Chore:** Use `prepare` instead of `postinstall-build` (thanks @davidyuk) +* **Docs:** Refreshed Docs: README.md + docs/usage.md -## [1.1.2] -### Added -- isAddressValid check +### Bug Fixes -### Changed -- Compatibility with Node >= 1.0.0 and <= 1.1.0 -- Fixed networkId propagation (and overriding on init of Flavors) -- Tx Fee formulas -- Fixed encodeBase58Check by feeding Buffered input +* **Chr:** Fix Import RLP package (thanks @davidyuk) +* **Rpc:** Fix for NetworkId propagation and override +* **Tx:** TxJS is not a stamp anymore, and instead: it exports helper functions -### Removed -- none -### Breaking Changes -- none +### BREAKING CHANGES + +* **Tx:** TxJs stamp (not a stamp anymore) +* **Chain:** balance now answer a formatted string composed of `AMOUNT + ' ' + unit` (eg. `10 exa` for 10 AE) ### Notes and known Issues -- none +* **Chore:** `10 exa` should be `10 ae` +* **Chain:** format shouldn't be a flag, but a request for `unit` eg. `{ format: `ae` }` -## [1.1.1] -### Added -- none -### Changed -- Fix Testing -- Added a command to remove images after CI testing -- Fixed Oracle error for Wallet flavor -### Removed -- none +## [1.1.2](https://github.com/aeternity/aepp-sdk-js/compare/1.1.1...1.1.2) (2018-12-15) -### Breaking Changes -- none -### Notes and known Issues -- none +### Feature -## [1.1.0] -### Added -- Oracles functionality and flavor -- Simple example of aepp-in-aepp (see `/examples` folder) +* **Chore:** isAddressValid check +* **Tx:** Tx Fee formulas -### Changed -- Fixed issue with big numbers and `TX` -### Removed -- none +### Bug Fixes -### Breaking Changes -- none +* **Rpc:** Fixed networkId propagation (and overriding on init of Flavors) +* **Crypto:** Fixed encodeBase58Check by feeding Buffered input -### Notes and known Issues -- none -## [1.0.1] -### Added -- ability to support Node range(s) using semver package (see https://www.npmjs.com/package/semver#ranges) +### BREAKING CHANGES -### Changed -- Support for Node >= 1.0.0 and < 2.0.0 +* **Chore:** Compatibility with Node >= 1.0.0 and <= 1.1.0 -### Removed -- none -### Breaking Changes -- none -### Notes and known Issues -- none +## [1.1.1](https://github.com/aeternity/aepp-sdk-js/compare/1.1.0...1.1.1) (2018-12-11) +### Features -## [1.0.0] -### Added -- Contract native Transactions +* **Rpc:** Added a command to remove images after CI testing -### Changed -- Rolled back to bignumbers.js for easier fix with axios.get/post -### Removed -- Support for Node < 1.0.0 +### Bug Fixes -### Breaking Changes -- New NETWORK_ID (also used in docker/sdk.env for CI tests) -- Encoding of transaction (and other objects) [changed from base58check to base64check](https://github.com/aeternity/protocol/blob/master/node/api/api_encoding.md) +* **Rpc:** Fix Testing +* **Rpc:** Fixed Oracle error for Wallet flavor -### Notes and known Issues -- State Channels have been excluded for problems with CI, will be included in next release -## [0.25.0-0.1.1] -### Added -- see [0.25.0-0.1.0] +# [1.1.0](https://github.com/aeternity/aepp-sdk-js/compare/1.0.1...1.1.0) (2018-12-11) -### Changed -- Change bignumbers.js with [bn.js](https://github.com/indutny/bn.js/) due to binding errors in browser's package -### Removed -- see [0.25.0-0.1.0] +### Features -### Breaking Changes -- see [0.25.0-0.1.0] +* **Oracle:** Oracles functionality and flavor +* **Aepp:** Simple example of aepp-in-aepp (see `/examples` folder) -### Notes and known Issues -- none, see [0.25.0-0.1.0] +### Bug Fixes -## [0.25.0-0.1.0] -### Added -- Parsing of `fee` using `bignum.js` -- Add `networkId` as param to `Account` flavor(default: `ae_mainnet`) -- Implement native build of `AENS` transaction. +* **Tx:** Fixed issue with big numbers and `TX` -### Changed -- Update keystore for new [requirements](https://www.pivotaltracker.com/n/projects/2124891/stories/155155204) -- -### Removed -- Support for < 0.25.0 -- [AE CLI](https://github.com/aeternity/aecli-js) and [AE PROJECT CLI](https://github.com/aeternity/aeproject) moved to separate repos and packages -### Breaking Changes -- Use NETWORK_ID for signing (see [here](https://github.com/aeternity/aepp-sdk-js/commit/9c252f937f7ea501c4aaacbbef53c4c1833e48e4#diff-ffb275ebb09085c85c59f140998199e0R28)) -- Keystore format [changes](https://www.pivotaltracker.com/n/projects/2124891/stories/155155204) + +## [1.0.1](https://github.com/aeternity/aepp-sdk-js/compare/1.0.0...1.0.1) (2018-11-30) + + + +### Features + +* **Node:** ability to support Node range(s) using semver package (see https://www.npmjs.com/package/semver#ranges) + + +### BREAKING CHANGES + +* **Node:** Support for Node >= 1.0.0 and < 2.0.0 + + + +## [1.0.0](https://github.com/aeternity/aepp-sdk-js/compare/0.25.0-0.1.1...1.0.0) (2018-11-30) + + + +### Features + +* **Contract:** Contract native Transactions + + +### Bug Fixes + +* **BigNumber:** Rolled back to bignumbers.js for easier fix with axios.get/post + + +### BREAKING CHANGES + +* **Node:** Support for Node < 1.0.0 +* **Build:** New NETWORK_ID (also used in docker/sdk.env for CI tests) +* **Protocol:** Encoding of transaction (and other objects) [changed from base58check to base64check](https://github.com/aeternity/protocol/blob/master/node/api/api_encoding.md) + ### Notes and known Issues -- none +* **Channel:** State Channels have been excluded for problems with CI, will be included in next release -## [0.25.0-0.1.0-next] -### Added -- Contract type checked call (Ability to call contract using contract address) -### Changed -- Use ES methods instead of Ramda, where possible -- Fixed keystore by adding a salt param for derivedKey function -### Removed -- Support for < 0.25.0 -- [AE CLI](https://github.com/aeternity/aecli-js) and [AE PROJECT CLI](https://github.com/aeternity/aeproject) moved to separate repos and packages +## [0.25.0-0.1.1](https://github.com/aeternity/aepp-sdk-js/compare/0.25.0-0.1.0...0.25.0-0.1.1) (2018-11-30) -### Breaking Changes -- Aens use domain `.test` instead of `.aet` (see [here](https://github.com/aeternity/aepp-sdk-js/commit/9c252f937f7ea501c4aaacbbef53c4c1833e48e4#diff-8ef3b328d008ef3dbb72a0bca42eba37L24)) -- Use NETWORK_ID for signing (see [here](https://github.com/aeternity/aepp-sdk-js/commit/9c252f937f7ea501c4aaacbbef53c4c1833e48e4#diff-ffb275ebb09085c85c59f140998199e0R28)) ### Notes and known Issues +* **Chore:** See [0.25.0-0.1.0] -## [0.24.0-0.2.0] -### Added -- RPC Client improvements -- (RPC) `onContract` Guard -- (AE PROJECT CLI) born -### Changed -- (CLI) New keystore following these specifications: https://www.pivotaltracker.com/n/projects/2124891/stories/155155204 -- (CLI) `Host` parameter became `Url`. (`-u` for hostname, `-U` for internal) + +## [0.25.0-0.1.0](https://github.com/aeternity/aepp-sdk-js/compare/0.25.0-0.1.0-next...0.25.0-0.1.0) (2018-11-30) + + +### Features + +* **Utils** Parsing of `fee` using `bignum.js` +* **Account** Add `networkId` as param to `Account` flavor(default: `ae_mainnet`) +* **Tx** Implement native build of `AENS` transaction. +* **Keystore** Update keystore for new [requirements](https://www.pivotaltracker.com/n/projects/2124891/stories/155155204) + + +### BREAKING CHANGES + +* **CLI** [AE CLI](https://github.com/aeternity/aecli-js) and [AE PROJECT CLI](https://github.com/aeternity/aeproject) moved to separate repos and packages +* **Node** Support for < 0.25.0 + + + +## [0.25.0-0.1.0-next](https://github.com/aeternity/aepp-sdk-js/compare/0.24.0-0.2.0...0.25.0-0.1.0-next) (2018-11-30) + + +### Features + +* **Contract** Contract type checked call (Ability to call contract using contract address) +* **Contract** Use ES methods instead of Ramda, where possible + +### Bug Fixes + +* **Contract** Fixed keystore by adding a salt param for derivedKey function + ### Breaking Changes -- The `Cli` flavor is now `Universal` -- the keypair keys changed from `{ pub, priv }` to `{ publicKey, secretKey }` for consistency with other systems using them (eg. AirGap and [HD Wallet](https://github.com/aeternity/hd-wallet-js)) -### Notes and known Issues -- CLI and AE PROJECT CLI will move to a separate package +* **Contract** Support for < 0.25.0 +* **Contract** Aens use domain `.test` instead of `.aet` (see [here](https://github.com/aeternity/aepp-sdk-js/commit/9c252f937f7ea501c4aaacbbef53c4c1833e48e4#diff-8ef3b328d008ef3dbb72a0bca42eba37L24)) +* **Contract** Use NETWORK_ID for signing (see [here](https://github.com/aeternity/aepp-sdk-js/commit/9c252f937f7ea501c4aaacbbef53c4c1833e48e4#diff-ffb275ebb09085c85c59f140998199e0R28)) -## [0.24.0-0.1.0] -### Added -- Full support of [Node-0.24.0](https://github.com/aeternity/aeternity/releases/tag/v0.24.0) -- (CLI) Develop `decode base58` address command in `crypto` module -- (CLI) Add `nonce` param to all tx command's -- (CLI) Add `gas` param to `deploy` and `call` commands -- Add ability to create `spend` transaction natively -- Implement `ethereum keystore` using `AES-126-CTR` and `SCRYPT` as key derivation function +# [0.24.0-0.2.0](https://github.com/aeternity/aepp-sdk-js/compare/v0.24.0-0.1.0...v0.24.0-0.2.0) (2018-10-30) -### Changed -- (CLI) Change `--privateKey` to `flag` on `ACCOUNT ADDRESS` command -- Change `node version` in `Dockerfile` -- API endpoints to meet new Node specifications -- Update `docco` config and change `rename` package to `recursive-rename` -- Improved documentation -### Removed -- Support for < 0.24.0 + +### Features + +* **Rpc** RPC Client improvements +* **Rpc** `onContract` Guard +* **CLI** born +* **CLI** `Host` parameter became `Url`. (`-u` for hostname, `-U` for internal) +* **CLI** New keystore following these specifications: https://www.pivotaltracker.com/n/projects/2124891/stories/155155204 + + +### BREAKING CHANGES + +* **Chore** The `Cli` flavor is now `Universal` +* **Chore** the keypair keys changed from `{ pub, priv }` to `{ publicKey, secretKey }` for consistency with other systems using them (eg. AirGap and [HD Wallet](https://github.com/aeternity/hd-wallet-js)) ### Notes and known Issues -- `ethereum keystore` usage will be removed in the next release -- CLI will move to a separate package +* **Chore** CLI and AE PROJECT CLI will move to a separate package -## [0.22.0-0.1.0-beta.1] -### Added -- Add **CLI** implementation -- nameId function for commitment hash calculations -### Changed -- API endpoints to meet new Node specifications -- Add Nonce calculation on SDK side -- Add check for MAX_GAS in call and deploy contract -- change hash prefix separator from $ to _ -- Add keywords ('SDK', 'CLI') to package.json -- Link aecli to `./bin/aecli.js` in package.json (After "npm link" you can use CLI globally) -- Wait until pre-claim transaction block was mined before send claim transaction -- Updated `webpack`, `webpack-cli` and added new dev deps accordingly -- Add Node Compatibility Check -- Add SDK nonce calculations -- Fixes commitment hash calculations in naming system, to be `Hash(nameId(name) + name_salt)` instead of `Hash(Hash(name + name_salt))`. - -### Removed -- Support for < 0.22.0 - -## [0.18.0-0.1.1] -### Added -- Lots of new documentation (prose and API) -- Fancy badges to README -- Transitive dev dependencies for standard-loader not covered by pnpm -- CI Dockerfile to include pnpm -- Fancy-shmancy diagram in README -- Generated documentation files since they are linked in static docs -### Changed -- Switch from Yarn to pnpm for building -- Structure of documentation -- Generate Markdown from Docco - -## [0.18.0-0.1.0] -### Added -- Support for Node 0.18.0 (changed endpoints) -- Wallet/Aepp RPC support -- Contract call result decoding support -- Per-module API documentation (Markdown based on JSDoc) -- More API documentation (still incomplete) -- SDK entrypoint factories (in `/es/ae/universal.js`) - -### Removed -- Support for < 0.18.0 (changed endpoints) -### Changed -- Module load path (src -> es) -- Lower mining rate (5s) in docker-compose +# [0.24.0-0.1.0](https://github.com/aeternity/aepp-sdk-js/compare/0.22.0-0.1.0-beta.1...v0.24.0-0.1.0) (2018-10-23) -### Fixed -- Symmetric key encryption/decryption -## [0.15.0-0.1.0] -### Removed -- Legacy Swagger file loading -- Compatibility with < 0.15.0 +### Features -### Fixed -- Contract unit state initialization -- Missing required parameter for name transfers (workaround for - [Swagger file bug]) +* **Node** Full support of [Node-0.24.0](https://github.com/aeternity/aeternity/releases/tag/v0.24.0) +* **CLI** Develop `decode base58` address command in `crypto` module +* **CLI** Add `nonce` param to all tx command's +* **CLI** Add `gas` param to `deploy` and `call` commands +* **Tx** Add ability to create `spend` transaction natively +* **Keystore** Implement `ethereum keystore` using `AES-126-CTR` and `SCRYPT` as key derivation function +* **CLI** Change `--privateKey` to `flag` on `ACCOUNT ADDRESS` command +* **Build** Change `node version` in `Dockerfile` +* **Node** API endpoints to meet new Node specifications +* **Chore** Update `docco` config and change `rename` package to `recursive-rename` +* **Docs** Improved documentation -[Swagger file bug]: https://www.pivotaltracker.com/n/projects/2124891 -## [0.14.0-0.1.0] -### Added -- New, opinionated top-level API +### BREAKING CHANGES -### Changed -- Rest of legacy API now uses new API as well -- Generated API now encapsulated in `api` object -- Automatic case conversion for remote parameter names -- Remaining tests to use new API -- Adapted new method of obtaining transaction hash, breaks compatibility (see +* **Node** Support for < 0.24.0 +* **Keystore** `ethereum keystore` usage will be removed in the next release +* **CLI** CLI will move to a separate package + + + +# [0.22.0-0.1.0-beta.1](https://github.com/aeternity/aepp-sdk-js/compare/v0.18.0-0.1.1...0.22.0-0.1.0-beta.1) (2018-10-02) + +### Features + +* **CLI** Add **CLI** implementation +* **Crypto** nameId function for commitment hash calculations +* **Node** API endpoints to meet new Node specifications +* **Tx** Add Nonce calculation on SDK side +* **Contract** Add check for MAX_GAS in call and deploy contract +* **Chore** change hash prefix separator from $ to _ +* **Chore** Add keywords ('SDK', 'CLI') to package.json +* **CLI** Link aecli to `./bin/aecli.js` in package.json (After "npm link" you can use CLI globally) +* **Aens** Wait until pre-claim transaction block was mined before send claim transaction +* **Build** Updated `webpack`, `webpack-cli` and added new dev deps accordingly +* **Node** Add Node Compatibility Check + +### Bug Fixes + +* **Crypto** Fixes commitment hash calculations in naming system, to be `Hash(nameId(name) + name_salt)` instead of `Hash(Hash(name + name_salt))`. + +### BREAKING CHANGES + +* **Node** Support for < 0.22.0 + + + +# [0.18.0-0.1.1](https://github.com/aeternity/aepp-sdk-js/compare/v0.18.0-0.1.0...v0.18.0-0.1.1) (2018-07-31) + +### Features + +* **Docs** Lots of new documentation (prose and API) +* **Docs** Fancy badges to README +* **Build** Transitive dev dependencies for standard-loader not covered by pnpm +* **Build** CI Dockerfile to include pnpm +* **Docs** Fancy-shmancy diagram in README +* **Docs**Generated documentation files since they are linked in static docs +* **Build** Switch from Yarn to pnpm for building +* **Docs** Structure of documentation +* **Docs** Generate Markdown from Docco + + + +# [0.18.0-0.1.0](https://github.com/aeternity/aepp-sdk-js/compare/v0.15.0-0.1.0...v0.18.0-0.1.0) (2018-07-24) + + +### Features + +* **Node** Support for Node 0.18.0 (changed endpoints) +* **RPC** Wallet/Aepp RPC support +* **Contract** Contract call result decoding support +* **Docs** Per-module API documentation (Markdown based on JSDoc) +* **Docs** More API documentation (still incomplete) +* **Build** SDK entrypoint factories (in `/es/ae/universal.js`) +* **Build** Module load path (src -> es) +* **Chore** Lower mining rate (5s) in docker-compose + + +### Bug Fixes + +* **Crypto** Symmetric key encryption/decryption + + +### BREAKING CHANGES + +* **Node** Support for < 0.18.0 (changed endpoints) + + + + +# [0.15.0-0.1.0](https://github.com/aeternity/aepp-sdk-js/compare/v0.14.0-0.1.0...v0.15.0-0.1.0) (2018-06-12) + + +### Features + +* **Node** Legacy Swagger file loading +* **Node** Compatibility with < 0.15.0 + + +### Bug Fixes + +* **Contract** Contract unit state initialization +* **Node** Missing required parameter for name transfers (workaround for + [Swagger file bug](https://www.pivotaltracker.com/n/projects/2124891)) + + + +# [0.14.0-0.1.0](https://github.com/aeternity/aepp-sdk-js/compare/v0.13.0-0.1.1...v0.14.0-0.1.0) (2018-06-11) + + +### Features + +* **API** New, opinionated top-level API +* **API** Rest of legacy API now uses new API as well +* **API** Generated API now encapsulated in `api` object +* **API** Automatic case conversion for remote parameter names +* **API** Remaining tests to use new API +* **API** Adapted new method of obtaining transaction hash, breaks compatibility (see below) -### Removed -- Oracle API (for the time being) -- Legacy API and tests -- Compatibility with older versions of Node which provide the transaction hash + +### Bug Fixes + +* **API** [GH-49]: Handle existing path components correctly + + +### BREAKING CHANGES +* **API** Remove Oracle API (for the time being) +* **API** Remove Legacy API and tests +* **API** Remove Compatibility with older versions of Node which provide the transaction hash the old way -### Fixed -- [GH-49]: Handle existing path components correctly -## [0.13.0-0.1.0] -### Added -- This change log file -### Changed -- Switch to curve ed25519 (from secp256k1) to align with Node protocol changes -- Generate basic API directly from Swagger files, also validate input data -- Compiled library now self-contained with all dependencies -- Use Webpack 4 based cross-platform (Node/Web) compilation -- Package description now reads `SDK for the æternity blockchain` -- Authors are now taken from `AUTHORS` instead of `package.json` -- Moved code examples from README to separate file in docs - -### Removed -- Defunct scripts; will be brought back later - -### Fixed -- More consistent code examples - -[0.13.0-0.1.0]: https://github.com/aeternity/aepp-sdk-js/compare/v0.10.0-0.1.0...v0.13.0-0.1.0 -[0.14.0-0.1.0]: https://github.com/aeternity/aepp-sdk-js/compare/v0.13.0-0.1.0...v0.14.0-0.1.0 -[0.15.0-0.1.0]: https://github.com/aeternity/aepp-sdk-js/compare/v0.14.0-0.1.0...v0.15.0-0.1.0 -[0.18.0-0.1.0]: https://github.com/aeternity/aepp-sdk-js/compare/v0.15.0-0.1.0...v0.18.0-0.1.0 -[0.18.0-0.1.1]: https://github.com/aeternity/aepp-sdk-js/compare/v0.18.0-0.1.0...v0.18.0-0.1.1 -[0.22.0-0.1.0-beta.1]: https://github.com/aeternity/aepp-sdk-js/compare/v0.18.0-0.1.1...v0.22.0-0.1.0-beta.1 -[0.24.0-0.1.0]: https://github.com/aeternity/aepp-sdk-js/compare/v0.22.0-0.1.0-beta.1...v0.24.0-0.1.0 -[0.24.0-0.2.0]: https://github.com/aeternity/aepp-sdk-js/compare/v0.24.0-0.1.0...v0.24.0-0.2.0 -[0.25.0-0.1.0-next]: https://github.com/aeternity/aepp-sdk-js/compare/v0.24.0-0.2.0...v0.25.0-0.1.0-next -[0.25.0-0.1.0]: https://github.com/aeternity/aepp-sdk-js/compare/v0.25.0-0.1.0-next...v0.25.0-0.1.0 -[0.25.0-0.1.1]: https://github.com/aeternity/aepp-sdk-js/compare/v0.25.0-0.1.0...v0.25.0-0.1.1 -[1.0.0]: https://github.com/aeternity/aepp-sdk-js/compare/v0.25.0-0.1.0...1.0.0 -[1.0.1]: https://github.com/aeternity/aepp-sdk-js/compare/1.0.0...1.0.1 -[1.1.0]: https://github.com/aeternity/aepp-sdk-js/compare/1.0.0...1.1.0 -[1.1.1]: https://github.com/aeternity/aepp-sdk-js/compare/1.1.0...1.1.1 -[1.1.2]: https://github.com/aeternity/aepp-sdk-js/compare/1.1.1...1.1.2 -[1.2.1]: https://github.com/aeternity/aepp-sdk-js/compare/1.1.2...1.2.1 -[1.3.0]: https://github.com/aeternity/aepp-sdk-js/compare/1.2.1...1.3.0 -[1.3.1]: https://github.com/aeternity/aepp-sdk-js/compare/1.3.0...1.3.1 -[1.3.2]: https://github.com/aeternity/aepp-sdk-js/compare/1.3.1...1.3.2 -[2.0.0]: https://github.com/aeternity/aepp-sdk-js/compare/1.3.2...2.0.0 -[2.1.0]: https://github.com/aeternity/aepp-sdk-js/compare/2.0.0...2.1.0 -[2.1.1-0.1.0-next]: https://github.com/aeternity/aepp-sdk-js/compare/2.1.0...2.1.1-0.1.0-next -[2.2.1-next]: https://github.com/aeternity/aepp-sdk-js/compare/2.1.1-0.1.0-next...2.2.1-next -[2.3.0-next]: https://github.com/aeternity/aepp-sdk-js/compare/2.2.1-next...2.3.0-next -[2.3.0]: https://github.com/aeternity/aepp-sdk-js/compare/2.3.0-next...2.3.0 -[2.3.1]: https://github.com/aeternity/aepp-sdk-js/compare/2.3.0...2.3.1 -[2.3.2]: https://github.com/aeternity/aepp-sdk-js/compare/2.3.1...2.3.2 -[2.4.0]: https://github.com/aeternity/aepp-sdk-js/compare/2.3.2...2.4.0 -[2.4.1]: https://github.com/aeternity/aepp-sdk-js/compare/2.4.0...2.4.1 +# [0.13.0-0.1.1](https://github.com/aeternity/aepp-sdk-js/compare/v0.13.0-0.1.0...v0.13.0-0.1.1) (2018-05-24) + + +### Features + +* **Node** Switch to curve ed25519 (from secp256k1) to align with Node protocol changes +* **Node** Generate basic API directly from Swagger files, also validate input data +* **Build** Compiled library now self-contained with all dependencies +* **Build** Use Webpack 4 based cross-platform (Node/Web) compilation +* **Docs** Package description now reads `SDK for the æternity blockchain` +* **Chore** Authors are now taken from `AUTHORS` instead of `package.json` +* **Docs** Moved code examples from README to separate file in docs + + +### BREAKING CHANGES + +* **Node** Defunct scripts; will be brought back later + + +### Bug Fixes + +* **Chore** More consistent code examples From fffdf1295882b2471af00c9749773232d4099e18 Mon Sep 17 00:00:00 2001 From: nduchak Date: Wed, 17 Apr 2019 14:54:57 +0300 Subject: [PATCH 10/40] chore(Docker): Update node version tot 2.3.0 --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index 45221a325a..10bf699537 100644 --- a/.env +++ b/.env @@ -1,3 +1,3 @@ -TAG=v2.2.0 +TAG=v2.3.0 COMPILER_TAG=v2.1.0 From eb3d4be13c6f20260e2eb5e8f5734dc8d5641417 Mon Sep 17 00:00:00 2001 From: nduchak Date: Wed, 17 Apr 2019 15:00:14 +0300 Subject: [PATCH 11/40] docs(CHANGELOG): Adjust release --- CHANGELOG.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index acf01d4482..3b74bfb07d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -# [3.0.0](https://github.com/aeternity/aepp-sdk-js/compare/2.4.1...3.0.0) (2019-04-17) +# [3.0.0](https://github.com/aeternity/aepp-sdk-js/compare/2.4.0...3.0.0) (2019-04-17) ### Bug Fixes @@ -8,6 +8,8 @@ ### Features +* **TX_BUILDER:** Channel tx serializations +* **TxValidator:** Add minGasPrice validation to contract transactions * **ACI:** Update due to compiler API changes ([#331](https://github.com/aeternity/aepp-sdk-js/issues/331)) ([e047f3b](https://github.com/aeternity/aepp-sdk-js/commit/e047f3b)) * **Aepp:** Add Compiler to Aepp rpc methods. Update example app ([#312](https://github.com/aeternity/aepp-sdk-js/issues/312)) ([9c72521](https://github.com/aeternity/aepp-sdk-js/commit/9c72521)) * **State Channels:** Add cleanContractCalls method ([#338](https://github.com/aeternity/aepp-sdk-js/issues/338)) ([778159a](https://github.com/aeternity/aepp-sdk-js/commit/778159a)) From 97c2a3c31747763a6a2c00a19b0bfaae27dc81de Mon Sep 17 00:00:00 2001 From: nduchak Date: Wed, 17 Apr 2019 15:03:09 +0300 Subject: [PATCH 12/40] feat(npm): Add script for auto-generating changelog --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 0f60bff7ac..f3f535ae21 100644 --- a/package.json +++ b/package.json @@ -15,6 +15,7 @@ "test:watch": "mocha --recursive --require @babel/register --watch", "test-jenkins": "mocha --recursive --require @babel/register --reporter mocha-junit-reporter", "prepare": "npm run build", + "genChangelog": "conventional-changelog -p angular -i CHANGELOG.md -s", "prepublishOnly": "npm run docs:docco && npm run docs:api" }, "license": "ISC", From 77cfbc8fd6e45b1ad6647b828acbf5af5b957d47 Mon Sep 17 00:00:00 2001 From: nduchak Date: Wed, 17 Apr 2019 15:30:06 +0300 Subject: [PATCH 13/40] chore(Node): downgrade to 2.2.0 due to failed channel test --- .env | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.env b/.env index 10bf699537..45221a325a 100644 --- a/.env +++ b/.env @@ -1,3 +1,3 @@ -TAG=v2.3.0 +TAG=v2.2.0 COMPILER_TAG=v2.1.0 From 55a289132d472a6c233be6984a4425c692f72d6c Mon Sep 17 00:00:00 2001 From: nduchak Date: Wed, 17 Apr 2019 15:31:37 +0300 Subject: [PATCH 14/40] fix(Channel): Fix failing test on 2.3.0 node --- .env | 2 +- test/integration/channel.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.env b/.env index 45221a325a..10bf699537 100644 --- a/.env +++ b/.env @@ -1,3 +1,3 @@ -TAG=v2.2.0 +TAG=v2.3.0 COMPILER_TAG=v2.1.0 diff --git a/test/integration/channel.js b/test/integration/channel.js index 627566a72c..60a909b2e2 100644 --- a/test/integration/channel.js +++ b/test/integration/channel.js @@ -701,7 +701,7 @@ describe('Channel', function () { }) it('when posting an update with incorrect address', async () => { - return update({ from: 'ak_123' }).should.eventually.be.rejectedWith('Rejected') + return update({ from: 'ak_123' }).should.eventually.be.rejectedWith('Internal error') }) it('when posting an update with incorrect amount', async () => { From ed82eb625f856b8707943c8f879d01a4245301cc Mon Sep 17 00:00:00 2001 From: nduchak Date: Wed, 17 Apr 2019 15:44:26 +0300 Subject: [PATCH 15/40] chore(package-lock): adjust package-lock --- CHANGELOG.md | 17 +++ package-lock.json | 257 +++++++++++++++++++++++----------------------- 2 files changed, 146 insertions(+), 128 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b74bfb07d..83b53cc23d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,20 @@ +# [3.0.0](https://github.com/aeternity/aepp-sdk-js/compare/2.4.1...3.0.0) (2019-04-17) + + +### Bug Fixes + +* **ACI:** Fix address type transformation when decoding data ([#335](https://github.com/aeternity/aepp-sdk-js/issues/335)) ([e37cdfc](https://github.com/aeternity/aepp-sdk-js/commit/e37cdfc)) +* **Channel:** Fix failing test on 2.3.0 node ([55a2891](https://github.com/aeternity/aepp-sdk-js/commit/55a2891)) + + +### Features + +* **ACI:** Update due to compiler API changes ([#331](https://github.com/aeternity/aepp-sdk-js/issues/331)) ([e047f3b](https://github.com/aeternity/aepp-sdk-js/commit/e047f3b)) +* **npm:** Add script for auto-generating changelog ([97c2a3c](https://github.com/aeternity/aepp-sdk-js/commit/97c2a3c)) +* **State Channels:** Add cleanContractCalls method ([#338](https://github.com/aeternity/aepp-sdk-js/issues/338)) ([778159a](https://github.com/aeternity/aepp-sdk-js/commit/778159a)) + + + # [3.0.0](https://github.com/aeternity/aepp-sdk-js/compare/2.4.0...3.0.0) (2019-04-17) diff --git a/package-lock.json b/package-lock.json index 7e0fa12296..02ac2d3f45 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aeternity/aepp-sdk", - "version": "2.3.0", + "version": "3.0.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1836,8 +1836,7 @@ "version": "2.7.0", "resolved": "https://registry.npmjs.org/acorn/-/acorn-2.7.0.tgz", "integrity": "sha1-q259nYhqrKiwhbwzEreaGYQz8Oc=", - "dev": true, - "optional": true + "dev": true }, "acorn-dynamic-import": { "version": "3.0.0", @@ -1954,15 +1953,6 @@ "nan": "^2.10.0" } }, - "argparse": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", - "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, - "requires": { - "sprintf-js": "~1.0.2" - } - }, "argv-tools": { "version": "0.1.1", "resolved": "https://registry.npmjs.org/argv-tools/-/argv-tools-0.1.1.tgz", @@ -2094,8 +2084,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", "integrity": "sha1-8S4PPF13sLHN2RRpQuTpbB5N1SU=", - "dev": true, - "optional": true + "dev": true }, "assertion-error": { "version": "1.1.0", @@ -3197,7 +3186,6 @@ "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.6.tgz", "integrity": "sha1-cj599ugBrFYTETp+RFqbactjKBg=", "dev": true, - "optional": true, "requires": { "delayed-stream": "~1.0.0" } @@ -3323,6 +3311,12 @@ "integrity": "sha1-/ozxhP9mcLa67wGp1IYaXL7EEgo=", "dev": true }, + "conventional-commit-types": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/conventional-commit-types/-/conventional-commit-types-2.1.1.tgz", + "integrity": "sha512-0Ts+fEdmjqYDOQ1yZ+LNgdSPO335XZw9qC10M7CxtLP3nIMGmeMhmkM8Taffa4+MXN13bRPlp0CtH+QfOzKTzw==", + "dev": true + }, "convert-source-map": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.5.1.tgz", @@ -3440,8 +3434,7 @@ "version": "0.3.4", "resolved": "https://registry.npmjs.org/cssom/-/cssom-0.3.4.tgz", "integrity": "sha512-+7prCSORpXNeR4/fUP3rL+TzqtiFfhMvTd7uEqMdgPvLPt4+uzFUeufx5RHjGTACCargg/DiEt/moMQmvnfkog==", - "dev": true, - "optional": true + "dev": true }, "cssstyle": { "version": "0.2.37", @@ -3458,6 +3451,19 @@ "resolved": "https://registry.npmjs.org/cyclist/-/cyclist-0.2.2.tgz", "integrity": "sha1-GzN5LhHpFKL9bW7WRHRkRE5fpkA=" }, + "cz-conventional-changelog": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/cz-conventional-changelog/-/cz-conventional-changelog-2.1.0.tgz", + "integrity": "sha1-L0vHOQ4yROTfKT5ro1Hkx0Cnx2Q=", + "dev": true, + "requires": { + "conventional-commit-types": "^2.0.0", + "lodash.map": "^4.5.1", + "longest": "^1.0.1", + "right-pad": "^1.0.1", + "word-wrap": "^1.0.3" + } + }, "dashdash": { "version": "1.14.1", "resolved": "https://registry.npmjs.org/dashdash/-/dashdash-1.14.1.tgz", @@ -3629,8 +3635,7 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=", - "dev": true, - "optional": true + "dev": true }, "delegates": { "version": "1.0.0", @@ -3681,9 +3686,9 @@ } }, "dmd": { - "version": "3.0.12", - "resolved": "https://registry.npmjs.org/dmd/-/dmd-3.0.12.tgz", - "integrity": "sha512-79w644JdsB2TthYpVl2bDurX7i9Abaegg2E7X46Ajc135aASTMXxrHzJ9mOa5X5nbmnXwlBYiF68K+1baX+BzQ==", + "version": "3.0.13", + "resolved": "https://registry.npmjs.org/dmd/-/dmd-3.0.13.tgz", + "integrity": "sha512-FV/417bH2c/CYpe8BjFEAHoaHaItcJnPlKELi/qyPZdmUom8joyuC78OhhfPUdyKD/WcouTQ2LxQT4M/RoiJ3w==", "dev": true, "requires": { "array-back": "^2.0.0", @@ -4662,8 +4667,7 @@ "version": "1.3.0", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz", "integrity": "sha1-lpGEQOMEGnpBT4xS48V06zw+HgU=", - "dev": true, - "optional": true + "dev": true }, "fast-deep-equal": { "version": "1.1.0", @@ -4949,14 +4953,14 @@ "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8=" }, "fsevents": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.4.tgz", - "integrity": "sha512-z8H8/diyk76B7q5wg+Ud0+CqzcAF3mBBI/bA5ne5zrRUUIvNkJY//D3BqyH571KuAC4Nr7Rw7CjWX4r0y9DvNg==", + "version": "1.2.8", + "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-1.2.8.tgz", + "integrity": "sha512-tPvHgPGB7m40CZ68xqFGkKuzN+RnpGmSV+hgeKxhRpbxdqKXUFJGC3yonBOLzQBcJyGpdZFDfCsdOC2KFsXzeA==", "dev": true, "optional": true, "requires": { - "nan": "^2.9.2", - "node-pre-gyp": "^0.10.0" + "nan": "^2.12.1", + "node-pre-gyp": "^0.12.0" }, "dependencies": { "abbrev": { @@ -4968,8 +4972,7 @@ "ansi-regex": { "version": "2.1.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "aproba": { "version": "1.2.0", @@ -4978,7 +4981,7 @@ "optional": true }, "are-we-there-yet": { - "version": "1.1.4", + "version": "1.1.5", "bundled": true, "dev": true, "optional": true, @@ -4990,21 +4993,19 @@ "balanced-match": { "version": "1.0.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "brace-expansion": { "version": "1.1.11", "bundled": true, "dev": true, - "optional": true, "requires": { "balanced-match": "^1.0.0", "concat-map": "0.0.1" } }, "chownr": { - "version": "1.0.1", + "version": "1.1.1", "bundled": true, "dev": true, "optional": true @@ -5012,20 +5013,17 @@ "code-point-at": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "concat-map": { "version": "0.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "console-control-strings": { "version": "1.1.0", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "core-util-is": { "version": "1.0.2", @@ -5034,16 +5032,16 @@ "optional": true }, "debug": { - "version": "2.6.9", + "version": "4.1.1", "bundled": true, "dev": true, "optional": true, "requires": { - "ms": "2.0.0" + "ms": "^2.1.1" } }, "deep-extend": { - "version": "0.5.1", + "version": "0.6.0", "bundled": true, "dev": true, "optional": true @@ -5092,7 +5090,7 @@ } }, "glob": { - "version": "7.1.2", + "version": "7.1.3", "bundled": true, "dev": true, "optional": true, @@ -5112,12 +5110,12 @@ "optional": true }, "iconv-lite": { - "version": "0.4.21", + "version": "0.4.24", "bundled": true, "dev": true, "optional": true, "requires": { - "safer-buffer": "^2.1.0" + "safer-buffer": ">= 2.1.2 < 3" } }, "ignore-walk": { @@ -5142,8 +5140,7 @@ "inherits": { "version": "2.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "ini": { "version": "1.3.5", @@ -5155,7 +5152,6 @@ "version": "1.0.0", "bundled": true, "dev": true, - "optional": true, "requires": { "number-is-nan": "^1.0.0" } @@ -5170,7 +5166,6 @@ "version": "3.0.4", "bundled": true, "dev": true, - "optional": true, "requires": { "brace-expansion": "^1.1.7" } @@ -5178,21 +5173,19 @@ "minimist": { "version": "0.0.8", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "minipass": { - "version": "2.2.4", + "version": "2.3.5", "bundled": true, "dev": true, - "optional": true, "requires": { - "safe-buffer": "^5.1.1", + "safe-buffer": "^5.1.2", "yallist": "^3.0.0" } }, "minizlib": { - "version": "1.1.0", + "version": "1.2.1", "bundled": true, "dev": true, "optional": true, @@ -5204,41 +5197,47 @@ "version": "0.5.1", "bundled": true, "dev": true, - "optional": true, "requires": { "minimist": "0.0.8" } }, "ms": { - "version": "2.0.0", + "version": "2.1.1", "bundled": true, "dev": true, "optional": true }, + "nan": { + "version": "2.13.2", + "resolved": "https://registry.npmjs.org/nan/-/nan-2.13.2.tgz", + "integrity": "sha512-TghvYc72wlMGMVMluVo9WRJc0mB8KxxF/gZ4YYFy7V2ZQX9l7rgbPg7vjS9mt6U5HXODVFVI2bOduCzwOMv/lw==", + "dev": true, + "optional": true + }, "needle": { - "version": "2.2.0", + "version": "2.3.0", "bundled": true, "dev": true, "optional": true, "requires": { - "debug": "^2.1.2", + "debug": "^4.1.0", "iconv-lite": "^0.4.4", "sax": "^1.2.4" } }, "node-pre-gyp": { - "version": "0.10.0", + "version": "0.12.0", "bundled": true, "dev": true, "optional": true, "requires": { "detect-libc": "^1.0.2", "mkdirp": "^0.5.1", - "needle": "^2.2.0", + "needle": "^2.2.1", "nopt": "^4.0.1", "npm-packlist": "^1.1.6", "npmlog": "^4.0.2", - "rc": "^1.1.7", + "rc": "^1.2.7", "rimraf": "^2.6.1", "semver": "^5.3.0", "tar": "^4" @@ -5255,13 +5254,13 @@ } }, "npm-bundled": { - "version": "1.0.3", + "version": "1.0.6", "bundled": true, "dev": true, "optional": true }, "npm-packlist": { - "version": "1.1.10", + "version": "1.4.1", "bundled": true, "dev": true, "optional": true, @@ -5285,8 +5284,7 @@ "number-is-nan": { "version": "1.0.1", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "object-assign": { "version": "4.1.1", @@ -5298,7 +5296,6 @@ "version": "1.4.0", "bundled": true, "dev": true, - "optional": true, "requires": { "wrappy": "1" } @@ -5338,12 +5335,12 @@ "optional": true }, "rc": { - "version": "1.2.7", + "version": "1.2.8", "bundled": true, "dev": true, "optional": true, "requires": { - "deep-extend": "^0.5.1", + "deep-extend": "^0.6.0", "ini": "~1.3.0", "minimist": "^1.2.0", "strip-json-comments": "~2.0.1" @@ -5373,19 +5370,18 @@ } }, "rimraf": { - "version": "2.6.2", + "version": "2.6.3", "bundled": true, "dev": true, "optional": true, "requires": { - "glob": "^7.0.5" + "glob": "^7.1.3" } }, "safe-buffer": { - "version": "5.1.1", + "version": "5.1.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "safer-buffer": { "version": "2.1.2", @@ -5400,7 +5396,7 @@ "optional": true }, "semver": { - "version": "5.5.0", + "version": "5.7.0", "bundled": true, "dev": true, "optional": true @@ -5421,7 +5417,6 @@ "version": "1.0.2", "bundled": true, "dev": true, - "optional": true, "requires": { "code-point-at": "^1.0.0", "is-fullwidth-code-point": "^1.0.0", @@ -5441,7 +5436,6 @@ "version": "3.0.1", "bundled": true, "dev": true, - "optional": true, "requires": { "ansi-regex": "^2.0.0" } @@ -5453,17 +5447,17 @@ "optional": true }, "tar": { - "version": "4.4.1", + "version": "4.4.8", "bundled": true, "dev": true, "optional": true, "requires": { - "chownr": "^1.0.1", + "chownr": "^1.1.1", "fs-minipass": "^1.2.5", - "minipass": "^2.2.4", - "minizlib": "^1.1.0", + "minipass": "^2.3.4", + "minizlib": "^1.1.1", "mkdirp": "^0.5.0", - "safe-buffer": "^5.1.1", + "safe-buffer": "^5.1.2", "yallist": "^3.0.2" } }, @@ -5474,25 +5468,23 @@ "optional": true }, "wide-align": { - "version": "1.1.2", + "version": "1.1.3", "bundled": true, "dev": true, "optional": true, "requires": { - "string-width": "^1.0.2" + "string-width": "^1.0.2 || 2" } }, "wrappy": { "version": "1.0.2", "bundled": true, - "dev": true, - "optional": true + "dev": true }, "yallist": { - "version": "3.0.2", + "version": "3.0.3", "bundled": true, - "dev": true, - "optional": true + "dev": true } } }, @@ -5666,25 +5658,29 @@ "dev": true }, "handlebars": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.1.0.tgz", - "integrity": "sha512-l2jRuU1NAWK6AW5qqcTATWQJvNPEwkM7NEKSiv/gqOsoSQbVoWyqVEY5GS+XPQ88zLNmqASRpzfdm8d79hJS+w==", + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/handlebars/-/handlebars-4.1.2.tgz", + "integrity": "sha512-nvfrjqvt9xQ8Z/w0ijewdD/vvWDTOweBUm96NTr66Wfvo1mJenBLwcYmPs3TIBP5ruzYGD7Hx/DaM9RmhroGPw==", "dev": true, "requires": { - "async": "^2.5.0", + "neo-async": "^2.6.0", "optimist": "^0.6.1", "source-map": "^0.6.1", "uglify-js": "^3.1.4" }, "dependencies": { - "async": { - "version": "2.6.2", - "resolved": "https://registry.npmjs.org/async/-/async-2.6.2.tgz", - "integrity": "sha512-H1qVYh1MYhEEFLsP97cVKqCGo7KfCyTt6uEWqsTBr9SO84oK9Uwbyd/yCW+6rKJLHksBNUVWZDAjfS+Ccx0Bbg==", + "commander": { + "version": "2.20.0", + "resolved": "https://registry.npmjs.org/commander/-/commander-2.20.0.tgz", + "integrity": "sha512-7j2y+40w61zy6YC2iRNpUe/NwhNyoXrYpHMrSunaMG64nRnaf96zO/KMQR4OyN/UnE5KLyEBnKHd4aG3rskjpQ==", "dev": true, - "requires": { - "lodash": "^4.17.11" - } + "optional": true + }, + "neo-async": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.0.tgz", + "integrity": "sha512-MFh0d/Wa7vkKO3Y3LlacqAEeHK0mckVqzDieUKTT+KGxi+zIpeVsFxymkIiRpbpDziHc290Xr9A1O4Om7otoRA==", + "dev": true }, "source-map": { "version": "0.6.1", @@ -5693,13 +5689,13 @@ "dev": true }, "uglify-js": { - "version": "3.4.9", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.4.9.tgz", - "integrity": "sha512-8CJsbKOtEbnJsTyv6LE6m6ZKniqMiFWmm9sRbopbkGs3gMPPfd3Fh8iIA4Ykv5MgaTbqHr4BaoGLJLZNhsrW1Q==", + "version": "3.5.4", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.5.4.tgz", + "integrity": "sha512-GpKo28q/7Bm5BcX9vOu4S46FwisbPbAmkkqPnGIpKvKTM96I85N6XHQV+k4I6FA2wxgLhcsSyHoNhzucwCflvA==", "dev": true, "optional": true, "requires": { - "commander": "~2.17.1", + "commander": "~2.20.0", "source-map": "~0.6.1" } } @@ -6387,11 +6383,9 @@ }, "js-yaml": { "version": "3.12.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", - "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", + "resolved": "", "dev": true, "requires": { - "argparse": "^1.0.7", "esprima": "^4.0.0" }, "dependencies": { @@ -6839,6 +6833,12 @@ "integrity": "sha512-Oo2Si3RMKV3+lV5MsSWplDQFoTClz/24S0MMHYcgGWWmFXr6TMlqcqk/l1GtH+d5wLBwNRiqGnwDRMirtFalJw==", "dev": true }, + "longest": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/longest/-/longest-1.0.1.tgz", + "integrity": "sha1-MKCy2jj3N3DoKUoNIuZiXtd9AJc=", + "dev": true + }, "loose-envify": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/loose-envify/-/loose-envify-1.4.0.tgz", @@ -6891,9 +6891,9 @@ } }, "marked": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.5.0.tgz", - "integrity": "sha512-UhjmkCWKu1SS/BIePL2a59BMJ7V42EYtTfksodPRXzPEGEph3Inp5dylseqt+KbU9Jglsx8xcMKmlumfJMBXAA==", + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/marked/-/marked-0.6.2.tgz", + "integrity": "sha512-LqxwVH3P/rqKX4EKGz7+c2G9r98WeM/SW34ybhgNGhUQNKtf1GmmSkJ6cDGJ/t6tiyae49qRkpyTw2B9HOrgUA==", "dev": true }, "md5": { @@ -6972,15 +6972,13 @@ "version": "1.35.0", "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.35.0.tgz", "integrity": "sha512-JWT/IcCTsB0Io3AhWUMjRqucrHSPsSf2xKLaRldJVULioggvkJvggZ3VXNNSRkCddE6D+BUI4HEIZIA2OjwIvg==", - "dev": true, - "optional": true + "dev": true }, "mime-types": { "version": "2.1.19", "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.19.tgz", "integrity": "sha512-P1tKYHVSZ6uFo26mtnve4HQFE3koh1UWVkp8YUC+ESBHe945xWSoXuHHiGarDqcEZ+whpCDnlNw5LON0kLo+sw==", "dev": true, - "optional": true, "requires": { "mime-db": "~1.35.0" } @@ -7960,8 +7958,7 @@ "version": "1.1.29", "resolved": "https://registry.npmjs.org/psl/-/psl-1.1.29.tgz", "integrity": "sha512-AeUmQ0oLN02flVHXWh9sSJF7mcdFq0ppid/JkErufc3hGIV/AMa8Fo9VgDo/cT2jFdOWoFvHp90qqBH54W+gjQ==", - "dev": true, - "optional": true + "dev": true }, "public-encrypt": { "version": "4.0.2", @@ -8122,7 +8119,7 @@ "dependencies": { "minimist": { "version": "1.2.0", - "resolved": "http://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-1.2.0.tgz", "integrity": "sha1-o1AIsg9BOD7sH7kU9M1d95omQoQ=" } } @@ -8553,6 +8550,12 @@ "integrity": "sha512-TTlYpa+OL+vMMNG24xSlQGEJ3B/RzEfUlLct7b5G/ytav+wPrplCpVMFuwzXbkecJrb6IYo1iFb0S9v37754mg==", "dev": true }, + "right-pad": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/right-pad/-/right-pad-1.0.1.tgz", + "integrity": "sha1-jKCMLLtbVedNr6lr9/0aJ9VoyNA=", + "dev": true + }, "rimraf": { "version": "2.6.2", "resolved": "https://registry.npmjs.org/rimraf/-/rimraf-2.6.2.tgz", @@ -9102,12 +9105,6 @@ "extend-shallow": "^3.0.0" } }, - "sprintf-js": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true - }, "sshpk": { "version": "1.14.2", "resolved": "https://registry.npmjs.org/sshpk/-/sshpk-1.14.2.tgz", @@ -9768,7 +9765,6 @@ "resolved": "https://registry.npmjs.org/tough-cookie/-/tough-cookie-2.4.3.tgz", "integrity": "sha512-Q5srk/4vDM54WJsJio3XNn6K2sCG+CQ8G5Wz6bZhRZoAe/+TxjWB/GlFAnYEbkYVlON9FMk/fE3h2RLpPXo4lQ==", "dev": true, - "optional": true, "requires": { "psl": "^1.1.24", "punycode": "^1.4.1" @@ -9778,8 +9774,7 @@ "version": "1.4.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-1.4.1.tgz", "integrity": "sha1-wNWmOycYgArY4esPpSachN1BhF4=", - "dev": true, - "optional": true + "dev": true } } }, @@ -10469,6 +10464,12 @@ "string-width": "^1.0.2 || 2" } }, + "word-wrap": { + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/word-wrap/-/word-wrap-1.2.3.tgz", + "integrity": "sha512-Hz/mrNwitNRh/HUAtM/VT/5VH+ygD6DV7mYKZAtHOrbs8U7lvPS6xf7EJKMF0uW1KJCl0H701g3ZGus+muE5vQ==", + "dev": true + }, "wordwrap": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-1.0.0.tgz", From a059273494b561152a676df2be22efd016b6d6e4 Mon Sep 17 00:00:00 2001 From: nduchak Date: Wed, 17 Apr 2019 15:46:46 +0300 Subject: [PATCH 16/40] chore(Channel): Revert to 2.2.0 --- .env | 2 +- CHANGELOG.md | 17 ----------------- test/integration/channel.js | 2 +- 3 files changed, 2 insertions(+), 19 deletions(-) diff --git a/.env b/.env index 10bf699537..45221a325a 100644 --- a/.env +++ b/.env @@ -1,3 +1,3 @@ -TAG=v2.3.0 +TAG=v2.2.0 COMPILER_TAG=v2.1.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index 83b53cc23d..3b74bfb07d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,20 +1,3 @@ -# [3.0.0](https://github.com/aeternity/aepp-sdk-js/compare/2.4.1...3.0.0) (2019-04-17) - - -### Bug Fixes - -* **ACI:** Fix address type transformation when decoding data ([#335](https://github.com/aeternity/aepp-sdk-js/issues/335)) ([e37cdfc](https://github.com/aeternity/aepp-sdk-js/commit/e37cdfc)) -* **Channel:** Fix failing test on 2.3.0 node ([55a2891](https://github.com/aeternity/aepp-sdk-js/commit/55a2891)) - - -### Features - -* **ACI:** Update due to compiler API changes ([#331](https://github.com/aeternity/aepp-sdk-js/issues/331)) ([e047f3b](https://github.com/aeternity/aepp-sdk-js/commit/e047f3b)) -* **npm:** Add script for auto-generating changelog ([97c2a3c](https://github.com/aeternity/aepp-sdk-js/commit/97c2a3c)) -* **State Channels:** Add cleanContractCalls method ([#338](https://github.com/aeternity/aepp-sdk-js/issues/338)) ([778159a](https://github.com/aeternity/aepp-sdk-js/commit/778159a)) - - - # [3.0.0](https://github.com/aeternity/aepp-sdk-js/compare/2.4.0...3.0.0) (2019-04-17) diff --git a/test/integration/channel.js b/test/integration/channel.js index 60a909b2e2..627566a72c 100644 --- a/test/integration/channel.js +++ b/test/integration/channel.js @@ -701,7 +701,7 @@ describe('Channel', function () { }) it('when posting an update with incorrect address', async () => { - return update({ from: 'ak_123' }).should.eventually.be.rejectedWith('Internal error') + return update({ from: 'ak_123' }).should.eventually.be.rejectedWith('Rejected') }) it('when posting an update with incorrect amount', async () => { From 71b0d0578115341c437ca9117f309d6bcb68fe9f Mon Sep 17 00:00:00 2001 From: nduchak Date: Wed, 17 Apr 2019 15:59:38 +0300 Subject: [PATCH 17/40] docs(Docs): Regenerate docs --- CHANGELOG.md | 5 +++++ docs/api/channel/index.md | 19 +++++++++++++++++++ docs/api/tx/builder.md | 1 + 3 files changed, 25 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3b74bfb07d..32d760e552 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,11 @@ * **State Channels:** Add cleanContractCalls method ([#338](https://github.com/aeternity/aepp-sdk-js/issues/338)) ([778159a](https://github.com/aeternity/aepp-sdk-js/commit/778159a)) +### BREAKING CHANGES + +* **ACI** Remove 2.0.0 compiler compatibility + + # [2.4.1](https://github.com/aeternity/aepp-sdk-js/compare/2.4.0...2.4.1) (2019-04-17) diff --git a/docs/api/channel/index.md b/docs/api/channel/index.md index 7219ee5d6f..ee8662dc97 100644 --- a/docs/api/channel/index.md +++ b/docs/api/channel/index.md @@ -14,6 +14,7 @@ import Channel from '@aeternity/aepp-sdk/es/channel/index' * [~on(event, callback)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..on) * [~status()](#module_@aeternity/aepp-sdk/es/channel/index--Channel..status) ⇒ `string` * [~state()](#module_@aeternity/aepp-sdk/es/channel/index--Channel..state) ⇒ `object` + * [~id()](#module_@aeternity/aepp-sdk/es/channel/index--Channel..id) ⇒ `string` * [~update(from, to, amount, sign)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..update) ⇒ `Promise.<object>` * [~poi(addresses)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..poi) ⇒ `Promise.<string>` * [~balances(accounts)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..balances) ⇒ `Promise.<object>` @@ -26,6 +27,7 @@ import Channel from '@aeternity/aepp-sdk/es/channel/index' * [~callContractStatic(options)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..callContractStatic) ⇒ `Promise.<object>` * [~getContractCall(options)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..getContractCall) ⇒ `Promise.<object>` * [~getContractState(contract)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..getContractState) ⇒ `Promise.<object>` + * [~cleanContractCalls()](#module_@aeternity/aepp-sdk/es/channel/index--Channel..cleanContractCalls) ⇒ `Promise` * [~sendMessage(message, recipient)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..sendMessage) @@ -97,6 +99,12 @@ Get current status #### Channel~state() ⇒ `object` Get current state +**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) + + +#### Channel~id() ⇒ `string` +Get channel id + **Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) @@ -395,6 +403,17 @@ channel.getContractState( console.log('deposit:', contract.deposit) }) ``` + + +#### Channel~cleanContractCalls() ⇒ `Promise` +Clean up all locally stored contract calls + +Contract calls are kept locally in order for the participant to be able to look them up. +They consume memory and in order for the participant to free it - one can prune all messages. +This cleans up all locally stored contract calls and those will no longer be available for +fetching and inspection. + +**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) #### Channel~sendMessage(message, recipient) diff --git a/docs/api/tx/builder.md b/docs/api/tx/builder.md index f16c668fac..7344617a9b 100644 --- a/docs/api/tx/builder.md +++ b/docs/api/tx/builder.md @@ -101,6 +101,7 @@ Build transaction hash | type | `String` | | Transaction type | | [options] | `Object` | {} | options | | [options.excludeKeys] | `Object` | | excludeKeys Array of keys to exclude for validation and build | +| [options.prefix] | `String` | | Prefix of transaction | From d0b7fa630f9c3c68d0317905b88e8d39342795da Mon Sep 17 00:00:00 2001 From: nduchak Date: Wed, 24 Apr 2019 14:44:31 +0300 Subject: [PATCH 18/40] refactor(node): Add txHash to sendTransaction error --- es/chain/node.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/es/chain/node.js b/es/chain/node.js index a43d5fac53..58feafcd2a 100644 --- a/es/chain/node.js +++ b/es/chain/node.js @@ -126,7 +126,7 @@ async function poll (th, { blocks = 10, interval = 5000 } = {}) { await pause(interval) return probe() } - throw new Error(`Giving up after ${blocks} blocks mined.`) + throw new Error(`Giving up after ${blocks} blocks mined. TxHash ${th}`) } return probe() From d8f0bdea017c727186fc1d6b6a4121f950be9393 Mon Sep 17 00:00:00 2001 From: nduchak Date: Wed, 24 Apr 2019 14:45:45 +0300 Subject: [PATCH 19/40] chore(package): bump version to 3.1.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index f3f535ae21..6c254d8967 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@aeternity/aepp-sdk", - "version": "3.0.0", + "version": "3.1.0", "description": "SDK for the æternity blockchain", "main": "dist/aepp-sdk.js", "browser": "dist/aepp-sdk.browser.js", From d4054002fa6c0a4ec5efc8a242268a2c6b68d5ba Mon Sep 17 00:00:00 2001 From: nduchak Date: Wed, 24 Apr 2019 14:47:45 +0300 Subject: [PATCH 20/40] chore(Docs): Regeneratee docs and changelog --- CHANGELOG.md | 20 ++ docs/api/account.md | 10 + docs/api/chain.md | 10 + docs/api/channel/index.md | 342 +++++++++++++++++++++++----------- docs/api/contract.md | 33 ++++ docs/api/tx/builder/schema.md | 2 +- 6 files changed, 311 insertions(+), 106 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 32d760e552..f0311229fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,23 @@ +# [3.1.0](https://github.com/aeternity/aepp-sdk-js/compare/2.4.0...3.1.0) (2019-04-24) + + +### Bug Fixes + +* **ACI:** Fix address type transformation when decoding data ([#335](https://github.com/aeternity/aepp-sdk-js/issues/335)) ([e37cdfc](https://github.com/aeternity/aepp-sdk-js/commit/e37cdfc)) + + +### Features + +* **ACI:** Add `contract`, `address`, `record` types argument/result transformation ([#349](https://github.com/aeternity/aepp-sdk-js/issues/349)) ([0599d7d](https://github.com/aeternity/aepp-sdk-js/commit/0599d7d)) +* **ACI:** Update due to compiler API changes ([#331](https://github.com/aeternity/aepp-sdk-js/issues/331)) ([e047f3b](https://github.com/aeternity/aepp-sdk-js/commit/e047f3b)) +* **Aepp:** Add Compiler to Aepp rpc methods. Update example app ([#312](https://github.com/aeternity/aepp-sdk-js/issues/312)) ([9c72521](https://github.com/aeternity/aepp-sdk-js/commit/9c72521)) +* **Compiler:** Add decode CallData by source/bytecode ([#354](https://github.com/aeternity/aepp-sdk-js/issues/354)) ([761f36b](https://github.com/aeternity/aepp-sdk-js/commit/761f36b)) +* **RPC:** Add getNodeInfo and getNetworkId to AEPP stamp through RPC ([#359](https://github.com/aeternity/aepp-sdk-js/issues/359)) ([2ddeea8](https://github.com/aeternity/aepp-sdk-js/commit/2ddeea8)) +* **State Channels:** Add cleanContractCalls method ([#338](https://github.com/aeternity/aepp-sdk-js/issues/338)) ([778159a](https://github.com/aeternity/aepp-sdk-js/commit/778159a)) +* **State Channels:** Ping every 10 seconds to persist connection ([#324](https://github.com/aeternity/aepp-sdk-js/issues/324)) ([6d0e156](https://github.com/aeternity/aepp-sdk-js/commit/6d0e156)), closes [#276](https://github.com/aeternity/aepp-sdk-js/issues/276) [#299](https://github.com/aeternity/aepp-sdk-js/issues/299) [#300](https://github.com/aeternity/aepp-sdk-js/issues/300) [#303](https://github.com/aeternity/aepp-sdk-js/issues/303) [#302](https://github.com/aeternity/aepp-sdk-js/issues/302) [#279](https://github.com/aeternity/aepp-sdk-js/issues/279) [#275](https://github.com/aeternity/aepp-sdk-js/issues/275) [#276](https://github.com/aeternity/aepp-sdk-js/issues/276) [#299](https://github.com/aeternity/aepp-sdk-js/issues/299) [#300](https://github.com/aeternity/aepp-sdk-js/issues/300) + + + # [3.0.0](https://github.com/aeternity/aepp-sdk-js/compare/2.4.0...3.0.0) (2019-04-17) diff --git a/docs/api/account.md b/docs/api/account.md index 2807ea329f..4ba81a889a 100644 --- a/docs/api/account.md +++ b/docs/api/account.md @@ -12,6 +12,7 @@ import Account from '@aeternity/aepp-sdk/es/account' * [@aeternity/aepp-sdk/es/account](#module_@aeternity/aepp-sdk/es/account) * [Account([options])](#exp_module_@aeternity/aepp-sdk/es/account--Account) ⇒ `Object` ⏏ * [.signTransaction(tx)](#module_@aeternity/aepp-sdk/es/account--Account+signTransaction) ⇒ `String` + * [.getNetworkId()](#module_@aeternity/aepp-sdk/es/account--Account+getNetworkId) ⇒ `String` * *[.sign(data)](#module_@aeternity/aepp-sdk/es/account--Account+sign) ⇒ `String`* * *[.address()](#module_@aeternity/aepp-sdk/es/account--Account+address) ⇒ `String`* @@ -50,6 +51,15 @@ Sign encoded transaction | --- | --- | --- | | tx | `String` | Transaction to sign | + + +#### account.getNetworkId() ⇒ `String` +Obtain networkId for signing + +**Kind**: instance method of [`Account`](#exp_module_@aeternity/aepp-sdk/es/account--Account) +**Returns**: `String` - NetworkId +**Category**: async +**rtype**: `() => networkId: String` #### *account.sign(data) ⇒ `String`* diff --git a/docs/api/chain.md b/docs/api/chain.md index dc36c83995..8d9f6b1292 100644 --- a/docs/api/chain.md +++ b/docs/api/chain.md @@ -28,6 +28,7 @@ import Chain from '@aeternity/aepp-sdk/es/chain' * *[.getMicroBlockHeader()](#module_@aeternity/aepp-sdk/es/chain--Chain+getMicroBlockHeader) ⇒ `Object`* * *[.getAccount(address, [options])](#module_@aeternity/aepp-sdk/es/chain--Chain+getAccount) ⇒ `Object`* * *[.txDryRun(txs, accounts, hashOrHeight)](#module_@aeternity/aepp-sdk/es/chain--Chain+txDryRun) ⇒ `Object`* + * *[.getInfo()](#module_@aeternity/aepp-sdk/es/chain--Chain+getInfo) ⇒ `Object`* * _static_ * [.waitMined(bool)](#module_@aeternity/aepp-sdk/es/chain--Chain.waitMined) ⇒ `Stamp` @@ -242,6 +243,15 @@ Transaction dry-run | accounts | `Array` | Array of account's | | hashOrHeight | `String` \| `Number` | hash or height of block on which to make dry-run | + + +#### *chain.getInfo() ⇒ `Object`* +Get Node Info + +**Kind**: instance abstract method of [`Chain`](#exp_module_@aeternity/aepp-sdk/es/chain--Chain) +**Returns**: `Object` - Result +**Category**: async +**rtype**: `() => result: Object` #### Chain.waitMined(bool) ⇒ `Stamp` diff --git a/docs/api/channel/index.md b/docs/api/channel/index.md index ee8662dc97..432490fc16 100644 --- a/docs/api/channel/index.md +++ b/docs/api/channel/index.md @@ -10,65 +10,74 @@ import Channel from '@aeternity/aepp-sdk/es/channel/index' ``` * [@aeternity/aepp-sdk/es/channel/index](#module_@aeternity/aepp-sdk/es/channel/index) - * [Channel([options])](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) ⇒ `Object` ⏏ + * [Channel(options)](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) ⇒ `Promise.<Object>` ⏏ * [~on(event, callback)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..on) - * [~status()](#module_@aeternity/aepp-sdk/es/channel/index--Channel..status) ⇒ `string` - * [~state()](#module_@aeternity/aepp-sdk/es/channel/index--Channel..state) ⇒ `object` - * [~id()](#module_@aeternity/aepp-sdk/es/channel/index--Channel..id) ⇒ `string` - * [~update(from, to, amount, sign)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..update) ⇒ `Promise.<object>` - * [~poi(addresses)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..poi) ⇒ `Promise.<string>` - * [~balances(accounts)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..balances) ⇒ `Promise.<object>` - * [~leave()](#module_@aeternity/aepp-sdk/es/channel/index--Channel..leave) ⇒ `Promise.<object>` - * [~shutdown(sign)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..shutdown) ⇒ `Promise.<string>` - * [~withdraw(amount, sign, [callbacks])](#module_@aeternity/aepp-sdk/es/channel/index--Channel..withdraw) ⇒ `Promise.<object>` - * [~deposit(amount, sign, [callbacks])](#module_@aeternity/aepp-sdk/es/channel/index--Channel..deposit) ⇒ `Promise.<object>` - * [~createContract(options, sign)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..createContract) ⇒ `Promise.<object>` - * [~callContract(options, sign)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..callContract) ⇒ `Promise.<object>` - * [~callContractStatic(options)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..callContractStatic) ⇒ `Promise.<object>` - * [~getContractCall(options)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..getContractCall) ⇒ `Promise.<object>` - * [~getContractState(contract)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..getContractState) ⇒ `Promise.<object>` + * [~disconnect()](#module_@aeternity/aepp-sdk/es/channel/index--Channel..disconnect) + * [~status()](#module_@aeternity/aepp-sdk/es/channel/index--Channel..status) ⇒ `String` + * [~state()](#module_@aeternity/aepp-sdk/es/channel/index--Channel..state) ⇒ `Promise.<Object>` + * [~id()](#module_@aeternity/aepp-sdk/es/channel/index--Channel..id) ⇒ `String` + * [~update(from, to, amount, sign)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..update) ⇒ `Promise.<Object>` + * [~poi(addresses)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..poi) ⇒ `Promise.<String>` + * [~balances(accounts)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..balances) ⇒ `Promise.<Object>` + * [~leave()](#module_@aeternity/aepp-sdk/es/channel/index--Channel..leave) ⇒ `Promise.<Object>` + * [~shutdown(sign)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..shutdown) ⇒ `Promise.<String>` + * [~withdraw(amount, sign, [callbacks])](#module_@aeternity/aepp-sdk/es/channel/index--Channel..withdraw) ⇒ `Promise.<Object>` + * [~deposit(amount, sign, [callbacks])](#module_@aeternity/aepp-sdk/es/channel/index--Channel..deposit) ⇒ `Promise.<Object>` + * [~createContract(options, sign)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..createContract) ⇒ `Promise.<Object>` + * [~callContract(options, sign)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..callContract) ⇒ `Promise.<Object>` + * [~callContractStatic(options)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..callContractStatic) ⇒ `Promise.<Object>` + * [~getContractCall(options)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..getContractCall) ⇒ `Promise.<Object>` + * [~getContractState(contract)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..getContractState) ⇒ `Promise.<Object>` * [~cleanContractCalls()](#module_@aeternity/aepp-sdk/es/channel/index--Channel..cleanContractCalls) ⇒ `Promise` * [~sendMessage(message, recipient)](#module_@aeternity/aepp-sdk/es/channel/index--Channel..sendMessage) -### Channel([options]) ⇒ `Object` ⏏ +### Channel(options) ⇒ `Promise.<Object>` ⏏ Channel **Kind**: Exported function -**Returns**: `Object` - Channel instance +**Returns**: `Promise.<Object>` - Channel instance **rtype**: `Channel` -| Param | Type | Default | Description | -| --- | --- | --- | --- | -| [options] | `Object` | {} | Initializer object | -| options.url | `String` | | Channel url (for example: "ws://localhost:3001/channel") | -| options.role | `String` | | Participant role ("initiator" or "responder") | -| options.initiatorId | `String` | | Initiator's public key | -| options.responderId | `String` | | Responder's public key | -| options.pushAmount | `Number` | | Initial deposit in favour of the responder by the initiator | -| options.initiatorAmount | `Number` | | Amount of tokens the initiator has committed to the channel | -| options.responderAmount | `Number` | | Amount of tokens the responder has committed to the channel | -| options.channelReserve | `Number` | | The minimum amount both peers need to maintain | -| [options.ttl] | `Number` | | Minimum block height to include the channel_create_tx | -| options.host | `String` | | Host of the responder's node | -| options.port | `Number` | | The port of the responders node | -| options.lockPeriod | `Number` | | Amount of blocks for disputing a solo close | -| [options.existingChannelId] | `Number` | | Existing channel id (required if reestablishing a channel) | -| [options.offchainTx] | `Number` | | Offchain transaction (required if reestablishing a channel) | -| options.sign | `function` | | Function which verifies and signs transactions | +| Param | Type | Description | +| --- | --- | --- | +| options | `Object` | Channel params | +| options.url | `String` | Channel url (for example: "ws://localhost:3001") | +| options.role | `String` | Participant role ("initiator" or "responder") | +| options.initiatorId | `String` | Initiator's public key | +| options.responderId | `String` | Responder's public key | +| options.pushAmount | `Number` | Initial deposit in favour of the responder by the initiator | +| options.initiatorAmount | `Number` | Amount of tokens the initiator has committed to the channel | +| options.responderAmount | `Number` | Amount of tokens the responder has committed to the channel | +| options.channelReserve | `Number` | The minimum amount both peers need to maintain | +| [options.ttl] | `Number` | Minimum block height to include the channel_create_tx | +| options.host | `String` | Host of the responder's node | +| options.port | `Number` | The port of the responders node | +| options.lockPeriod | `Number` | Amount of blocks for disputing a solo close | +| [options.existingChannelId] | `Number` | Existing channel id (required if reestablishing a channel) | +| [options.offchainTx] | `Number` | Offchain transaction (required if reestablishing a channel) | +| [options.timeoutIdle] | `Number` | The time waiting for a new event to be initiated (default: 600000) | +| [options.timeoutFundingCreate] | `Number` | The time waiting for the initiator to produce the create channel transaction after the noise session had been established (default: 120000) | +| [options.timeoutFundingSign] | `Number` | The time frame the other client has to sign an off-chain update after our client had initiated and signed it. This applies only for double signed on-chain intended updates: channel create transaction, deposit, withdrawal and etc. (default: 120000) | +| [options.timeoutFundingLock] | `Number` | The time frame the other client has to confirm an on-chain transaction reaching maturity (passing minimum depth) after the local node has detected this. This applies only for double signed on-chain intended updates: channel create transaction, deposit, withdrawal and etc. (default: 360000) | +| [options.timeoutSign] | `Number` | The time frame the client has to return a signed off-chain update or to decline it. This applies for all off-chain updates (default: 500000) | +| [options.timeoutAccept] | `Number` | The time frame the other client has to react to an event. This applies for all off-chain updates that are not meant to land on-chain, as well as some special cases: opening a noise connection, mutual closing acknowledgement and reestablishing an existing channel (default: 120000) | +| [options.timeoutInitialized] | `Number` | the time frame the responder has to accept an incoming noise session. Applicable only for initiator (default: timeout_accept's value) | +| [options.timeoutAwaitingOpen] | `Number` | The time frame the initiator has to start an outgoing noise session to the responder's node. Applicable only for responder (default: timeout_idle's value) | +| options.sign | `function` | Function which verifies and signs transactions | **Example** ```js Channel({ url: 'ws://localhost:3001', role: 'initiator' - initiatorId: 'ak$2QC98ahNHSrZLWKrpQyv91eQfCDA3aFVSNoYKdQ1ViYWVF8Z9d', - responderId: 'ak$Gi42jcRm9DcZjk72UWQQBSxi43BG3285C9n4QSvP5JdzDyH2o', - pushAmount: 3, - initiatorAmount: 10, - responderAmount: 10, - channelReserve: 2, + initiatorId: 'ak_Y1NRjHuoc3CGMYMvCmdHSBpJsMDR6Ra2t5zjhRcbtMeXXLpLH', + responderId: 'ak_V6an1xhec1xVaAhLuak7QoEbi6t7w5hEtYWp9bMKaJ19i6A9E', + initiatorAmount: 1e18, + responderAmount: 1e18, + pushAmount: 0, + channelReserve: 0, ttl: 1000, host: 'localhost', port: 3002, @@ -81,53 +90,74 @@ Channel({ #### Channel~on(event, callback) Register event listener function +Possible events: + + - "error" + - "onChainTx" + - "ownWithdrawLocked" + - "withdrawLocked" + - "ownDepositLocked" + - "depositLocked" + **Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) | Param | Type | Description | | --- | --- | --- | -| event | `string` | Event name | +| event | `String` | Event name | | callback | `function` | Callback function | + + +#### Channel~disconnect() +Close the connection + +**Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) -#### Channel~status() ⇒ `string` +#### Channel~status() ⇒ `String` Get current status **Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) -#### Channel~state() ⇒ `object` +#### Channel~state() ⇒ `Promise.<Object>` Get current state **Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) -#### Channel~id() ⇒ `string` +#### Channel~id() ⇒ `String` Get channel id **Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) -#### Channel~update(from, to, amount, sign) ⇒ `Promise.<object>` -Trigger an update +#### Channel~update(from, to, amount, sign) ⇒ `Promise.<Object>` +Trigger a transfer update + +The transfer update is moving tokens from one channel account to another. +The update is a change to be applied on top of the latest state. + +Sender and receiver are the channel parties. Both the initiator and responder +can take those roles. Any public key outside of the channel is considered invalid. **Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) | Param | Type | Description | | --- | --- | --- | -| from | `string` | Sender's public address | -| to | `string` | Receiver's public address | -| amount | `number` | Transaction amount | -| sign | `function` | Function which verifies and signs transaction | +| from | `String` | Sender's public address | +| to | `String` | Receiver's public address | +| amount | `Number` | Transaction amount | +| sign | `function` | Function which verifies and signs offchain transaction | **Example** ```js channel.update( - 'ak$2QC98ahNHSrZLWKrpQyv91eQfCDA3aFVSNoYKdQ1ViYWVF8Z9d', - 'ak$Gi42jcRm9DcZjk72UWQQBSxi43BG3285C9n4QSvP5JdzDyH2o', + 'ak_Y1NRjHuoc3CGMYMvCmdHSBpJsMDR6Ra2t5zjhRcbtMeXXLpLH', + 'ak_V6an1xhec1xVaAhLuak7QoEbi6t7w5hEtYWp9bMKaJ19i6A9E', 10, async (tx) => await account.signTransaction(tx) -).then({ accepted, signedTx } => +).then(({ accepted, signedTx }) => if (accepted) { console.log('Update has been accepted') } @@ -135,16 +165,19 @@ channel.update( ``` -#### Channel~poi(addresses) ⇒ `Promise.<string>` +#### Channel~poi(addresses) ⇒ `Promise.<String>` Get proof of inclusion +If a certain address of an account or a contract is not found +in the state tree - the response is an error. + **Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) | Param | Type | Description | | --- | --- | --- | -| addresses | `object` | | -| [addresses.accounts] | `array.<string>` | List of account addresses to include in poi | -| [addresses.contracts] | `array.<string>` | List of contract addresses to include in poi | +| addresses | `Object` | | +| [addresses.accounts] | `Array.<String>` | List of account addresses to include in poi | +| [addresses.contracts] | `Array.<String>` | List of contract addresses to include in poi | **Example** ```js @@ -158,14 +191,20 @@ channel.poi({ ``` -#### Channel~balances(accounts) ⇒ `Promise.<object>` +#### Channel~balances(accounts) ⇒ `Promise.<Object>` Get balances +The accounts paramcontains a list of addresses to fetch balances of. +Those can be either account balances or a contract ones, encoded as an account addresses. + +If a certain account address had not being found in the state tree - it is simply +skipped in the response. + **Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) | Param | Type | Description | | --- | --- | --- | -| accounts | `array.<string>` | List of addresses to fetch balances from | +| accounts | `Array.<String>` | List of addresses to fetch balances from | **Example** ```js @@ -179,27 +218,39 @@ channel.balances([ ``` -#### Channel~leave() ⇒ `Promise.<object>` +#### Channel~leave() ⇒ `Promise.<Object>` Leave channel +It is possible to leave a channel and then later reestablish the channel +off-chain state and continue operation. When a leave method is called, +the channel fsm passes it on to the peer fsm, reports the current mutually +signed state and then terminates. + +The channel can be reestablished by instantiating another Channel instance +with two extra params: existingChannelId and offchainTx (returned from leave +method as channelId and signedTx respectively). + **Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) **Example** ```js -channel.leave().then(({ channelId, signedTx }) => +channel.leave().then(({ channelId, signedTx }) => { console.log(channelId) - console.log(state) -) + console.log(signedTx) +}) ``` -#### Channel~shutdown(sign) ⇒ `Promise.<string>` -Trigger a channel shutdown +#### Channel~shutdown(sign) ⇒ `Promise.<String>` +Trigger mutual close + +At any moment after the channel is opened, a closing procedure can be triggered. +This can be done by either of the parties. The process is similar to the off-chain updates. **Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) | Param | Type | Description | | --- | --- | --- | -| sign | `function` | Function which verifies and signs transaction | +| sign | `function` | Function which verifies and signs mutual close transaction | **Example** ```js @@ -209,16 +260,40 @@ channel.shutdown( ``` -#### Channel~withdraw(amount, sign, [callbacks]) ⇒ `Promise.<object>` +#### Channel~withdraw(amount, sign, [callbacks]) ⇒ `Promise.<Object>` Withdraw tokens from the channel +After the channel had been opened any of the participants can initiate a withdrawal. +The process closely resembles the update. The most notable difference is that the +transaction has been co-signed: it is channel_withdraw_tx and after the procedure +is finished - it is being posted on-chain. + +Any of the participants can initiate a withdrawal. The only requirements are: + + - Channel is already opened + - No off-chain update/deposit/withdrawal is currently being performed + - Channel is not being closed or in a solo closing state + - The withdrawal amount must be equal to or greater than zero, and cannot exceed + the available balance on the channel (minus the channel_reserve) + +After the other party had signed the withdraw transaction, the transaction is posted +on-chain and onOnChainTx callback is called with on-chain transaction as first argument. +After computing transaction hash it can be tracked on the chain: entering the mempool, +block inclusion and a number of confirmations. + +After the minimum_depth block confirmations onOwnWithdrawLocked callback is called +(without any arguments). + +When the other party had confirmed that the block height needed is reached +onWithdrawLocked callback is called (without any arguments). + **Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) | Param | Type | Description | | --- | --- | --- | -| amount | `number` | Amount of tokens to withdraw | +| amount | `Number` | Amount of tokens to withdraw | | sign | `function` | Function which verifies and signs withdraw transaction | -| [callbacks] | `object` | | +| [callbacks] | `Object` | | | [callbacks.onOnChainTx] | `function` | Called when withdraw transaction has been posted on chain | | [callbacks.onOwnWithdrawLocked] | `function` | | | [callbacks.onWithdrawLocked] | `function` | | @@ -239,16 +314,40 @@ channel.withdraw( ``` -#### Channel~deposit(amount, sign, [callbacks]) ⇒ `Promise.<object>` +#### Channel~deposit(amount, sign, [callbacks]) ⇒ `Promise.<Object>` Deposit tokens into the channel +After the channel had been opened any of the participants can initiate a deposit. +The process closely resembles the update. The most notable difference is that the +transaction has been co-signed: it is channel_deposit_tx and after the procedure +is finished - it is being posted on-chain. + +Any of the participants can initiate a deposit. The only requirements are: + + - Channel is already opened + - No off-chain update/deposit/withdrawal is currently being performed + - Channel is not being closed or in a solo closing state + - The deposit amount must be equal to or greater than zero, and cannot exceed + the available balance on the channel (minus the channel_reserve) + +After the other party had signed the deposit transaction, the transaction is posted +on-chain and onOnChainTx callback is called with on-chain transaction as first argument. +After computing transaction hash it can be tracked on the chain: entering the mempool, +block inclusion and a number of confirmations. + +After the minimum_depth block confirmations onOwnDepositLocked callback is called +(without any arguments). + +When the other party had confirmed that the block height needed is reached +onDepositLocked callback is called (without any arguments). + **Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) | Param | Type | Description | | --- | --- | --- | -| amount | `number` | Amount of tokens to deposit | +| amount | `Number` | Amount of tokens to deposit | | sign | `function` | Function which verifies and signs deposit transaction | -| [callbacks] | `object` | | +| [callbacks] | `Object` | | | [callbacks.onOnChainTx] | `function` | Called when deposit transaction has been posted on chain | | [callbacks.onOwnDepositLocked] | `function` | | | [callbacks.onDepositLocked] | `function` | | @@ -270,19 +369,25 @@ channel.deposit( ``` -#### Channel~createContract(options, sign) ⇒ `Promise.<object>` -Create a contract +#### Channel~createContract(options, sign) ⇒ `Promise.<Object>` +Trigger create contract update + +The create contract update is creating a contract inside the channel's internal state tree. +The update is a change to be applied on top of the latest state. + +That would create a contract with the poster being the owner of it. Poster commits initially +a deposit amount of tokens to the new contract. **Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) | Param | Type | Description | | --- | --- | --- | -| options | `object` | | -| [options.code] | `string` | Api encoded compiled AEVM byte code | -| [options.callData] | `string` | Api encoded compiled AEVM call data for the code | -| [options.deposit] | `number` | Initial amount the owner of the contract commits to it | -| [options.vmVersion] | `number` | Version of the AEVM | -| [options.abiVersion] | `number` | Version of the ABI | +| options | `Object` | | +| options.code | `String` | Api encoded compiled AEVM byte code | +| options.callData | `String` | Api encoded compiled AEVM call data for the code | +| options.deposit | `Number` | Initial amount the owner of the contract commits to it | +| options.vmVersion | `Number` | Version of the AEVM | +| options.abiVersion | `Number` | Version of the ABI | | sign | `function` | Function which verifies and signs create contract transaction | **Example** @@ -304,18 +409,31 @@ channel.createContract({ ``` -#### Channel~callContract(options, sign) ⇒ `Promise.<object>` -Call a contract +#### Channel~callContract(options, sign) ⇒ `Promise.<Object>` +Trigger call a contract update + +The call contract update is calling a preexisting contract inside the channel's +internal state tree. The update is a change to be applied on top of the latest state. + +That would call a contract with the poster being the caller of it. Poster commits +an amount of tokens to the contract. + +The call would also create a call object inside the channel state tree. It contains +the result of the contract call. + +It is worth mentioning that the gas is not consumed, because this is an off-chain +contract call. It would be consumed if it were a on-chain one. This could happen +if a call with a similar computation amount is to be forced on-chain. **Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) | Param | Type | Description | | --- | --- | --- | -| options | `object` | | -| [options.amount] | `string` | Amount the caller of the contract commits to it | -| [options.callData] | `string` | ABI encoded compiled AEVM call data for the code | -| [options.contract] | `number` | Address of the contract to call | -| [options.abiVersion] | `number` | Version of the ABI | +| options | `Object` | | +| [options.amount] | `String` | Amount the caller of the contract commits to it | +| [options.callData] | `String` | ABI encoded compiled AEVM call data for the code | +| [options.contract] | `Number` | Address of the contract to call | +| [options.abiVersion] | `Number` | Version of the ABI | | sign | `function` | Function which verifies and signs contract call transaction | **Example** @@ -335,18 +453,26 @@ channel.callContract({ ``` -#### Channel~callContractStatic(options) ⇒ `Promise.<object>` +#### Channel~callContractStatic(options) ⇒ `Promise.<Object>` Call contract using dry-run +In order to get the result of a potential contract call, one might need to +dry-run a contract call. It takes the exact same arguments as a call would +and returns the call object. + +The call is executed in the channel's state but it does not impact the state +whatsoever. It uses as an environment the latest channel's state and the current +top of the blockchain as seen by the node. + **Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) | Param | Type | Description | | --- | --- | --- | -| options | `object` | | -| [options.amount] | `string` | Amount the caller of the contract commits to it | -| [options.callData] | `string` | ABI encoded compiled AEVM call data for the code | -| [options.contract] | `number` | Address of the contract to call | -| [options.abiVersion] | `number` | Version of the ABI | +| options | `Object` | | +| [options.amount] | `String` | Amount the caller of the contract commits to it | +| [options.callData] | `String` | ABI encoded compiled AEVM call data for the code | +| [options.contract] | `Number` | Address of the contract to call | +| [options.abiVersion] | `Number` | Version of the ABI | **Example** ```js @@ -362,17 +488,20 @@ channel.callContractStatic({ ``` -#### Channel~getContractCall(options) ⇒ `Promise.<object>` +#### Channel~getContractCall(options) ⇒ `Promise.<Object>` Get contract call result +The combination of a caller, contract and a round of execution determines the +contract call. Providing an incorrect set of those results in an error response. + **Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) | Param | Type | Description | | --- | --- | --- | -| options | `object` | | -| [options.caller] | `string` | Address of contract caller | -| [options.contract] | `string` | Address of the contract | -| [options.round] | `number` | Round when contract was called | +| options | `Object` | | +| [options.caller] | `String` | Address of contract caller | +| [options.contract] | `String` | Address of the contract | +| [options.round] | `Number` | Round when contract was called | **Example** ```js @@ -386,19 +515,19 @@ channel.getContractCall({ ``` -#### Channel~getContractState(contract) ⇒ `Promise.<object>` +#### Channel~getContractState(contract) ⇒ `Promise.<Object>` Get contract latest state **Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) | Param | Type | Description | | --- | --- | --- | -| contract | `string` | Address of the contract | +| contract | `String` | Address of the contract | **Example** ```js channel.getContractState( - 'ct_9sRA9AVE4BYTAkh5RNfJYmwQe1NZ4MErasQLXZkFWG43TPBqa', + 'ct_9sRA9AVE4BYTAkh5RNfJYmwQe1NZ4MErasQLXZkFWG43TPBqa' ).then(({ contract }) => { console.log('deposit:', contract.deposit) }) @@ -422,12 +551,15 @@ Send generic message If message is an object it will be serialized into JSON string before sending. +If there is ongoing update that has not yet been finished the message +will be sent after that update is finalized. + **Kind**: inner method of [`Channel`](#exp_module_@aeternity/aepp-sdk/es/channel/index--Channel) | Param | Type | Description | | --- | --- | --- | -| message | `string` \| `object` | | -| recipient | `string` | Address of the recipient | +| message | `String` \| `Object` | | +| recipient | `String` | Address of the recipient | **Example** ```js diff --git a/docs/api/contract.md b/docs/api/contract.md index a7e308fae4..fb03912eb1 100644 --- a/docs/api/contract.md +++ b/docs/api/contract.md @@ -13,6 +13,8 @@ import ContractBase from '@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`* * *[.contractDecodeDataAPI(type, data)](#module_@aeternity/aepp-sdk/es/contract--ContractBase+contractDecodeDataAPI) ⇒ `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`* * *[.compileContractAPI(code, [options])](#module_@aeternity/aepp-sdk/es/contract--ContractBase+compileContractAPI) ⇒ `Object`* @@ -63,6 +65,37 @@ Decode data | type | `String` | Contract call result type | | data | `String` | Encoded contract call result | + + +#### *contractBase.contractDecodeCallDataBySourceAPI(source, function, callData) ⇒ `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]` + +| Param | Type | Description | +| --- | --- | --- | +| source | `String` | contract source | +| function | `String` | function name | +| callData | `String` | Encoded contract call data | + + + +#### *contractBase.contractDecodeCallDataByCodeAPI(code, callData) ⇒ `String`* +Decode call data by bytecode + +**Kind**: instance abstract method of [`ContractBase`](#exp_module_@aeternity/aepp-sdk/es/contract--ContractBase) +**Returns**: `String` - - Decoded contract call data +**Category**: async +**rtype**: `(code: String, callData: String) => decodedResult: Promise[String]` + +| Param | Type | Description | +| --- | --- | --- | +| code | `String` | contract byte code | +| callData | `String` | Encoded contract call data | + #### *contractBase.compileContractAPI(code, [options]) ⇒ `Object`* diff --git a/docs/api/tx/builder/schema.md b/docs/api/tx/builder/schema.md index 75dcd26fb7..982b969517 100644 --- a/docs/api/tx/builder/schema.md +++ b/docs/api/tx/builder/schema.md @@ -10,7 +10,7 @@ import TxSchema from '@aeternity/aepp-sdk/es/tx/builder/schema' ``` -### exports.TX_TYPE : `Object` ⏏ +### exports.TX\_TYPE : `Object` ⏏ Object with transaction types **Kind**: Exported constant From 561bb180ba7b467fac52dd457aa066af9713511d Mon Sep 17 00:00:00 2001 From: nduchak Date: Wed, 24 Apr 2019 15:06:53 +0300 Subject: [PATCH 21/40] chore(package): Add packa-lock --- package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 02ac2d3f45..8a8f265d41 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aeternity/aepp-sdk", - "version": "3.0.0", + "version": "3.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { From c3b5adecf1578f689470f1855018a780bfd52003 Mon Sep 17 00:00:00 2001 From: nduchak Date: Wed, 24 Apr 2019 15:32:55 +0300 Subject: [PATCH 22/40] chore(changelog): Adjust closes issue --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f0311229fe..d2a8aad294 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,7 +14,7 @@ * **Compiler:** Add decode CallData by source/bytecode ([#354](https://github.com/aeternity/aepp-sdk-js/issues/354)) ([761f36b](https://github.com/aeternity/aepp-sdk-js/commit/761f36b)) * **RPC:** Add getNodeInfo and getNetworkId to AEPP stamp through RPC ([#359](https://github.com/aeternity/aepp-sdk-js/issues/359)) ([2ddeea8](https://github.com/aeternity/aepp-sdk-js/commit/2ddeea8)) * **State Channels:** Add cleanContractCalls method ([#338](https://github.com/aeternity/aepp-sdk-js/issues/338)) ([778159a](https://github.com/aeternity/aepp-sdk-js/commit/778159a)) -* **State Channels:** Ping every 10 seconds to persist connection ([#324](https://github.com/aeternity/aepp-sdk-js/issues/324)) ([6d0e156](https://github.com/aeternity/aepp-sdk-js/commit/6d0e156)), closes [#276](https://github.com/aeternity/aepp-sdk-js/issues/276) [#299](https://github.com/aeternity/aepp-sdk-js/issues/299) [#300](https://github.com/aeternity/aepp-sdk-js/issues/300) [#303](https://github.com/aeternity/aepp-sdk-js/issues/303) [#302](https://github.com/aeternity/aepp-sdk-js/issues/302) [#279](https://github.com/aeternity/aepp-sdk-js/issues/279) [#275](https://github.com/aeternity/aepp-sdk-js/issues/275) [#276](https://github.com/aeternity/aepp-sdk-js/issues/276) [#299](https://github.com/aeternity/aepp-sdk-js/issues/299) [#300](https://github.com/aeternity/aepp-sdk-js/issues/300) +* **State Channels:** Ping every 10 seconds to persist connection ([#324](https://github.com/aeternity/aepp-sdk-js/issues/324)) ([6d0e156](https://github.com/aeternity/aepp-sdk-js/commit/6d0e156)) From a5f7be4dc6997dadca4824f448bf17b56d0ea66f Mon Sep 17 00:00:00 2001 From: nduchak Date: Thu, 16 May 2019 12:45:03 +0300 Subject: [PATCH 23/40] chore(package): Bump version to 3.2.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 0dceff0437..fcda2c4791 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@aeternity/aepp-sdk", - "version": "3.1.0", + "version": "3.2.0", "description": "SDK for the æternity blockchain", "main": "dist/aepp-sdk.js", "browser": "dist/aepp-sdk.browser.js", From 4afe94adcb0485afe32a4d5f20a850b22b39e6dd Mon Sep 17 00:00:00 2001 From: nduchak Date: Thu, 16 May 2019 12:46:36 +0300 Subject: [PATCH 24/40] docs(Docs and Changelog): Regenerate docs --- CHANGELOG.md | 35 +++++++++++++++++++++++++++++++++++ docs/api/ae.md | 17 +++++++++++++++++ docs/api/utils/crypto.md | 8 ++++---- 3 files changed, 56 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d2a8aad294..fc4adfa53b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,38 @@ +# [3.2.0](https://github.com/aeternity/aepp-sdk-js/compare/2.4.0...3.2.0) (2019-05-16) + + +### Bug Fixes + +* **ACI:** Add ability to pass zero address as number. ([#396](https://github.com/aeternity/aepp-sdk-js/issues/396)) ([b5b5c61](https://github.com/aeternity/aepp-sdk-js/commit/b5b5c61)) +* **ACI:** Fix address type transformation when decoding data ([#335](https://github.com/aeternity/aepp-sdk-js/issues/335)) ([e37cdfc](https://github.com/aeternity/aepp-sdk-js/commit/e37cdfc)) +* **Contract:** Add error handlinc(decoding) in low lvl contract API ([#386](https://github.com/aeternity/aepp-sdk-js/issues/386)) ([e1fdce0](https://github.com/aeternity/aepp-sdk-js/commit/e1fdce0)) + + +### Features + +* **ACI:** Add `contract`, `address`, `record` types argument/result transformation ([#349](https://github.com/aeternity/aepp-sdk-js/issues/349)) ([0599d7d](https://github.com/aeternity/aepp-sdk-js/commit/0599d7d)) +* **ACI:** Add `Option` sophia type to ACI ([#390](https://github.com/aeternity/aepp-sdk-js/issues/390)) ([83f5279](https://github.com/aeternity/aepp-sdk-js/commit/83f5279)) +* **ACI:** Implement arguments validation for generic sophia types(list, map, tuple, record) ([#384](https://github.com/aeternity/aepp-sdk-js/issues/384)) ([956e59e](https://github.com/aeternity/aepp-sdk-js/commit/956e59e)) +* **ACI:** Update due to compiler API changes ([#331](https://github.com/aeternity/aepp-sdk-js/issues/331)) ([e047f3b](https://github.com/aeternity/aepp-sdk-js/commit/e047f3b)) +* **AE:** Allow to spend % of balance. ([#371](https://github.com/aeternity/aepp-sdk-js/issues/371)) ([f97a2ae](https://github.com/aeternity/aepp-sdk-js/commit/f97a2ae)), closes [#336](https://github.com/aeternity/aepp-sdk-js/issues/336) +* **Aepp:** Add Compiler to Aepp rpc methods. Update example app ([#312](https://github.com/aeternity/aepp-sdk-js/issues/312)) ([9c72521](https://github.com/aeternity/aepp-sdk-js/commit/9c72521)) +* **Compiler:** Add decode CallData by source/bytecode ([#354](https://github.com/aeternity/aepp-sdk-js/issues/354)) ([761f36b](https://github.com/aeternity/aepp-sdk-js/commit/761f36b)) +* **Fortuna:** Node 3.0.0 compatibility ([#397](https://github.com/aeternity/aepp-sdk-js/issues/397)) ([17b78d5](https://github.com/aeternity/aepp-sdk-js/commit/17b78d5)) +* **RPC:** Add getNodeInfo and getNetworkId to AEPP stamp through RPC ([#359](https://github.com/aeternity/aepp-sdk-js/issues/359)) ([2ddeea8](https://github.com/aeternity/aepp-sdk-js/commit/2ddeea8)) +* **State Channels:** Add cleanContractCalls method ([#338](https://github.com/aeternity/aepp-sdk-js/issues/338)) ([778159a](https://github.com/aeternity/aepp-sdk-js/commit/778159a)) +* **State Channels:** Ping every 10 seconds to persist connection ([#324](https://github.com/aeternity/aepp-sdk-js/issues/324)) ([6d0e156](https://github.com/aeternity/aepp-sdk-js/commit/6d0e156)), closes [#276](https://github.com/aeternity/aepp-sdk-js/issues/276) [#299](https://github.com/aeternity/aepp-sdk-js/issues/299) [#300](https://github.com/aeternity/aepp-sdk-js/issues/300) [#303](https://github.com/aeternity/aepp-sdk-js/issues/303) [#302](https://github.com/aeternity/aepp-sdk-js/issues/302) [#279](https://github.com/aeternity/aepp-sdk-js/issues/279) [#275](https://github.com/aeternity/aepp-sdk-js/issues/275) [#276](https://github.com/aeternity/aepp-sdk-js/issues/276) [#299](https://github.com/aeternity/aepp-sdk-js/issues/299) [#300](https://github.com/aeternity/aepp-sdk-js/issues/300) +* **State Channels:** Remove endpoint param ([#391](https://github.com/aeternity/aepp-sdk-js/issues/391)) ([8d9ea7e](https://github.com/aeternity/aepp-sdk-js/commit/8d9ea7e)) + + +### BREAKING CHANGES + +* **State Channels:** Endpoint param is removed and no longer defaults to "/channel". This means that +"/channel" (or other path) must be appendend to url para + +* Fix channel test + + + # [3.1.0](https://github.com/aeternity/aepp-sdk-js/compare/2.4.0...3.1.0) (2019-04-24) diff --git a/docs/api/ae.md b/docs/api/ae.md index e6d61d28cf..5e79fc6f81 100644 --- a/docs/api/ae.md +++ b/docs/api/ae.md @@ -15,6 +15,7 @@ import Ae from '@aeternity/aepp-sdk/es/ae' * _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` @@ -78,3 +79,19 @@ Send tokens to another account | recipientId | `String` | Address of recipient account | | options | `Object` | Options | + + +#### ae.transferFunds(percentage, recipientId, options) ⇒ `String` \| `String` +Send a percentage of funds to another account + +**Kind**: instance method of [`Ae`](#exp_module_@aeternity/aepp-sdk/es/ae--Ae) +**Returns**: `String` \| `String` - Transaction or transaction hash +**Category**: async +**rtype**: `(percentage: Number|String, recipientId: String, options?: Object) => Promise[String]` + +| Param | Type | Description | +| --- | --- | --- | +| percentage | `Number` \| `String` | Percentage of amount to spend | +| recipientId | `String` | Address of recipient account | +| options | `Object` | Options | + diff --git a/docs/api/utils/crypto.md b/docs/api/utils/crypto.md index f25d968574..254d8fc185 100644 --- a/docs/api/utils/crypto.md +++ b/docs/api/utils/crypto.md @@ -22,7 +22,7 @@ import * as Crypto from '@aeternity/aepp-sdk/es/utils/crypto' * [.salt()](#module_@aeternity/aepp-sdk/es/utils/crypto.salt) ⇒ `Number` * [.encodeBase64Check(input)](#module_@aeternity/aepp-sdk/es/utils/crypto.encodeBase64Check) ⇒ `Buffer` * [.decodeBase64Check(str)](#module_@aeternity/aepp-sdk/es/utils/crypto.decodeBase64Check) ⇒ `Buffer` - * [.encodeBase58Check(input)](#module_@aeternity/aepp-sdk/es/utils/crypto.encodeBase58Check) ⇒ `Buffer` + * [.encodeBase58Check(input)](#module_@aeternity/aepp-sdk/es/utils/crypto.encodeBase58Check) ⇒ `String` * [.decodeBase58Check(str)](#module_@aeternity/aepp-sdk/es/utils/crypto.decodeBase58Check) ⇒ `Buffer` * [.hexStringToByte(str)](#module_@aeternity/aepp-sdk/es/utils/crypto.hexStringToByte) ⇒ `Uint8Array` * [.encodeUnsigned(value)](#module_@aeternity/aepp-sdk/es/utils/crypto.encodeUnsigned) ⇒ `Buffer` @@ -203,12 +203,12 @@ Base64check decode given `str` -### @aeternity/aepp-sdk/es/utils/crypto.encodeBase58Check(input) ⇒ `Buffer` +### @aeternity/aepp-sdk/es/utils/crypto.encodeBase58Check(input) ⇒ `String` Base58 encode given `input` **Kind**: static method of [`@aeternity/aepp-sdk/es/utils/crypto`](#module_@aeternity/aepp-sdk/es/utils/crypto) -**Returns**: `Buffer` - Base58 encoded data -**rtype**: `(input: String) => Buffer` +**Returns**: `String` - Base58 encoded data +**rtype**: `(input: String) => String` | Param | Type | Description | | --- | --- | --- | From 157f9d4a1fca2f32950c72c0a19bb80517089148 Mon Sep 17 00:00:00 2001 From: nduchak Date: Thu, 16 May 2019 13:06:15 +0300 Subject: [PATCH 25/40] docs(CHANGELOG): Adjust changelog --- CHANGELOG.md | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fc4adfa53b..c78f8d1430 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,20 +5,27 @@ * **ACI:** Add ability to pass zero address as number. ([#396](https://github.com/aeternity/aepp-sdk-js/issues/396)) ([b5b5c61](https://github.com/aeternity/aepp-sdk-js/commit/b5b5c61)) * **ACI:** Fix address type transformation when decoding data ([#335](https://github.com/aeternity/aepp-sdk-js/issues/335)) ([e37cdfc](https://github.com/aeternity/aepp-sdk-js/commit/e37cdfc)) -* **Contract:** Add error handlinc(decoding) in low lvl contract API ([#386](https://github.com/aeternity/aepp-sdk-js/issues/386)) ([e1fdce0](https://github.com/aeternity/aepp-sdk-js/commit/e1fdce0)) - +* **Contract:** Add error handling(decoding) in low lvl contract API ([#386](https://github.com/aeternity/aepp-sdk-js/issues/386)) ([e1fdce0](https://github.com/aeternity/aepp-sdk-js/commit/e1fdce0)) +* **Dependencies:** Use URL class instead of "url" package +* **Dependencies:** Use custom version of json-bigint +* **Dependencies:** Avoid usage of semver package and cleanup deps +* **RPC:** rpc client: Handle case if aepp opened without wallet ### Features +* **KEYSTORE:** Add browser compatibility * **ACI:** Add `contract`, `address`, `record` types argument/result transformation ([#349](https://github.com/aeternity/aepp-sdk-js/issues/349)) ([0599d7d](https://github.com/aeternity/aepp-sdk-js/commit/0599d7d)) +* **WEBPACK:** webpack configs: Mark all dependencies as external +* **WEBPACK:** Setup webpack-bundle-analyzer plugin * **ACI:** Add `Option` sophia type to ACI ([#390](https://github.com/aeternity/aepp-sdk-js/issues/390)) ([83f5279](https://github.com/aeternity/aepp-sdk-js/commit/83f5279)) * **ACI:** Implement arguments validation for generic sophia types(list, map, tuple, record) ([#384](https://github.com/aeternity/aepp-sdk-js/issues/384)) ([956e59e](https://github.com/aeternity/aepp-sdk-js/commit/956e59e)) * **ACI:** Update due to compiler API changes ([#331](https://github.com/aeternity/aepp-sdk-js/issues/331)) ([e047f3b](https://github.com/aeternity/aepp-sdk-js/commit/e047f3b)) * **AE:** Allow to spend % of balance. ([#371](https://github.com/aeternity/aepp-sdk-js/issues/371)) ([f97a2ae](https://github.com/aeternity/aepp-sdk-js/commit/f97a2ae)), closes [#336](https://github.com/aeternity/aepp-sdk-js/issues/336) * **Aepp:** Add Compiler to Aepp rpc methods. Update example app ([#312](https://github.com/aeternity/aepp-sdk-js/issues/312)) ([9c72521](https://github.com/aeternity/aepp-sdk-js/commit/9c72521)) +* **Aepp:** Refactor Aepp example app. Allow to spend with payload and add reverse iframe approach. * **Compiler:** Add decode CallData by source/bytecode ([#354](https://github.com/aeternity/aepp-sdk-js/issues/354)) ([761f36b](https://github.com/aeternity/aepp-sdk-js/commit/761f36b)) * **Fortuna:** Node 3.0.0 compatibility ([#397](https://github.com/aeternity/aepp-sdk-js/issues/397)) ([17b78d5](https://github.com/aeternity/aepp-sdk-js/commit/17b78d5)) -* **RPC:** Add getNodeInfo and getNetworkId to AEPP stamp through RPC ([#359](https://github.com/aeternity/aepp-sdk-js/issues/359)) ([2ddeea8](https://github.com/aeternity/aepp-sdk-js/commit/2ddeea8)) +* **RPC:** Add `getNodeInfo` to AEPP stamp through RPC ([#359](https://github.com/aeternity/aepp-sdk-js/issues/359)) ([2ddeea8](https://github.com/aeternity/aepp-sdk-js/commit/2ddeea8)) * **State Channels:** Add cleanContractCalls method ([#338](https://github.com/aeternity/aepp-sdk-js/issues/338)) ([778159a](https://github.com/aeternity/aepp-sdk-js/commit/778159a)) * **State Channels:** Ping every 10 seconds to persist connection ([#324](https://github.com/aeternity/aepp-sdk-js/issues/324)) ([6d0e156](https://github.com/aeternity/aepp-sdk-js/commit/6d0e156)), closes [#276](https://github.com/aeternity/aepp-sdk-js/issues/276) [#299](https://github.com/aeternity/aepp-sdk-js/issues/299) [#300](https://github.com/aeternity/aepp-sdk-js/issues/300) [#303](https://github.com/aeternity/aepp-sdk-js/issues/303) [#302](https://github.com/aeternity/aepp-sdk-js/issues/302) [#279](https://github.com/aeternity/aepp-sdk-js/issues/279) [#275](https://github.com/aeternity/aepp-sdk-js/issues/275) [#276](https://github.com/aeternity/aepp-sdk-js/issues/276) [#299](https://github.com/aeternity/aepp-sdk-js/issues/299) [#300](https://github.com/aeternity/aepp-sdk-js/issues/300) * **State Channels:** Remove endpoint param ([#391](https://github.com/aeternity/aepp-sdk-js/issues/391)) ([8d9ea7e](https://github.com/aeternity/aepp-sdk-js/commit/8d9ea7e)) From cb6ce03327a0915d30790ef2ab96b994df96c21a Mon Sep 17 00:00:00 2001 From: nduchak Date: Thu, 16 May 2019 13:10:34 +0300 Subject: [PATCH 26/40] docs(CHANGELOG): Adjust changelog --- CHANGELOG.md | 1 + es/tx/tx.js | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index c78f8d1430..a9f12409a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -14,6 +14,7 @@ ### Features * **KEYSTORE:** Add browser compatibility +* **TX:** Handle VM/ABI fields serialization and validation basaed on tx type and node version * **ACI:** Add `contract`, `address`, `record` types argument/result transformation ([#349](https://github.com/aeternity/aepp-sdk-js/issues/349)) ([0599d7d](https://github.com/aeternity/aepp-sdk-js/commit/0599d7d)) * **WEBPACK:** webpack configs: Mark all dependencies as external * **WEBPACK:** Setup webpack-bundle-analyzer plugin diff --git a/es/tx/tx.js b/es/tx/tx.js index c10cfac14b..50e2d19df7 100644 --- a/es/tx/tx.js +++ b/es/tx/tx.js @@ -347,7 +347,7 @@ async function channelSnapshotSoloTx ({ channelId, fromId, payload }) { * @return {object} Object with vm/abi version ({ vmVersion: number, abiVersion: number }) */ function getVmVersion (txType, { vmVersion, abiVersion } = {}) { - const isMinerva = semverSatisfies(this.version.split('-')[0], '2.5.0', '3.0.0') + const isMinerva = semverSatisfies(this.version.split('-')[0], '2.0.0', '3.0.0') const supported = isMinerva ? VM_ABI_MAP_MINERVA[txType] : VM_ABI_MAP_FORTUNA[txType] if (!supported) throw new Error('Not supported tx type') From e7e55962bca06084d785ce65997888eddea630f4 Mon Sep 17 00:00:00 2001 From: nduchak Date: Thu, 16 May 2019 13:16:57 +0300 Subject: [PATCH 27/40] chore(Jenkions): Force jenkins --- CHANGELOG.md | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9f12409a9..8d7f71c1a9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ * **Dependencies:** Use custom version of json-bigint * **Dependencies:** Avoid usage of semver package and cleanup deps * **RPC:** rpc client: Handle case if aepp opened without wallet +* **Channels:** Fix state channel test's ### Features @@ -37,8 +38,6 @@ * **State Channels:** Endpoint param is removed and no longer defaults to "/channel". This means that "/channel" (or other path) must be appendend to url para -* Fix channel test - # [3.1.0](https://github.com/aeternity/aepp-sdk-js/compare/2.4.0...3.1.0) (2019-04-24) From 90e54390b5cd504c2160f7f906d28c52355d03c5 Mon Sep 17 00:00:00 2001 From: nduchak Date: Thu, 16 May 2019 13:24:57 +0300 Subject: [PATCH 28/40] fix(NPM): Make audit of npm packages. Remove esm from deps --- package-lock.json | 533 ++++++++++++++++++++++------------------------ package.json | 3 +- 2 files changed, 256 insertions(+), 280 deletions(-) diff --git a/package-lock.json b/package-lock.json index 73b83ad293..2fd132eb89 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aeternity/aepp-sdk", - "version": "3.1.0", + "version": "3.2.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1945,12 +1945,12 @@ } }, "ansi-escape-sequences": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/ansi-escape-sequences/-/ansi-escape-sequences-4.0.0.tgz", - "integrity": "sha512-v+0wW9Wezwsyb0uF4aBVCjmSqit3Ru7PZFziGF0o2KwTvN2zWfTi3BRLq9EkJFdg3eBbyERXGTntVpBxH1J68Q==", + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/ansi-escape-sequences/-/ansi-escape-sequences-4.1.0.tgz", + "integrity": "sha512-dzW9kHxH011uBsidTXd14JXgzye/YLb2LzeKZ4bsgl/Knwx8AtbSFkkGxagdNOoh0DlqHCmfiEjWKBaqjOanVw==", "dev": true, "requires": { - "array-back": "^2.0.0" + "array-back": "^3.0.1" } }, "ansi-escapes": { @@ -2020,21 +2020,10 @@ "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", - "dev": true, "requires": { "sprintf-js": "~1.0.2" } }, - "argv-tools": { - "version": "0.1.1", - "resolved": "https://registry.npmjs.org/argv-tools/-/argv-tools-0.1.1.tgz", - "integrity": "sha512-Cc0dBvx4dvrjjKpyDA6w8RlNAw8Su30NvZbWl/Tv9ZALEVlLVkWQiHMi84Q0xNfpVuSaiQbYkdmWK8g1PLGhKw==", - "dev": true, - "requires": { - "array-back": "^2.0.0", - "find-replace": "^2.0.1" - } - }, "arr-diff": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/arr-diff/-/arr-diff-4.0.0.tgz", @@ -2054,13 +2043,10 @@ "dev": true }, "array-back": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/array-back/-/array-back-2.0.0.tgz", - "integrity": "sha512-eJv4pLLufP3g5kcZry0j6WXpIbzYw9GUB4mVJZno9wfwiBxbizTnHCw3VJb07cBihbFX48Y7oSrW9y+gt4glyw==", - "dev": true, - "requires": { - "typical": "^2.6.1" - } + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-3.1.0.tgz", + "integrity": "sha512-TkuxA4UCOvxuDK6NZYXCalszEzj+TLszyASooky+i742l9TqsOdYCMJJupxRic61hwquNtppB3hgcuq9SVSH1Q==", + "dev": true }, "array-flatten": { "version": "1.1.1", @@ -2922,6 +2908,12 @@ "integrity": "sha1-hZgoeOIbmOHGZCXgPQF0eI9Wnug=", "dev": true }, + "bytes": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/bytes/-/bytes-3.0.0.tgz", + "integrity": "sha1-0ygVQE1olpn4Wk6k+odV3ROpYEg=", + "dev": true + }, "cache-base": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/cache-base/-/cache-base-1.0.1.tgz", @@ -2948,6 +2940,17 @@ "array-back": "^2.0.0", "fs-then-native": "^2.0.0", "mkdirp2": "^1.0.3" + }, + "dependencies": { + "array-back": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-2.0.0.tgz", + "integrity": "sha512-eJv4pLLufP3g5kcZry0j6WXpIbzYw9GUB4mVJZno9wfwiBxbizTnHCw3VJb07cBihbFX48Y7oSrW9y+gt4glyw==", + "dev": true, + "requires": { + "typical": "^2.6.1" + } + } } }, "caller-path": { @@ -2985,12 +2988,12 @@ "optional": true }, "catharsis": { - "version": "0.8.9", - "resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.8.9.tgz", - "integrity": "sha1-mMyJDKZS3S7w5ws3klMQ/56Q/Is=", + "version": "0.8.10", + "resolved": "https://registry.npmjs.org/catharsis/-/catharsis-0.8.10.tgz", + "integrity": "sha512-l2OUaz/3PU3MZylspVFJvwHCVfWyvcduPq4lv3AzZ2pJzZCo7kNKFNyatwujD7XgvGkNAE/Jhhbh2uARNwNkfw==", "dev": true, "requires": { - "underscore-contrib": "~0.3.0" + "lodash": "^4.17.11" } }, "chai": { @@ -3312,16 +3315,23 @@ } }, "command-line-args": { - "version": "5.0.2", - "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-5.0.2.tgz", - "integrity": "sha512-/qPcbL8zpqg53x4rAaqMFlRV4opN3pbla7I7k9x8kyOBMQoGT6WltjN6sXZuxOXw6DgdK7Ad+ijYS5gjcr7vlA==", + "version": "5.1.1", + "resolved": "https://registry.npmjs.org/command-line-args/-/command-line-args-5.1.1.tgz", + "integrity": "sha512-hL/eG8lrll1Qy1ezvkant+trihbGnaKaeEjj6Scyr3DN+RC7iQ5Rz84IeLERfAWDGo0HBSNAakczwgCilDXnWg==", "dev": true, "requires": { - "argv-tools": "^0.1.1", - "array-back": "^2.0.0", - "find-replace": "^2.0.1", + "array-back": "^3.0.1", + "find-replace": "^3.0.0", "lodash.camelcase": "^4.3.0", - "typical": "^2.6.1" + "typical": "^4.0.0" + }, + "dependencies": { + "typical": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/typical/-/typical-4.0.0.tgz", + "integrity": "sha512-VAH4IvQ7BDFYglMd7BPRDfLgxZZX4O4TFcRDA6EN5X7erNJJq+McIEp8np9aVtxrCJ6qx4GTYVfOWNjcqwZgRw==", + "dev": true + } } }, "command-line-tool": { @@ -3335,6 +3345,17 @@ "command-line-args": "^5.0.0", "command-line-usage": "^4.1.0", "typical": "^2.6.1" + }, + "dependencies": { + "array-back": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-2.0.0.tgz", + "integrity": "sha512-eJv4pLLufP3g5kcZry0j6WXpIbzYw9GUB4mVJZno9wfwiBxbizTnHCw3VJb07cBihbFX48Y7oSrW9y+gt4glyw==", + "dev": true, + "requires": { + "typical": "^2.6.1" + } + } } }, "command-line-usage": { @@ -3347,6 +3368,17 @@ "array-back": "^2.0.0", "table-layout": "^0.4.2", "typical": "^2.6.1" + }, + "dependencies": { + "array-back": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-2.0.0.tgz", + "integrity": "sha512-eJv4pLLufP3g5kcZry0j6WXpIbzYw9GUB4mVJZno9wfwiBxbizTnHCw3VJb07cBihbFX48Y7oSrW9y+gt4glyw==", + "dev": true, + "requires": { + "typical": "^2.6.1" + } + } } }, "commander": { @@ -3490,103 +3522,6 @@ "integrity": "sha1-Z29us8OZl8LuGsOpJP1hJHSPV40=", "dev": true }, - "copy-webpack-plugin": { - "version": "4.6.0", - "resolved": "https://registry.npmjs.org/copy-webpack-plugin/-/copy-webpack-plugin-4.6.0.tgz", - "integrity": "sha512-Y+SQCF+0NoWQryez2zXn5J5knmr9z/9qSQt7fbL78u83rxmigOy8X5+BFn8CFSuX+nKT8gpYwJX68ekqtQt6ZA==", - "dev": true, - "requires": { - "cacache": "^10.0.4", - "find-cache-dir": "^1.0.0", - "globby": "^7.1.1", - "is-glob": "^4.0.0", - "loader-utils": "^1.1.0", - "minimatch": "^3.0.4", - "p-limit": "^1.0.0", - "serialize-javascript": "^1.4.0" - }, - "dependencies": { - "cacache": { - "version": "10.0.4", - "resolved": "https://registry.npmjs.org/cacache/-/cacache-10.0.4.tgz", - "integrity": "sha512-Dph0MzuH+rTQzGPNT9fAnrPmMmjKfST6trxJeK7NQuHRaVw24VzPRWTmg9MpcwOVQZO0E1FBICUlFeNaKPIfHA==", - "dev": true, - "requires": { - "bluebird": "^3.5.1", - "chownr": "^1.0.1", - "glob": "^7.1.2", - "graceful-fs": "^4.1.11", - "lru-cache": "^4.1.1", - "mississippi": "^2.0.0", - "mkdirp": "^0.5.1", - "move-concurrently": "^1.0.1", - "promise-inflight": "^1.0.1", - "rimraf": "^2.6.2", - "ssri": "^5.2.4", - "unique-filename": "^1.1.0", - "y18n": "^4.0.0" - } - }, - "find-cache-dir": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/find-cache-dir/-/find-cache-dir-1.0.0.tgz", - "integrity": "sha1-kojj6ePMN0hxfTnq3hfPcfww7m8=", - "dev": true, - "requires": { - "commondir": "^1.0.1", - "make-dir": "^1.0.0", - "pkg-dir": "^2.0.0" - } - }, - "globby": { - "version": "7.1.1", - "resolved": "https://registry.npmjs.org/globby/-/globby-7.1.1.tgz", - "integrity": "sha1-+yzP+UAfhgCUXfral0QMypcrhoA=", - "dev": true, - "requires": { - "array-union": "^1.0.1", - "dir-glob": "^2.0.0", - "glob": "^7.1.2", - "ignore": "^3.3.5", - "pify": "^3.0.0", - "slash": "^1.0.0" - } - }, - "ignore": { - "version": "3.3.10", - "resolved": "https://registry.npmjs.org/ignore/-/ignore-3.3.10.tgz", - "integrity": "sha512-Pgs951kaMm5GXP7MOvxERINe3gsaVjUWFm+UZPSq9xYriQAksyhg0csnS0KXSNRD5NmNdapXEpjxG49+AKh/ug==", - "dev": true - }, - "mississippi": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/mississippi/-/mississippi-2.0.0.tgz", - "integrity": "sha512-zHo8v+otD1J10j/tC+VNoGK9keCuByhKovAvdn74dmxJl9+mWHnx6EMsDN4lgRoMI/eYo2nchAxniIbUPb5onw==", - "dev": true, - "requires": { - "concat-stream": "^1.5.0", - "duplexify": "^3.4.2", - "end-of-stream": "^1.1.0", - "flush-write-stream": "^1.0.0", - "from2": "^2.1.0", - "parallel-transform": "^1.1.0", - "pump": "^2.0.1", - "pumpify": "^1.3.3", - "stream-each": "^1.1.0", - "through2": "^2.0.0" - } - }, - "ssri": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/ssri/-/ssri-5.3.0.tgz", - "integrity": "sha512-XRSIPqLij52MtgoQavH/x/dU1qVKtWUAAZeOHsR9c2Ddi4XerFy3mc1alf+dLJKl9EUIm/Ht+EowFkTUOA6GAQ==", - "dev": true, - "requires": { - "safe-buffer": "^5.1.1" - } - } - } - }, "core-js": { "version": "2.5.7", "resolved": "https://registry.npmjs.org/core-js/-/core-js-2.5.7.tgz", @@ -3945,50 +3880,30 @@ "randombytes": "^2.0.0" } }, - "dir-glob": { - "version": "2.2.2", - "resolved": "https://registry.npmjs.org/dir-glob/-/dir-glob-2.2.2.tgz", - "integrity": "sha512-f9LBi5QWzIW3I6e//uxZoLBlUt9kcp66qo0sSCxL6YZKc75R1c4MFCoe/LaZiBGmgujvQdxc5Bn3QhfyvK5Hsw==", - "dev": true, - "requires": { - "path-type": "^3.0.0" - }, - "dependencies": { - "path-type": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/path-type/-/path-type-3.0.0.tgz", - "integrity": "sha512-T2ZUsdZFHgA3u4e5PfPbjd7HDDpxPnQb5jN0SrDsjNSuVXHJqtwTnWqG0B1jZrgmJ/7lj1EmVIByWt1gxGkWvg==", - "dev": true, - "requires": { - "pify": "^3.0.0" - } - } - } - }, "dmd": { - "version": "3.0.13", - "resolved": "https://registry.npmjs.org/dmd/-/dmd-3.0.13.tgz", - "integrity": "sha512-FV/417bH2c/CYpe8BjFEAHoaHaItcJnPlKELi/qyPZdmUom8joyuC78OhhfPUdyKD/WcouTQ2LxQT4M/RoiJ3w==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/dmd/-/dmd-4.0.0.tgz", + "integrity": "sha512-J+4CgbQiMuJHiU9dvTVN8iOOZGeR3bef1wBqz6eVvvX17jkpkKVd8TeeutA/FJAeFbLQfXnyQ3o4qY7W+c5cxQ==", "dev": true, "requires": { - "array-back": "^2.0.0", + "array-back": "^3.1.0", "cache-point": "^0.4.1", "common-sequence": "^1.0.2", "file-set": "^2.0.0", - "handlebars": "^4.0.11", - "marked": "^0.3.16", + "handlebars": "^4.1.2", + "marked": "^0.6.2", "object-get": "^2.1.0", - "reduce-flatten": "^1.0.1", - "reduce-unique": "^1.0.0", + "reduce-flatten": "^2.0.0", + "reduce-unique": "^2.0.1", "reduce-without": "^1.0.1", "test-value": "^3.0.0", - "walk-back": "^3.0.0" + "walk-back": "^3.0.1" }, "dependencies": { - "marked": { - "version": "0.3.19", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.3.19.tgz", - "integrity": "sha512-ea2eGWOqNxPcXv8dyERdSr/6FmzvWwzjMxpfGB/sbMccXoct+xY+YukPD+QTUZwyvK7BZwcr4m21WBOW41pAkg==", + "reduce-flatten": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/reduce-flatten/-/reduce-flatten-2.0.0.tgz", + "integrity": "sha512-EJ4UNY/U1t2P/2k6oqotuX2Cc3T6nxJwsM0N0asT7dhrtH1ltUxDn4NalSYmPE2rCkVpcf/X6R0wDwcFpzhd4w==", "dev": true } } @@ -5072,13 +4987,24 @@ } }, "file-set": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/file-set/-/file-set-2.0.0.tgz", - "integrity": "sha512-cCWXfw+nrYoIoUVmEF7Xsw91lGWuObtSnTEZ7AmdvZou1A/6Xx237HfxdQyC/ayKRvQSMbNOBwg62OjN5JxbXw==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/file-set/-/file-set-2.0.1.tgz", + "integrity": "sha512-XgOUUpgR6FbbfYcniLw0qm1Am7PnNYIAkd+eXxRt42LiYhjaso0WiuQ+VmrNdtwotyM+cLCfZ56AZrySP3QnKA==", "dev": true, "requires": { "array-back": "^2.0.0", - "glob": "^7.1.2" + "glob": "^7.1.3" + }, + "dependencies": { + "array-back": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-2.0.0.tgz", + "integrity": "sha512-eJv4pLLufP3g5kcZry0j6WXpIbzYw9GUB4mVJZno9wfwiBxbizTnHCw3VJb07cBihbFX48Y7oSrW9y+gt4glyw==", + "dev": true, + "requires": { + "typical": "^2.6.1" + } + } } }, "filesize": { @@ -5202,13 +5128,12 @@ } }, "find-replace": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/find-replace/-/find-replace-2.0.1.tgz", - "integrity": "sha512-LzDo3Fpa30FLIBsh6DCDnMN1KW2g4QKkqKmejlImgWY67dDFPX/x9Kh/op/GK522DchQXEvDi/wD48HKW49XOQ==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/find-replace/-/find-replace-3.0.0.tgz", + "integrity": "sha512-6Tb2myMioCAgv5kfvP5/PkZZ/ntTpVK39fHY7WkWBgvbeE+VHd/tZuZ4mrC+bxh4cfOZeYKVPaJIZtZXV7GNCQ==", "dev": true, "requires": { - "array-back": "^2.0.0", - "test-value": "^3.0.0" + "array-back": "^3.0.1" } }, "find-root": { @@ -6106,9 +6031,9 @@ "optional": true }, "neo-async": { - "version": "2.6.0", - "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.0.tgz", - "integrity": "sha512-MFh0d/Wa7vkKO3Y3LlacqAEeHK0mckVqzDieUKTT+KGxi+zIpeVsFxymkIiRpbpDziHc290Xr9A1O4Om7otoRA==", + "version": "2.6.1", + "resolved": "https://registry.npmjs.org/neo-async/-/neo-async-2.6.1.tgz", + "integrity": "sha512-iyam8fBuCUpWeKPGpaNMetEocMt364qkCsfL9JuhjXX6dRnguRVOfk2GZaDpPjcOKiiXCPINZC1GczQ7iTq3Zw==", "dev": true }, "source-map": { @@ -6118,9 +6043,9 @@ "dev": true }, "uglify-js": { - "version": "3.5.4", - "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.5.4.tgz", - "integrity": "sha512-GpKo28q/7Bm5BcX9vOu4S46FwisbPbAmkkqPnGIpKvKTM96I85N6XHQV+k4I6FA2wxgLhcsSyHoNhzucwCflvA==", + "version": "3.5.12", + "resolved": "https://registry.npmjs.org/uglify-js/-/uglify-js-3.5.12.tgz", + "integrity": "sha512-KeQesOpPiZNgVwJj8Ge3P4JYbQHUdZzpx6Fahy6eKAYRSV4zhVmLXoC+JtOeYxcHCHTve8RG1ZGdTvpeOUM26Q==", "dev": true, "optional": true, "requires": { @@ -6840,10 +6765,9 @@ "dev": true }, "js-yaml": { - "version": "3.12.0", - "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.12.0.tgz", - "integrity": "sha512-PIt2cnwmPfL4hKNwqeiuz4bKfnzHTBv6HyVgjahA6mPLwPDzjDWrplJBMjHUFxku/N3FlmrbyPclad+I+4mJ3A==", - "dev": true, + "version": "3.13.1", + "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", + "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -6852,18 +6776,17 @@ "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", - "dev": true + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" } } }, "js2xmlparser": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-3.0.0.tgz", - "integrity": "sha1-P7YOqgicVED5MZ9RdgzNB+JJlzM=", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/js2xmlparser/-/js2xmlparser-4.0.0.tgz", + "integrity": "sha512-WuNgdZOXVmBk5kUPMcTcVUpbGRzLfNkv7+7APq7WiDihpXVKrgxo6wwRpRl9OQeEBgKCVk9mR7RbzrnNWC8oBw==", "dev": true, "requires": { - "xmlcreate": "^1.0.1" + "xmlcreate": "^2.0.0" } }, "jsbn": { @@ -6874,44 +6797,58 @@ "optional": true }, "jsdoc": { - "version": "3.5.5", - "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.5.5.tgz", - "integrity": "sha512-6PxB65TAU4WO0Wzyr/4/YhlGovXl0EVYfpKbpSroSj0qBxT4/xod/l40Opkm38dRHRdQgdeY836M0uVnJQG7kg==", - "dev": true, - "requires": { - "babylon": "7.0.0-beta.19", - "bluebird": "~3.5.0", - "catharsis": "~0.8.9", - "escape-string-regexp": "~1.0.5", - "js2xmlparser": "~3.0.0", - "klaw": "~2.0.0", - "marked": "~0.3.6", - "mkdirp": "~0.5.1", - "requizzle": "~0.2.1", - "strip-json-comments": "~2.0.1", + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/jsdoc/-/jsdoc-3.6.2.tgz", + "integrity": "sha512-S2vzg99C5+gb7FWlrK4TVdyzVPGGkdvpDkCEJH1JABi2PKzPeLu5/zZffcJUifgWUJqXWl41Hoc+MmuM2GukIg==", + "dev": true, + "requires": { + "@babel/parser": "^7.4.4", + "bluebird": "^3.5.4", + "catharsis": "^0.8.10", + "escape-string-regexp": "^2.0.0", + "js2xmlparser": "^4.0.0", + "klaw": "^3.0.0", + "markdown-it": "^8.4.2", + "markdown-it-anchor": "^5.0.2", + "marked": "^0.6.2", + "mkdirp": "^0.5.1", + "requizzle": "^0.2.2", + "strip-json-comments": "^3.0.1", "taffydb": "2.6.2", - "underscore": "~1.8.3" + "underscore": "~1.9.1" }, "dependencies": { - "babylon": { - "version": "7.0.0-beta.19", - "resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.19.tgz", - "integrity": "sha512-Vg0C9s/REX6/WIXN37UKpv5ZhRi6A4pjHlpkE34+8/a6c2W1Q692n3hmc+SZG5lKRnaExLUbxtJ1SVT+KaCQ/A==", + "@babel/parser": { + "version": "7.4.4", + "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.4.4.tgz", + "integrity": "sha512-5pCS4mOsL+ANsFZGdvNLybx4wtqAZJ0MJjMHxvzI3bvIsz6sQvzW8XX92EYIkiPtIvcfG3Aj+Ir5VNyjnZhP7w==", "dev": true }, - "klaw": { + "bluebird": { + "version": "3.5.4", + "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.5.4.tgz", + "integrity": "sha512-FG+nFEZChJrbQ9tIccIfZJBz3J7mLrAhxakAbnrJWn8d7aKOC+LWifa0G+p4ZqKp4y13T7juYvdhq9NzKdsrjw==", + "dev": true + }, + "escape-string-regexp": { "version": "2.0.0", - "resolved": "https://registry.npmjs.org/klaw/-/klaw-2.0.0.tgz", - "integrity": "sha1-WcEo4Nxc5BAgEVEZTuucv4WGUPY=", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-2.0.0.tgz", + "integrity": "sha512-UpzcLCXolUWcNu5HtVMHYdXJjArjsF9C0aNnquZYY4uW/Vu0miy5YoWvbV345HauVvcAUnpRuhMMcqTcGOY2+w==", + "dev": true + }, + "klaw": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/klaw/-/klaw-3.0.0.tgz", + "integrity": "sha512-0Fo5oir+O9jnXu5EefYbVK+mHMBeEVEy2cmctR1O1NECcCkPRreJKrS6Qt/j3KC2C148Dfo9i3pCmCMsdqGr0g==", "dev": true, "requires": { "graceful-fs": "^4.1.9" } }, - "marked": { - "version": "0.3.19", - "resolved": "https://registry.npmjs.org/marked/-/marked-0.3.19.tgz", - "integrity": "sha512-ea2eGWOqNxPcXv8dyERdSr/6FmzvWwzjMxpfGB/sbMccXoct+xY+YukPD+QTUZwyvK7BZwcr4m21WBOW41pAkg==", + "strip-json-comments": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz", + "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw==", "dev": true }, "taffydb": { @@ -6919,30 +6856,24 @@ "resolved": "https://registry.npmjs.org/taffydb/-/taffydb-2.6.2.tgz", "integrity": "sha1-fLy2S1oUG2ou/CxdLGe04VCyomg=", "dev": true - }, - "underscore": { - "version": "1.8.3", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.8.3.tgz", - "integrity": "sha1-Tz+1OxBuYJf8+ctBCfKl6b36UCI=", - "dev": true } } }, "jsdoc-api": { - "version": "4.0.3", - "resolved": "https://registry.npmjs.org/jsdoc-api/-/jsdoc-api-4.0.3.tgz", - "integrity": "sha512-dfYq9JgB+XahY0XfSEw93PmXmocjwYcvJ5aMuQUJ/OdDRGWamf2SSOk3W06Bsj8qdjp/UdefzqpP/mpwsvHuvA==", + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/jsdoc-api/-/jsdoc-api-5.0.1.tgz", + "integrity": "sha512-bntcT/3No4dPJZs9KX0AN3vrX/7P6PwDXVKANCXYpa0WJsbud41yAunoMxGFS4APHwmDoWl8E0ZuowLCOiOOFw==", "dev": true, "requires": { - "array-back": "^2.0.0", + "array-back": "^3.1.0", "cache-point": "^0.4.1", "collect-all": "^1.0.3", - "file-set": "^2.0.0", + "file-set": "^2.0.1", "fs-then-native": "^2.0.0", - "jsdoc": "~3.5.5", + "jsdoc": "^3.6.1", "object-to-spawn-args": "^1.1.1", "temp-path": "^1.0.0", - "walk-back": "^3.0.0" + "walk-back": "^3.0.1" } }, "jsdoc-parse": { @@ -6957,21 +6888,32 @@ "reduce-extract": "^1.0.0", "sort-array": "^2.0.0", "test-value": "^3.0.0" + }, + "dependencies": { + "array-back": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-2.0.0.tgz", + "integrity": "sha512-eJv4pLLufP3g5kcZry0j6WXpIbzYw9GUB4mVJZno9wfwiBxbizTnHCw3VJb07cBihbFX48Y7oSrW9y+gt4glyw==", + "dev": true, + "requires": { + "typical": "^2.6.1" + } + } } }, "jsdoc-to-markdown": { - "version": "4.0.1", - "resolved": "https://registry.npmjs.org/jsdoc-to-markdown/-/jsdoc-to-markdown-4.0.1.tgz", - "integrity": "sha512-LHJRoLoLyDdxNcColgkLoB/rFG5iRP+PNJjMILI0x+95IdEAtyjSt0wJ6ZlKxRpkhBYtQXTQQ119hMqPIUZzTQ==", + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/jsdoc-to-markdown/-/jsdoc-to-markdown-5.0.0.tgz", + "integrity": "sha512-3gKEnbay7dSdyvtMDDkUf4r7pmBVgs3aqeT0Cg/ngTILPpJUzf8iKgASIo5psF007L45OIJtIuRX5VL/YUXKaA==", "dev": true, "requires": { - "array-back": "^2.0.0", + "array-back": "^3.1.0", "command-line-tool": "^0.8.0", "config-master": "^3.1.0", - "dmd": "^3.0.10", - "jsdoc-api": "^4.0.1", + "dmd": "^4.0.0", + "jsdoc-api": "^5.0.1", "jsdoc-parse": "^3.0.1", - "walk-back": "^3.0.0" + "walk-back": "^3.0.1" } }, "jsdom": { @@ -7137,6 +7079,15 @@ "libsodium-sumo": "0.7.3" } }, + "linkify-it": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/linkify-it/-/linkify-it-2.1.0.tgz", + "integrity": "sha512-4REs8/062kV2DSHxNfq5183zrqXMl7WP0WzABH9IeJI+NLm429FgE1PDecltYfnOoFDFlZGh2T8PfZn0r+GTRg==", + "dev": true, + "requires": { + "uc.micro": "^1.0.1" + } + }, "load-json-file": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/load-json-file/-/load-json-file-2.0.0.tgz", @@ -7356,6 +7307,25 @@ "object-visit": "^1.0.0" } }, + "markdown-it": { + "version": "8.4.2", + "resolved": "https://registry.npmjs.org/markdown-it/-/markdown-it-8.4.2.tgz", + "integrity": "sha512-GcRz3AWTqSUphY3vsUqQSFMbgR38a4Lh3GWlHRh/7MRwz8mcu9n2IO7HOh+bXHrR9kOPDl5RNCaEsrneb+xhHQ==", + "dev": true, + "requires": { + "argparse": "^1.0.7", + "entities": "~1.1.1", + "linkify-it": "^2.0.0", + "mdurl": "^1.0.1", + "uc.micro": "^1.0.5" + } + }, + "markdown-it-anchor": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/markdown-it-anchor/-/markdown-it-anchor-5.0.2.tgz", + "integrity": "sha512-AFM/woBI8QDJMS/9+MmsBMT5/AR+ImfOsunQZTZhzcTmna3rIzAzbOh5E0l6mlFM/i9666BpUtkqQ9bS7WApCg==", + "dev": true + }, "marked": { "version": "0.6.2", "resolved": "https://registry.npmjs.org/marked/-/marked-0.6.2.tgz", @@ -7382,6 +7352,12 @@ "inherits": "^2.0.1" } }, + "mdurl": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/mdurl/-/mdurl-1.0.1.tgz", + "integrity": "sha1-/oWy7HWlkDfyrf7BAP1sYBdhFS4=", + "dev": true + }, "media-typer": { "version": "0.3.0", "resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz", @@ -8695,9 +8671,9 @@ "dev": true }, "reduce-unique": { - "version": "1.0.0", - "resolved": "https://registry.npmjs.org/reduce-unique/-/reduce-unique-1.0.0.tgz", - "integrity": "sha1-flhrz4ek4ytter2Cd/rWzeyfSAM=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/reduce-unique/-/reduce-unique-2.0.1.tgz", + "integrity": "sha512-x4jH/8L1eyZGR785WY+ePtyMNhycl1N2XOLxhCbzZFaqF4AXjLzqSxa2UHgJ2ZVR/HHyPOvl1L7xRnW8ye5MdA==", "dev": true }, "reduce-without": { @@ -9014,20 +8990,12 @@ } }, "requizzle": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/requizzle/-/requizzle-0.2.1.tgz", - "integrity": "sha1-aUPDUwxNmn5G8c3dUcFY/GcM294=", + "version": "0.2.2", + "resolved": "https://registry.npmjs.org/requizzle/-/requizzle-0.2.2.tgz", + "integrity": "sha512-oJ6y7JcUJkblRGhMByGNcszeLgU0qDxNKFCiUZR1XyzHyVsev+Mxb1tyygxLd1ORsKee1SA5BInFdUwY64GE/A==", "dev": true, "requires": { - "underscore": "~1.6.0" - }, - "dependencies": { - "underscore": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", - "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", - "dev": true - } + "lodash": "^4.17.11" } }, "resolve": { @@ -9265,8 +9233,7 @@ "serialize-javascript": { "version": "1.5.0", "resolved": "https://registry.npmjs.org/serialize-javascript/-/serialize-javascript-1.5.0.tgz", - "integrity": "sha512-Ga8c8NjAAp46Br4+0oZ2WxJCwIzwP60Gq1YPgU+39PiTVxyed/iKE/zyZI6+UlVYH5Q4PaQdHhcegIFPZTUfoQ==", - "dev": true + "integrity": "sha512-Ga8c8NjAAp46Br4+0oZ2WxJCwIzwP60Gq1YPgU+39PiTVxyed/iKE/zyZI6+UlVYH5Q4PaQdHhcegIFPZTUfoQ==" }, "serve-static": { "version": "1.13.2", @@ -9696,8 +9663,7 @@ "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", - "dev": true + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" }, "sshpk": { "version": "1.14.2", @@ -10182,6 +10148,17 @@ "lodash.padend": "^4.6.1", "typical": "^2.6.1", "wordwrapjs": "^3.0.0" + }, + "dependencies": { + "array-back": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-2.0.0.tgz", + "integrity": "sha512-eJv4pLLufP3g5kcZry0j6WXpIbzYw9GUB4mVJZno9wfwiBxbizTnHCw3VJb07cBihbFX48Y7oSrW9y+gt4glyw==", + "dev": true, + "requires": { + "typical": "^2.6.1" + } + } } }, "taffydb": { @@ -10249,6 +10226,17 @@ "requires": { "array-back": "^2.0.0", "typical": "^2.6.1" + }, + "dependencies": { + "array-back": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/array-back/-/array-back-2.0.0.tgz", + "integrity": "sha512-eJv4pLLufP3g5kcZry0j6WXpIbzYw9GUB4mVJZno9wfwiBxbizTnHCw3VJb07cBihbFX48Y7oSrW9y+gt4glyw==", + "dev": true, + "requires": { + "typical": "^2.6.1" + } + } } }, "text-encoding": { @@ -10490,6 +10478,12 @@ "integrity": "sha1-XAgOXWYcu+OCWdLnCjxyU+hziB0=", "dev": true }, + "uc.micro": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/uc.micro/-/uc.micro-1.0.6.tgz", + "integrity": "sha512-8Y75pvTYkLJW2hWQHXxoqRgV7qb9B+9vFEtidML+7koHUFapnVJAZ6cKs+Qjz5Aw3aZWHMC6u0wJE3At+nSGwA==", + "dev": true + }, "uglify-es": { "version": "3.3.9", "resolved": "https://registry.npmjs.org/uglify-es/-/uglify-es-3.3.9.tgz", @@ -10603,23 +10597,6 @@ "integrity": "sha512-5/4etnCkd9c8gwgowi5/om/mYO5ajCaOgdzj/oW+0eQV9WxKBDZw5+ycmKmeaTXjInS/W0BzpGLo2xR2aBwZdg==", "dev": true }, - "underscore-contrib": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/underscore-contrib/-/underscore-contrib-0.3.0.tgz", - "integrity": "sha1-ZltmwkeD+PorGMn4y7Dix9SMJsc=", - "dev": true, - "requires": { - "underscore": "1.6.0" - }, - "dependencies": { - "underscore": { - "version": "1.6.0", - "resolved": "https://registry.npmjs.org/underscore/-/underscore-1.6.0.tgz", - "integrity": "sha1-izixDKze9jM3uLJOT/htRa6lKag=", - "dev": true - } - } - }, "unicode-canonical-property-names-ecmascript": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/unicode-canonical-property-names-ecmascript/-/unicode-canonical-property-names-ecmascript-1.0.4.tgz", @@ -10893,9 +10870,9 @@ } }, "walk-back": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/walk-back/-/walk-back-3.0.0.tgz", - "integrity": "sha1-I1h4ejXakQMtrV6S+AsSNw2HlcU=", + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/walk-back/-/walk-back-3.0.1.tgz", + "integrity": "sha512-umiNB2qLO731Sxbp6cfZ9pwURJzTnftxE4Gc7hq8n/ehkuXC//s9F65IEIJA2ZytQZ1ZOsm/Fju4IWx0bivkUQ==", "dev": true }, "watchpack": { @@ -11231,9 +11208,9 @@ "optional": true }, "xmlcreate": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/xmlcreate/-/xmlcreate-1.0.2.tgz", - "integrity": "sha1-+mv3YqYKQT+z3Y9LA8WyaSONMI8=", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/xmlcreate/-/xmlcreate-2.0.1.tgz", + "integrity": "sha512-MjGsXhKG8YjTKrDCXseFo3ClbMGvUD4en29H2Cev1dv4P/chlpw6KdYmlCWDkhosBVKRDjM836+3e3pm1cBNJA==", "dev": true }, "xregexp": { diff --git a/package.json b/package.json index fcda2c4791..0269809fc5 100644 --- a/package.json +++ b/package.json @@ -39,7 +39,6 @@ "blakejs": "^1.1.0", "bs58check": "^2.1.1", "commander": "^2.14.1", - "esm": "^3.0.77", "libsodium-wrappers-sumo": "0.7.3", "json-bigint": "github:davidyuk/json-bigint", "ramda": "^0.25.0", @@ -83,7 +82,7 @@ "eslint-plugin-react": "^7.10.0", "eslint-plugin-standard": "^3.1.0", "find-cache-dir": "^2.0.0", - "jsdoc-to-markdown": "^4.0.1", + "jsdoc-to-markdown": "^5.0.0", "mocha": "^5.0.0", "mocha-junit-reporter": "^1.17.0", "recursive-rename": "^2.0.0", From 564be25fd2c441b8448fecf98536da41e03f3144 Mon Sep 17 00:00:00 2001 From: nduchak Date: Thu, 16 May 2019 16:38:29 +0300 Subject: [PATCH 29/40] chore(Release): Bump version in package, generate CHNAGELOG --- CHANGELOG.md | 8 ++++++++ package.json | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8d7f71c1a9..e3731c478a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,11 @@ +# [3.2.1](https://github.com/aeternity/aepp-sdk-js/compare/2.4.0...3.2.1) (2019-05-16) + + +### Bug Fixes + +* **Joi:** Add `JOI` browser comparability + + # [3.2.0](https://github.com/aeternity/aepp-sdk-js/compare/2.4.0...3.2.0) (2019-05-16) diff --git a/package.json b/package.json index c2e562ba3d..e82c122c25 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@aeternity/aepp-sdk", - "version": "3.2.0", + "version": "3.2.1", "description": "SDK for the æternity blockchain", "main": "dist/aepp-sdk.js", "browser": "dist/aepp-sdk.browser.js", From b75e1f5afbfe17c5913e5fa9a7df209bd0e5c159 Mon Sep 17 00:00:00 2001 From: nduchak Date: Thu, 16 May 2019 16:51:38 +0300 Subject: [PATCH 30/40] force Jenkins --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index e39b332405..39be2180ae 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,7 @@ + # [3.2.0](https://github.com/aeternity/aepp-sdk-js/compare/2.4.0...3.2.0) (2019-05-16) From 184f58e43f2c145b09600a3217a9073fd6269b53 Mon Sep 17 00:00:00 2001 From: nduchak Date: Thu, 16 May 2019 16:54:15 +0300 Subject: [PATCH 31/40] force Jenkins --- CHANGELOG.md | 1 - 1 file changed, 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 39be2180ae..e39b332405 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,7 +7,6 @@ - # [3.2.0](https://github.com/aeternity/aepp-sdk-js/compare/2.4.0...3.2.0) (2019-05-16) From 0c954c131c880e749ded1ffddfb878213fc9598b Mon Sep 17 00:00:00 2001 From: nduchak Date: Thu, 16 May 2019 17:33:36 +0300 Subject: [PATCH 32/40] force Jenkins --- test/unit/crypto.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/test/unit/crypto.js b/test/unit/crypto.js index 0669add974..142b52fc0c 100644 --- a/test/unit/crypto.js +++ b/test/unit/crypto.js @@ -19,8 +19,7 @@ import '../' import { describe, it } from 'mocha' import { assert, expect } from 'chai' import * as Crypto from '../../es/utils/crypto' -import { addressToHex } from '../../es/utils/crypto' -import { encodeBase58Check } from '../../es/utils/crypto' +import { addressToHex, encodeBase58Check } from '../../es/utils/crypto' // These keys are fixations for the encryption lifecycle tests and will // not be used for signing From 8b48bc7e7a6f172ad9a620f061bce67a4b92ef34 Mon Sep 17 00:00:00 2001 From: nduchak Date: Thu, 16 May 2019 17:47:10 +0300 Subject: [PATCH 33/40] force Jenkins --- test/unit/crypto.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/unit/crypto.js b/test/unit/crypto.js index 142b52fc0c..3018b6389c 100644 --- a/test/unit/crypto.js +++ b/test/unit/crypto.js @@ -19,6 +19,7 @@ import '../' import { describe, it } from 'mocha' import { assert, expect } from 'chai' import * as Crypto from '../../es/utils/crypto' + import { addressToHex, encodeBase58Check } from '../../es/utils/crypto' // These keys are fixations for the encryption lifecycle tests and will From e2fec1935558ad3c69ce219892b6f63ae35b4d03 Mon Sep 17 00:00:00 2001 From: nduchak Date: Fri, 17 May 2019 17:36:12 +0300 Subject: [PATCH 34/40] fix(AEP exampe): Fix contract in AEPP example --- .../connect-two-ae/aepp/src/components/Home.vue | 4 ++-- package-lock.json | 15 +++++++-------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/examples/connect-two-ae/aepp/src/components/Home.vue b/examples/connect-two-ae/aepp/src/components/Home.vue index 5c00258824..3786a83342 100644 --- a/examples/connect-two-ae/aepp/src/components/Home.vue +++ b/examples/connect-two-ae/aepp/src/components/Home.vue @@ -157,8 +157,8 @@ spendResult: null, spendError: null, contractCode: `contract Identity = - type state = () - function main(x : int) = x`, + type state = () + function main(x : int) = x`, byteCode: null, compileError: null, contractInitState: [], diff --git a/package-lock.json b/package-lock.json index d213b7bbdf..318708e39c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aeternity/aepp-sdk", - "version": "3.2.0", + "version": "3.2.1", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1992,6 +1992,7 @@ "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, "requires": { "sprintf-js": "~1.0.2" } @@ -4616,11 +4617,6 @@ "integrity": "sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ==", "dev": true }, - "esm": { - "version": "3.2.23", - "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.23.tgz", - "integrity": "sha512-p7iNpE0K3nLn1KE2O0Vz/2Gpg93U+JroVqAdHZwK7l3MmPKh4iu5CEvw1Gym9DT23BgNNvnY5wOf9vMjBFw7Ug==" - }, "esprima": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", @@ -6750,6 +6746,7 @@ "version": "3.13.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "dev": true, "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -6758,7 +6755,8 @@ "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true } } }, @@ -9645,7 +9643,8 @@ "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true }, "sshpk": { "version": "1.14.2", From d957cc9b17a040926bd7c4e8d794f4ecb78c2954 Mon Sep 17 00:00:00 2001 From: naz_dou <41945483+nduchak@users.noreply.github.com> Date: Fri, 17 May 2019 18:48:27 +0300 Subject: [PATCH 35/40] Release/3.3.0 (#417) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Realign/3.2.1 (#412) * chore(package): Bump version to 2.4.1 * chore(Adjust CHANGELOG): * chore(CAHNGELOG): Fix typo * docs(USAGE): Fix networkId in Wallet example * fix(Http): Remove userAgent from axios * chore(CHANGELOG): Fix typo * docs(*): Regenrate docs * chore(bump version in package): * chore(CHANGELOG): Adjust changelog to conventional changelog style * chore(Docker): Update node version tot 2.3.0 * docs(CHANGELOG): Adjust release * feat(npm): Add script for auto-generating changelog * chore(Node): downgrade to 2.2.0 due to failed channel test * fix(Channel): Fix failing test on 2.3.0 node * chore(package-lock): adjust package-lock * chore(Channel): Revert to 2.2.0 * docs(Docs): Regenerate docs * refactor(node): Add txHash to sendTransaction error * chore(package): bump version to 3.1.0 * chore(Docs): Regeneratee docs and changelog * chore(package): Add packa-lock * chore(changelog): Adjust closes issue * chore(package): Bump version to 3.2.0 * docs(Docs and Changelog): Regenerate docs * docs(CHANGELOG): Adjust changelog * docs(CHANGELOG): Adjust changelog * chore(Jenkions): Force jenkins * fix(NPM): Make audit of npm packages. Remove esm from deps * chore(Release): Bump version in package, generate CHNAGELOG * force Jenkins * force Jenkins * force Jenkins * force Jenkins * feat(Consensus): Add function to get consensus version. (#413) * feat(Consensus): Add function to get conmsensus version. Get vm/abi based on node protocol * chore(node): Remove logs * add docs for node getProtocol * disable channel tests * try to fix channel test * try to fix channel test * Make sdk compatible with node from 2.3.0 to 4.0.0 * feat(TxBuilder): INT type must be greater or equal 0 int transaction * feat(State Channels): Make state channels compatible with aeternity v… (#415) * feat(State Channels): Make state channels compatible with aeternity v3.0.0 * Fix lint error * feat(Transaction Builder): Add serializations for transactions introd… (#416) * feat(Transaction Builder): Add serializations for transactions introduced in fortuna release * Fix lint errors * fix(AEP exampe): Fix contract in AEPP example * chore(package): Bump version to 3.3.0 * fix(Node): Use universalUrl istead of ES URL * Enable channel tests --- .env | 2 +- CHANGELOG.md | 20 + docker/aeternity_node_mean16.yaml | 4 + es/channel/handlers.js | 18 +- es/node.js | 29 +- es/tx/builder/index.js | 14 +- es/tx/builder/schema.js | 391 ++++++++++++++---- es/tx/tx.js | 21 +- .../aepp/src/components/Home.vue | 4 +- package-lock.json | 64 ++- package.json | 5 +- test/integration/accounts.js | 8 + test/integration/channel.js | 191 +++++++-- 13 files changed, 623 insertions(+), 148 deletions(-) diff --git a/.env b/.env index 13150cee73..e569c471ec 100644 --- a/.env +++ b/.env @@ -1,3 +1,3 @@ -TAG=v2.5.0 +TAG=master COMPILER_TAG=v2.1.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index e39b332405..5ab526c23b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,23 @@ +# [3.3.0](https://github.com/aeternity/aepp-sdk-js/compare/2.4.0...3.3.0) (2019-05-17) + + +### Bug Fixes + +* **AEP exampe:** Fix contract in AEPP example ([e2fec19](https://github.com/aeternity/aepp-sdk-js/commit/e2fec19)) +fix(AEP exampe): Fix contract in AEPP example + +### Features + +* **Consensus:** Add function to get consensus version. ([#413](https://github.com/aeternity/aepp-sdk-js/issues/413)) ([46027cd](https://github.com/aeternity/aepp-sdk-js/commit/46027cd)) +* **State Channels:** Make state channels compatible with aeternity 3.0.0 ([#415](https://github.com/aeternity/aepp-sdk-js/issues/415)) ([668e7f1](https://github.com/aeternity/aepp-sdk-js/commit/668e7f1)) +* **Transaction Builder:** Add serializations for transactions introd… ([#416](https://github.com/aeternity/aepp-sdk-js/issues/416)) ([fd7b8ce](https://github.com/aeternity/aepp-sdk-js/commit/fd7b8ce)) + + +### BREAKING CHANGES + +* **NODE** Change compatibility from `2.3.0` to `3.0.0` + + # [3.2.1](https://github.com/aeternity/aepp-sdk-js/compare/2.4.0...3.2.1) (2019-05-16) diff --git a/docker/aeternity_node_mean16.yaml b/docker/aeternity_node_mean16.yaml index 780b64b803..a580c0198f 100644 --- a/docker/aeternity_node_mean16.yaml +++ b/docker/aeternity_node_mean16.yaml @@ -20,6 +20,10 @@ keys: chain: persist: true + hard_forks: + "1": 0 + "2": 2 + "3": 4 mining: autostart: true diff --git a/es/channel/handlers.js b/es/channel/handlers.js index 3b80b6a515..d18dbd27fa 100644 --- a/es/channel/handlers.js +++ b/es/channel/handlers.js @@ -151,7 +151,7 @@ channelOpen.enter = (channel) => { export async function awaitingOffChainTx (channel, message, state) { if (message.method === 'channels.sign.update') { const { sign } = state - const signedTx = await sign(message.params.data.tx) + const signedTx = await sign(message.params.data.tx, { updates: message.params.data.updates }) send(channel, { jsonrpc: '2.0', method: 'channels.update', params: { tx: signedTx } }) return { handler: awaitingOffChainUpdate, state } } @@ -194,7 +194,11 @@ export async function awaitingTxSignRequest (channel, message, state) { // eslint-disable-next-line no-useless-escape const [, tag] = message.method.match(/^channels\.sign\.([^\.]+)$/) || [] if (tag) { - const signedTx = await options.get(channel).sign(tag, message.params.data.tx) + const signedTx = await options.get(channel).sign( + tag, + message.params.data.tx, + { updates: message.params.data.updates } + ) if (signedTx) { send(channel, { jsonrpc: '2.0', method: `channels.${tag}`, params: { tx: signedTx } }) return { handler: channelOpen } @@ -256,7 +260,10 @@ export function awaitingLeave (channel, message, state) { export async function awaitingWithdrawTx (channel, message, state) { if (message.method === 'channels.sign.withdraw_tx') { - const signedTx = await Promise.resolve(state.sign(message.params.data.tx)) + const signedTx = await Promise.resolve(state.sign( + message.params.data.tx, + { updates: message.params.data.updates } + )) send(channel, { jsonrpc: '2.0', method: 'channels.withdraw_tx', params: { tx: signedTx } }) return { handler: awaitingWithdrawCompletion, state } } @@ -296,7 +303,10 @@ export function awaitingWithdrawCompletion (channel, message, state) { export async function awaitingDepositTx (channel, message, state) { if (message.method === 'channels.sign.deposit_tx') { - const signedTx = await Promise.resolve(state.sign(message.params.data.tx)) + const signedTx = await Promise.resolve(state.sign( + message.params.data.tx, + { updates: message.params.data.updates } + )) send(channel, { jsonrpc: '2.0', method: 'channels.deposit_tx', params: { tx: signedTx } }) return { handler: awaitingDepositCompletion, state } } diff --git a/es/node.js b/es/node.js index ed24e27155..2c2e554f97 100644 --- a/es/node.js +++ b/es/node.js @@ -27,6 +27,7 @@ import axios from 'axios' import * as R from 'ramda' import Swagger from './utils/swagger' import semverSatisfies from './utils/semver-satisfies' +import { URL } from 'universal-url' function resolveUrl (url, baseUrl) { return new URL(url, baseUrl).toString() @@ -63,6 +64,27 @@ const loader = ({ url, internalUrl }) => (path, definition) => { } } +/** + * get consensus protocol version + * @param {Array} protocols Array of protocols + * @param {Number} height Geigh + * @return {Number} version Protocol version + */ +async function getConsensusProtocolVersion (protocols = [], height) { + if (!protocols) throw new Error('Protocols must be an array') + if (!height) height = (await this.api.getCurrentKeyBlock()).height + if (height < 0) throw new Error('height must be a number >= 0') + + const { version } = protocols + .reduce( + ({ effectiveAtHeight, version }, p) => height >= p.effectiveAtHeight && p.effectiveAtHeight > effectiveAtHeight + ? { effectiveAtHeight: p.effectiveAtHeight, version: p.version } + : { effectiveAtHeight, version }, + { effectiveAtHeight: -1, version: 0 } + ) + return version +} + /** * {@link Swagger} based Node remote API Stamp * @function @@ -95,15 +117,18 @@ const Node = stampit({ nodeNetworkId: this.nodeNetworkId, version: this.version } - } + }, + getConsensusProtocolVersion }, props: { version: null, + consensusProtocolVersion: null, nodeNetworkId: null } }, Swagger, { async init ({ forceCompatibility = false }) { - const { nodeRevision: revision, genesisKeyBlockHash: genesisHash, networkId } = await this.api.getStatus() + const { nodeRevision: revision, genesisKeyBlockHash: genesisHash, networkId, protocols } = await this.api.getStatus() + this.consensusProtocolVersion = await this.getConsensusProtocolVersion(protocols) if ( !semverSatisfies(this.version.split('-')[0], NODE_GE_VERSION, NODE_LT_VERSION) && !forceCompatibility diff --git a/es/tx/builder/index.js b/es/tx/builder/index.js index a6dcf2d4fd..08b3f73b9c 100644 --- a/es/tx/builder/index.js +++ b/es/tx/builder/index.js @@ -124,7 +124,8 @@ function validateField (value, key, type, prefix) { // Validate type of value switch (type) { case FIELD_TYPES.int: - return assert(!isNaN(value) || BigNumber.isBigNumber(value), { value }) + const isMinusValue = (!isNaN(value) || BigNumber.isBigNumber(value)) && BigNumber(value).lt(0) + return assert((!isNaN(value) || BigNumber.isBigNumber(value)) && BigNumber(value).gte(0), { value, isMinusValue }) case FIELD_TYPES.id: return assert(PREFIX_ID_TAG[value.split('_')[0]] && value.split('_')[0] === prefix, { value, prefix }) case FIELD_TYPES.binary: @@ -301,7 +302,10 @@ export function buildTx (params, type, { excludeKeys = [], prefix = 'tx' } = {}) if (!TX_SERIALIZATION_SCHEMA[type]) { throw new Error('Transaction serialization not implemented for ' + type) } - const [schema, tag] = TX_SERIALIZATION_SCHEMA[type] + 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 rlpEncoded = rlp.encode(binary) @@ -326,7 +330,11 @@ export function unpackTx (encodedTx, fromRlpBinary = false) { if (!TX_DESERIALIZATION_SCHEMA[objId]) { return { message: 'Transaction deserialization not implemented for tag ' + objId } } - const [schema] = TX_DESERIALIZATION_SCHEMA[objId] + const vsn = readInt(binary[1]) + if (!TX_DESERIALIZATION_SCHEMA[objId][vsn]) { + return { message: 'Transaction deserialization not implemented for tag ' + objId + ' version ' + vsn } + } + const [schema] = TX_DESERIALIZATION_SCHEMA[objId][vsn] return { txType: OBJECT_ID_TX_TYPE[objId], tx: unpackRawTx(binary, schema), rlpEncoded, binary } } diff --git a/es/tx/builder/schema.js b/es/tx/builder/schema.js index 46af8e6129..b714eb4a6f 100644 --- a/es/tx/builder/schema.js +++ b/es/tx/builder/schema.js @@ -155,18 +155,33 @@ export const ABI_VERSIONS = { SOLIDITY: 2 } +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] }, + [TX_TYPE.oracleRegister]: { vmVersion: [VM_VERSIONS.SOPHIA], abiVersion: [ABI_VERSIONS.NO_ABI, ABI_VERSIONS.SOPHIA] } +} + export const VM_ABI_MAP_MINERVA = { [TX_TYPE.contractCreate]: { vmVersion: [VM_VERSIONS.SOPHIA_IMPROVEMENTS_MINERVA], abiVersion: [ABI_VERSIONS.SOPHIA] }, - [TX_TYPE.contractCall]: { vmVersion: [VM_VERSIONS.SOPHIA, VM_VERSIONS.SOPHIA_IMPROVEMENTS_MINERVA], abiVersion: [ABI_VERSIONS.SOPHIA] }, + [TX_TYPE.contractCall]: { vmVersion: [VM_VERSIONS.SOPHIA_IMPROVEMENTS_MINERVA, VM_VERSIONS.SOPHIA], abiVersion: [ABI_VERSIONS.SOPHIA] }, [TX_TYPE.oracleRegister]: { vmVersion: [VM_VERSIONS.SOPHIA_IMPROVEMENTS_MINERVA], abiVersion: [ABI_VERSIONS.NO_ABI, ABI_VERSIONS.SOPHIA] } } export const VM_ABI_MAP_FORTUNA = { - [TX_TYPE.contractCreate]: { vmVersion: [VM_VERSIONS.SOPHIA_IMPROVEMENTS_MINERVA, VM_VERSIONS.SOPHIA_IMPROVEMENTS_FORTUNA], abiVersion: [ABI_VERSIONS.SOPHIA] }, // vmVersion 0x4 do not work with fortuna - [TX_TYPE.contractCall]: { vmVersion: [VM_VERSIONS.SOPHIA, VM_VERSIONS.SOPHIA_IMPROVEMENTS_FORTUNA, VM_VERSIONS.SOPHIA_IMPROVEMENTS_MINERVA], abiVersion: [ABI_VERSIONS.SOPHIA] }, + [TX_TYPE.contractCreate]: { vmVersion: [VM_VERSIONS.SOPHIA_IMPROVEMENTS_FORTUNA], abiVersion: [ABI_VERSIONS.SOPHIA] }, + [TX_TYPE.contractCall]: { vmVersion: [VM_VERSIONS.SOPHIA_IMPROVEMENTS_FORTUNA, VM_VERSIONS.SOPHIA, VM_VERSIONS.SOPHIA_IMPROVEMENTS_MINERVA], abiVersion: [ABI_VERSIONS.SOPHIA] }, [TX_TYPE.oracleRegister]: { vmVersion: [], abiVersion: [ABI_VERSIONS.NO_ABI, ABI_VERSIONS.SOPHIA] } } +export const PROTOCOL_VM_ABI = { + // Roma + '1': VM_ABI_MAP_ROMA, + // Minerva + '2': VM_ABI_MAP_MINERVA, + // Fortuna + '3': VM_ABI_MAP_FORTUNA +} + export const OBJECT_ID_TX_TYPE = { [OBJECT_TAG_ACCOUNT]: TX_TYPE.account, [OBJECT_TAG_SIGNED_TRANSACTION]: TX_TYPE.signed, @@ -291,7 +306,7 @@ export const ID_TAG_PREFIX = revertObject(PREFIX_ID_TAG) const VALIDATION_ERROR = (msg) => msg export const VALIDATION_MESSAGE = { - [FIELD_TYPES.int]: ({ value }) => VALIDATION_ERROR(`${value} is not of type Number or BigNumber`), + [FIELD_TYPES.int]: ({ value, isMinusValue }) => isMinusValue ? VALIDATION_ERROR(`${value} must be >= 0`) : VALIDATION_ERROR(`${value} is not of type Number or BigNumber`), [FIELD_TYPES.id]: ({ value, prefix }) => VALIDATION_ERROR(`'${value}' prefix doesn't match expected prefix '${prefix}' or ID_TAG for prefix not found`), [FIELD_TYPES.binary]: ({ prefix, value }) => VALIDATION_ERROR(`'${value}' prefix doesn't match expected prefix '${prefix}'`), [FIELD_TYPES.string]: ({ value }) => VALIDATION_ERROR(`Not a string`), @@ -310,6 +325,15 @@ const ACCOUNT_TX = [ TX_FIELD('balance', FIELD_TYPES.int) ] +const ACCOUNT_TX_2 = [ + ...BASE_TX, + 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('gaAuthFun', FIELD_TYPES.binary, 'cb') +] + const SPEND_TX = [ ...BASE_TX, TX_FIELD('senderId', FIELD_TYPES.id, 'ak'), @@ -572,6 +596,13 @@ const CHANNEL_OFFCHAIN_TX = [ TX_FIELD('stateHash', FIELD_TYPES.binary, 'st') ] +const CHANNEL_OFFCHAIN_TX_2 = [ + ...BASE_TX, + TX_FIELD('channelId', FIELD_TYPES.id, 'ch'), + TX_FIELD('round', FIELD_TYPES.int), + TX_FIELD('stateHash', FIELD_TYPES.binary, 'st') +] + const CHANNEL_TX = [ ...BASE_TX, TX_FIELD('initiator', FIELD_TYPES.id, 'ak'), @@ -588,6 +619,24 @@ const CHANNEL_TX = [ TX_FIELD('lockedUntil', FIELD_TYPES.int) ] +const CHANNEL_TX_2 = [ + ...BASE_TX, + TX_FIELD('initiator', FIELD_TYPES.id, 'ak'), + TX_FIELD('responder', FIELD_TYPES.id, 'ak'), + TX_FIELD('channelAmount', FIELD_TYPES.int), + TX_FIELD('initiatorAmount', FIELD_TYPES.int), + TX_FIELD('responderAmount', FIELD_TYPES.int), + TX_FIELD('channelReserve', FIELD_TYPES.int), + TX_FIELD('delegateIds', FIELD_TYPES.ids), + TX_FIELD('stateHash', FIELD_TYPES.hex), + TX_FIELD('round', FIELD_TYPES.int), + TX_FIELD('soloRound', FIELD_TYPES.int), + TX_FIELD('lockPeriod', FIELD_TYPES.int), + TX_FIELD('lockedUntil', FIELD_TYPES.int), + TX_FIELD('initiatorAuth', FIELD_TYPES.binary, 'cb'), + TX_FIELD('responderAuth', FIELD_TYPES.binary, 'cb') +] + const CHANNEL_SNAPSHOT_SOLO_TX = [ ...BASE_TX, TX_FIELD('channelId', FIELD_TYPES.id, 'ch'), @@ -700,91 +749,261 @@ const ACCOUNTS_TREE_TX = [ ] export const TX_SERIALIZATION_SCHEMA = { - [TX_TYPE.account]: TX_SCHEMA_FIELD(ACCOUNT_TX, OBJECT_TAG_ACCOUNT), - [TX_TYPE.signed]: TX_SCHEMA_FIELD(SIGNED_TX, OBJECT_TAG_SIGNED_TRANSACTION), - [TX_TYPE.spend]: TX_SCHEMA_FIELD(SPEND_TX, OBJECT_TAG_SPEND_TRANSACTION), - [TX_TYPE.namePreClaim]: TX_SCHEMA_FIELD(NAME_PRE_CLAIM_TX, OBJECT_TAG_NAME_SERVICE_PRECLAIM_TRANSACTION), - [TX_TYPE.nameClaim]: TX_SCHEMA_FIELD(NAME_CLAIM_TX, OBJECT_TAG_NAME_SERVICE_CLAIM_TRANSACTION), - [TX_TYPE.nameUpdate]: TX_SCHEMA_FIELD(NAME_UPDATE_TX, OBJECT_TAG_NAME_SERVICE_UPDATE_TRANSACTION), - [TX_TYPE.nameTransfer]: TX_SCHEMA_FIELD(NAME_TRANSFER_TX, OBJECT_TAG_NAME_SERVICE_TRANSFER_TRANSACTION), - [TX_TYPE.nameRevoke]: TX_SCHEMA_FIELD(NAME_REVOKE_TX, OBJECT_TAG_NAME_SERVICE_REVOKE_TRANSACTION), - [TX_TYPE.contract]: TX_SCHEMA_FIELD(CONTRACT_TX, OBJECT_TAG_CONTRACT), - [TX_TYPE.contractCreate]: TX_SCHEMA_FIELD(CONTRACT_CREATE_TX, OBJECT_TAG_CONTRACT_CREATE_TRANSACTION), - [TX_TYPE.contractCall]: TX_SCHEMA_FIELD(CONTRACT_CALL_TX, OBJECT_TAG_CONTRACT_CALL_TRANSACTION), - [TX_TYPE.contractCallResult]: TX_SCHEMA_FIELD(CONTRACT_CALL_RESULT_TX, OBJECT_TAG_CONTRACT_CALL), - [TX_TYPE.oracleRegister]: TX_SCHEMA_FIELD(ORACLE_REGISTER_TX, OBJECT_TAG_ORACLE_REGISTER_TRANSACTION), - [TX_TYPE.oracleExtend]: TX_SCHEMA_FIELD(ORACLE_EXTEND_TX, OBJECT_TAG_ORACLE_EXTEND_TRANSACTION), - [TX_TYPE.oracleQuery]: TX_SCHEMA_FIELD(ORACLE_QUERY_TX, OBJECT_TAG_ORACLE_QUERY_TRANSACTION), - [TX_TYPE.oracleResponse]: TX_SCHEMA_FIELD(ORACLE_RESPOND_TX, OBJECT_TAG_ORACLE_RESPONSE_TRANSACTION), - [TX_TYPE.channelCreate]: TX_SCHEMA_FIELD(CHANNEL_CREATE_TX, OBJECT_TAG_CHANNEL_CREATE_TX), - [TX_TYPE.channelCloseMutual]: TX_SCHEMA_FIELD(CHANNEL_CLOSE_MUTUAL_TX, OBJECT_TAG_CHANNEL_CLOSE_MUTUAL_TX), - [TX_TYPE.channelCloseSolo]: TX_SCHEMA_FIELD(CHANNEL_CLOSE_SOLO_TX, OBJECT_TAG_CHANNEL_CLOSE_SOLO_TX), - [TX_TYPE.channelSlash]: TX_SCHEMA_FIELD(CHANNEL_SLASH_TX, OBJECT_TAG_CHANNEL_SLASH_TX), - [TX_TYPE.channelDeposit]: TX_SCHEMA_FIELD(CHANNEL_DEPOSIT_TX, OBJECT_TAG_CHANNEL_DEPOSIT_TX), - [TX_TYPE.channelWithdraw]: TX_SCHEMA_FIELD(CHANNEL_WITHDRAW_TX, OBJECT_TAG_CHANNEL_WITHRAW_TX), - [TX_TYPE.channelSettle]: TX_SCHEMA_FIELD(CHANNEL_SETTLE_TX, OBJECT_TAG_CHANNEL_SETTLE_TX), - [TX_TYPE.channelOffChain]: TX_SCHEMA_FIELD(CHANNEL_OFFCHAIN_TX, OBJECT_TAG_CHANNEL_OFFCHAIN_TX), - [TX_TYPE.channel]: TX_SCHEMA_FIELD(CHANNEL_TX, OBJECT_TAG_CHANNEL), - [TX_TYPE.channelSnapshotSolo]: TX_SCHEMA_FIELD(CHANNEL_SNAPSHOT_SOLO_TX, OBJECT_TAG_CHANNEL_SNAPSHOT_SOLO_TX), - [TX_TYPE.channelOffChainUpdateTransfer]: TX_SCHEMA_FIELD(CHANNEL_OFFCHAIN_UPDATE_TRANSFER_TX, OBJECT_TAG_CHANNEL_OFFCHAIN_UPDATE_TRANSFER_TX), - [TX_TYPE.channelOffChainUpdateDeposit]: TX_SCHEMA_FIELD(CHANNEL_OFFCHAIN_UPDATE_DEPOSIT_TX, OBJECT_TAG_CHANNEL_OFFCHAIN_UPDATE_DEPOSIT_TX), - [TX_TYPE.channelOffChainUpdateWithdrawal]: TX_SCHEMA_FIELD(CHANNEL_OFFCHAIN_UPDATE_WITHDRAWAL_TX, OBJECT_TAG_CHANNEL_OFFCHAIN_UPDATE_WITHDRAWAL_TX), - [TX_TYPE.channelOffChainCreateContract]: TX_SCHEMA_FIELD(CHANNEL_OFFCHAIN_CREATE_CONTRACT_TX, OBJECT_TAG_CHANNEL_OFFCHAIN_CREATE_CONTRACT_TX), - [TX_TYPE.channelOffChainCallContract]: TX_SCHEMA_FIELD(CHANNEL_OFFCHAIN_CALL_CONTRACT_TX, OBJECT_TAG_CHANNEL_OFFCHAIN_CALL_CONTRACT_TX), - [TX_TYPE.proofOfInclusion]: TX_SCHEMA_FIELD(PROOF_OF_INCLUSION_TX, OBJECT_TAG_PROOF_OF_INCLUSION), - [TX_TYPE.stateTrees]: TX_SCHEMA_FIELD(STATE_TREES_TX, OBJECT_TAG_STATE_TREES), - [TX_TYPE.merklePatriciaTree]: TX_SCHEMA_FIELD(MERKLE_PATRICIA_TREE_TX, OBJECT_TAG_MERKLE_PATRICIA_TREE), - [TX_TYPE.merklePatriciaTreeValue]: TX_SCHEMA_FIELD(MERKLE_PATRICIA_TREE_VALUE_TX, OBJECT_TAG_MERKLE_PATRICIA_TREE_VALUE), - [TX_TYPE.contractsTree]: TX_SCHEMA_FIELD(CONTRACTS_TREE_TX, OBJECT_TAG_CONTRACTS_TREE), - [TX_TYPE.contractCallsTree]: TX_SCHEMA_FIELD(CONTRACT_CALLS_TREE_TX, OBJECT_TAG_CONTRACT_CALLS_TREE), - [TX_TYPE.channelsTree]: TX_SCHEMA_FIELD(CHANNELS_TREE_TX, OBJECT_TAG_CHANNELS_TREE), - [TX_TYPE.nameserviceTree]: TX_SCHEMA_FIELD(NAMESERVICE_TREE_TX, OBJECT_TAG_NAMESERVICE_TREE), - [TX_TYPE.oraclesTree]: TX_SCHEMA_FIELD(ORACLES_TREE_TX, OBJECT_TAG_ORACLES_TREE), - [TX_TYPE.accountsTree]: TX_SCHEMA_FIELD(ACCOUNTS_TREE_TX, OBJECT_TAG_ACCOUNTS_TREE) + [TX_TYPE.account]: { + 1: TX_SCHEMA_FIELD(ACCOUNT_TX, OBJECT_TAG_ACCOUNT), + 2: TX_SCHEMA_FIELD(ACCOUNT_TX_2, OBJECT_TAG_ACCOUNT) + }, + [TX_TYPE.signed]: { + 1: TX_SCHEMA_FIELD(SIGNED_TX, OBJECT_TAG_SIGNED_TRANSACTION) + }, + [TX_TYPE.spend]: { + 1: TX_SCHEMA_FIELD(SPEND_TX, OBJECT_TAG_SPEND_TRANSACTION) + }, + [TX_TYPE.namePreClaim]: { + 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) + }, + [TX_TYPE.nameUpdate]: { + 1: TX_SCHEMA_FIELD(NAME_UPDATE_TX, OBJECT_TAG_NAME_SERVICE_UPDATE_TRANSACTION) + }, + [TX_TYPE.nameTransfer]: { + 1: TX_SCHEMA_FIELD(NAME_TRANSFER_TX, OBJECT_TAG_NAME_SERVICE_TRANSFER_TRANSACTION) + }, + [TX_TYPE.nameRevoke]: { + 1: TX_SCHEMA_FIELD(NAME_REVOKE_TX, OBJECT_TAG_NAME_SERVICE_REVOKE_TRANSACTION) + }, + [TX_TYPE.contract]: { + 1: TX_SCHEMA_FIELD(CONTRACT_TX, OBJECT_TAG_CONTRACT) + }, + [TX_TYPE.contractCreate]: { + 1: TX_SCHEMA_FIELD(CONTRACT_CREATE_TX, OBJECT_TAG_CONTRACT_CREATE_TRANSACTION) + }, + [TX_TYPE.contractCall]: { + 1: TX_SCHEMA_FIELD(CONTRACT_CALL_TX, OBJECT_TAG_CONTRACT_CALL_TRANSACTION) + }, + [TX_TYPE.contractCallResult]: { + 1: TX_SCHEMA_FIELD(CONTRACT_CALL_RESULT_TX, OBJECT_TAG_CONTRACT_CALL) + }, + [TX_TYPE.oracleRegister]: { + 1: TX_SCHEMA_FIELD(ORACLE_REGISTER_TX, OBJECT_TAG_ORACLE_REGISTER_TRANSACTION) + }, + [TX_TYPE.oracleExtend]: { + 1: TX_SCHEMA_FIELD(ORACLE_EXTEND_TX, OBJECT_TAG_ORACLE_EXTEND_TRANSACTION) + }, + [TX_TYPE.oracleQuery]: { + 1: TX_SCHEMA_FIELD(ORACLE_QUERY_TX, OBJECT_TAG_ORACLE_QUERY_TRANSACTION) + }, + [TX_TYPE.oracleResponse]: { + 1: TX_SCHEMA_FIELD(ORACLE_RESPOND_TX, OBJECT_TAG_ORACLE_RESPONSE_TRANSACTION) + }, + [TX_TYPE.channelCreate]: { + 1: TX_SCHEMA_FIELD(CHANNEL_CREATE_TX, OBJECT_TAG_CHANNEL_CREATE_TX) + }, + [TX_TYPE.channelCloseMutual]: { + 1: TX_SCHEMA_FIELD(CHANNEL_CLOSE_MUTUAL_TX, OBJECT_TAG_CHANNEL_CLOSE_MUTUAL_TX) + }, + [TX_TYPE.channelCloseSolo]: { + 1: TX_SCHEMA_FIELD(CHANNEL_CLOSE_SOLO_TX, OBJECT_TAG_CHANNEL_CLOSE_SOLO_TX) + }, + [TX_TYPE.channelSlash]: { + 1: TX_SCHEMA_FIELD(CHANNEL_SLASH_TX, OBJECT_TAG_CHANNEL_SLASH_TX) + }, + [TX_TYPE.channelDeposit]: { + 1: TX_SCHEMA_FIELD(CHANNEL_DEPOSIT_TX, OBJECT_TAG_CHANNEL_DEPOSIT_TX) + }, + [TX_TYPE.channelWithdraw]: { + 1: TX_SCHEMA_FIELD(CHANNEL_WITHDRAW_TX, OBJECT_TAG_CHANNEL_WITHRAW_TX) + }, + [TX_TYPE.channelSettle]: { + 1: TX_SCHEMA_FIELD(CHANNEL_SETTLE_TX, OBJECT_TAG_CHANNEL_SETTLE_TX) + }, + [TX_TYPE.channelOffChain]: { + 1: TX_SCHEMA_FIELD(CHANNEL_OFFCHAIN_TX, OBJECT_TAG_CHANNEL_OFFCHAIN_TX), + 2: TX_SCHEMA_FIELD(CHANNEL_OFFCHAIN_TX_2, OBJECT_TAG_CHANNEL_OFFCHAIN_TX) + }, + [TX_TYPE.channel]: { + 1: TX_SCHEMA_FIELD(CHANNEL_TX, OBJECT_TAG_CHANNEL), + 2: TX_SCHEMA_FIELD(CHANNEL_TX_2, OBJECT_TAG_CHANNEL) + }, + [TX_TYPE.channelSnapshotSolo]: { + 1: TX_SCHEMA_FIELD(CHANNEL_SNAPSHOT_SOLO_TX, OBJECT_TAG_CHANNEL_SNAPSHOT_SOLO_TX) + }, + [TX_TYPE.channelOffChainUpdateTransfer]: { + 1: TX_SCHEMA_FIELD(CHANNEL_OFFCHAIN_UPDATE_TRANSFER_TX, OBJECT_TAG_CHANNEL_OFFCHAIN_UPDATE_TRANSFER_TX) + }, + [TX_TYPE.channelOffChainUpdateDeposit]: { + 1: TX_SCHEMA_FIELD(CHANNEL_OFFCHAIN_UPDATE_DEPOSIT_TX, OBJECT_TAG_CHANNEL_OFFCHAIN_UPDATE_DEPOSIT_TX) + }, + [TX_TYPE.channelOffChainUpdateWithdrawal]: { + 1: TX_SCHEMA_FIELD(CHANNEL_OFFCHAIN_UPDATE_WITHDRAWAL_TX, OBJECT_TAG_CHANNEL_OFFCHAIN_UPDATE_WITHDRAWAL_TX) + }, + [TX_TYPE.channelOffChainCreateContract]: { + 1: TX_SCHEMA_FIELD(CHANNEL_OFFCHAIN_CREATE_CONTRACT_TX, OBJECT_TAG_CHANNEL_OFFCHAIN_CREATE_CONTRACT_TX) + }, + [TX_TYPE.channelOffChainCallContract]: { + 1: TX_SCHEMA_FIELD(CHANNEL_OFFCHAIN_CALL_CONTRACT_TX, OBJECT_TAG_CHANNEL_OFFCHAIN_CALL_CONTRACT_TX) + }, + [TX_TYPE.proofOfInclusion]: { + 1: TX_SCHEMA_FIELD(PROOF_OF_INCLUSION_TX, OBJECT_TAG_PROOF_OF_INCLUSION) + }, + [TX_TYPE.stateTrees]: { + 1: TX_SCHEMA_FIELD(STATE_TREES_TX, OBJECT_TAG_STATE_TREES) + }, + [TX_TYPE.merklePatriciaTree]: { + 1: TX_SCHEMA_FIELD(MERKLE_PATRICIA_TREE_TX, OBJECT_TAG_MERKLE_PATRICIA_TREE) + }, + [TX_TYPE.merklePatriciaTreeValue]: { + 1: TX_SCHEMA_FIELD(MERKLE_PATRICIA_TREE_VALUE_TX, OBJECT_TAG_MERKLE_PATRICIA_TREE_VALUE) + }, + [TX_TYPE.contractsTree]: { + 1: TX_SCHEMA_FIELD(CONTRACTS_TREE_TX, OBJECT_TAG_CONTRACTS_TREE) + }, + [TX_TYPE.contractCallsTree]: { + 1: TX_SCHEMA_FIELD(CONTRACT_CALLS_TREE_TX, OBJECT_TAG_CONTRACT_CALLS_TREE) + }, + [TX_TYPE.channelsTree]: { + 1: TX_SCHEMA_FIELD(CHANNELS_TREE_TX, OBJECT_TAG_CHANNELS_TREE) + }, + [TX_TYPE.nameserviceTree]: { + 1: TX_SCHEMA_FIELD(NAMESERVICE_TREE_TX, OBJECT_TAG_NAMESERVICE_TREE) + }, + [TX_TYPE.oraclesTree]: { + 1: TX_SCHEMA_FIELD(ORACLES_TREE_TX, OBJECT_TAG_ORACLES_TREE) + }, + [TX_TYPE.accountsTree]: { + 1: TX_SCHEMA_FIELD(ACCOUNTS_TREE_TX, OBJECT_TAG_ACCOUNTS_TREE) + } } export const TX_DESERIALIZATION_SCHEMA = { - [OBJECT_TAG_ACCOUNT]: TX_SCHEMA_FIELD(ACCOUNT_TX, OBJECT_TAG_ACCOUNT), - [OBJECT_TAG_SIGNED_TRANSACTION]: TX_SCHEMA_FIELD(SIGNED_TX, OBJECT_TAG_SIGNED_TRANSACTION), - [OBJECT_TAG_SPEND_TRANSACTION]: TX_SCHEMA_FIELD(SPEND_TX, OBJECT_TAG_SPEND_TRANSACTION), - [OBJECT_TAG_NAME_SERVICE_PRECLAIM_TRANSACTION]: TX_SCHEMA_FIELD(NAME_PRE_CLAIM_TX, OBJECT_TAG_NAME_SERVICE_PRECLAIM_TRANSACTION), - [OBJECT_TAG_NAME_SERVICE_CLAIM_TRANSACTION]: TX_SCHEMA_FIELD(NAME_CLAIM_TX, OBJECT_TAG_NAME_SERVICE_CLAIM_TRANSACTION), - [OBJECT_TAG_NAME_SERVICE_UPDATE_TRANSACTION]: TX_SCHEMA_FIELD(NAME_UPDATE_TX, OBJECT_TAG_NAME_SERVICE_UPDATE_TRANSACTION), - [OBJECT_TAG_NAME_SERVICE_TRANSFER_TRANSACTION]: TX_SCHEMA_FIELD(NAME_TRANSFER_TX, OBJECT_TAG_NAME_SERVICE_TRANSFER_TRANSACTION), - [OBJECT_TAG_NAME_SERVICE_REVOKE_TRANSACTION]: TX_SCHEMA_FIELD(NAME_REVOKE_TX, OBJECT_TAG_NAME_SERVICE_REVOKE_TRANSACTION), - [OBJECT_TAG_CONTRACT]: TX_SCHEMA_FIELD(CONTRACT_TX, OBJECT_TAG_CONTRACT), - [OBJECT_TAG_CONTRACT_CREATE_TRANSACTION]: TX_SCHEMA_FIELD(CONTRACT_CREATE_TX, OBJECT_TAG_CONTRACT_CREATE_TRANSACTION), - [OBJECT_TAG_CONTRACT_CALL_TRANSACTION]: TX_SCHEMA_FIELD(CONTRACT_CALL_TX, OBJECT_TAG_CONTRACT_CALL_TRANSACTION), - [OBJECT_TAG_CONTRACT_CALL]: TX_SCHEMA_FIELD(CONTRACT_CALL_RESULT_TX, OBJECT_TAG_CONTRACT_CALL), - [OBJECT_TAG_ORACLE_REGISTER_TRANSACTION]: TX_SCHEMA_FIELD(ORACLE_REGISTER_TX, OBJECT_TAG_ORACLE_REGISTER_TRANSACTION), - [OBJECT_TAG_ORACLE_EXTEND_TRANSACTION]: TX_SCHEMA_FIELD(ORACLE_EXTEND_TX, OBJECT_TAG_ORACLE_EXTEND_TRANSACTION), - [OBJECT_TAG_ORACLE_QUERY_TRANSACTION]: TX_SCHEMA_FIELD(ORACLE_QUERY_TX, OBJECT_TAG_ORACLE_QUERY_TRANSACTION), - [OBJECT_TAG_ORACLE_RESPONSE_TRANSACTION]: TX_SCHEMA_FIELD(ORACLE_RESPOND_TX, OBJECT_TAG_ORACLE_RESPONSE_TRANSACTION), - [OBJECT_TAG_CHANNEL_CREATE_TX]: TX_SCHEMA_FIELD(CHANNEL_CREATE_TX, OBJECT_TAG_CHANNEL_CREATE_TX), - [OBJECT_TAG_CHANNEL_CLOSE_MUTUAL_TX]: TX_SCHEMA_FIELD(CHANNEL_CLOSE_MUTUAL_TX, OBJECT_TAG_CHANNEL_CLOSE_MUTUAL_TX), - [OBJECT_TAG_CHANNEL_CLOSE_SOLO_TX]: TX_SCHEMA_FIELD(CHANNEL_CLOSE_SOLO_TX, OBJECT_TAG_CHANNEL_CLOSE_SOLO_TX), - [OBJECT_TAG_CHANNEL_SLASH_TX]: TX_SCHEMA_FIELD(CHANNEL_SLASH_TX, OBJECT_TAG_CHANNEL_SLASH_TX), - [OBJECT_TAG_CHANNEL_DEPOSIT_TX]: TX_SCHEMA_FIELD(CHANNEL_DEPOSIT_TX, OBJECT_TAG_CHANNEL_DEPOSIT_TX), - [OBJECT_TAG_CHANNEL_WITHRAW_TX]: TX_SCHEMA_FIELD(CHANNEL_WITHDRAW_TX, OBJECT_TAG_CHANNEL_WITHRAW_TX), - [OBJECT_TAG_CHANNEL_SETTLE_TX]: TX_SCHEMA_FIELD(CHANNEL_SETTLE_TX, OBJECT_TAG_CHANNEL_SETTLE_TX), - [OBJECT_TAG_CHANNEL_OFFCHAIN_TX]: TX_SCHEMA_FIELD(CHANNEL_OFFCHAIN_TX, OBJECT_TAG_CHANNEL_OFFCHAIN_TX), - [OBJECT_TAG_CHANNEL]: TX_SCHEMA_FIELD(CHANNEL_TX, OBJECT_TAG_CHANNEL), - [OBJECT_TAG_CHANNEL_SNAPSHOT_SOLO_TX]: TX_SCHEMA_FIELD(CHANNEL_SNAPSHOT_SOLO_TX, OBJECT_TAG_CHANNEL_SNAPSHOT_SOLO_TX), - [OBJECT_TAG_CHANNEL_OFFCHAIN_UPDATE_TRANSFER_TX]: TX_SCHEMA_FIELD(CHANNEL_OFFCHAIN_UPDATE_TRANSFER_TX, OBJECT_TAG_CHANNEL_OFFCHAIN_UPDATE_TRANSFER_TX), - [OBJECT_TAG_CHANNEL_OFFCHAIN_UPDATE_DEPOSIT_TX]: TX_SCHEMA_FIELD(CHANNEL_OFFCHAIN_UPDATE_DEPOSIT_TX, OBJECT_TAG_CHANNEL_OFFCHAIN_UPDATE_DEPOSIT_TX), - [OBJECT_TAG_CHANNEL_OFFCHAIN_UPDATE_WITHDRAWAL_TX]: TX_SCHEMA_FIELD(CHANNEL_OFFCHAIN_UPDATE_WITHDRAWAL_TX, OBJECT_TAG_CHANNEL_OFFCHAIN_UPDATE_WITHDRAWAL_TX), - [OBJECT_TAG_CHANNEL_OFFCHAIN_CREATE_CONTRACT_TX]: TX_SCHEMA_FIELD(CHANNEL_OFFCHAIN_CREATE_CONTRACT_TX, OBJECT_TAG_CHANNEL_OFFCHAIN_CREATE_CONTRACT_TX), - [OBJECT_TAG_CHANNEL_OFFCHAIN_CALL_CONTRACT_TX]: TX_SCHEMA_FIELD(CHANNEL_OFFCHAIN_CALL_CONTRACT_TX, OBJECT_TAG_CHANNEL_OFFCHAIN_CALL_CONTRACT_TX), - [OBJECT_TAG_PROOF_OF_INCLUSION]: TX_SCHEMA_FIELD(PROOF_OF_INCLUSION_TX, OBJECT_TAG_PROOF_OF_INCLUSION), - [OBJECT_TAG_STATE_TREES]: TX_SCHEMA_FIELD(STATE_TREES_TX, OBJECT_TAG_STATE_TREES), - [OBJECT_TAG_MERKLE_PATRICIA_TREE]: TX_SCHEMA_FIELD(MERKLE_PATRICIA_TREE_TX, OBJECT_TAG_MERKLE_PATRICIA_TREE), - [OBJECT_TAG_MERKLE_PATRICIA_TREE_VALUE]: TX_SCHEMA_FIELD(MERKLE_PATRICIA_TREE_VALUE_TX, OBJECT_TAG_MERKLE_PATRICIA_TREE_VALUE), - [OBJECT_TAG_CONTRACTS_TREE]: TX_SCHEMA_FIELD(CONTRACTS_TREE_TX, OBJECT_TAG_CONTRACTS_TREE), - [OBJECT_TAG_CONTRACT_CALLS_TREE]: TX_SCHEMA_FIELD(CONTRACT_CALLS_TREE_TX, OBJECT_TAG_CONTRACT_CALLS_TREE), - [OBJECT_TAG_CHANNELS_TREE]: TX_SCHEMA_FIELD(CHANNELS_TREE_TX, OBJECT_TAG_CHANNELS_TREE), - [OBJECT_TAG_NAMESERVICE_TREE]: TX_SCHEMA_FIELD(NAMESERVICE_TREE_TX, OBJECT_TAG_NAMESERVICE_TREE), - [OBJECT_TAG_ORACLES_TREE]: TX_SCHEMA_FIELD(ORACLES_TREE_TX, OBJECT_TAG_ORACLES_TREE), - [OBJECT_TAG_ACCOUNTS_TREE]: TX_SCHEMA_FIELD(ACCOUNTS_TREE_TX, OBJECT_TAG_ACCOUNTS_TREE) + [OBJECT_TAG_ACCOUNT]: { + 1: TX_SCHEMA_FIELD(ACCOUNT_TX, OBJECT_TAG_ACCOUNT), + 2: TX_SCHEMA_FIELD(ACCOUNT_TX_2, OBJECT_TAG_ACCOUNT) + }, + [OBJECT_TAG_SIGNED_TRANSACTION]: { + 1: TX_SCHEMA_FIELD(SIGNED_TX, OBJECT_TAG_SIGNED_TRANSACTION) + }, + [OBJECT_TAG_SPEND_TRANSACTION]: { + 1: TX_SCHEMA_FIELD(SPEND_TX, OBJECT_TAG_SPEND_TRANSACTION) + }, + [OBJECT_TAG_NAME_SERVICE_PRECLAIM_TRANSACTION]: { + 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) + }, + [OBJECT_TAG_NAME_SERVICE_UPDATE_TRANSACTION]: { + 1: TX_SCHEMA_FIELD(NAME_UPDATE_TX, OBJECT_TAG_NAME_SERVICE_UPDATE_TRANSACTION) + }, + [OBJECT_TAG_NAME_SERVICE_TRANSFER_TRANSACTION]: { + 1: TX_SCHEMA_FIELD(NAME_TRANSFER_TX, OBJECT_TAG_NAME_SERVICE_TRANSFER_TRANSACTION) + }, + [OBJECT_TAG_NAME_SERVICE_REVOKE_TRANSACTION]: { + 1: TX_SCHEMA_FIELD(NAME_REVOKE_TX, OBJECT_TAG_NAME_SERVICE_REVOKE_TRANSACTION) + }, + [OBJECT_TAG_CONTRACT]: { + 1: TX_SCHEMA_FIELD(CONTRACT_TX, OBJECT_TAG_CONTRACT) + }, + [OBJECT_TAG_CONTRACT_CREATE_TRANSACTION]: { + 1: TX_SCHEMA_FIELD(CONTRACT_CREATE_TX, OBJECT_TAG_CONTRACT_CREATE_TRANSACTION) + }, + [OBJECT_TAG_CONTRACT_CALL_TRANSACTION]: { + 1: TX_SCHEMA_FIELD(CONTRACT_CALL_TX, OBJECT_TAG_CONTRACT_CALL_TRANSACTION) + }, + [OBJECT_TAG_CONTRACT_CALL]: { + 1: TX_SCHEMA_FIELD(CONTRACT_CALL_RESULT_TX, OBJECT_TAG_CONTRACT_CALL) + }, + [OBJECT_TAG_ORACLE_REGISTER_TRANSACTION]: { + 1: TX_SCHEMA_FIELD(ORACLE_REGISTER_TX, OBJECT_TAG_ORACLE_REGISTER_TRANSACTION) + }, + [OBJECT_TAG_ORACLE_EXTEND_TRANSACTION]: { + 1: TX_SCHEMA_FIELD(ORACLE_EXTEND_TX, OBJECT_TAG_ORACLE_EXTEND_TRANSACTION) + }, + [OBJECT_TAG_ORACLE_QUERY_TRANSACTION]: { + 1: TX_SCHEMA_FIELD(ORACLE_QUERY_TX, OBJECT_TAG_ORACLE_QUERY_TRANSACTION) + }, + [OBJECT_TAG_ORACLE_RESPONSE_TRANSACTION]: { + 1: TX_SCHEMA_FIELD(ORACLE_RESPOND_TX, OBJECT_TAG_ORACLE_RESPONSE_TRANSACTION) + }, + [OBJECT_TAG_CHANNEL_CREATE_TX]: { + 1: TX_SCHEMA_FIELD(CHANNEL_CREATE_TX, OBJECT_TAG_CHANNEL_CREATE_TX) + }, + [OBJECT_TAG_CHANNEL_CLOSE_MUTUAL_TX]: { + 1: TX_SCHEMA_FIELD(CHANNEL_CLOSE_MUTUAL_TX, OBJECT_TAG_CHANNEL_CLOSE_MUTUAL_TX) + }, + [OBJECT_TAG_CHANNEL_CLOSE_SOLO_TX]: { + 1: TX_SCHEMA_FIELD(CHANNEL_CLOSE_SOLO_TX, OBJECT_TAG_CHANNEL_CLOSE_SOLO_TX) + }, + [OBJECT_TAG_CHANNEL_SLASH_TX]: { + 1: TX_SCHEMA_FIELD(CHANNEL_SLASH_TX, OBJECT_TAG_CHANNEL_SLASH_TX) + }, + [OBJECT_TAG_CHANNEL_DEPOSIT_TX]: { + 1: TX_SCHEMA_FIELD(CHANNEL_DEPOSIT_TX, OBJECT_TAG_CHANNEL_DEPOSIT_TX) + }, + [OBJECT_TAG_CHANNEL_WITHRAW_TX]: { + 1: TX_SCHEMA_FIELD(CHANNEL_WITHDRAW_TX, OBJECT_TAG_CHANNEL_WITHRAW_TX) + }, + [OBJECT_TAG_CHANNEL_SETTLE_TX]: { + 1: TX_SCHEMA_FIELD(CHANNEL_SETTLE_TX, OBJECT_TAG_CHANNEL_SETTLE_TX) + }, + [OBJECT_TAG_CHANNEL_OFFCHAIN_TX]: { + 1: TX_SCHEMA_FIELD(CHANNEL_OFFCHAIN_TX, OBJECT_TAG_CHANNEL_OFFCHAIN_TX), + 2: TX_SCHEMA_FIELD(CHANNEL_OFFCHAIN_TX_2, OBJECT_TAG_CHANNEL_OFFCHAIN_TX) + }, + [OBJECT_TAG_CHANNEL]: { + 1: TX_SCHEMA_FIELD(CHANNEL_TX, OBJECT_TAG_CHANNEL), + 2: TX_SCHEMA_FIELD(CHANNEL_TX_2, OBJECT_TAG_CHANNEL) + }, + [OBJECT_TAG_CHANNEL_SNAPSHOT_SOLO_TX]: { + 1: TX_SCHEMA_FIELD(CHANNEL_SNAPSHOT_SOLO_TX, OBJECT_TAG_CHANNEL_SNAPSHOT_SOLO_TX) + }, + [OBJECT_TAG_CHANNEL_OFFCHAIN_UPDATE_TRANSFER_TX]: { + 1: TX_SCHEMA_FIELD(CHANNEL_OFFCHAIN_UPDATE_TRANSFER_TX, OBJECT_TAG_CHANNEL_OFFCHAIN_UPDATE_TRANSFER_TX) + }, + [OBJECT_TAG_CHANNEL_OFFCHAIN_UPDATE_DEPOSIT_TX]: { + 1: TX_SCHEMA_FIELD(CHANNEL_OFFCHAIN_UPDATE_DEPOSIT_TX, OBJECT_TAG_CHANNEL_OFFCHAIN_UPDATE_DEPOSIT_TX) + }, + [OBJECT_TAG_CHANNEL_OFFCHAIN_UPDATE_WITHDRAWAL_TX]: { + 1: TX_SCHEMA_FIELD(CHANNEL_OFFCHAIN_UPDATE_WITHDRAWAL_TX, OBJECT_TAG_CHANNEL_OFFCHAIN_UPDATE_WITHDRAWAL_TX) + }, + [OBJECT_TAG_CHANNEL_OFFCHAIN_CREATE_CONTRACT_TX]: { + 1: TX_SCHEMA_FIELD(CHANNEL_OFFCHAIN_CREATE_CONTRACT_TX, OBJECT_TAG_CHANNEL_OFFCHAIN_CREATE_CONTRACT_TX) + }, + [OBJECT_TAG_CHANNEL_OFFCHAIN_CALL_CONTRACT_TX]: { + 1: TX_SCHEMA_FIELD(CHANNEL_OFFCHAIN_CALL_CONTRACT_TX, OBJECT_TAG_CHANNEL_OFFCHAIN_CALL_CONTRACT_TX) + }, + [OBJECT_TAG_PROOF_OF_INCLUSION]: { + 1: TX_SCHEMA_FIELD(PROOF_OF_INCLUSION_TX, OBJECT_TAG_PROOF_OF_INCLUSION) + }, + [OBJECT_TAG_STATE_TREES]: { + 1: TX_SCHEMA_FIELD(STATE_TREES_TX, OBJECT_TAG_STATE_TREES) + }, + [OBJECT_TAG_MERKLE_PATRICIA_TREE]: { + 1: TX_SCHEMA_FIELD(MERKLE_PATRICIA_TREE_TX, OBJECT_TAG_MERKLE_PATRICIA_TREE) + }, + [OBJECT_TAG_MERKLE_PATRICIA_TREE_VALUE]: { + 1: TX_SCHEMA_FIELD(MERKLE_PATRICIA_TREE_VALUE_TX, OBJECT_TAG_MERKLE_PATRICIA_TREE_VALUE) + }, + [OBJECT_TAG_CONTRACTS_TREE]: { + 1: TX_SCHEMA_FIELD(CONTRACTS_TREE_TX, OBJECT_TAG_CONTRACTS_TREE) + }, + [OBJECT_TAG_CONTRACT_CALLS_TREE]: { + 1: TX_SCHEMA_FIELD(CONTRACT_CALLS_TREE_TX, OBJECT_TAG_CONTRACT_CALLS_TREE) + }, + [OBJECT_TAG_CHANNELS_TREE]: { + 1: TX_SCHEMA_FIELD(CHANNELS_TREE_TX, OBJECT_TAG_CHANNELS_TREE) + }, + [OBJECT_TAG_NAMESERVICE_TREE]: { + 1: TX_SCHEMA_FIELD(NAMESERVICE_TREE_TX, OBJECT_TAG_NAMESERVICE_TREE) + }, + [OBJECT_TAG_ORACLES_TREE]: { + 1: TX_SCHEMA_FIELD(ORACLES_TREE_TX, OBJECT_TAG_ORACLES_TREE) + }, + [OBJECT_TAG_ACCOUNTS_TREE]: { + 1: TX_SCHEMA_FIELD(ACCOUNTS_TREE_TX, OBJECT_TAG_ACCOUNTS_TREE) + } } // VERIFICATION SCHEMA diff --git a/es/tx/tx.js b/es/tx/tx.js index 50e2d19df7..3951dd7ac5 100644 --- a/es/tx/tx.js +++ b/es/tx/tx.js @@ -23,12 +23,11 @@ */ import * as R from 'ramda' -import semverSatisfies from '../utils/semver-satisfies' import Tx from './' import Node from '../node' import { buildTx, calculateFee } from './builder' -import { MIN_GAS_PRICE, TX_TYPE, VM_ABI_MAP_FORTUNA, VM_ABI_MAP_MINERVA } from './builder/schema' +import { MIN_GAS_PRICE, PROTOCOL_VM_ABI, TX_TYPE } from './builder/schema' import { buildContractId, oracleQueryId } from './builder/helpers' async function spendTx ({ senderId, recipientId, amount, payload = '' }) { @@ -146,7 +145,7 @@ async function contractCallTx ({ callerId, contractId, abiVersion, amount, gas, fee: parseInt(fee), gas: parseInt(gas), gasPrice, - abiVersion: ctVersion.vmVersion + abiVersion: ctVersion.abiVersion })) return tx @@ -347,16 +346,18 @@ async function channelSnapshotSoloTx ({ channelId, fromId, payload }) { * @return {object} Object with vm/abi version ({ vmVersion: number, abiVersion: number }) */ function getVmVersion (txType, { vmVersion, abiVersion } = {}) { - const isMinerva = semverSatisfies(this.version.split('-')[0], '2.0.0', '3.0.0') - const supported = isMinerva ? VM_ABI_MAP_MINERVA[txType] : VM_ABI_MAP_FORTUNA[txType] - if (!supported) throw new Error('Not supported tx type') + const version = this.consensusProtocolVersion + const supportedProtocol = PROTOCOL_VM_ABI[version] + if (!supportedProtocol) throw new Error('Not supported consensus protocol version') + const protocolForTX = supportedProtocol[txType] + if (!protocolForTX) throw new Error('Not supported tx type') const ctVersion = { - abiVersion: abiVersion !== undefined ? abiVersion : supported.abiVersion[0], - vmVersion: vmVersion !== undefined ? vmVersion : supported.vmVersion[0] + abiVersion: abiVersion !== undefined ? abiVersion : protocolForTX.abiVersion[0], + vmVersion: vmVersion !== undefined ? vmVersion : protocolForTX.vmVersion[0] } - if (supported.vmVersion.length && !R.contains(ctVersion.vmVersion, supported.vmVersion)) throw new Error(`VM VERSION ${ctVersion.vmVersion} do not support by this node. Supported: [${supported.vmVersion}]`) - if (!R.contains(ctVersion.abiVersion, supported.abiVersion)) throw new Error(`ABI VERSION ${ctVersion.abiVersion} do not support by this node. Supported: [${supported.abiVersion}]`) + 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}]`) return ctVersion } diff --git a/examples/connect-two-ae/aepp/src/components/Home.vue b/examples/connect-two-ae/aepp/src/components/Home.vue index 5c00258824..3786a83342 100644 --- a/examples/connect-two-ae/aepp/src/components/Home.vue +++ b/examples/connect-two-ae/aepp/src/components/Home.vue @@ -157,8 +157,8 @@ spendResult: null, spendError: null, contractCode: `contract Identity = - type state = () - function main(x : int) = x`, + type state = () + function main(x : int) = x`, byteCode: null, compileError: null, contractInitState: [], diff --git a/package-lock.json b/package-lock.json index d213b7bbdf..f28182e5b5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@aeternity/aepp-sdk", - "version": "3.2.0", + "version": "3.3.0", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -1992,6 +1992,7 @@ "version": "1.0.10", "resolved": "https://registry.npmjs.org/argparse/-/argparse-1.0.10.tgz", "integrity": "sha512-o5Roy6tNG4SL/FOkCAN6RzjiakZS25RLYFrcMttJqbdd8BWrnA+fGz57iN5Pb06pvBGvl5gQ0B48dJlslXvoTg==", + "dev": true, "requires": { "sprintf-js": "~1.0.2" } @@ -4616,11 +4617,6 @@ "integrity": "sha512-qzm/XxIbxm/FHyH341ZrbnMUpe+5Bocte9xkmFMzPMjRaZMcXww+MpBptFvtU+79L362nqiLhekCxCxDPaUMBQ==", "dev": true }, - "esm": { - "version": "3.2.23", - "resolved": "https://registry.npmjs.org/esm/-/esm-3.2.23.tgz", - "integrity": "sha512-p7iNpE0K3nLn1KE2O0Vz/2Gpg93U+JroVqAdHZwK7l3MmPKh4iu5CEvw1Gym9DT23BgNNvnY5wOf9vMjBFw7Ug==" - }, "esprima": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/esprima/-/esprima-3.1.3.tgz", @@ -6131,6 +6127,11 @@ "minimalistic-assert": "^1.0.1" } }, + "hasurl": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/hasurl/-/hasurl-1.0.0.tgz", + "integrity": "sha512-43ypUd3DbwyCT01UYpA99AEZxZ4aKtRxWGBHEIbjcOsUghd9YUON0C+JF6isNjaiwC/UF5neaUudy6JS9jZPZQ==" + }, "he": { "version": "1.1.1", "resolved": "https://registry.npmjs.org/he/-/he-1.1.1.tgz", @@ -6750,6 +6751,7 @@ "version": "3.13.1", "resolved": "https://registry.npmjs.org/js-yaml/-/js-yaml-3.13.1.tgz", "integrity": "sha512-YfbcO7jXDdyj0DGxYVSlSeQNHbD7XPWvrVWeVUujrQEoZzWJIRrCPoyk6kL6IAjAG2IolMK4T0hNUe0HOUs5Jw==", + "dev": true, "requires": { "argparse": "^1.0.7", "esprima": "^4.0.0" @@ -6758,7 +6760,8 @@ "esprima": { "version": "4.0.1", "resolved": "https://registry.npmjs.org/esprima/-/esprima-4.0.1.tgz", - "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==" + "integrity": "sha512-eGuFFw7Upda+g4p+QHvnW0RyTX/SVeJBDM/gCtMARO0cLuT2HcEKnTPvhjV6aGeqrCB/sbNop0Kszm0jsaWU4A==", + "dev": true } } }, @@ -7225,6 +7228,11 @@ "integrity": "sha1-G7nzFO9ri63tE7VJFpsqlF62jk0=", "dev": true }, + "lodash.sortby": { + "version": "4.7.0", + "resolved": "https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz", + "integrity": "sha1-7dFMgk4sycHgsKG0K7UhBRakJDg=" + }, "lolex": { "version": "2.7.1", "resolved": "https://registry.npmjs.org/lolex/-/lolex-2.7.1.tgz", @@ -9645,7 +9653,8 @@ "sprintf-js": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.0.3.tgz", - "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=" + "integrity": "sha1-BOaSb2YolTVPPdAVIDYzuFcpfiw=", + "dev": true }, "sshpk": { "version": "1.14.2", @@ -10666,6 +10675,15 @@ "imurmurhash": "^0.1.4" } }, + "universal-url": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/universal-url/-/universal-url-2.0.0.tgz", + "integrity": "sha512-3DLtXdm/G1LQMCnPj+Aw7uDoleQttNHp2g5FnNQKR6cP6taNWS1b/Ehjjx4PVyvejKi3TJyu8iBraKM4q3JQPg==", + "requires": { + "hasurl": "^1.0.0", + "whatwg-url": "^7.0.0" + } + }, "universalify": { "version": "0.1.2", "resolved": "https://registry.npmjs.org/universalify/-/universalify-0.1.2.tgz", @@ -11071,6 +11089,36 @@ } } }, + "whatwg-url": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-7.0.0.tgz", + "integrity": "sha512-37GeVSIJ3kn1JgKyjiYNmSLP1yzbpb29jdmwBSgkD9h40/hyrR/OifpVUndji3tmwGgD8qpw7iQu3RSbCrBpsQ==", + "requires": { + "lodash.sortby": "^4.7.0", + "tr46": "^1.0.1", + "webidl-conversions": "^4.0.2" + }, + "dependencies": { + "punycode": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.1.1.tgz", + "integrity": "sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A==" + }, + "tr46": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/tr46/-/tr46-1.0.1.tgz", + "integrity": "sha1-qLE/1r/SSJUZZ0zN5VujaTtwbQk=", + "requires": { + "punycode": "^2.1.0" + } + }, + "webidl-conversions": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-4.0.2.tgz", + "integrity": "sha512-YQ+BmxuTgd6UXZW3+ICGfyqRyHXVlD5GtQr5+qjiNW7bF0cqrzX500HVXPBOvgXb5YnzDd+h0zqyv61KUD7+Sg==" + } + } + }, "whatwg-url-compat": { "version": "0.6.5", "resolved": "https://registry.npmjs.org/whatwg-url-compat/-/whatwg-url-compat-0.6.5.tgz", diff --git a/package.json b/package.json index e82c122c25..415adc4275 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@aeternity/aepp-sdk", - "version": "3.2.1", + "version": "3.3.0", "description": "SDK for the æternity blockchain", "main": "dist/aepp-sdk.js", "browser": "dist/aepp-sdk.browser.js", @@ -39,14 +39,15 @@ "bs58check": "^2.1.1", "commander": "^2.14.1", "joi-browser": "^13.4.0", - "libsodium-wrappers-sumo": "0.7.3", "json-bigint": "github:davidyuk/json-bigint", + "libsodium-wrappers-sumo": "0.7.3", "ramda": "^0.25.0", "rlp": "2.1.0", "serialize-javascript": "^1.5.0", "sha.js": "^2.4.11", "tweetnacl": "^1.0.0", "tweetnacl-auth": "^1.0.1", + "universal-url": "^2.0.0", "uuid": "^3.3.2", "websocket": "^1.0.26" }, diff --git a/test/integration/accounts.js b/test/integration/accounts.js index 2031429e9f..fff7749c1f 100644 --- a/test/integration/accounts.js +++ b/test/integration/accounts.js @@ -46,6 +46,14 @@ describe('Accounts', function () { it('spending tokens', async () => { return wallet.spend(1, receiver).should.be.rejectedWith(Error) }) + + it('spending minus amount of tokens', async () => { + try { + await wallet.spend(-1, receiver) + } catch (e) { + e.message.should.be.equal('Transaction build error. {"amount":"-1 must be >= 0"}') + } + }) }) it('determines the balance', async () => { diff --git a/test/integration/channel.js b/test/integration/channel.js index 88602fe430..0f63a667d1 100644 --- a/test/integration/channel.js +++ b/test/integration/channel.js @@ -147,17 +147,43 @@ describe('Channel', function () { result.signedTx.should.be.a('string') sinon.assert.notCalled(initiatorSign) sinon.assert.calledOnce(responderSign) - sinon.assert.calledWithExactly(responderSign, sinon.match('update_ack'), sinon.match.string) + sinon.assert.calledWithExactly( + responderSign, + sinon.match('update_ack'), + sinon.match.string, + sinon.match({ + updates: sinon.match([{ + amount: sinon.match(amount), + from: sinon.match(await initiator.address()), + to: sinon.match(await responder.address()), + op: sinon.match('OffChainTransfer') + }]) + }) + ) sinon.assert.calledOnce(sign) - sinon.assert.calledWithExactly(sign, sinon.match.string) - const { txType, tx: { updates } } = unpackTx(sign.firstCall.args[0]) + sinon.assert.calledWithExactly( + sign, + sinon.match.string, + sinon.match({ + updates: sinon.match([{ + amount: sinon.match(amount), + from: sinon.match(await initiator.address()), + to: sinon.match(await responder.address()), + op: sinon.match('OffChainTransfer') + }]) + }) + ) + const { txType } = unpackTx(sign.firstCall.args[0]) txType.should.equal('channelOffChain') - updates[0].txType.should.equal('channelOffChainUpdateTransfer') - updates[0].tx.should.eql({ - ...updates[0].tx, - from: await initiator.address(), - to: await responder.address(), - amount: amount.toString() + sign.firstCall.args[1].should.eql({ + updates: [ + { + amount, + from: await initiator.address(), + to: await responder.address(), + op: 'OffChainTransfer' + } + ] }) }) @@ -174,17 +200,43 @@ describe('Channel', function () { result.accepted.should.equal(false) sinon.assert.notCalled(initiatorSign) sinon.assert.calledOnce(responderSign) - sinon.assert.calledWithExactly(responderSign, sinon.match('update_ack'), sinon.match.string) + sinon.assert.calledWithExactly( + responderSign, + sinon.match('update_ack'), + sinon.match.string, + sinon.match({ + updates: sinon.match([{ + amount: sinon.match(amount), + from: sinon.match(await responder.address()), + to: sinon.match(await initiator.address()), + op: sinon.match('OffChainTransfer') + }]) + }) + ) sinon.assert.calledOnce(sign) - sinon.assert.calledWithExactly(sign, sinon.match.string) - const { txType, tx: { updates } } = unpackTx(sign.firstCall.args[0]) + sinon.assert.calledWithExactly( + sign, + sinon.match.string, + sinon.match({ + updates: sinon.match([{ + amount: sinon.match(amount), + from: sinon.match(await responder.address()), + to: sinon.match(await initiator.address()), + op: sinon.match('OffChainTransfer') + }]) + }) + ) + const { txType } = unpackTx(sign.firstCall.args[0]) txType.should.equal('channelOffChain') - updates[0].txType.should.equal('channelOffChainUpdateTransfer') - updates[0].tx.should.eql({ - ...updates[0].tx, - from: await responder.address(), - to: await initiator.address(), - amount: amount.toString() + sign.firstCall.args[1].should.eql({ + updates: [ + { + amount, + from: await responder.address(), + to: await initiator.address(), + op: 'OffChainTransfer' + } + ] }) }) @@ -250,9 +302,30 @@ describe('Channel', function () { sinon.assert.calledOnce(onWithdrawLocked) sinon.assert.notCalled(initiatorSign) sinon.assert.calledOnce(responderSign) - sinon.assert.calledWithExactly(responderSign, sinon.match('withdraw_ack'), sinon.match.string) + sinon.assert.calledWithExactly( + responderSign, + sinon.match('withdraw_ack'), + sinon.match.string, + sinon.match({ + updates: [{ + amount, + op: 'OffChainWithdrawal', + to: await initiator.address() + }] + }) + ) sinon.assert.calledOnce(sign) - sinon.assert.calledWithExactly(sign, sinon.match.string) + sinon.assert.calledWithExactly( + sign, + sinon.match.string, + sinon.match({ + updates: [{ + amount, + op: 'OffChainWithdrawal', + to: await initiator.address() + }] + }) + ) const { txType, tx } = unpackTx(sign.firstCall.args[0]) txType.should.equal('channelWithdraw') tx.should.eql({ @@ -280,9 +353,30 @@ describe('Channel', function () { sinon.assert.notCalled(onWithdrawLocked) sinon.assert.notCalled(initiatorSign) sinon.assert.calledOnce(responderSign) - sinon.assert.calledWithExactly(responderSign, sinon.match('withdraw_ack'), sinon.match.string) + sinon.assert.calledWithExactly( + responderSign, + sinon.match('withdraw_ack'), + sinon.match.string, + sinon.match({ + updates: [{ + amount, + op: 'OffChainWithdrawal', + to: await initiator.address() + }] + }) + ) sinon.assert.calledOnce(sign) - sinon.assert.calledWithExactly(sign, sinon.match.string) + sinon.assert.calledWithExactly( + sign, + sinon.match.string, + sinon.match({ + updates: [{ + amount, + op: 'OffChainWithdrawal', + to: await initiator.address() + }] + }) + ) const { txType, tx } = unpackTx(sign.firstCall.args[0]) txType.should.equal('channelWithdraw') tx.should.eql({ @@ -311,9 +405,30 @@ describe('Channel', function () { sinon.assert.calledOnce(onDepositLocked) sinon.assert.notCalled(initiatorSign) sinon.assert.calledOnce(responderSign) - sinon.assert.calledWithExactly(responderSign, sinon.match('deposit_ack'), sinon.match.string) + sinon.assert.calledWithExactly( + responderSign, + sinon.match('deposit_ack'), + sinon.match.string, + sinon.match({ + updates: sinon.match([{ + amount, + op: 'OffChainDeposit', + from: await initiator.address() + }]) + }) + ) sinon.assert.calledOnce(sign) - sinon.assert.calledWithExactly(sign, sinon.match.string) + sinon.assert.calledWithExactly( + sign, + sinon.match.string, + sinon.match({ + updates: sinon.match([{ + amount, + op: 'OffChainDeposit', + from: await initiator.address() + }]) + }) + ) const { txType, tx } = unpackTx(sign.firstCall.args[0]) txType.should.equal('channelDeposit') tx.should.eql({ @@ -341,7 +456,18 @@ describe('Channel', function () { sinon.assert.notCalled(onDepositLocked) sinon.assert.notCalled(initiatorSign) sinon.assert.calledOnce(responderSign) - sinon.assert.calledWithExactly(responderSign, sinon.match('deposit_ack'), sinon.match.string) + sinon.assert.calledWithExactly( + responderSign, + sinon.match('deposit_ack'), + sinon.match.string, + sinon.match({ + updates: [{ + amount, + op: 'OffChainDeposit', + from: await initiator.address() + }] + }) + ) const { txType, tx } = unpackTx(sign.firstCall.args[0]) txType.should.equal('channelDeposit') tx.should.eql({ @@ -357,7 +483,12 @@ describe('Channel', function () { result.should.be.a('string') sinon.assert.notCalled(initiatorSign) sinon.assert.calledOnce(responderSign) - sinon.assert.calledWithExactly(responderSign, sinon.match('shutdown_sign_ack'), sinon.match.string) + sinon.assert.calledWithExactly( + responderSign, + sinon.match('shutdown_sign_ack'), + sinon.match.string, + sinon.match.any + ) sinon.assert.calledOnce(sign) sinon.assert.calledWithExactly(sign, sinon.match.string) const { txType, tx } = unpackTx(sign.firstCall.args[0]) @@ -550,7 +681,7 @@ describe('Channel', function () { code, callData, deposit: 1000, - vmVersion: 3, + vmVersion: 4, abiVersion: 1 }, async (tx) => await initiator.signTransaction(tx)) result.should.eql({ accepted: true, address: result.address, signedTx: (await initiatorCh.state()).signedTx }) @@ -566,7 +697,7 @@ describe('Channel', function () { code, callData, deposit: 1000, - vmVersion: 3, + vmVersion: 4, abiVersion: 1 }, async (tx) => await initiator.signTransaction(tx)) result.should.eql({ accepted: false }) @@ -656,7 +787,7 @@ describe('Channel', function () { id: contractAddress, ownerId: await initiator.address(), referrerIds: [], - vmVersion: 3, + vmVersion: 4, }, contractState: result.contractState }) @@ -715,7 +846,7 @@ describe('Channel', function () { }) it('when posting incorrect update tx', async () => { - return update({ sign: () => 'abcdefg' }).should.eventually.be.rejectedWith('Internal error') + return update({ sign: () => 'abcdefg' }).should.eventually.be.rejectedWith('Rejected') }) }) }) From ee04d3229484bd0c6c16625ee6f361b2df374cdc Mon Sep 17 00:00:00 2001 From: nduchak Date: Wed, 22 May 2019 12:27:13 +0200 Subject: [PATCH 36/40] chore(package): Bump version to 3.4.0 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 415adc4275..815586a143 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@aeternity/aepp-sdk", - "version": "3.3.0", + "version": "3.4.0", "description": "SDK for the æternity blockchain", "main": "dist/aepp-sdk.js", "browser": "dist/aepp-sdk.browser.js", From cb80d2f4aa9efca63348813af97b6febebbe144f Mon Sep 17 00:00:00 2001 From: nduchak Date: Wed, 22 May 2019 12:30:06 +0200 Subject: [PATCH 37/40] chore(CHANGELOG): Adjust CHANGELOG for 3.4.0 --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 5ab526c23b..b033e55794 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,12 @@ +# [3.4.0](https://github.com/aeternity/aepp-sdk-js/compare/2.4.0...3.4.0) (2019-05-22) + + +### Bug Fixes + +* **State Channels:** Remove automatic pinging to fix browser compatibility ([#432](https://github.com/aeternity/aepp-sdk-js/issues/432)) ([0700f3a](https://github.com/aeternity/aepp-sdk-js/commit/0700f3a)) + + + # [3.3.0](https://github.com/aeternity/aepp-sdk-js/compare/2.4.0...3.3.0) (2019-05-17) From e27441b8823673a985d57cbefcdf83b3cc3bf62a Mon Sep 17 00:00:00 2001 From: nduchak Date: Wed, 22 May 2019 12:40:17 +0200 Subject: [PATCH 38/40] chore(CHANGELOG/.env): Adjust changlog. Point node version in `.env` to v3.0.0-rc.1 --- .env | 2 +- CHANGELOG.md | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/.env b/.env index e569c471ec..8a75e4fb75 100644 --- a/.env +++ b/.env @@ -1,3 +1,3 @@ -TAG=master +TAG=v3.0.0-rc.1 COMPILER_TAG=v2.1.0 diff --git a/CHANGELOG.md b/CHANGELOG.md index b033e55794..013d7cc103 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,16 @@ * **State Channels:** Remove automatic pinging to fix browser compatibility ([#432](https://github.com/aeternity/aepp-sdk-js/issues/432)) ([0700f3a](https://github.com/aeternity/aepp-sdk-js/commit/0700f3a)) +### Features + +* **Transaction Builder:** Improve min fee calculation(Reduce the fee) ([#424](https://github.com/aeternity/aepp-sdk-js/pull/424)) +* **AXIOS:** Add ability to intercept error from axios ([#431](https://github.com/aeternity/aepp-sdk-js/pull/431)) + > Added additional param to sdk initialization `axiosConfig` + + > Example: `Universal({ axiosConfig: { config: { // axios config object }, errorHandler: (err) => throw err }})` +* **Transaction Builder:** Implement vm/abi validation for contract/oracle tx based on consensus protocol version. Add custom verification based on transaction type ([#425](https://github.com/aeternity/aepp-sdk-js/pull/425)) ([#426](https://github.com/aeternity/aepp-sdk-js/pull/426)) + + # [3.3.0](https://github.com/aeternity/aepp-sdk-js/compare/2.4.0...3.3.0) (2019-05-17) From bb546c79c3e5a99969b75404a292f4f011f33289 Mon Sep 17 00:00:00 2001 From: nduchak Date: Wed, 22 May 2019 12:43:57 +0200 Subject: [PATCH 39/40] chore(.env): Remove trailing newlines --- .env | 1 - 1 file changed, 1 deletion(-) diff --git a/.env b/.env index 8a75e4fb75..823112739a 100644 --- a/.env +++ b/.env @@ -1,3 +1,2 @@ TAG=v3.0.0-rc.1 COMPILER_TAG=v2.1.0 - From 36a076b4b488ecbc2dec1941dcbe71da84ae2fc1 Mon Sep 17 00:00:00 2001 From: nduchak Date: Wed, 22 May 2019 12:48:27 +0200 Subject: [PATCH 40/40] docs(Docs): Regenrate docs --- docs/api/node.md | 8 +++++--- docs/api/utils/swagger.md | 1 + 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/docs/api/node.md b/docs/api/node.md index 227690b534..abd0e8e37c 100644 --- a/docs/api/node.md +++ b/docs/api/node.md @@ -13,7 +13,7 @@ import Node from '@aeternity/aepp-sdk/es/node' * [~loader(options)](#module_@aeternity/aepp-sdk/es/node--Node..loader) ⇒ `function` * [~getConsensusProtocolVersion(protocols, height)](#module_@aeternity/aepp-sdk/es/node--Node..getConsensusProtocolVersion) ⇒ `Number` * _async_ - * [~remoteSwag(url)](#module_@aeternity/aepp-sdk/es/node--Node..remoteSwag) ⇒ `Object` + * [~remoteSwag(url, axiosConfig)](#module_@aeternity/aepp-sdk/es/node--Node..remoteSwag) ⇒ `Object` @@ -29,6 +29,7 @@ import Node from '@aeternity/aepp-sdk/es/node' | [options] | `Object` | {} | Options | | options.url | `String` | | Base URL for Node | | options.internalUrl | `String` | | Base URL for internal requests | +| options.axiosConfig | `String` | | Object with axios configuration. Example { config: {}, errorHandler: (err) => throw err } | **Example** ```js @@ -60,11 +61,11 @@ get consensus protocol version | Param | Type | Description | | --- | --- | --- | | protocols | `Array` | Array of protocols | -| height | `Number` | Geigh | +| height | `Number` | Height | -#### Node~remoteSwag(url) ⇒ `Object` +#### Node~remoteSwag(url, axiosConfig) ⇒ `Object` Obtain Swagger configuration from Node node **Kind**: inner method of [`Node`](#exp_module_@aeternity/aepp-sdk/es/node--Node) @@ -75,4 +76,5 @@ Obtain Swagger configuration from Node node | Param | Type | Description | | --- | --- | --- | | url | `String` | Node base URL | +| axiosConfig | `Object` | Axios configuration object | diff --git a/docs/api/utils/swagger.md b/docs/api/utils/swagger.md index 673ded63fd..8f840aaf52 100644 --- a/docs/api/utils/swagger.md +++ b/docs/api/utils/swagger.md @@ -43,6 +43,7 @@ Swagger Stamp | --- | --- | --- | | options | `Object` | Initializer object | | options.swag | `Object` | Swagger definition | +| options.axiosConfig | `Object` | Object with axios configuration. Example { config: {}, errorHandler: (err) => throw err } | **Example** ```js