API for dApps on DAD blockchain. This is an implementation of dAPI from OEP-6 communication protocol.
The library is written in TypeScript, so all the methods and objects are typed. It is therefore usable in TypeScript projects as well as vanilla JavaScript projects.
dad-dapi can be used as CommonJS/ES6 module or directly referencing in web page html.
npm install dad-dapi
var client = require('dad-dapi').client;
import { client } from 'dad-dapi';
The browser.js file under the '/lib' folder needs to be referenced from the page:
<script src="/sitelet?url=https%3A%2F%2Fgithub.com%2FDAD-Chain%2Flib%2Fbrowser.js"></script>
The use of the code is required under the global namespace of DAD.
var client = dApi.client;
dApp needs to register itself as a client with the dad-dapi library to enable the communication.
import { client } from 'dad-dapi';
client.registerClient({});
- Node
- Npm
Execute these commands in the project's root directory:
git clone 'https://github.com/DAD-Chain/dad-dapi.git'
cd dad-dapi
npm install
This will build the project with minimum polyfilling for better debug experience.
npm run build:dev
You will get the packaged code under '/lib'.
npm run build:prod
You will get the packaged code under '/lib'
- TypeScript - Used language
- Node.js - JavaScript runtime for building