How to use the hardhat/internal/core/providers/errors.TransactionExecutionError function in hardhat

To help you get started, we’ve selected a few hardhat 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-optimism / optimism / packages / smock / src / smockit / binding.ts View on Github external
/* Imports: External */
import { HardhatNetworkProvider } from 'hardhat/internal/hardhat-network/provider/provider'
import { decodeRevertReason } from 'hardhat/internal/hardhat-network/stack-traces/revert-reasons'
import { VmError } from '@nomiclabs/ethereumjs-vm/dist/exceptions'
import BN from 'bn.js'

// Handle hardhat ^2.2.0
let TransactionExecutionError: any
try {
  // tslint:disable-next-line
  TransactionExecutionError = require('hardhat/internal/hardhat-network/provider/errors')
    .TransactionExecutionError
} catch (err) {
  // tslint:disable-next-line
  TransactionExecutionError = require('hardhat/internal/core/providers/errors')
    .TransactionExecutionError
}

/* Imports: Internal */
import { MockContract, SmockedVM } from './types'
import { fromFancyAddress, toFancyAddress } from '../common'

/**
 * Checks to see if smock has been initialized already. Basically just checking to see if we've
 * attached smock state to the VM already.
 * @param provider Base hardhat network provider to check.
 * @return Whether or not the provider has already been modified to support smock.
 */
const isSmockInitialized = (provider: HardhatNetworkProvider): boolean => {
  return (provider as any)._node._vm._smockState !== undefined
}