Skip to content

Commit

Permalink
Merge pull request #21 from mosaicnetworks/dev
Browse files Browse the repository at this point in the history
Dev
  • Loading branch information
danuio committed Sep 17, 2019
2 parents 08c03bf + 8727a49 commit 9fdbe99
Show file tree
Hide file tree
Showing 16 changed files with 68 additions and 23 deletions.
5 changes: 2 additions & 3 deletions lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,8 @@
"exact": true
},
"publish": {
"message": "chore(release): publish",
"push": false,
"exact": true
"ignoreChanges": ["**/*.md", "**/example/**", "**/test/**"],
"message": "chore(release): publish"
}
}
}
4 changes: 4 additions & 0 deletions packages/client/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v1.3.2

- No changes

## v1.3.1

### Changed
Expand Down
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "evm-lite-client",
"namespace": "mosaicnetworks",
"author": "Danu Kumanan",
"version": "1.3.1",
"version": "1.3.2",
"license": "MIT",
"main": "./dist/index.js",
"typings": "./dist/typings/index.d.ts",
Expand Down
4 changes: 4 additions & 0 deletions packages/consensus/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v1.3.2

- No changes

## v1.3.1

### Added
Expand Down
4 changes: 2 additions & 2 deletions packages/consensus/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "evm-lite-consensus",
"namespace": "mosaicnetworks",
"author": "Danu Kumanan",
"version": "1.3.1",
"version": "1.3.2",
"license": "MIT",
"main": "./dist/index.js",
"typings": "./dist/typings/index.d.ts",
Expand All @@ -15,7 +15,7 @@
"doc": "rm -rf docs/ && typedoc"
},
"dependencies": {
"evm-lite-client": "^1.3.1",
"evm-lite-client": "^1.3.2",
"json-bigint": "^0.3.0"
},
"repository": {
Expand Down
8 changes: 8 additions & 0 deletions packages/core/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v1.3.2

### Changed

- `Account.balance` is now a `Currency` object
- Exports `IEVMAccount` which has `balance` attribute as currency
- Add `^` to `evm-lite-*` modules

## v1.3.1

### Added
Expand Down
8 changes: 4 additions & 4 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "evm-lite-core",
"namespace": "mosaicnetworks",
"author": "Danu Kumanan",
"version": "1.3.1",
"version": "1.3.2",
"license": "MIT",
"main": "./dist/index.js",
"typings": "./dist/typings/index.d.ts",
Expand All @@ -16,9 +16,9 @@
},
"dependencies": {
"eth-lib": "0.2.8",
"evm-lite-client": "^1.3.1",
"evm-lite-consensus": "^1.3.1",
"evm-lite-utils": "^1.3.1",
"evm-lite-client": "^1.3.2",
"evm-lite-consensus": "^1.3.2",
"evm-lite-utils": "^1.3.3",
"json-bigint": "^0.3.0",
"web3": "0.20.6",
"web3-eth-iban": "1.0.0-beta.46",
Expand Down
11 changes: 7 additions & 4 deletions packages/core/src/Account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as ethlib from 'eth-lib';
// @ts-ignore
import * as EthLibAccount from 'eth-lib/lib/account';

import utils from 'evm-lite-utils';
import utils, { Currency } from 'evm-lite-utils';

import { ISignedTx, ITransaction } from './Transaction';

Expand All @@ -15,7 +15,7 @@ export interface IAccount {
privateKey: string;

// account data
balance: number;
balance: Currency;
nonce: number;

// sign transaction method
Expand All @@ -33,7 +33,10 @@ export default class Account implements IAccount {
public static fromPrivateKey(privateKey: string) {
privateKey = utils.cleanAddress(privateKey);

return new Account(EthLibAccount.fromPrivate(privateKey));
const account = new Account(EthLibAccount.fromPrivate(privateKey));
account.balance = new Currency(0);

return account;
}

/**
Expand All @@ -52,7 +55,7 @@ export default class Account implements IAccount {
public readonly address: string;
public readonly privateKey: string;

public balance: number = 0;
public balance: Currency = new Currency(0);
public nonce: number = 0;

constructor({
Expand Down
2 changes: 2 additions & 0 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import Node from './Node';

export { IEVMAccount } from './Node';

export { ITransaction, ISignedTx, default as Transaction } from './Transaction';
export { default as Account, IAccount } from './Account';
export { default as Contract, IAbstractSchema } from './Contract';
Expand Down
6 changes: 6 additions & 0 deletions packages/datadir/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v1.3.3

### Changed

- Add `^` to `evm-lite-*` modules

## v1.3.2

### Added
Expand Down
6 changes: 3 additions & 3 deletions packages/datadir/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "evm-lite-datadir",
"namespace": "mosaicnetworks",
"version": "1.3.2",
"version": "1.3.3",
"license": "MIT",
"main": "./dist/index.js",
"typings": "./dist/typings/index.d.ts",
Expand All @@ -13,8 +13,8 @@
"prepublish": "tsc"
},
"dependencies": {
"evm-lite-keystore": "^1.3.1",
"evm-lite-utils": "^1.3.1",
"evm-lite-keystore": "^1.3.2",
"evm-lite-utils": "^1.3.3",
"mkdirp": "^0.5.1",
"toml": "^3.0.0",
"tomlify-j0.4": "^3.0.0"
Expand Down
6 changes: 6 additions & 0 deletions packages/keystore/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v1.3.2

### Changed

- Add `^` to `evm-lite-*` modules

## v1.3.1

### Changed
Expand Down
8 changes: 4 additions & 4 deletions packages/keystore/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "evm-lite-keystore",
"namespace": "mosaicnetworks",
"version": "1.3.1",
"version": "1.3.2",
"license": "MIT",
"main": "./dist/index.js",
"typings": "./dist/typings/index.d.ts",
Expand All @@ -17,9 +17,9 @@
"browserify-cipher": "^1.0.1",
"crypto-random-hex": "^1.0.0",
"eth-lib": "^0.2.8",
"evm-lite-client": "^1.3.1",
"evm-lite-core": "^1.3.1",
"evm-lite-utils": "^1.3.1",
"evm-lite-client": "^1.3.2",
"evm-lite-core": "^1.3.2",
"evm-lite-utils": "^1.3.3",
"json-bigint": "0.3.0",
"keccak256": "^1.0.0",
"mkdirp": "^0.5.1",
Expand Down
6 changes: 6 additions & 0 deletions packages/utils/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## v1.3.3

### Changed

- `Currency.plus` now returns `Currency` object instead of `BigNumber`

## v1.3.2

### Changed
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "evm-lite-utils",
"namespace": "mosaicnetworks",
"author": "Danu Kumanan",
"version": "1.3.2",
"version": "1.3.3",
"license": "MIT",
"main": "./dist/index.js",
"typings": "./dist/typings/index.d.ts",
Expand Down
9 changes: 8 additions & 1 deletion packages/utils/src/Currency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,12 +99,19 @@ class Currency extends BN {
}

// Return currency object
public times(n: number): Currency {
public times(n: Currency): Currency {
const bn = super.times(n, 10);

return new Currency(bn);
}

// Return currency object
public plus(n: Currency): Currency {
const bn = super.plus(n, 10);

return new Currency(bn);
}

private convert(to: IUnits) {
// starting unit is always a BN due `evm-lite` always
// returning balance in atto tokens
Expand Down

0 comments on commit 9fdbe99

Please sign in to comment.