diff --git a/src/App.js b/src/App.js index f41eb76..4209d5c 100644 --- a/src/App.js +++ b/src/App.js @@ -109,9 +109,9 @@ class App extends Component { console.log(isValid); if(Number(isValid) !== 1){ this.setState({loading:false}); - const invalidKeyMsg = `The key is invalid initial Key
- or you're connect to incorrect chain!
- Please make sure you have loaded correct initial key in Metamask.

+ const invalidKeyMsg = `The key is an invalid Initial key
+ or you're connected to the incorrect chain!
+ Please make sure you have loaded correct Initial key in MetaMask.

Your current selected key is ${initialKey}
Current Network ID is ${this.state.web3Config.netId}` swal({ @@ -156,7 +156,7 @@ class App extends Component { let content = document.createElement("div"); let msg; if (error.message.includes(constants.userDeniedTransactionPattern)) - msg = `Error: User ${constants.userDeniedTransactionPattern}` + msg = `Error: ${constants.userDeniedTransactionPattern}` else msg = error.message content.innerHTML = `
diff --git a/src/keysManager.js b/src/keysManager.js index d8710e1..be7ff08 100644 --- a/src/keysManager.js +++ b/src/keysManager.js @@ -1,6 +1,7 @@ import Web3 from 'web3'; import addressGenerator from './addressGenerator'; import helpers from "./helpers"; +import { constants } from "./constants"; export default class KeysManager { async init({web3, netId, addresses}){ @@ -12,6 +13,7 @@ export default class KeysManager { const KeysManagerAbi = await helpers.getABI(branch, 'KeysManager') this.keysInstance = new this.web3_10.eth.Contract(KeysManagerAbi, KEYS_MANAGER_ADDRESS); + this.netId = netId; } async isInitialKeyValid(initialKey) { @@ -34,9 +36,12 @@ export default class KeysManager { async generateKeys() { return await addressGenerator(); } + createKeys({mining, voting, payout, sender}){ - const gasPrice = this.web3_10.utils.toWei('2', 'gwei') - return this.keysInstance.methods.createKeys(mining, voting, payout).send({from: sender, gasPrice}) + let gasPrice = this.web3_10.utils.toWei('2', 'gwei'); + if (this.netId === constants.NETID_DAI_TEST || this.netId === constants.NETID_DAI) { + gasPrice = 0; + } + return this.keysInstance.methods.createKeys(mining, voting, payout).send({from: sender, gasPrice}); } - } \ No newline at end of file