Skip to content

Commit

Permalink
Merge branch 'release/v1.11.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
wulfraem committed Feb 7, 2020
2 parents 169290a + 96936be commit 94042ca
Show file tree
Hide file tree
Showing 14 changed files with 339 additions and 184 deletions.
10 changes: 10 additions & 0 deletions VERSIONS.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,16 @@
### Deprecations


## Version 1.11.0
### Features
- add `getGasPrice` to `SignerInterface`

### Fixes
- use typescript version `3.7.4`
- update `AccountStore` to throw if private key is missing
- check `dataSchema` for incorrect ajv schema when setting description


## Version 1.10.0
### Features
- add `getPublicKey` to `SignerInterface`
Expand Down
2 changes: 1 addition & 1 deletion docs/blockchain/signer-internal.rst
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ Example
------------------------------------------------------------------------------

.. _signerInternal_getGasPricex:
.. _signerInternal_getGasPrice:

getGasPrice
===================
Expand Down
38 changes: 34 additions & 4 deletions docs/common/validator.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,37 @@ Example
.. code-block:: typescript
const nameResolver = new Validator({
schema
});
schema
});
--------------------------------------------------------------------------------

.. _validator_isSchemaCorrect:

isSchemaCorrect
===================

.. code-block:: javascript
Validator.isSchemaCorrect(schema);
Checks if the given ajv schema is correct and returns an array of ajv errors, when the schema is invalid.



----------
Parameters
----------

#. ``schema`` - ``any``: schema to be validated

-------
Returns
-------

``bool`` | |source ajvError|_: true if data is valid, array of object if validation is failed


--------------------------------------------------------------------------------

Expand All @@ -84,7 +111,7 @@ Parameters
Returns
-------

``bool | strings[]``: true if data is valid, array of object if validation is failed
``bool`` | |source ajvError|_: true if data is valid, array of object if validation is failed

------------------------------------------------------------------------------

Expand Down Expand Up @@ -113,4 +140,7 @@ Returns
.. _source logLevel: ../common/logger.html#loglevel

.. |source logLogInterface| replace:: ``LogLogInterface``
.. _source logLogInterface: ../common/logger.html#logloginterface
.. _source logLogInterface: ../common/logger.html#logloginterface

.. |source ajvError| replace:: ``AjvError``
.. _source ajvError: https://github.com/epoberezkin/ajv/blob/master/lib/compile/error_classes.js
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@
"@types/chai-as-promised": "^7.1.0",
"@types/chai-spies": "^1.0.1",
"@types/mocha": "^5.2.7",
"@typescript-eslint/eslint-plugin": "^2.12.0",
"@typescript-eslint/parser": "^2.11.0",
"@typescript-eslint/eslint-plugin": "^2.16.0",
"@typescript-eslint/parser": "^2.16.0",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"chai-spies": "^1.0.0",
"common-shakeify": "^0.6.2",
"dirty-chai": "^2.0.1",
"eslint": "^6.1.0",
"eslint-config-airbnb": "^18.0.1",
"eslint": "^6.8.0",
"eslint-config-airbnb-base": "^14.0.0",
"eslint-config-airbnb-typescript": "^6.3.1",
"eslint-plugin-chai-friendly": "^0.5.0",
"eslint-plugin-import": "^2.19.1",
Expand All @@ -41,7 +41,7 @@
"nyc": "^13.1.0",
"request": "^2.83.0",
"ts-node": "^8.3.0",
"typescript": "^3.5.3"
"typescript": "^3.7.4"
},
"homepage": "https://dbcp.online/",
"husky": {
Expand Down Expand Up @@ -75,5 +75,5 @@
"testunitcoverage": "npm run build && nyc -r lcov -e .ts -x \"**/*.spec.ts\" -x \"lib\" mocha --exit -r ts-node/register $TESTSPECS && nyc report --reporter=json > coverage/coverage.json"
},
"types": "./dist/index.d.ts",
"version": "1.10.0"
}
"version": "1.11.0"
}
8 changes: 6 additions & 2 deletions src/account-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,11 @@ export class AccountStore extends Logger implements KeyStoreInterface {
* @param {string} accountId eth accountId
* @return {Promise<string>} private key for this account
*/
getPrivateKey(accountId: string): Promise<string> {
return Promise.resolve(this.accounts[accountId]);
async getPrivateKey(accountId: string): Promise<string> {
const privateKey = this.accounts[accountId];
if (!privateKey) {
throw new Error(`missing private key for accountId "${accountId}"`);
}
return privateKey;
}
}
4 changes: 4 additions & 0 deletions src/contracts/executor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@ class MockedSigner implements SignerInterface {
public async signMessage(): Promise<string> {
throw new Error('not implemented');
}

public async getGasPrice(): Promise<string> {
throw new Error('not implemented');
}
}


Expand Down
4 changes: 4 additions & 0 deletions src/contracts/signer-external.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ export class SignerExternal implements SignerInterface {
throw new Error('not implemented');
}

public async getGasPrice(): Promise<string> {
throw new Error('not implemented');
}

public async getPublicKey(): Promise<string> {
throw new Error('not implemented');
}
Expand Down
8 changes: 8 additions & 0 deletions src/contracts/signer-interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ export interface SignerInterface {
*/
createContract(contractName: string, functionArguments: any[], options: any): Promise<string>;

/**
* get gas price (either from config or from api.eth.web3.eth.gasPrice (gas price median of last
* blocks) or api.config.eth.gasPrice; unset config value or set it to falsy for median gas price
*
* @return {Promise<string>} hex string with gas price
*/
getGasPrice(): Promise<string>;

/**
* get public key for given account
*
Expand Down
Loading

0 comments on commit 94042ca

Please sign in to comment.