Skip to content

Commit

Permalink
Merge branch '1.0' into fix/send-signed-transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
nivida committed Mar 26, 2019
2 parents ad5224d + 1e31cc2 commit e49da4f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
19 changes: 12 additions & 7 deletions packages/web3-eth/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import * as net from 'net';
export class Eth extends AbstractWeb3Module {
constructor(
provider: provider,
net?: net.Socket|null,
net?: net.Socket | null,
options?: Web3ModuleOptions
);

Expand All @@ -54,10 +54,15 @@ export class Eth extends AbstractWeb3Module {

clearSubscriptions(): Promise<boolean>;

subscribe(type: 'logs', options?: Logs, callback?: (error: Error, log: Log) => void): Subscription<Log>;
subscribe(type: 'syncing', options?: null, callback?: (error: Error, result: any) => void): Subscription<any>;
subscribe(type: 'logs', options?: LogsOptions, callback?: (error: Error, log: Log) => void): Subscription<Log>;
subscribe(type: 'syncing', options?: null, callback?: (error: Error, result: Syncing) => void): Subscription<Syncing>;
subscribe(type: 'newBlockHeaders', options?: null, callback?: (error: Error, blockHeader: BlockHeader) => void): Subscription<BlockHeader>;
subscribe(type: 'pendingTransactions', options?: null, callback?: (error: Error, transactionHash: string) => void): Subscription<string>;
subscribe(
type: 'pendingTransactions' | 'logs' | 'syncing' | 'newBlockHeaders',
options?: null | LogsOptions,
callback?: (error: Error, item: Log | Syncing | BlockHeader | string) => void
): Subscription<Log | BlockHeader | Syncing | string>;

getProtocolVersion(callback?: (error: Error, protocolVersion: string) => void): Promise<string>;

Expand Down Expand Up @@ -186,13 +191,13 @@ export interface Block extends BlockHeader {
export interface PastLogsOptions {
fromBlock?: number | string;
toBlock?: number | string;
address: string | string[];
address?: string | string[];
topics?: Array<string | string[]>;
}

export interface Logs {
fromBlock?: number
address?: string
export interface LogsOptions {
fromBlock?: number | string;
address?: string | string[];
topics?: Array<string | string[]>
}

Expand Down
6 changes: 3 additions & 3 deletions packages/web3-eth/types/tests/eth.tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ eth.subscribe('logs', {});
// $ExpectType Subscription<Log>
eth.subscribe('logs', {}, (error: Error, log: Log) => {});

// $ExpectType Subscription<any>
// $ExpectType Subscription<Syncing>
eth.subscribe('syncing');
// $ExpectType Subscription<any>
eth.subscribe('syncing', null, (error: Error, result: any) => {});
// $ExpectType Subscription<Syncing>
eth.subscribe('syncing', null, (error: Error, result: Syncing) => {});

// $ExpectType Subscription<BlockHeader>
eth.subscribe('newBlockHeaders');
Expand Down

0 comments on commit e49da4f

Please sign in to comment.