@cerbymask/cerbymask-lib v1.0.12
🔥 Install
$ npm install @cerbymask/cerbymask-lib
🐺 Getting Started
This library is a wrapper to the object window.cerbymask
that is made available in webpage load time.
⚡ Install dependencies
After cloning the project, navigate to the root folder and run:
$ npm install
⚡ Build
In order to build the extension, execute:
$ npm run build
🎄 API
The following table describes the interface containing the functions which are injected in runtime - these functions are accessible by simply using the instance of window.cerbymask
⚡ Callbacks
Every function call returns an event in case the specific function/method has been fully performed - e.g. onClientConnect
is called once the user has allowed the web application to connect()
. These events are emitted using NodeJS Event Emitter
⚡ Middleware
In case the web applications performs a function call without having explicit permission, the background worker replies back with false
as response.
Checkout an example here.
⚡ Functions
Function | Event Callback | Description |
---|---|---|
connect | onClientConnect | Performs a request to the extension to allow the current client to communicate to the background worker |
validateWallet | onValidateWallet | Validate if the user contains a wallet, we recommend to display 'Connect' whenever validation returns false |
submitTransaction | onApproveTransaction | Perform a transaction via CerbyMask |
getPublicAddresses | onPublicAddresses | Get client available public addresses |
events | - | NodeJS Event Emitter object where you attach .on("<event callback>") from previous function calls |