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 to TypeScript definitions #1131

Merged
merged 11 commits into from
Oct 24, 2017
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ bower_components
/bower
.idea/
.npm/
.vscode/
2 changes: 1 addition & 1 deletion packages/web3/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ declare class Web3 {
Shh: new (provider: t.Provider) => t.Shh
Bzz: new (provider: t.Provider) => t.Bzz
}
constructor(provider: t.Provider)
constructor(provider: t.Provider | string)
version: string
BatchRequest: new () => t.BatchRequest
extend(methods: any): any // TODO
Expand Down
23 changes: 22 additions & 1 deletion packages/web3/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,22 @@ export declare interface TransactionReceipt {
logs?: Array<Log>
events?: {
[eventName: string]: EventLog
},
status: string
}
export declare interface EncodedTransaction {
raw: string,
tx: {
nonce: string,
gasPrice: string,
gas: string,
to: string,
value: string,
input: string,
v: string,
r: string,
s: string,
hash: string
}
}
export declare interface BlockHeader {
Expand Down Expand Up @@ -265,6 +281,10 @@ export declare interface Contract {
options: {
address: string
jsonInterface: ABIDefinition[]
data: string
from: string
gasPrice: string
gas: number
}
methods: {
[fnName: string]: (...args) => TransactionObject<any>
Expand Down Expand Up @@ -313,7 +333,7 @@ export declare class Eth {
}
accounts: {
'new'(entropy?: string): Account
privateToAccount(privKey: string): Account
privateKeyToAccount(privKey: string): Account
publicToAddress(key: string): string
signTransaction(tx: Tx, privateKey: string, returnSignature?: boolean, cb?: (err: Error, result: string | Signature) => void): Promise<string> | Signature
recoverTransaction(signature: string | Signature): string
Expand Down Expand Up @@ -376,6 +396,7 @@ export declare class Eth {
isSyncing(cb?: Callback<boolean>): Promise<boolean>
net: Net
personal: Personal
signTransaction(tx: Tx, address?: string, cb?: Callback<string>): Promise<EncodedTransaction>
sendSignedTransaction(data: string, cb?: Callback<string>): PromiEvent<TransactionReceipt>
sendTransaction(tx: Tx, cb?: Callback<string>): PromiEvent<TransactionReceipt>
submitWork(nonce: string, powHash: string, digest: string, cb?: Callback<boolean>): Promise<boolean>
Expand Down