Within the constructor, we set the app name and define the following state parameters:
- mnemonic: The mnemonic used to generate the root node address of the HD wallet
- accounts: A list of merchant's HD wallet addresses
- acc: The merchant account address for which the app is displaying transactions in the WalletTrans component
- transactions: All transactions to date for the merchant address mapped to acc
We also bind the getAccountTransactions method so the child components can change the state, as shown here:
class App extends Component {
constructor(){
super();
this.appName = 'Merchant Wallet';
this.getAccountTransactions = this.getAccountTransactions.bind(this);
this.state = {
acc: null,
accounts: [],
transactions: [],
mnemonic: Mnemonic
};
}
Let's have a look at the methods that load after the main component mounts next.