From 006b394cf89f2301218ca7b0bcdbdd669bcf7a02 Mon Sep 17 00:00:00 2001 From: Nick Addison Date: Tue, 24 Oct 2017 08:58:43 +0000 Subject: [PATCH] Fixes to TypeScript definitions (#1131) * 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 --- .gitignore | 1 + packages/web3/index.d.ts | 2 +- packages/web3/types.d.ts | 23 ++++++++++++++++++++++- 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 7ab4350d86a..2dfb2150de0 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ bower_components /bower .idea/ .npm/ +.vscode/ \ No newline at end of file diff --git a/packages/web3/index.d.ts b/packages/web3/index.d.ts index e0799833411..c8e825c62b0 100644 --- a/packages/web3/index.d.ts +++ b/packages/web3/index.d.ts @@ -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 diff --git a/packages/web3/types.d.ts b/packages/web3/types.d.ts index 1e71cfeedae..a11dc79ade5 100644 --- a/packages/web3/types.d.ts +++ b/packages/web3/types.d.ts @@ -112,6 +112,22 @@ export declare interface TransactionReceipt { logs?: Array 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 { @@ -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 @@ -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 | Signature recoverTransaction(signature: string | Signature): string @@ -376,6 +396,7 @@ export declare class Eth { isSyncing(cb?: Callback): Promise net: Net personal: Personal + signTransaction(tx: Tx, address?: string, cb?: Callback): Promise sendSignedTransaction(data: string, cb?: Callback): PromiEvent sendTransaction(tx: Tx, cb?: Callback): PromiEvent submitWork(nonce: string, powHash: string, digest: string, cb?: Callback): Promise