-
Notifications
You must be signed in to change notification settings - Fork 98
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IPC #572
IPC #572
Changes from all commits
758157b
51593c6
c926fec
eff5ece
dbb197e
8cdd532
7b241af
ca01ea4
3ad38f5
6983123
51288c6
7d70134
79438ac
9e3acbb
999cc61
c53844c
5470c65
ff19f89
b29cbe5
6f586e0
62bc262
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,17 +2,17 @@ | |
const RestClient = require('./lcdClient.js') | ||
const mockedRestClient = require('./lcdClientMock.js') | ||
const RpcWrapper = require('./rpcWrapper.js') | ||
const mockedRpcWrapper = require('./rpcWrapperMock.js') | ||
const MockedRpcWrapper = require('./rpcWrapperMock.js') | ||
|
||
module.exports = function (nodeIP, relayPort, mocked = false) { | ||
const RELAY_SERVER = 'http://localhost:' + relayPort | ||
module.exports = function (lcdPort, mocked = false) { | ||
const LCD_SERVER = 'http://localhost:' + lcdPort | ||
|
||
let connector = { | ||
relayPort, | ||
lcdPort, | ||
// activate or deactivate the mocked lcdClient | ||
setMocked: (mocked) => { | ||
let newRestClient = mocked ? mockedRestClient : new RestClient(RELAY_SERVER) | ||
let newRpcClient = mocked ? mockedRpcWrapper(connector) : RpcWrapper(connector, nodeIP, RELAY_SERVER) | ||
setup: (mocked) => { | ||
let newRestClient = mocked ? mockedRestClient : new RestClient(LCD_SERVER) | ||
let newRpcClient = mocked ? MockedRpcWrapper(connector) : RpcWrapper(connector) | ||
Object.assign(connector, newRestClient, newRpcClient) | ||
// we can't assign class functions to an object so we need to iterate over the prototype | ||
if (!mocked) { | ||
|
@@ -24,7 +24,6 @@ module.exports = function (nodeIP, relayPort, mocked = false) { | |
} | ||
// TODO: eventually, get all data from light-client connection instead of RPC | ||
|
||
connector.setMocked(mocked) | ||
connector.initRPC(nodeIP) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why don't we need to call initRPC anymore? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. init is called only after the main process signals, that it has connected to a node |
||
connector.setup(mocked) | ||
return connector | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is our standard for capital vs camel casing?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I used capital here, as it is a constructor-like function.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general only classes and constants should have capital letters