aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-05-26 23:47:00 +0800
committerFabio Berger <me@fabioberger.com>2017-05-26 23:47:00 +0800
commita6da9cd07389b317624ad00a3cb73b75820687e1 (patch)
treea7e488b85e308b9cfa6e4dcd144bfaf2e9843062
parent1d4a52fe15988fb8534c441c539f55dd5d18db1a (diff)
downloaddexon-sol-tools-a6da9cd07389b317624ad00a3cb73b75820687e1.tar
dexon-sol-tools-a6da9cd07389b317624ad00a3cb73b75820687e1.tar.gz
dexon-sol-tools-a6da9cd07389b317624ad00a3cb73b75820687e1.tar.bz2
dexon-sol-tools-a6da9cd07389b317624ad00a3cb73b75820687e1.tar.lz
dexon-sol-tools-a6da9cd07389b317624ad00a3cb73b75820687e1.tar.xz
dexon-sol-tools-a6da9cd07389b317624ad00a3cb73b75820687e1.tar.zst
dexon-sol-tools-a6da9cd07389b317624ad00a3cb73b75820687e1.zip
Add missing return types
-rw-r--r--src/ts/utils/utils.ts2
-rw-r--r--src/ts/web3_wrapper.ts4
-rw-r--r--test/utils/blockchain_clean.ts4
-rw-r--r--test/utils/rpc.ts4
4 files changed, 7 insertions, 7 deletions
diff --git a/src/ts/utils/utils.ts b/src/ts/utils/utils.ts
index 893f82ca3..04ac36b54 100644
--- a/src/ts/utils/utils.ts
+++ b/src/ts/utils/utils.ts
@@ -1,5 +1,5 @@
export const utils = {
- consoleLog(message: string) {
+ consoleLog(message: string): void {
/* tslint:disable */
console.log(message);
/* tslint:enable */
diff --git a/src/ts/web3_wrapper.ts b/src/ts/web3_wrapper.ts
index ec3be994f..969c2c040 100644
--- a/src/ts/web3_wrapper.ts
+++ b/src/ts/web3_wrapper.ts
@@ -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;
}
diff --git a/test/utils/blockchain_clean.ts b/test/utils/blockchain_clean.ts
index 6468dbec7..18b7e3a5b 100644
--- a/test/utils/blockchain_clean.ts
+++ b/test/utils/blockchain_clean.ts
@@ -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`);
diff --git a/test/utils/rpc.ts b/test/utils/rpc.ts
index b689a938c..e331fa6d4 100644
--- a/test/utils/rpc.ts
+++ b/test/utils/rpc.ts
@@ -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}`,