From f8aec7571ff7de692befa581c72b6d0039fdb01f Mon Sep 17 00:00:00 2001 From: Nicolas Gotchac Date: Wed, 15 Mar 2017 16:49:26 +0100 Subject: [PATCH] Use the registry fee in Token Deployment dapp (#4915) --- .../Deploy/Deployment/deployment.js | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/js/src/dapps/tokendeploy/Deploy/Deployment/deployment.js b/js/src/dapps/tokendeploy/Deploy/Deployment/deployment.js index 0872c992f..51dcd2f5b 100644 --- a/js/src/dapps/tokendeploy/Deploy/Deployment/deployment.js +++ b/js/src/dapps/tokendeploy/Deploy/Deployment/deployment.js @@ -253,23 +253,28 @@ export default class Deployment extends Component { onDeploy = () => { const { managerInstance, registryInstance, tokenregInstance } = this.context; - const { base, deployBusy, globalReg, globalFee, name, nameError, tla, tlaError, totalSupply, totalSupplyError } = this.state; + const { base, deployBusy, globalReg, name, nameError, tla, tlaError, totalSupply, totalSupplyError } = this.state; const hasError = !!(nameError || tlaError || totalSupplyError); if (hasError || deployBusy) { return; } - const tokenreg = (globalReg ? tokenregInstance : registryInstance).address; + const registry = globalReg ? tokenregInstance : registryInstance; + const tokenreg = registry.address; + const values = [base.mul(totalSupply), tla, name, tokenreg]; - const options = { - value: globalReg ? globalFee : 0 - }; + const options = {}; this.setState({ deployBusy: true, deployState: 'Estimating gas for the transaction' }); - return api.parity - .defaultAccount() + return registry.fee.call({}, []) + .then((fee) => { + console.log('deploying with fee of', fee.toFixed()); + options.value = fee; + + return api.parity.defaultAccount(); + }) .then((defaultAddress) => { options.from = defaultAddress;