Unverified Commit 29df5bbb authored by yann300's avatar yann300 Committed by GitHub

Merge pull request #1208 from ethereum/removeRuntxDependencies

Remove udapp dependency from remix-lib
parents b9fd3ad8 aeb8a5da
...@@ -26,10 +26,10 @@ jobs: ...@@ -26,10 +26,10 @@ jobs:
- checkout - checkout
- restore_cache: - restore_cache:
keys: keys:
- dep-bundle-5-{{ checksum "package.json" }} - dep-bundle-6-{{ checksum "package.json" }}
- run: npm install - run: npm install
- save_cache: - save_cache:
key: dep-bundle-5-{{ checksum "package.json" }} key: dep-bundle-6-{{ checksum "package.json" }}
paths: paths:
- ~/repo/node_modules - ~/repo/node_modules
- run: npm run lint && npm run test && npm run downloadsolc && npm run make-mock-compiler && npm run build - run: npm run lint && npm run test && npm run downloadsolc && npm run make-mock-compiler && npm run build
...@@ -46,10 +46,10 @@ jobs: ...@@ -46,10 +46,10 @@ jobs:
- checkout - checkout
- restore_cache: - restore_cache:
keys: keys:
- dep-bundle-5-{{ checksum "package.json" }} - dep-bundle-6-{{ checksum "package.json" }}
- run: npm install - run: npm install
- save_cache: - save_cache:
key: dep-bundle-5-{{ checksum "package.json" }} key: dep-bundle-6-{{ checksum "package.json" }}
paths: paths:
- ~/repo/node_modules - ~/repo/node_modules
- run: npm run build_debugger - run: npm run build_debugger
...@@ -60,4 +60,4 @@ workflows: ...@@ -60,4 +60,4 @@ workflows:
build_all: build_all:
jobs: jobs:
- remix-ide - remix-ide
- remix-debugger - remix-debugger
\ No newline at end of file
...@@ -281,10 +281,10 @@ function contractDropdown (events, appAPI, appEvents, instanceContainer) { ...@@ -281,10 +281,10 @@ function contractDropdown (events, appAPI, appEvents, instanceContainer) {
var constructor = txHelper.getConstructorInterface(selectedContract.contract.object.abi) var constructor = txHelper.getConstructorInterface(selectedContract.contract.object.abi)
var args = createButtonInput.value var args = createButtonInput.value
txFormat.buildData(selectedContract.name, selectedContract.contract.object, appAPI.getContracts(), true, constructor, args, appAPI.udapp(), (error, data) => { txFormat.buildData(selectedContract.name, selectedContract.contract.object, appAPI.getContracts(), true, constructor, args, (error, data) => {
if (!error) { if (!error) {
appAPI.logMessage(`creation of ${selectedContract.name} pending...`) appAPI.logMessage(`creation of ${selectedContract.name} pending...`)
txExecution.createContract(data, appAPI.udapp(), (error, txResult) => { appAPI.udapp().createContract(data, (error, txResult) => {
if (!error) { if (!error) {
var isVM = executionContext.isVM() var isVM = executionContext.isVM()
if (isVM) { if (isVM) {
...@@ -306,6 +306,9 @@ function contractDropdown (events, appAPI, appEvents, instanceContainer) { ...@@ -306,6 +306,9 @@ function contractDropdown (events, appAPI, appEvents, instanceContainer) {
} }
}, (msg) => { }, (msg) => {
appAPI.logMessage(msg) appAPI.logMessage(msg)
}, (data, runTxCallback) => {
// called for libraries deployment
appAPI.udapp().runTx(data, runTxCallback)
}) })
} }
......
...@@ -162,7 +162,7 @@ UniversalDApp.prototype.call = function (isUserAction, args, value, lookupOnly, ...@@ -162,7 +162,7 @@ UniversalDApp.prototype.call = function (isUserAction, args, value, lookupOnly,
logMsg = `call to ${args.contractName}.${(args.funABI.name) ? args.funABI.name : '(fallback)'}` logMsg = `call to ${args.contractName}.${(args.funABI.name) ? args.funABI.name : '(fallback)'}`
} }
} }
txFormat.buildData(args.contractName, args.contractAbi, self.contracts, false, args.funABI, value, self, (error, data) => { txFormat.buildData(args.contractName, args.contractAbi, self.contracts, false, args.funABI, value, (error, data) => {
if (!error) { if (!error) {
if (isUserAction) { if (isUserAction) {
if (!args.funABI.constant) { if (!args.funABI.constant) {
...@@ -171,7 +171,7 @@ UniversalDApp.prototype.call = function (isUserAction, args, value, lookupOnly, ...@@ -171,7 +171,7 @@ UniversalDApp.prototype.call = function (isUserAction, args, value, lookupOnly,
self._api.logMessage(`${logMsg}`) self._api.logMessage(`${logMsg}`)
} }
} }
txExecution.callFunction(args.address, data, args.funABI, self, (error, txResult) => { self.callFunction(args.address, data, args.funABI, (error, txResult) => {
if (!error) { if (!error) {
var isVM = executionContext.isVM() var isVM = executionContext.isVM()
if (isVM) { if (isVM) {
...@@ -194,6 +194,37 @@ UniversalDApp.prototype.call = function (isUserAction, args, value, lookupOnly, ...@@ -194,6 +194,37 @@ UniversalDApp.prototype.call = function (isUserAction, args, value, lookupOnly,
} }
}, (msg) => { }, (msg) => {
self._api.logMessage(msg) self._api.logMessage(msg)
}, (data, runTxCallback) => {
// called for libraries deployment
self.runTx(data, runTxCallback)
})
}
/**
* deploy the given contract
*
* @param {String} data - data to send with the transaction ( return of txFormat.buildData(...) ).
* @param {Function} callback - callback.
*/
UniversalDApp.prototype.createContract = function (data, callback) {
this.runTx({data: data, useCall: false}, (error, txResult) => {
// see universaldapp.js line 660 => 700 to check possible values of txResult (error case)
callback(error, txResult)
})
}
/**
* call the current given contract
*
* @param {String} to - address of the contract to call.
* @param {String} data - data to send with the transaction ( return of txFormat.buildData(...) ).
* @param {Object} funAbi - abi definition of the function to call.
* @param {Function} callback - callback.
*/
UniversalDApp.prototype.callFunction = function (to, data, funAbi, callback) {
this.runTx({to: to, data: data, useCall: funAbi.constant}, (error, txResult) => {
// see universaldapp.js line 660 => 700 to check possible values of txResult (error case)
callback(error, txResult)
}) })
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment