diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-05-11 23:38:51 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-05-14 16:35:13 +0800 |
commit | b74957acdfc8d67d154bcb4698acd7575db7cc47 (patch) | |
tree | 3f33c2faac3b55e52098ab0b5b9883a9b62f5aee /packages/subproviders | |
parent | 6aed4fb1ae27dabed027c855f2cbdc0bfb4f3b6b (diff) | |
download | dexon-sol-tools-b74957acdfc8d67d154bcb4698acd7575db7cc47.tar dexon-sol-tools-b74957acdfc8d67d154bcb4698acd7575db7cc47.tar.gz dexon-sol-tools-b74957acdfc8d67d154bcb4698acd7575db7cc47.tar.bz2 dexon-sol-tools-b74957acdfc8d67d154bcb4698acd7575db7cc47.tar.lz dexon-sol-tools-b74957acdfc8d67d154bcb4698acd7575db7cc47.tar.xz dexon-sol-tools-b74957acdfc8d67d154bcb4698acd7575db7cc47.tar.zst dexon-sol-tools-b74957acdfc8d67d154bcb4698acd7575db7cc47.zip |
Add missing type definitions
Diffstat (limited to 'packages/subproviders')
10 files changed, 13 insertions, 13 deletions
diff --git a/packages/subproviders/src/subproviders/base_wallet_subprovider.ts b/packages/subproviders/src/subproviders/base_wallet_subprovider.ts index f68d7eb29..a04be68e1 100644 --- a/packages/subproviders/src/subproviders/base_wallet_subprovider.ts +++ b/packages/subproviders/src/subproviders/base_wallet_subprovider.ts @@ -8,13 +8,13 @@ import { Callback, ErrorCallback, PartialTxParams, ResponseWithTxParams, WalletS import { Subprovider } from './subprovider'; export abstract class BaseWalletSubprovider extends Subprovider { - protected static _validateTxParams(txParams: PartialTxParams) { + protected static _validateTxParams(txParams: PartialTxParams): void { if (!_.isUndefined(txParams.to)) { assert.isETHAddressHex('to', txParams.to); } assert.isHexString('nonce', txParams.nonce); } - private static _validateSender(sender: string) { + private static _validateSender(sender: string): void { if (_.isUndefined(sender) || !addressUtils.isAddress(sender)) { throw new Error(WalletSubproviderErrors.SenderInvalidOrNotSupplied); } @@ -33,7 +33,7 @@ export abstract class BaseWalletSubprovider extends Subprovider { * @param end Callback to call if subprovider handled the request and wants to pass back the request. */ // tslint:disable-next-line:async-suffix - public async handleRequest(payload: JSONRPCRequestPayload, next: Callback, end: ErrorCallback) { + public async handleRequest(payload: JSONRPCRequestPayload, next: Callback, end: ErrorCallback): Promise<void> { let accounts; let txParams; switch (payload.method) { diff --git a/packages/subproviders/src/subproviders/empty_wallet_subprovider.ts b/packages/subproviders/src/subproviders/empty_wallet_subprovider.ts index 8f152dc0a..bd7a4b6d9 100644 --- a/packages/subproviders/src/subproviders/empty_wallet_subprovider.ts +++ b/packages/subproviders/src/subproviders/empty_wallet_subprovider.ts @@ -18,7 +18,7 @@ export class EmptyWalletSubprovider extends Subprovider { * @param end Callback to call if subprovider handled the request and wants to pass back the request. */ // tslint:disable-next-line:prefer-function-over-method async-suffix - public async handleRequest(payload: JSONRPCRequestPayload, next: Callback, end: ErrorCallback) { + public async handleRequest(payload: JSONRPCRequestPayload, next: Callback, end: ErrorCallback): Promise<void> { switch (payload.method) { case 'eth_accounts': end(null, []); diff --git a/packages/subproviders/src/subproviders/fake_gas_estimate_subprovider.ts b/packages/subproviders/src/subproviders/fake_gas_estimate_subprovider.ts index 54fd7bcb9..6c49f20cf 100644 --- a/packages/subproviders/src/subproviders/fake_gas_estimate_subprovider.ts +++ b/packages/subproviders/src/subproviders/fake_gas_estimate_subprovider.ts @@ -32,7 +32,7 @@ export class FakeGasEstimateSubprovider extends Subprovider { * @param end Callback to call if subprovider handled the request and wants to pass back the request. */ // tslint:disable-next-line:prefer-function-over-method async-suffix - public async handleRequest(payload: JSONRPCRequestPayload, next: Callback, end: ErrorCallback) { + public async handleRequest(payload: JSONRPCRequestPayload, next: Callback, end: ErrorCallback): Promise<void> { switch (payload.method) { case 'eth_estimateGas': end(null, this._constantGasAmount); diff --git a/packages/subproviders/src/subproviders/ganache.ts b/packages/subproviders/src/subproviders/ganache.ts index debd7ecf0..9ab764048 100644 --- a/packages/subproviders/src/subproviders/ganache.ts +++ b/packages/subproviders/src/subproviders/ganache.ts @@ -28,7 +28,7 @@ export class GanacheSubprovider extends Subprovider { * @param end Callback to call if subprovider handled the request and wants to pass back the request. */ // tslint:disable-next-line:prefer-function-over-method async-suffix - public async handleRequest(payload: JSONRPCRequestPayload, next: Callback, end: ErrorCallback) { + public async handleRequest(payload: JSONRPCRequestPayload, next: Callback, end: ErrorCallback): Promise<void> { this._ganacheProvider.sendAsync(payload, (err: Error | null, result: any) => { end(err, result && result.result); }); diff --git a/packages/subproviders/src/subproviders/injected_web3.ts b/packages/subproviders/src/subproviders/injected_web3.ts index 3ca0c4bd0..73b870cd5 100644 --- a/packages/subproviders/src/subproviders/injected_web3.ts +++ b/packages/subproviders/src/subproviders/injected_web3.ts @@ -31,7 +31,7 @@ export class InjectedWeb3Subprovider extends Subprovider { * @param end Callback to call if subprovider handled the request and wants to pass back the request. */ // tslint:disable-next-line:prefer-function-over-method async-suffix - public async handleRequest(payload: JSONRPCRequestPayload, next: Callback, end: ErrorCallback) { + public async handleRequest(payload: JSONRPCRequestPayload, next: Callback, end: ErrorCallback): Promise<void> { switch (payload.method) { case 'web3_clientVersion': this._injectedWeb3.version.getNode(end); diff --git a/packages/subproviders/src/subproviders/ledger.ts b/packages/subproviders/src/subproviders/ledger.ts index 563e5a56a..347eda55f 100644 --- a/packages/subproviders/src/subproviders/ledger.ts +++ b/packages/subproviders/src/subproviders/ledger.ts @@ -74,7 +74,7 @@ export class LedgerSubprovider extends BaseWalletSubprovider { * Set a desired derivation path when computing the available user addresses * @param basDerivationPath The desired derivation path (e.g `44'/60'/0'`) */ - public setPath(basDerivationPath: string) { + public setPath(basDerivationPath: string): void { this._baseDerivationPath = basDerivationPath; } /** @@ -192,7 +192,7 @@ export class LedgerSubprovider extends BaseWalletSubprovider { this._connectionLock.release(); return ledgerEthereumClient; } - private async _destroyLedgerClientAsync() { + private async _destroyLedgerClientAsync(): Promise<void> { await this._connectionLock.acquire(); if (_.isUndefined(this._ledgerClientIfExists)) { this._connectionLock.release(); diff --git a/packages/subproviders/src/subproviders/mnemonic_wallet.ts b/packages/subproviders/src/subproviders/mnemonic_wallet.ts index 080bfeb4c..f29864a74 100644 --- a/packages/subproviders/src/subproviders/mnemonic_wallet.ts +++ b/packages/subproviders/src/subproviders/mnemonic_wallet.ts @@ -56,7 +56,7 @@ export class MnemonicWalletSubprovider extends BaseWalletSubprovider { * Set a desired derivation path when computing the available user addresses * @param baseDerivationPath The desired derivation path (e.g `44'/60'/0'`) */ - public setPath(baseDerivationPath: string) { + public setPath(baseDerivationPath: string): void { this._baseDerivationPath = baseDerivationPath; this._derivedKeyInfo = this._initialDerivedKeyInfo(this._baseDerivationPath); } diff --git a/packages/subproviders/src/subproviders/subprovider.ts b/packages/subproviders/src/subproviders/subprovider.ts index 2118f52c8..56d2381a0 100644 --- a/packages/subproviders/src/subproviders/subprovider.ts +++ b/packages/subproviders/src/subproviders/subprovider.ts @@ -11,7 +11,7 @@ export abstract class Subprovider { // tslint:disable-next-line:underscore-private-and-protected private engine: any; // Ported from: https://github.com/MetaMask/provider-engine/blob/master/util/random-id.js - private static _getRandomId() { + private static _getRandomId(): number { const extraDigits = 3; // 13 time digits const datePart = new Date().getTime() * Math.pow(10, extraDigits); diff --git a/packages/subproviders/test/chai_setup.ts b/packages/subproviders/test/chai_setup.ts index a281bab6c..6c24dc222 100644 --- a/packages/subproviders/test/chai_setup.ts +++ b/packages/subproviders/test/chai_setup.ts @@ -3,7 +3,7 @@ import chaiAsPromised = require('chai-as-promised'); import * as dirtyChai from 'dirty-chai'; export const chaiSetup = { - configure() { + configure(): void { chai.config.includeStack = true; chai.use(dirtyChai); chai.use(chaiAsPromised); diff --git a/packages/subproviders/test/unit/nonce_tracker_subprovider_test.ts b/packages/subproviders/test/unit/nonce_tracker_subprovider_test.ts index 14176c145..1a3db7672 100644 --- a/packages/subproviders/test/unit/nonce_tracker_subprovider_test.ts +++ b/packages/subproviders/test/unit/nonce_tracker_subprovider_test.ts @@ -39,7 +39,7 @@ describe('NonceTrackerSubprovider', () => { '0x5e1d3a76fbf824220eafc8c79ad578ad2b67d01b0c2425eb1f1347e8f50882ab', '0x5bd428537f05f9830e93792f90ea6a3e2d1ee84952dd96edbae9f658f831ab13', ]; - function createFixtureSubprovider() { + function createFixtureSubprovider(): FixtureSubprovider { let isFirstGetTransactionCount = true; const fixedBlockNumberAndTransactionCountProvider = new FixtureSubprovider({ eth_getBlockByNumber: '0x01', |