Skip to content
This repository has been archived by the owner. It is now read-only.

Commit 4e4ef1c

Browse files
authored
Material-UI, React, Typescript upgrade (#118)
* use local lerna * solution: typescript, material-ui, jest, tslint upgraded * travis ci: upgrade node to v10 * version bump to v0.6.0
1 parent b680b9c commit 4e4ef1c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

77 files changed

+5285
-2219
lines changed

.travis.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
sudo: required
22
language: node_js
33
node_js:
4-
- "8"
4+
- "10"
55

66
notifications:
77
email:
@@ -10,9 +10,9 @@ notifications:
1010
install:
1111
- npm install -g yarn
1212
- npm install -g codecov
13-
- npm install -g lerna
1413
- npm install -g https://github.com/google/js-green-licenses.git\#494a457
15-
- lerna bootstrap
14+
- yarn
15+
- yarn lerna bootstrap
1616

1717
script:
1818
- yarn build

README.adoc

+9-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
= Emerald Platform JS SDK
22

3-
image:https://img.shields.io/travis/ETCDEVTeam/emerald-js.svg["Travis (.org)", link="https://travis-ci.org/ETCDEVTeam/emerald-js"]
3+
image:https://img.shields.io/travis/emeraldpay/emerald-js.svg["Travis (.org)", link="https://travis-ci.org/emeraldpay/emerald-js"]
44
image:https://img.shields.io/codecov/c/github/ETCDEVTeam/emerald-js.svg["Codecov", link="https://codecov.io/gh/ETCDEVTeam/emerald-js"]
55
image:https://img.shields.io/github/license/ETCDEVTeam/emerald-wallet.svg?maxAge=2592000["License", link="https://github.com/ETCDEVTeam/emerald-wallet/blob/master/LICENSE"]
66
image:https://img.shields.io/gitter/room/etcdev-public/Lobby.svg["Gitter", link="https://gitter.im/etcdev-public/Lobby"]
@@ -56,10 +56,17 @@ image:https://img.shields.io/gitter/room/etcdev-public/Lobby.svg["Gitter", link=
5656

5757
== Development
5858

59+
=== Requirements
60+
61+
To install common packages run `yarn` from root folder
62+
----
63+
yarn
64+
----
65+
5966
=== Build
6067

6168
----
62-
lerna bootstrap
69+
yarn lerna bootstrap
6370
----
6471

6572
=== Tests suite

lerna.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"packages": [
33
"packages/*"
44
],
5-
"version": "0.5.12",
5+
"version": "0.6.0",
66
"npmClient": "yarn",
77
"useWorkspaces": true
88
}

package.json

+10-2
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,19 @@
44
"clean:node_modules": "rimraf node_modules packages/*/node_modules",
55
"test": "CI=true lerna run test --stream",
66
"build": "CI=true lerna run build --stream",
7-
"test:coverage": "CI=true lerna run test:coverage --stream && codecov"
7+
"test:coverage": "CI=true lerna run test:coverage --stream && codecov",
8+
"lint:ts": "tslint 'packages/**/*.ts{,x}' -c tslint.json"
89
},
910
"homepage": "https://emeraldplatform.io",
1011
"devDependencies": {
11-
"rimraf": "^3.0.0"
12+
"jest": "25.3.0",
13+
"lerna": "3.20.2",
14+
"rimraf": "^3.0.0",
15+
"ts-jest": "25.3.0",
16+
"tslint": "5.20.1",
17+
"tslint-config-standard": "8.0.1",
18+
"tslint-react": "4.1.0",
19+
"typescript": "3.8.3"
1220
},
1321
"workspaces": [
1422
"packages/*"

packages/contracts/package.json

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@emeraldplatform/contracts",
3-
"version": "0.5.1",
3+
"version": "0.6.0",
44
"description": "Ethereum contracts interop",
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",
@@ -33,11 +33,7 @@
3333
"ethereumjs-abi": "0.6.7"
3434
},
3535
"devDependencies": {
36-
"@types/jest": "^24.0.11",
37-
"@types/node": "^10.12.18",
38-
"jest": "^24.7.1",
39-
"ts-jest": "^24.0.2",
40-
"typescript": "3.4.2"
36+
"@types/node": "^10.12.18"
4137
},
4238
"publishConfig": {
4339
"access": "public"

packages/contracts/src/Contract.ts

+29-29
Original file line numberDiff line numberDiff line change
@@ -16,43 +16,43 @@ limitations under the License.
1616
import { methodID, rawEncode } from 'ethereumjs-abi';
1717

1818
export interface IAbiFunction {
19-
name: string;
20-
inputs: any;
21-
outputs: any;
22-
};
19+
name: string;
20+
inputs: any;
21+
outputs: any;
22+
}
2323

