Created
November 8, 2017 06:50
-
-
Save ricomonster/88baecd59858690a1d79d5ab8a6e0c72 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// reference: https://gist.github.com/ricomonster/24a18b8f01d0b44dec22e0bb29b23d3a | |
import tokenContract from 'token.js'; | |
const contract = new web3.eth.Contract(tokenContract.tokenABI); | |
contract.deploy({ | |
data: '0x' + tokenContract.tokenBytecode, | |
arguments: [form.token.supply, form.token.name, form.token.symbol] | |
}) | |
.send({ | |
from: this.state.form.address, | |
gas: 21000 | |
}, (error, transactionHash) => { | |
console.log('TX hash', transactionHash); | |
}) | |
.on('error', (error) => { | |
console.log('err', error); | |
}) | |
.on('transactionHash', (transactionHash) => { | |
console.log('tx', transactionHash); | |
}) | |
.on('receipt', function(receipt){ | |
console.log(receipt.contractAddress) | |
}) | |
.on('confirmation', function(confirmationNumber, receipt){ | |
console.log('num', confirmationNumber); | |
console.log('rp', receipt); | |
}) | |
.then(function(newContractInstance){ | |
console.log(newContractInstance.options.address) | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment