-
Notifications
You must be signed in to change notification settings - Fork 187
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
Js client first implementation #192
Conversation
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.
- There's a list of minor issues
- Probably you should migrate to Webpack
- Code mostly looks like work-in-progress
- I think we should merge it after the tiny fixes, as it will evolve along with the ongoing VM and Consensus updates
js-client/README.md
Outdated
@@ -0,0 +1,120 @@ | |||
## IMPORTANT: Client and README are under heavy development and can be outdated. Ask questions in gitter or in issues. |
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.
Ask a question in gitter or file an issue
js-client/gulpfile.js
Outdated
* limitations under the License. | ||
*/ | ||
|
||
var gulp = require("gulp"); |
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.
You should use webpack.
js-client/src/ResultAwait.ts
Outdated
* @param responseTimeoutSec what time to check | ||
*/ | ||
async result(requestsPerSec: number = 4, responseTimeoutSec = 5): Promise<Result> { | ||
const path = wrapInQuotes(this.target_key + "/result"); |
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.
Maybe it's safer to use JSON.stringify
instead? So that quotes inside the string are escaped?
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.
You are right!
let engine = new Engine(tm); | ||
|
||
// default signing key for now | ||
let signingKey = "TVAD4tNeMH2yJfkDZBSjrMJRbavmdc3/fGU2N2VAnxT3hAtSkX+Lrl4lN5OEsXjD7GGG7iEewSod472HudrkrA=="; |
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.
Probably some TODO with explanation should be there?
} | ||
} | ||
|
||
const _global = (window /* browser */ || global /* node */) as any; |
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.
Why do you do it? Why not to simply export the class, and then import it where it's needed?
js-client/src/main.ts
Outdated
* @param host | ||
* @param port | ||
*/ | ||
export async function defaultTest(host: string, port: number) { |
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.
This test could never fail? Looks like the naming is wrong.
js-client/src/tx.ts
Outdated
return wrapInQuotes(utils.toHex(Buffer.from(JSON.stringify(json))).toUpperCase()) | ||
} | ||
|
||
class TxCl { |
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.
Some docs expected.
js-client/src/utils.ts
Outdated
*/ | ||
|
||
export function wrapInQuotes(str: string): string { | ||
return "\"" + str + "\"" |
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.
str
could contain quotes inside. Will it be safe in this case?
No description provided.