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