arrow-left

All pages
gitbookPowered by GitBook
1 of 1

Loading...

JS

arrow-up-right arrow-up-right

blzjs is a Typescript/JavaScript library that can be used to access the Bluzelle database service.

hashtag
Installation

There are two versions of the bluzelle library. bluzelle-node.js and bluzelle-js.js. By default the NodeJS version will be used.

hashtag
To use the NodeJS version

hashtag
To use the pure JS version

hashtag
To load additional Typescript definitions

hashtag
Quckstart

hashtag
Javascript

hashtag
Typescript

yarn add bluzelle
or
npm install bluzelle
REPL (interactive console)arrow-up-right
API docsarrow-up-right
Download browser version for <script> tagarrow-up-right
Examplesarrow-up-right
import { bluzele } from 'bluzelle';
or
const { bluzelle } = require('bluzelle');
import { bluzele } from 'bluzelle/lib/bluzelle-js';
or
const { bluzelle } = require('bluzelle/lib/bluzelle-js');
import {bluzelle, API, BluzelleConfig} from 'bluzelle'
import {bluzelle, API, BluzelleConfig} from 'bluzelle/lib/bluzelle-js'
const {bluzelle} = require('bluzelle');

const config = {
    mnemonic: "apology antique such ancient spend narrow twin banner coral book iron summer west extend toddler walnut left genius exchange globe satisfy shield case rose",
    endpoint: "http://testnet.public.bluzelle.com:1317",
    chain_id: 'bluzelle',
    uuid: Date.now().toString()
};

(async () => {
    const bz = await bluzelle(config);

    await bz.create("somekey", "somevalue", {'gas_price': 10})
    console.log(await bz.read("somekey"))
})();
import {bluzelle, API, BluzelleConfig} from 'bluzelle';

const config: BluzelleConfig = {
    mnemonic: "apology antique such ancient spend narrow twin banner coral book iron summer west extend toddler walnut left genius exchange globe satisfy shield case rose",
    endpoint: "http://testnet.public.bluzelle.com:1317",
    chain_id: 'bluzelle',
    uuid: Date.now().toString()
};

(async () => {
    const bz: API = await bluzelle(config);

    await bz.create("somekey", "somevalue", {'gas_price': 10})
    console.log(await bz.read("somekey"))
})();
Build Status
Coverage Status