imports updated

toaster-react
aniket-engg 4 years ago committed by Aniket
parent 662faf8cdd
commit c02bf692fb
  1. 22
      libs/remix-lib/src/execution/execution-context.ts
  2. 16
      libs/remix-lib/src/execution/txFormat.ts
  3. 11
      libs/remix-lib/src/execution/txListener.ts
  4. 4
      libs/remix-lib/src/execution/txRunner.ts
  5. 42
      libs/remix-lib/src/index.ts
  6. 1
      libs/remix-lib/src/universalDapp.ts
  7. 2
      libs/remix-lib/src/web3Provider/dummyProvider.ts
  8. 2
      libs/remix-lib/src/web3Provider/web3VmProvider.ts

@ -1,11 +1,11 @@
/* global ethereum */
'use strict'
import Web3 from 'web3'
const EventManager = require('../eventManager')
import { EventManager } from '../eventManager'
const EthJSVM = require('ethereumjs-vm').default
import { rlp, keccak, bufferToHex } from 'ethereumjs-util'
const StateManager = require('ethereumjs-vm/dist/state/stateManager').default
const Web3VMProvider = require('../web3Provider/web3VmProvider')
import { Web3VmProvider } from '../web3Provider/web3VmProvider'
const LogsManager = require('./logsManager.js')
@ -84,7 +84,7 @@ function createVm (hardfork) {
hardfork: hardfork
})
vm.blockchain.validate = false
const web3vm = new Web3VMProvider()
const web3vm = new Web3VmProvider()
web3vm.setVM(vm)
return { vm, web3vm, stateManager }
}
@ -306,6 +306,15 @@ export class ExecutionContext {
}
txDetailsLink (network, hash) {
const transactionDetailsLinks = {
'Main': 'https://www.etherscan.io/tx/',
'Rinkeby': 'https://rinkeby.etherscan.io/tx/',
'Ropsten': 'https://ropsten.etherscan.io/tx/',
'Kovan': 'https://kovan.etherscan.io/tx/',
'Goerli': 'https://goerli.etherscan.io/tx/'
}
if (transactionDetailsLinks[network]) {
return transactionDetailsLinks[network] + hash
}
@ -330,10 +339,3 @@ export class ExecutionContext {
}
}
const transactionDetailsLinks = {
'Main': 'https://www.etherscan.io/tx/',
'Rinkeby': 'https://rinkeby.etherscan.io/tx/',
'Ropsten': 'https://ropsten.etherscan.io/tx/',
'Kovan': 'https://kovan.etherscan.io/tx/',
'Goerli': 'https://goerli.etherscan.io/tx/'
}

