Run npm install
to install all dependencies.
npm install -g ethereumjs-testrpc
.testrpc
to create an Ethereum test network with 10 accounts. Leave it running.truffle test
to execute tests. If testrpc
crashes, cross your fingers and try again.npm install
to install all dependenciesnpm install -g ethereumjs-testrpc
testrpc
to create a Ethereum test network. This should create 10 fake accounts on the network. Leave it running.truffle migrate
(try 'rm -R build' and then add a '--reset' flag if it doesn't work)src/KryptomonKore.js
following the guide below.npm run-script start
to open the react app.Run truffle console
Run:
var k = KryptomonKore.at(KryptomonKore.address); k.setCompleteFreeze(false); var me = web3.eth.accounts[0]; k.buyGenZeroEggs(4, {value: 1e18, from: me});
Have fun!
NOTE: If npm install fails, try deleting the package-lock.json and trying again.
ALSO NOTE: Double check that the kryptomon contract address is the same address that you get when you run "kryptomon.address" in truffle console (there's a 1/10^100000000000 probability that it is).
ALSO ALSO NOTE: By default, the KryptoGod is set to whatever the first account is in MetaMask.
Try the following
rm -rf build/
restart testrpc
truffle run migrate --reset
Running truffle migrate
deployed our contract to our testnet.
To make our app work we initialize the contract from the compiled ABI.
We need to keep this synced in the frontend.
build/contracts/KryptomonKore.json
abi
keysrc/index.js:19
Once the page reloads, the new contract should be up and running!
MetaMaskChecker
File source:
src/templates/misc/MetaMaskChecker.jsx
// Other imports...
import MetaMaskChecker from 'misc/MetaMaskChecker';
import { withRouter } from 'react-router-dom';
class MyClass extends React.Component {
componentDidMount() {
this.checker = MetaMaskChecker(this.props.history);
}
componentWillUnmount() {
window.clearInterval(this.checker);
}
// Other methods, like render
}
export default withRouter(MyClass);