From c0ee63f2441e527c56f49db5d7d3aa9da89d87c9 Mon Sep 17 00:00:00 2001 From: Thomas Scholtes Date: Fri, 12 Jul 2019 15:58:44 +0200 Subject: [PATCH 1/3] Fix TypeScript 'ContractOptions' interface * Make all fields optional * Add `transactionConfirmationBlocks` field * Document all fields Note that the list is still not exhaustive but I was unable to confidently determine the types of the other options. --- packages/web3-eth-contract/types/index.d.ts | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/packages/web3-eth-contract/types/index.d.ts b/packages/web3-eth-contract/types/index.d.ts index 97aab09eba7..75d989c399b 100644 --- a/packages/web3-eth-contract/types/index.d.ts +++ b/packages/web3-eth-contract/types/index.d.ts @@ -95,10 +95,16 @@ export interface EstimateGasOptions { } export interface ContractOptions { - from: string; - gasPrice: string; - gas: number; - data: string; + // Sender to use for contract calls + from?: string; + // Gas price to use for contract calls + gasPrice?: string; + // Gas to use for contract calls + gas?: number; + // Contract code + data?: string; + // Number of blocks until a contract call transaction is considered confirmed + transactionConfirmationBlocks?: number } export interface EventOptions { From 0a0b2e7b6cf8e697c83f942307af6c995c3b4ae2 Mon Sep 17 00:00:00 2001 From: Thomas Scholtes Date: Mon, 15 Jul 2019 18:06:14 +0200 Subject: [PATCH 2/3] TypeScript 'ContractOptions' extend 'Web3ModuleOptions' --- packages/web3-eth-contract/types/index.d.ts | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/packages/web3-eth-contract/types/index.d.ts b/packages/web3-eth-contract/types/index.d.ts index 75d989c399b..c1245b2a9bd 100644 --- a/packages/web3-eth-contract/types/index.d.ts +++ b/packages/web3-eth-contract/types/index.d.ts @@ -20,7 +20,7 @@ import BN = require('bn.js'); import {provider} from 'web3-providers'; import {AbiInput, AbiOutput, AbiItem} from 'web3-utils'; -import {PromiEvent} from 'web3-core'; +import {PromiEvent, Web3ModuleOptions} from 'web3-core'; export class Contract { constructor( @@ -94,7 +94,7 @@ export interface EstimateGasOptions { value?: number | string | BN; } -export interface ContractOptions { +export interface ContractOptions extends Web3ModuleOptions { // Sender to use for contract calls from?: string; // Gas price to use for contract calls @@ -103,8 +103,6 @@ export interface ContractOptions { gas?: number; // Contract code data?: string; - // Number of blocks until a contract call transaction is considered confirmed - transactionConfirmationBlocks?: number } export interface EventOptions { From f6d97927610afdc617bd54773e3cc8507946c34b Mon Sep 17 00:00:00 2001 From: nivida Date: Tue, 16 Jul 2019 12:44:43 +0200 Subject: [PATCH 3/3] CHANGELOG updated --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 95419d54a63..4c4ebdd60db 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -71,4 +71,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - miner.startMining fixed (#2877) - Subscription type definitions fixed (#2919) +- ``ContractOptions`` type definitions corrected (#2939)