How to use the typechain.isConstantFn function in typechain

To help you get started, we’ve selected a few typechain examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ethereum-ts / TypeChain / packages / typechain-target-ethers / lib / generation.ts View on Github external
function generateFunction(fn: FunctionDeclaration): string {
  return `
  ${fn.name}(${generateInputTypes(fn.inputs)}${
    !isConstant(fn) && !isConstantFn(fn) ? "overrides?: TransactionOverrides" : ""
  }): Promise<${
    fn.stateMutability === "pure" || fn.stateMutability === "view"
      ? generateOutputTypes(fn.outputs)
      : "ContractTransaction"
  }>;
`;
}
github ethereum-ts / TypeChain / packages / typechain-target-truffle / lib / generation.ts View on Github external
function generateFunction(fn: FunctionDeclaration): string {
  if (isConstant(fn) || isConstantFn(fn)) {
    return generateConstantFunction(fn);
  }

  return `
  ${fn.name}: {
    (${generateInputTypes(
      fn.inputs,
    )} txDetails?: Truffle.TransactionDetails): Promise;
  call(${generateInputTypes(
    fn.inputs,
  )} txDetails?: Truffle.TransactionDetails): Promise<${generateOutputTypes(fn.outputs)}>;
  sendTransaction(${generateInputTypes(
    fn.inputs,
  )} txDetails?: Truffle.TransactionDetails): Promise;
  estimateGas(${generateInputTypes(
    fn.inputs,