diff --git a/embark-ui/src/actions/index.js b/embark-ui/src/actions/index.js index 54f7716b..a901dd07 100644 --- a/embark-ui/src/actions/index.js +++ b/embark-ui/src/actions/index.js @@ -113,14 +113,14 @@ export const contractFile = { export const CONTRACT_FUNCTION = createRequestTypes('CONTRACT_FUNCTION'); export const contractFunction = { - post: (contractName, method, inputs) => action(CONTRACT_FUNCTION[REQUEST], {contractName, method, inputs}), + post: (contractName, method, inputs, gasPrice) => action(CONTRACT_FUNCTION[REQUEST], {contractName, method, inputs, gasPrice}), success: (result, payload) => action(CONTRACT_FUNCTION[SUCCESS], {contractFunctions: [{...result, ...payload}]}), failure: (error) => action(CONTRACT_FUNCTION[FAILURE], {error}) }; export const CONTRACT_DEPLOY = createRequestTypes('CONTRACT_DEPLOY'); export const contractDeploy = { - post: (contractName, method, inputs) => action(CONTRACT_DEPLOY[REQUEST], {contractName, method, inputs}), + post: (contractName, method, inputs, gasPrice) => action(CONTRACT_DEPLOY[REQUEST], {contractName, method, inputs, gasPrice}), success: (result, payload) => action(CONTRACT_DEPLOY[SUCCESS], {contractDeploys: [{...result, ...payload}]}), failure: (error) => action(CONTRACT_DEPLOY[FAILURE], {error}) }; diff --git a/embark-ui/src/components/ContractFunctions.js b/embark-ui/src/components/ContractFunctions.js index 47383689..5c3a9c26 100644 --- a/embark-ui/src/components/ContractFunctions.js +++ b/embark-ui/src/components/ContractFunctions.js @@ -15,13 +15,17 @@ class ContractFunction extends Component { this.state = {inputs: {}}; } + static isPureCall(method) { + return (method.mutability === 'view' || method.mutability === 'pure'); + } + buttonTitle() { const {method} = this.props; if (method.name === 'constructor') { return 'Deploy'; } - return (method.mutability === 'view' || method.mutability === 'pure') ? 'Call' : 'Send'; + return ContractFunction.isPureCall(method) ? 'Call' : 'Send'; } inputsAsArray() { @@ -38,7 +42,7 @@ class ContractFunction extends Component { handleCall(e) { e.preventDefault(); - this.props.postContractFunction(this.props.contractProfile.name, this.props.method.name, this.inputsAsArray()); + this.props.postContractFunction(this.props.contractProfile.name, this.props.method.name, this.inputsAsArray(), this.state.inputs.gasPrice * 1000000000); } callDisabled() { @@ -59,6 +63,11 @@ class ContractFunction extends Component {