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

Commit

Permalink
Material-UI, React, Typescript upgrade (#118)
Browse files Browse the repository at this point in the history
* use local lerna
* solution: typescript, material-ui, jest, tslint upgraded
* travis ci: upgrade node to v10
* version bump to v0.6.0
  • Loading branch information
gagarin55 authored Apr 16, 2020
1 parent b680b9c commit 4e4ef1c
Show file tree
Hide file tree
Showing 77 changed files with 5,285 additions and 2,219 deletions.
6 changes: 3 additions & 3 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
sudo: required
language: node_js
node_js:
- "8"
- "10"

notifications:
email:
Expand All @@ -10,9 +10,9 @@ notifications:
install:
- npm install -g yarn
- npm install -g codecov
- npm install -g lerna
- npm install -g https://github.com/google/js-green-licenses.git\#494a457
- lerna bootstrap
- yarn
- yarn lerna bootstrap

script:
- yarn build
Expand Down
11 changes: 9 additions & 2 deletions README.adoc
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
= Emerald Platform JS SDK

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

== Development

=== Requirements

To install common packages run `yarn` from root folder
----
yarn
----

=== Build

----
lerna bootstrap
yarn lerna bootstrap
----

=== Tests suite
Expand Down
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"packages": [
"packages/*"
],
"version": "0.5.12",
"version": "0.6.0",
"npmClient": "yarn",
"useWorkspaces": true
}
12 changes: 10 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,19 @@
"clean:node_modules": "rimraf node_modules packages/*/node_modules",
"test": "CI=true lerna run test --stream",
"build": "CI=true lerna run build --stream",
"test:coverage": "CI=true lerna run test:coverage --stream && codecov"
"test:coverage": "CI=true lerna run test:coverage --stream && codecov",
"lint:ts": "tslint 'packages/**/*.ts{,x}' -c tslint.json"
},
"homepage": "https://emeraldplatform.io",
"devDependencies": {
"rimraf": "^3.0.0"
"jest": "25.3.0",
"lerna": "3.20.2",
"rimraf": "^3.0.0",
"ts-jest": "25.3.0",
"tslint": "5.20.1",
"tslint-config-standard": "8.0.1",
"tslint-react": "4.1.0",
"typescript": "3.8.3"
},
"workspaces": [
"packages/*"
Expand Down
8 changes: 2 additions & 6 deletions packages/contracts/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emeraldplatform/contracts",
"version": "0.5.1",
"version": "0.6.0",
"description": "Ethereum contracts interop",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down Expand Up @@ -33,11 +33,7 @@
"ethereumjs-abi": "0.6.7"
},
"devDependencies": {
"@types/jest": "^24.0.11",
"@types/node": "^10.12.18",
"jest": "^24.7.1",
"ts-jest": "^24.0.2",
"typescript": "3.4.2"
"@types/node": "^10.12.18"
},
"publishConfig": {
"access": "public"
Expand Down
58 changes: 29 additions & 29 deletions packages/contracts/src/Contract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,43 +16,43 @@ limitations under the License.
import { methodID, rawEncode } from 'ethereumjs-abi';

export interface IAbiFunction {
name: string;
inputs: any;
outputs: any;
};
name: string;
inputs: any;
outputs: any;
}

type ContractAbi = Array<IAbiFunction>;
type ContractAbi = IAbiFunction[];

