message: Add gas estimate methods to ethers contracts
diff: @@ -24,8 +24,8 @@ import {
  export function codegen(contract: Contract) {
  // TODO strict typings for the event listener methods?
  const template = `
  - import { Contract, ContractTransaction, EventFilter, Listener, Signer } from 'ethers';
  - import { Provider } from 'ethers/providers';
  + import { Contract, ContractTransaction, EventFilter, Signer } from 'ethers';
  + import { Listener, Provider } from 'ethers/providers';
  import { BigNumber } from "ethers/utils";
  import { TransactionOverrides } from ".";
  @@ -48,7 +48,11 @@ export function codegen(contract: Contract) {
  filters: {
  ${contract.events.map(generateEvents).join("\n")}
  - }
  + };
  +
  + estimate: {
  + ${contract.functions.map(generateEstimateFunction).join("\n")}
  + };
  }
  `;
  @@ -69,6 +73,12 @@ function generateFunction(fn: FunctionDeclaration): string {
  `;
  }
  +function generateEstimateFunction(fn: FunctionDeclaration): string {
  + return `
  + ${fn.name}(${generateInputTypes(fn.inputs)}): Promise<BigNumber>;
  +`;
  +}
  +
  function generateConstant(fn: ConstantDeclaration): string {
  return `${fn.name}(): Promise<${generateOutputType(fn.output)}>;`;
  }
  