How to use @truffle/contract - 1 common examples

To help you get started, we’ve selected a few @truffle/contract 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 trufflesuite / truffle / packages / core / lib / debug / mocha.js View on Github external
}
      case "send": {
        const result = await operation;

        return { txHash: result.tx, method, result };
      }
      case "call": {
        // replays as send
        const { contract, fn, abi, args, address } = method;

        // get the result of the call
        const result = await operation;

        // and replay it as a transaction so we can debug
        // bit of a HACK: properly making a call act like a tx requires forking
        const { tx: txHash } = await execute.send.call(
          contract,
          fn,
          abi,
          address
        )(...args);

        return { txHash, method, result };
      }
      default: {
        throw new Error(`Unsupported action for debugging: ${action}`);
      }
    }
  }

@truffle/contract

A better contract abstraction for Ethereum (formerly EtherPudding)

MIT
Latest version published 8 months ago

Package Health Score

55 / 100
Full package analysis

Popular @truffle/contract functions