Skip to content

Commit

Permalink
Fixes to TypeScript definitions (#1131)
Browse files Browse the repository at this point in the history
* removed privateKey from web3.eth.signTransaction and web3.eth.accounts.signTransaction documentation

* removed privateKey from web3.eth.signTransaction and web3.eth.accounts.signTransaction documentation

* added vscode to gitignore and minor doco change

* Added test to show privateKey can not be passed to accounts.signTransaction

* removed passing of private key

* Added Eth.signTransaction function
renamed accounts.privateToAccount to accounts.privateKeyToAccount
Added missing Contract.options
Added status to TransactionReceipt

* reversing changes so my forked 1.0 branch is in sync with the upstream 1.0 branch
  • Loading branch information
naddison36 authored and frozeman committed Oct 24, 2017
1 parent 78bdf99 commit 006b394
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
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

0 comments on commit 006b394

Please sign in to comment.