Chrome Plugin
Integrating the Google Chrome Cyano wallet plugin
Last updated
Was this helpful?
Integrating the Google Chrome Cyano wallet plugin
Last updated
Was this helpful?
Before using the , it is necessary to first install and implement a wallet that has the dAPI provider
functionality built into it, for e.g., .
The dAPI
can be implemented using TypeScript
, and can also be used in JavaScript
programs.
Some of the more popular usage channels of dApps
, apart from opening the dApp
in the Chrome
browser, also consist of launching the dApp
from withing the mobile wallet. The access scheme for opening a dApp
in the wallet is illustrated .
Here is a step by step guide to assist developers with the integration process:
Before starting with the actual development process, do ensure that the following tools are installed and set-up on your local machine.
Node.js v6+ (LTS with npm) -
Google Chrome -
Cyano Wallet Chrome Plugin -
Git -
Next, we can install Ontology's dAPI
. While building dApps
, this dAPI
serves as one of the core APIs that allow us to communicate with the chain. The source code can be downloaded . To carry out the installation using npm
, use the following shell command:
Creating a dAPI
instance involves importing and registering the client-side, as such:
Once a dAPI
instance is created successfully, dAPI
methods can be used in a given dApp
.
Follow the link below to refer to a demo dApp
that utilizes the dAPI
methods mentioned above.
Every transaction that takes place on the chain includes a gaslimit
and gasprice
.
gasprice
has a correlation with the amount of standby time while the given transaction is packaged. Currently, the lowest value of gasprice
is 500 units on the TestNet and MainNet.
The gaslimit
of deployment contracts is set based on the complexity of smart contract's execution process. The minimum gaslimit
value of a contract can be determined before deploying it by carrying out a pre-execution. The default gaslimit
value of native
contracts is 20000, while that of deployment contracts is usually higher than 20000000 units, generally speaking.
The Chrome plugin Cyano
wallet only accepts addresses in ByteArray
format when importing addresses. While testing smart contracts in SmartX
, the IDE automatically converts addresses to ByteArray
format. So, there will be no address related issues during the deployment phase. However, in the developer's local environment, if the conversion is not carried out manually, the system will return an error.
The following method can be used to convert addresses to ByteArray
format in JavaScript:
For a comprehensive list of all the available dAPI
methods, please refer to the .