Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes in types definition #1139

Merged
merged 2 commits into from
Nov 13, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/web3/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,4 +25,4 @@ declare class Web3 {

}

export = Web3
export default Web3
47 changes: 39 additions & 8 deletions packages/web3/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BigNumber } from 'bignumber.js' // TODO change to BN
import { BigNumber } from 'bn.js'
import * as us from 'underscore'


Expand All @@ -18,9 +18,6 @@ export declare interface JsonRPCResponse {

type Callback<T> = (error: Error, result: T) => void
type ABIDataTypes = "uint256" | "boolean" | "string" | "bytes" | string // TODO complete list
export declare interface Provider {
send(payload: JsonRPCRequest, callback: (e: Error, val: JsonRPCResponse) => void)
}
type PromiEventType = "transactionHash" | "receipt" | "confirmation" | "error"
export declare interface PromiEvent<T> extends Promise<T> {
once(type: "transactionHash", handler: (receipt: string) => void): PromiEvent<T>
Expand Down Expand Up @@ -232,9 +229,44 @@ export declare interface Tx {
gasPrice?: string | number

}
export declare interface WebsocketProvider extends Provider { }
export declare interface HttpProvider extends Provider { }
export declare interface IpcProvider extends Provider { }
export declare interface IProvider {
send(payload: JsonRPCRequest, callback: (e: Error, val: JsonRPCResponse) => void)
}
export declare interface WebsocketProvider extends IProvider {
responseCallbacks: object
notificationCallbacks: [() => any]
connection: {
onclose(e: any): void,
onmessage(e: any): void,
onerror(e?: any): void
}
addDefaultEvents: () => void
on(type: string, callback: () => any): void
removeListener(type: string, callback: () => any): void
removeAllListeners(type: string): void
reset(): void
}
export declare interface HttpProvider extends IProvider {
responseCallbacks: undefined
notificationCallbacks: undefined
connection: undefined
addDefaultEvents: undefined
on(type: string, callback: () => any): undefined
removeListener(type: string, callback: () => any): undefined
removeAllListeners(type: string): undefined
reset(): undefined
}
export declare interface IpcProvider extends IProvider {
responseCallbacks: undefined
notificationCallbacks: undefined
connection: undefined
addDefaultEvents: undefined
on(type: string, callback: () => any): undefined
removeListener(type: string, callback: () => any): undefined
removeAllListeners(type: string): undefined
reset(): undefined
}
export type Provider = WebsocketProvider | IpcProvider | HttpProvider;
type Unit = "kwei" | "femtoether" | "babbage" | "mwei" | "picoether" | "lovelace" | "qwei" | "nanoether" | "shannon" | "microether" | "szabo" | "nano" | "micro" | "milliether" | "finney" | "milli" | "ether" | "kether" | "grand" | "mether" | "gether" | "tether"
export type BlockType = "latest" | "pending" | "genesis" | number
export declare interface Iban { }
Expand Down Expand Up @@ -422,4 +454,3 @@ export declare class BatchRequest {
add(request: Request): void //
execute(): void
}