24-
type ContractAbi = Array<IAbiFunction>;
24+
type ContractAbi = IAbiFunction[];
2525

2626
export default class Contract {
27-
abi: ContractAbi;
27+
public abi: ContractAbi;
2828

29-
constructor(abi: ContractAbi) {
30-
this.abi = abi;
31-
}
29+
constructor (abi: ContractAbi) {
30+
this.abi = abi;
31+
}
3232

33-
getFunction(name: string): IAbiFunction {
34-
const found = this.abi.filter((f) => (f.name === name));
35-
if (found.length > 0) {
36-
return found[0];
37-
}
38-
return null;
33+
public getFunction (name: string): IAbiFunction {
34+
const found = this.abi.filter((f) => (f.name === name));
35+
if (found.length > 0) {
36+
return found[0];
3937
}
40-
41-
functionToData(name: string, inputs): string {
42-
const func = this.getFunction(name);
43-
if (func) {
44-
const types = [];
45-
const values = [];
46-
func.inputs.forEach((input) => {
47-
types.push(input.type);
48-
values.push(inputs[input.name]);
49-
});
50-
const data = Buffer.concat([
38+
return null;
39+
}
40+
41+
public functionToData (name: string, inputs): string {
42+
const func = this.getFunction(name);
43+
if (func) {
44+
const types = [];
45+
const values = [];
46+
func.inputs.forEach((input) => {
47+
types.push(input.type);
48+
values.push(inputs[input.name]);
49+
});
50+
const data = Buffer.concat([
5151
methodID(func.name, types),
5252
rawEncode(types, values)]
5353
).toString('hex');
54-
return `0x${data}`;
55-
}
56-
throw new Error(`Function ${name} not found in ABI`);
54+
return `0x${data}`;
5755
}
56+
throw new Error(`Function ${name} not found in ABI`);
57+
}
5858
}

packages/contracts/src/index.ts

+7-7
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
See the License for the specific language governing permissions and
1414
limitations under the License.
1515
*/
16-
import { methodID, rawDecode, rawEncode } from 'ethereumjs-abi';
1716
import BigNumber from 'bignumber.js';
17+
import { methodID, rawDecode, rawEncode } from 'ethereumjs-abi';
1818

1919
const ethAbi = { methodID, rawDecode, rawEncode };
2020

@@ -31,7 +31,7 @@ export interface OutputValue {
3131
/**
3232
* Converts function input parameters to TX's data field.
3333
*/
34-
export function functionToData(func: any, inputs: InputValues): string {
34+
export function functionToData (func: any, inputs: InputValues): string {
3535
if (func) {
3636
const types = [];
3737
const values = [];
@@ -47,20 +47,20 @@ export function functionToData(func: any, inputs: InputValues): string {
4747
throw new Error(`Invalid function ABI: ${func}`);
4848
}
4949

50-
export function dataToParams(func: any, data: string): Array<OutputValue> {
50+
export function dataToParams (func: any, data: string): OutputValue[] {
5151
const buffer = Buffer.from(data.replace('0x', ''), 'hex');
52-
const types = func.outputs.map(output => output.type);
52+
const types = func.outputs.map((output) => output.type);
5353
const params = ethAbi.rawDecode(types, buffer);
5454
return func.outputs.map((o, i) => ({
5555
type: o.type,
5656
name: o.name,
57-
value: (params[i] instanceof BigNumber) ? params[i].toString() : params[i],
57+
value: (params[i] instanceof BigNumber) ? params[i].toString() : params[i]
5858
}));
5959
}
6060

6161
export default {
6262
functionToData,
63-
dataToParams,
63+
dataToParams
6464
};
6565

66-
export { default as Contract } from './Contract';
66+
export { default as Contract } from './Contract';

packages/core/package.json

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@emeraldplatform/core",
3-
"version": "0.5.11",
3+
"version": "0.6.0",
44
"description": "Emerald platform core components",
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",
@@ -35,11 +35,7 @@
3535
"devDependencies": {
3636
"@types/bn.js": "^4.11.4",
3737
"@types/ethereumjs-abi": "^0.6.3",
38-
"@types/jest": "^24.0.11",
39-
"@types/node": "^10.12.18",
40-
"jest": "^24.7.1",
41-
"ts-jest": "^24.0.2",
42-
"typescript": "3.4.2"
38+
"@types/node": "^10.12.18"
4339
},
4440
"publishConfig": {
4541
"access": "public"

packages/eth-node/package.json

+5-9
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@emeraldplatform/eth-node",
3-
"version": "0.5.11",
3+
"version": "0.6.0",
44
"description": "Ethereum and Ethereum classic full node management",
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",
@@ -31,16 +31,12 @@
3131
},
3232
"homepage": "https://emeraldplatform.io",
3333
"dependencies": {
34-
"@emeraldplatform/core": "^0.5.11",
35-
"@emeraldplatform/eth-rpc": "^0.5.11",
36-
"@emeraldplatform/rpc": "^0.5.1"
34+
"@emeraldplatform/core": "^0.6.0",
35+
"@emeraldplatform/eth-rpc": "^0.6.0",
36+
"@emeraldplatform/rpc": "^0.6.0"
3737
},
3838
"devDependencies": {
39-
"@types/jest": "^24.0.11",
40-
"@types/node": "^10.12.26",
41-
"jest": "^24.7.1",
42-
"ts-jest": "^24.0.2",
43-
"typescript": "3.4.2"
39+
"@types/node": "^10.12.26"
4440
},
4541
"publishConfig": {
4642
"access": "public"

packages/eth-rpc/package.json

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@emeraldplatform/eth-rpc",
3-
"version": "0.5.11",
3+
"version": "0.6.0",
44
"description": "Ethereum RPC client",
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",
@@ -30,17 +30,13 @@
3030
},
3131
"homepage": "https://emeraldplatform.io",
3232
"dependencies": {
33-
"@emeraldplatform/core": "^0.5.11",
34-
"@emeraldplatform/rpc": "^0.5.1",
33+
"@emeraldplatform/core": "^0.6.0",
34+
"@emeraldplatform/rpc": "^0.6.0",
3535
"bignumber.js": "8.0.2"
3636
},
3737
"devDependencies": {
38-
"@types/jest": "^24.0.11",
3938
"@types/node": "^10.12.26",
40-
"jest": "^24.7.1",
41-
"rimraf": "^2.6.3",
42-
"ts-jest": "^24.0.2",
43-
"typescript": "3.4.2"
39+
"rimraf": "^2.6.3"
4440
},
4541
"publishConfig": {
4642
"access": "public"

packages/eth/package.json

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@emeraldplatform/eth",
3-
"version": "0.5.10",
3+
"version": "0.6.0",
44
"description": "Ethereum Core components",
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",
@@ -34,13 +34,9 @@
3434
"qs": "6.7.0"
3535
},
3636
"devDependencies": {
37-
"@types/jest": "^24.0.11",
3837
"@types/node": "^10.12.26",
3938
"@types/qs": "6.5.3",
40-
"jest": "^24.7.1",
41-
"rimraf": "^2.6.3",
42-
"ts-jest": "^24.0.2",
43-
"typescript": "3.4.2"
39+
"rimraf": "^2.6.3"
4440
},
4541
"publishConfig": {
4642
"access": "public"

packages/rpc/package.json

+2-6
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@emeraldplatform/rpc",
3-
"version": "0.5.1",
3+
"version": "0.6.0",
44
"description": "Json RPC utilities",
55
"main": "lib/index.js",
66
"types": "lib/index.d.ts",
@@ -31,11 +31,7 @@
3131
"isomorphic-fetch": "^2.2.1"
3232
},
3333
"devDependencies": {
34-
"@types/jest": "^24.0.11",
35-
"@types/node": "^10.12.26",
36-
"jest": "^24.7.1",
37-
"ts-jest": "^24.0.2",
38-
"typescript": "3.4.2"
34+
"@types/node": "^10.12.26"
3935
},
4036
"publishConfig": {
4137
"access": "public"

0 commit comments

Comments
 (0)