Replace web3->ethers and JS->TS in RPC class#589
Open
kautukkundan wants to merge 1 commit intoconfluencefrom
Open
Replace web3->ethers and JS->TS in RPC class#589kautukkundan wants to merge 1 commit intoconfluencefrom
kautukkundan wants to merge 1 commit intoconfluencefrom
Conversation
Comment on lines
+14
to
+15
| // Change block time using TestRPC call evm_setTimestamp | ||
| // https://github.com/numerai/contract/blob/master/test/numeraire.js |
Contributor
There was a problem hiding this comment.
I think these comments are now outdated and can be removed
| export default class RPC { | ||
| constructor(public provider: ethers.providers.JsonRpcProvider) {} | ||
|
|
||
| sendAsync(method: string, arg: any[]) { |
Contributor
There was a problem hiding this comment.
can we explicitly mark it as 'async' and also specify a return type? (I guess by using a generic since it is used in functions that return Promise<void> or Promise<someType>
| await this.waitUntilBlock(targetBlock, seconds) | ||
| } | ||
|
|
||
| async getBlockNumberAsync() { |
| return this.sendAsync("evm_increaseTime", [time]) | ||
| } | ||
|
|
||
| mine() { |
Contributor
There was a problem hiding this comment.
mark it as async and since it seems in the codebase we are not expecting any return type i guess you can just use Promise<void>
| return this.sendAsync("evm_mine", []) | ||
| } | ||
|
|
||
| async snapshot() { |
| ) | ||
| } | ||
|
|
||
| nextBlockMultiple(currentBlockNum: number, blockMultiple: number) { |
| } | ||
| } | ||
|
|
||
| async waitUntilNextBlockMultiple( |
| return this.sendAsync("evm_revert", [snapshotId]) | ||
| } | ||
|
|
||
| async wait(blocks = 1, seconds = 20) { |
| return id | ||
| } | ||
|
|
||
| revert(snapshotId: number) { |
Contributor
There was a problem hiding this comment.
same as the comment for the 'mine' method
Contributor
|
Good job starting the refactoring to typescript. I guess we can also improve the type annotations a bit |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this pull request do? Explain your changes. (required)
Specific updates (required)
How did you test each of these updates (required)
Does this pull request close any open issues?
closes #573
Checklist:
yarn testpass