|
|
@ -1,7 +1,7 @@ |
|
|
|
import { execution } from '@remix-project/remix-lib' |
|
|
|
import { execution, Transaction } from '@remix-project/remix-lib' |
|
|
|
const TxExecution = execution.txExecution |
|
|
|
const TxExecution = execution.txExecution |
|
|
|
|
|
|
|
|
|
|
|
function runCall (payload, from, to, data, value, gasLimit, txRunner, callbacks, callback) { |
|
|
|
function runCall ({ from, to, data, value, gasLimit, signed }: Transaction, txRunner, callbacks, callback) { |
|
|
|
const finalCallback = function (err, result) { |
|
|
|
const finalCallback = function (err, result) { |
|
|
|
if (err) { |
|
|
|
if (err) { |
|
|
|
return callback(err) |
|
|
|
return callback(err) |
|
|
@ -9,10 +9,10 @@ function runCall (payload, from, to, data, value, gasLimit, txRunner, callbacks, |
|
|
|
return callback(null, result) |
|
|
|
return callback(null, result) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TxExecution.callFunction(from, to, data, value, gasLimit, { constant: true }, txRunner, callbacks, finalCallback) |
|
|
|
TxExecution.callFunction({ from, to, data, value, gasLimit, signed }, { constant: true }, txRunner, callbacks, finalCallback) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function runTx (payload, from, to, data, value, gasLimit, txRunner, callbacks, callback) { |
|
|
|
function runTx ({ from, to, data, value, gasLimit, signed }: Transaction, txRunner, callbacks, callback) { |
|
|
|
const finalCallback = function (err, result) { |
|
|
|
const finalCallback = function (err, result) { |
|
|
|
if (err) { |
|
|
|
if (err) { |
|
|
|
return callback(err) |
|
|
|
return callback(err) |
|
|
@ -20,10 +20,10 @@ function runTx (payload, from, to, data, value, gasLimit, txRunner, callbacks, c |
|
|
|
callback(null, result) |
|
|
|
callback(null, result) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TxExecution.callFunction(from, to, data, value, gasLimit, { constant: false }, txRunner, callbacks, finalCallback) |
|
|
|
TxExecution.callFunction({ from, to, data, value, gasLimit, signed }, { constant: false }, txRunner, callbacks, finalCallback) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function createContract (payload, from, data, value, gasLimit, txRunner, callbacks, callback) { |
|
|
|
function createContract ({ from, data, value, gasLimit, signed }: Transaction, txRunner, callbacks, callback) { |
|
|
|
const finalCallback = function (err, result) { |
|
|
|
const finalCallback = function (err, result) { |
|
|
|
if (err) { |
|
|
|
if (err) { |
|
|
|
return callback(err) |
|
|
|
return callback(err) |
|
|
@ -31,11 +31,11 @@ function createContract (payload, from, data, value, gasLimit, txRunner, callbac |
|
|
|
callback(null, result) |
|
|
|
callback(null, result) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
TxExecution.createContract(from, data, value, gasLimit, txRunner, callbacks, finalCallback) |
|
|
|
TxExecution.createContract({ from, data, value, gasLimit, signed }, txRunner, callbacks, finalCallback) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
export function processTx (txRunnerInstance, payload, isCall, callback) { |
|
|
|
export function processTx (txRunnerInstance, payload, isCall, callback) { |
|
|
|
let { from, to, data, input, value, gas } = payload.params[0] // eslint-disable-line
|
|
|
|
let { from, to, data, input, value, gas, signed } = payload.params[0] // eslint-disable-line
|
|
|
|
gas = gas || 3000000 |
|
|
|
gas = gas || 3000000 |
|
|
|
|
|
|
|
|
|
|
|
const callbacks = { |
|
|
|
const callbacks = { |
|
|
@ -54,10 +54,10 @@ export function processTx (txRunnerInstance, payload, isCall, callback) { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (isCall) { |
|
|
|
if (isCall) { |
|
|
|
runCall(payload, from, to, data||input, value, gas, txRunnerInstance, callbacks, callback) |
|
|
|
runCall({ from, to, data: data||input, value, gasLimit: gas, signed }, txRunnerInstance, callbacks, callback) |
|
|
|
} else if (to) { |
|
|
|
} else if (to) { |
|
|
|
runTx(payload, from, to, data||input, value, gas, txRunnerInstance, callbacks, callback) |
|
|
|
runTx({ from, to, data: data||input, value, gasLimit: gas, signed }, txRunnerInstance, callbacks, callback) |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
createContract(payload, from, data||input, value, gas, txRunnerInstance, callbacks, callback) |
|
|
|
createContract({ from, to: undefined, data: data||input, value, gasLimit: gas, signed }, txRunnerInstance, callbacks, callback) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|