export default class Contract {
abi: ContractAbi;
public abi: ContractAbi;

constructor(abi: ContractAbi) {
this.abi = abi;
}
constructor (abi: ContractAbi) {
this.abi = abi;
}

getFunction(name: string): IAbiFunction {
const found = this.abi.filter((f) => (f.name === name));
if (found.length > 0) {
return found[0];
}
return null;
public getFunction (name: string): IAbiFunction {
const found = this.abi.filter((f) => (f.name === name));
if (found.length > 0) {
return found[0];
}

functionToData(name: string, inputs): string {
const func = this.getFunction(name);
if (func) {
const types = [];
const values = [];
func.inputs.forEach((input) => {
types.push(input.type);
values.push(inputs[input.name]);
});
const data = Buffer.concat([
return null;
}

public functionToData (name: string, inputs): string {
const func = this.getFunction(name);
if (func) {
const types = [];
const values = [];
func.inputs.forEach((input) => {
types.push(input.type);
values.push(inputs[input.name]);
});
const data = Buffer.concat([
methodID(func.name, types),
rawEncode(types, values)]
).toString('hex');
return `0x${data}`;
}
throw new Error(`Function ${name} not found in ABI`);
return `0x${data}`;
}
throw new Error(`Function ${name} not found in ABI`);
}
}
14 changes: 7 additions & 7 deletions packages/contracts/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
import { methodID, rawDecode, rawEncode } from 'ethereumjs-abi';
import BigNumber from 'bignumber.js';
import { methodID, rawDecode, rawEncode } from 'ethereumjs-abi';

const ethAbi = { methodID, rawDecode, rawEncode };

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

export function dataToParams(func: any, data: string): Array<OutputValue> {
export function dataToParams (func: any, data: string): OutputValue[] {
const buffer = Buffer.from(data.replace('0x', ''), 'hex');
const types = func.outputs.map(output => output.type);
const types = func.outputs.map((output) => output.type);
const params = ethAbi.rawDecode(types, buffer);
return func.outputs.map((o, i) => ({
type: o.type,
name: o.name,
value: (params[i] instanceof BigNumber) ? params[i].toString() : params[i],
value: (params[i] instanceof BigNumber) ? params[i].toString() : params[i]
}));
}

export default {
functionToData,
dataToParams,
dataToParams
};

export { default as Contract } from './Contract';
export { default as Contract } from './Contract';
8 changes: 2 additions & 6 deletions packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emeraldplatform/core",
"version": "0.5.11",
"version": "0.6.0",
"description": "Emerald platform core components",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down Expand Up @@ -35,11 +35,7 @@
"devDependencies": {
"@types/bn.js": "^4.11.4",
"@types/ethereumjs-abi": "^0.6.3",
"@types/jest": "^24.0.11",
"@types/node": "^10.12.18",
"jest": "^24.7.1",
"ts-jest": "^24.0.2",
"typescript": "3.4.2"
"@types/node": "^10.12.18"
},
"publishConfig": {
"access": "public"
Expand Down
14 changes: 5 additions & 9 deletions packages/eth-node/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emeraldplatform/eth-node",
"version": "0.5.11",
"version": "0.6.0",
"description": "Ethereum and Ethereum classic full node management",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down Expand Up @@ -31,16 +31,12 @@
},
"homepage": "https://emeraldplatform.io",
"dependencies": {
"@emeraldplatform/core": "^0.5.11",
"@emeraldplatform/eth-rpc": "^0.5.11",
"@emeraldplatform/rpc": "^0.5.1"
"@emeraldplatform/core": "^0.6.0",
"@emeraldplatform/eth-rpc": "^0.6.0",
"@emeraldplatform/rpc": "^0.6.0"
},
"devDependencies": {
"@types/jest": "^24.0.11",
"@types/node": "^10.12.26",
"jest": "^24.7.1",
"ts-jest": "^24.0.2",
"typescript": "3.4.2"
"@types/node": "^10.12.26"
},
"publishConfig": {
"access": "public"
Expand Down
12 changes: 4 additions & 8 deletions packages/eth-rpc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emeraldplatform/eth-rpc",
"version": "0.5.11",
"version": "0.6.0",
"description": "Ethereum RPC client",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down Expand Up @@ -30,17 +30,13 @@
},
"homepage": "https://emeraldplatform.io",
"dependencies": {
"@emeraldplatform/core": "^0.5.11",
"@emeraldplatform/rpc": "^0.5.1",
"@emeraldplatform/core": "^0.6.0",
"@emeraldplatform/rpc": "^0.6.0",
"bignumber.js": "8.0.2"
},
"devDependencies": {
"@types/jest": "^24.0.11",
"@types/node": "^10.12.26",
"jest": "^24.7.1",
"rimraf": "^2.6.3",
"ts-jest": "^24.0.2",
"typescript": "3.4.2"
"rimraf": "^2.6.3"
},
"publishConfig": {
"access": "public"
Expand Down
8 changes: 2 additions & 6 deletions packages/eth/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emeraldplatform/eth",
"version": "0.5.10",
"version": "0.6.0",
"description": "Ethereum Core components",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down Expand Up @@ -34,13 +34,9 @@
"qs": "6.7.0"
},
"devDependencies": {
"@types/jest": "^24.0.11",
"@types/node": "^10.12.26",
"@types/qs": "6.5.3",
"jest": "^24.7.1",
"rimraf": "^2.6.3",
"ts-jest": "^24.0.2",
"typescript": "3.4.2"
"rimraf": "^2.6.3"
},
"publishConfig": {
"access": "public"
Expand Down
8 changes: 2 additions & 6 deletions packages/rpc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@emeraldplatform/rpc",
"version": "0.5.1",
"version": "0.6.0",
"description": "Json RPC utilities",
"main": "lib/index.js",
"types": "lib/index.d.ts",
Expand Down Expand Up @@ -31,11 +31,7 @@
"isomorphic-fetch": "^2.2.1"
},
"devDependencies": {
"@types/jest": "^24.0.11",
"@types/node": "^10.12.26",
"jest": "^24.7.1",
"ts-jest": "^24.0.2",
"typescript": "3.4.2"
"@types/node": "^10.12.26"
},
"publishConfig": {
"access": "public"
Expand Down
Loading

0 comments on commit 4e4ef1c

Please sign in to comment.