Skip to content

Commit

Permalink
Merge pull request #5 from mh739025250/node
Browse files Browse the repository at this point in the history
connect to smart contract
mh739025250 authored Nov 19, 2021

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
2 parents cf98130 + 124936c commit 4b4b0dc
Showing 10 changed files with 7,679 additions and 335 deletions.
901 changes: 901 additions & 0 deletions DeltaContract.json

Large diffs are not rendered by default.

6,510 changes: 6,228 additions & 282 deletions package-lock.json

Large diffs are not rendered by default.

13 changes: 11 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -5,7 +5,7 @@
"main": "index.js",
"scripts": {
"build:proto": "$(npm bin)/proto-loader-gen-types --defaults --oneofs --grpcLib=@grpc/grpc-js -O src/service src/service/*.proto",
"serve": "ts-node --cwd-mode src/server.ts",
"serve": "ts-node --cwd-mode src/server.ts | bunyan",
"test": "mocha -r ts-node/register 'src/**/*.test.ts'",
"test:debug": "mocha --inspect -r ts-node/register 'src/**/*.test.ts'",
"format": "prettier -w 'src/**/*.ts'"
@@ -25,6 +25,7 @@
"homepage": "https://github.com/delta-mpc/delta-chain-connector#readme",
"devDependencies": {
"@tsconfig/node16": "^1.0.2",
"@types/bunyan": "^1.8.8",
"@types/chai": "^4.2.22",
"@types/chai-as-promised": "^7.1.4",
"@types/mocha": "^9.0.0",
@@ -44,13 +45,21 @@
"typescript": "^4.4.3"
},
"dependencies": {
"@ethereumjs/common": "^2.6.0",
"@ethereumjs/tx": "^3.4.0",
"@grpc/grpc-js": "^1.4.1",
"@grpc/proto-loader": "^0.6.6",
"@mikro-orm/cli": "^4.5.9",
"@mikro-orm/core": "^4.5.9",
"@mikro-orm/sqlite": "^4.5.9",
"bunyan": "^1.8.15",
"hi-base32": "^0.5.1",
"reflect-metadata": "^0.1.13"
"reflect-metadata": "^0.1.13",
"web3": "^1.6.1",
"web3-core": "^1.6.1",
"web3-eth": "^1.6.1",
"web3-eth-contract": "^1.6.1",
"web3-utils": "^1.6.1"
},
"prettier": {
"tabWidth": 2,
28 changes: 21 additions & 7 deletions src/config.ts
Original file line number Diff line number Diff line change
@@ -4,21 +4,35 @@ const configFile = process.env.COORDINATOR ?? __dirname + "/../config/config.jso

const file = fs.readFileSync(configFile, { encoding: "utf-8" });

type LogLevelType = "DEBUG" | "INFO" | "WARNING" | "ERROR" | "EXCEPTION";
type LogLevelType = "debug" | "info" | "warn" | "error" | "fatal";
type DatabaseType = "mysql" | "sqlite";

interface Config {
log: {
level: LogLevelType;
};
impl: string;
impl: "monkey" | "chain";
host: string;
port: number;
nodeAddress: string;
db: {
type: DatabaseType;
url: string;
};
monkey: {
db: {
type: DatabaseType;
url: string;
};
},
chain: {
contractAddress: string,
nodeAddress: string,
privateKey: string,
provider: string,
abiFile: string,
gasPrice: number,
gasLimit: number,
chainParam: {
name: string,
chainId: number,
}
}
}

export const config = JSON.parse(file) as Config;
Loading

0 comments on commit 4b4b0dc

Please sign in to comment.