@ -1,6 +1,6 @@
'use strict'
import { ethers } from 'ethers'
const helper = require('./txHelper')
import { encodeParams as encodeParamsHelper, encodeFunctionId, makeFullTypeDefinition} from './txHelper'
import { eachOfSeries } from 'async'
import { linkBytecode } from 'solc/linker'
import { isValidAddress, addHexPrefix } from 'ethereumjs-util'
@ -16,7 +16,7 @@ export function encodeData (funABI, values, contractbyteCode) {
let encoded
let encodedHex
try {
encoded = helper.encodeParams(funABI, values)
encoded = encodeParamsHelper(funABI, values)
encodedHex = encoded.toString('hex')
} catch (e) {
return { error: 'cannot encode arguments' }
@ -24,7 +24,7 @@ export function encodeData (funABI, values, contractbyteCode) {
if (contractbyteCode) {
return { data: '0x' + contractbyteCode + encodedHex.replace('0x', '') }
} else {
return { data: helper.encodeFunctionId(funABI) + encodedHex.replace('0x', '') }
return { data: encodeFunctionId(funABI) + encodedHex.replace('0x', '') }
}
}
@ -53,7 +53,7 @@ export function encodeParams (params, funAbi, callback) {
}
if (funArgs.length > 0) {
try {
data = helper.encodeParams(funAbi, funArgs)
data = encodeParamsHelper(funAbi, funArgs)
dataHex = data.toString('hex')
} catch (e) {
return callback('Error encoding arguments: ' + e)
@ -79,7 +79,7 @@ export function encodeParams (params, funAbi, callback) {
export function encodeFunctionCall (params, funAbi, callback) {
this.encodeParams(params, funAbi, (error, encodedParam) => {
if (error) return callback(error)
callback(null, { dataHex: helper.encodeFunctionId(funAbi) + encodedParam.dataHex, funAbi, funArgs: encodedParam.funArgs })
callback(null, { dataHex: encodeFunctionId(funAbi) + encodedParam.dataHex, funAbi, funArgs: encodedParam.funArgs })
})
}
@ -182,7 +182,7 @@ export function buildData (contractName, contract, contracts, isConstructor, fun
return callback('Error encoding arguments: ' + e)
}
try {
data = helper.encodeParams(funAbi, funArgs)
data = encodeParamsHelper(funAbi, funArgs)
dataHex = data.toString('hex')
} catch (e) {
return callback('Error encoding arguments: ' + e)
@ -212,7 +212,7 @@ export function buildData (contractName, contract, contracts, isConstructor, fun
dataHex = bytecodeToDeploy + dataHex
}
} else {
dataHex = helper.encodeFunctionId(funAbi) + dataHex
dataHex = encodeFunctionId(funAbi) + dataHex
}
callback(null, { dataHex, funAbi, funArgs, contractBytecode, contractName: contractName })
}
@ -361,7 +361,7 @@ export function decodeResponse (response, fnabi) {
const outputTypes = []
for (i = 0; i < fnabi.outputs.length; i++) {
const type = fnabi.outputs[i].type
outputTypes.push(type.indexOf('tuple') === 0 ? helper.makeFullTypeDefinition(fnabi.outputs[i]) : type)
outputTypes.push(type.indexOf('tuple') === 0 ? makeFullTypeDefinition(fnabi.outputs[i]) : type)
}
if (!response.length) response = new Uint8Array(32 * fnabi.outputs.length) // ensuring the data is at least filled by 0 cause `AbiCoder` throws if there's not engouh data

@ -1,10 +1,9 @@
'use strict'
import async from 'async'
import { each } from 'async'
import { ethers } from 'ethers'
import { toBuffer } from 'ethereumjs-util'
const EventManager = require('../eventManager')
const codeUtil = require('../util')
import { EventManager } from '../eventManager'
import { compareByteCode } from '../util'
import { ExecutionContext } from './execution-context'
import { decodeResponse } from './txFormat'
import { getFunction, getReceiveInterface, getConstructorInterface, visitContracts, makeFullTypeDefinition } from './txHelper'
@ -214,7 +213,7 @@ export class TxListener {
}
_resolve (transactions, callback) {
async.each(transactions, (tx, cb) => {
each(transactions, (tx, cb) => {
this._api.resolveReceipt(tx, (error, receipt) => {
if (error) return cb(error)
this._resolveTx(tx, receipt, (error, resolvedData) => {
@ -339,7 +338,7 @@ export class TxListener {
let found = null
visitContracts(compiledContracts, (contract) => {
const bytes = isCreation ? contract.object.evm.bytecode.object : contract.object.evm.deployedBytecode.object
if (codeUtil.compareByteCode(codeToResolve, '0x' + bytes)) {
if (compareByteCode(codeToResolve, '0x' + bytes)) {
found = contract
return true
}

@ -2,8 +2,8 @@
import { Transaction } from 'ethereumjs-tx'
import { Block } from 'ethereumjs-block'
import { BN, bufferToHex } from 'ethereumjs-util'
import { ExecutionContext } from './execution-context'
const EventManager = require('../eventManager')
import { ExecutionContext } from './execution-context'
import { EventManager } from '../eventManager'
export class TxRunner {

@ -1,22 +1,20 @@
const EventManager = require('./eventManager')
const uiHelper = require('./helpers/uiHelper')
const compilerHelper = require('./helpers/compilerHelper')
const util = require('./util')
const Web3Providers = require('./web3Provider/web3Providers')
const DummyProvider = require('./web3Provider/dummyProvider')
const Web3VMProvider = require('./web3Provider/web3VmProvider')
const Storage = require('./storage')
const EventsDecoder = require('./execution/eventsDecoder')
const txExecution = require('./execution/txExecution')
const txHelper = require('./execution/txHelper')
const txFormat = require('./execution/txFormat')
const txListener = require('./execution/txListener')
const txRunner = require('./execution/txRunner')
const ExecutionContext = require('./execution/execution-context')
const typeConversion = require('./execution/typeConversion')
const UniversalDApp = require('./universalDapp')
import { EventManager } from './eventManager'
import * as uiHelper from './helpers/uiHelper'
import * as compilerHelper from './helpers/compilerHelper'
import * as util from './util'
import { Web3Providers } from './web3Provider/web3Providers'
import { DummyProvider } from './web3Provider/dummyProvider'
import { Web3VmProvider } from './web3Provider/web3VmProvider'
import { Storage } from './storage'
import { EventsDecoder } from './execution/eventsDecoder'
import * as txExecution from './execution/txExecution'
import * as txHelper from './execution/txHelper'
import * as txFormat from './execution/txFormat'
import { TxListener } from './execution/txListener'
import { TxRunner } from './execution/txRunner'
import { ExecutionContext } from './execution/execution-context'
import * as typeConversion from './execution/typeConversion'
import { UniversalDApp } from './universalDapp'
if (typeof (module) !== 'undefined' && typeof (module.exports) !== 'undefined') {
module.exports = modules()
@ -32,7 +30,7 @@ function modules () {
vm: {
Web3Providers: Web3Providers,
DummyProvider: DummyProvider,
Web3VMProvider: Web3VMProvider
Web3VMProvider: Web3VmProvider
},
Storage: Storage,
util: util,
@ -42,8 +40,8 @@ function modules () {
txHelper: txHelper,
executionContext: new ExecutionContext(),
txFormat: txFormat,
txListener: txListener,
txRunner: txRunner,
txListener: TxListener,
txRunner: TxRunner,
typeConversion: typeConversion
},
UniversalDApp: UniversalDApp

@ -3,7 +3,6 @@ import { BN, privateToAddress, isValidPrivate, toChecksumAddress } from 'ethereu
import { stripHexPrefix } from 'ethjs-util'
import { randomBytes } from 'crypto'
import { EventEmitter } from 'events'
import { TxRunner } from './execution/txRunner'
import { sortAbiFunction, getFallbackInterface, getReceiveInterface, inputParametersDeclarationToString } from './execution/txHelper'
import { EventManager } from './eventManager'

@ -1,4 +1,4 @@
export class dummyProvider {
export class DummyProvider {
eth
debug
providers

@ -1,7 +1,7 @@
import { hexConvert, hexListFromBNs, formatMemory } from '../util'
import { normalizeHexAddress } from '../helpers/uiHelper'
import { toChecksumAddress, BN, toBuffer, } from 'ethereumjs-util'
const Web3 = require('web3')
import Web3 from 'web3'
export class Web3VmProvider {

Loading…
Cancel
Save