Add missing return types
This commit is contained in:
parent
1d4a52fe15
commit
a6da9cd073
@ -1,5 +1,5 @@
|
||||
export const utils = {
|
||||
consoleLog(message: string) {
|
||||
consoleLog(message: string): void {
|
||||
/* tslint:disable */
|
||||
console.log(message);
|
||||
/* tslint:enable */
|
||||
|
@ -34,7 +34,7 @@ export class Web3Wrapper {
|
||||
public getCurrentProvider(): Web3.Provider {
|
||||
return this.web3.currentProvider;
|
||||
}
|
||||
public async getNetworkIdIfExistsAsync() {
|
||||
public async getNetworkIdIfExistsAsync(): Promise<number|undefined> {
|
||||
try {
|
||||
const networkId = await this.getNetworkAsync();
|
||||
return Number(networkId);
|
||||
@ -64,7 +64,7 @@ export class Web3Wrapper {
|
||||
const {timestamp} = await promisify(this.web3.eth.getBlock)(blockHash);
|
||||
return timestamp;
|
||||
}
|
||||
private async getNetworkAsync() {
|
||||
private async getNetworkAsync(): Promise<number> {
|
||||
const networkId = await promisify(this.web3.version.getNetwork)();
|
||||
return networkId;
|
||||
}
|
||||
|
@ -7,10 +7,10 @@ export class BlockchainClean {
|
||||
this.rpc = new RPC();
|
||||
}
|
||||
// TODO: Check if running on TestRPC or on actual node, if actual node, re-deploy contracts instead
|
||||
public async setupAsync() {
|
||||
public async setupAsync(): Promise<void> {
|
||||
this.snapshotId = await this.rpc.takeSnapshotAsync();
|
||||
}
|
||||
public async restoreAsync() {
|
||||
public async restoreAsync(): Promise<void> {
|
||||
const didRevert = await this.rpc.revertSnapshotAsync(this.snapshotId);
|
||||
if (!didRevert) {
|
||||
throw new Error(`Snapshot with id #${this.snapshotId} failed to revert`);
|
||||
|
@ -26,7 +26,7 @@ export class RPC {
|
||||
const didRevert = await this.sendAsync(payload);
|
||||
return didRevert;
|
||||
}
|
||||
private toPayload(method: string, params: any[] = []) {
|
||||
private toPayload(method: string, params: any[] = []): string {
|
||||
const payload = JSON.stringify({
|
||||
id: this.id,
|
||||
method,
|
||||
@ -35,7 +35,7 @@ export class RPC {
|
||||
this.id += 1;
|
||||
return payload;
|
||||
}
|
||||
private async sendAsync(payload: string) {
|
||||
private async sendAsync(payload: string): Promise<any> {
|
||||
const opts = {
|
||||
method: 'POST',
|
||||
uri: `http://${this.host}:${this.port}`,
|
||||
|
Loading…
x
Reference in New Issue
Block a user