Of course you have the web3 object and the privateKey so you can do ton with that, but there are also a bunch of other helpers and injected data.
The first thing you will want to do is load in your contracts using the contractLoader()function:
YourContract: this.props.contractLoader("YourContract")
Once your contract is loaded into the state, now you can perform transactions on it from the frontend:
tx()
The tx() function is a nice abstraction for making transactions.
this.props.tx(this.state.YourContract.updateVar(name),120000,0,0,(result)=>)
Notice that to make a transaction on a contract you just pass the contract call with arguments into the tx function. The extra numbers there are things like gas, message value, etc.
send()
The send() function is an easy way to send funds to another address.
this.props.send(toAddress, amount, 120000,"0x00", (result) => )
Events
Dapparatus provides an Events object to follow specific events of a contract and trigger an onUpdate() function when new events happen. In the template module, we are listening for the user to sign a message and put it on chain.
Deployment
If your contract is already deployed you can enter the address and abi in the src/contracts/ folder. But, you can also empower the user to deploy their own version of the contract too. Take a look at the deployYourContract() function.
let code = require("../contracts/YourContract.bytecode.js")
this.props.tx(this.state.YourContract._contract.deploy(),640000,(receipt)=>)
})
Interval
You’ll notice there is a pollInterval() function that is reading from multiple chains. This is a great place to read from your contract or grab other data periodically:
let yourVar = await this.state.YourContract.YourVar().call()
let yourContractBalance = await this.props.web3.eth.getBalance(0x..)
#BUIDL
For there you should hopefully have everything you need to build a module into the Burner . Connect your contract, wire up some UI, and let’s get it deployed to production!
Emojicoin.Exchange
An example of extending the beyond sending and receiving is . This is a UX study where I created a small shitcoin exchange within a white labeled burner . Onboarding was through the roof and a simple game can be built in an afternoon:
Feedback
Take some time to build out your module and feel free to hit me up. I think this will be a little bit of an iterative process to get everything we need.
Feel free to him me up on Twitter/Telegram: @austingriffith
Troubleshooting
Refer to the repo first:
If you have problems with Clevis:
If you have problems with Dapparatus:
Feel free to him me up on Twitter/Telegram: @austingriffith
Published at Thu, 18 Apr 2019 14:03:02 +0000