Guidelines
- Introduction
- Installation
- Quick Start
Guides
- Introductions
- Build local test node
- Smart Contract - ABI Files
- Smart Contract——JS Contract
- Deploy Contracts
- Test Contract
- Develop DApp Client
Smart Contracts
- Contract Introduction
- ABI File
- Database
- Account Authority
- Call In-contract
- Notification
System Contracts
- Resources
- Account
- Permission
Token Contracts
- Transfer
- Token
- Token Exchange
- Contract Sub-Wallet
Node Guide
- Node Introduction
- Add to nodes network
- Node Data Persistence
Access Guide
- FO 接入安全指南
Develop DApp Client
This article uses the front-end framework of React to create a TodoList example, and call the contract to perform the data addition.
Note: This article will apply the front-end framework React. If you are not familiar with React, you may learn React first. React 。
Obtain the data
In the the file of dapp/components/app.js of the project todomvc, the getTableRows() method can be used to obtain the data.
Note: the configuration of file config.js has been completed in the previous chapter of Deployment of Contract.
1 | const FIBOS = require('fibos.js'); |
Call the contract
In the todomvc project, the dapp/components/app.js file is used to call the contract. The contract can be called by the methods of contract().
1 | fibosClient.contract(config.contract.name) |
Take data inserting as an example, call the emplacetodo method exposed in the contract, and pass in three parameters: id, text, completed. At the same time, authorization should be configured as the account of contract caller.
1 | fibosClient.contract(config.contract.name).then((contract) => { |
Conclusion
This article takes data addition as an example. For more examples of todo operations you can refer to dapp
at https://github.com/fengluo/fibos-todomvc!