npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

mzaalosdk

v1.3.8

Published

library to send events to mzaalo blockchain service

Downloads

17

Readme

Updates for version 1.3.6

  1. Bug fixes for submitting event when token already exists.

Mzaalo SDK for JavaScript

This repository allows to use the functions of Mzaalo Blockchain Service by connecting it with your backend application.

Installation

npm install mzaalosdk

Usage

  1. Include the library and create the MzaaloSdk object environment can be "staging" or "production"
const config = require("./config.json")
const MzaaloSdkService= require('./src/service/mzaalosdk_service')

mzaalo = new MzaaloSdkService(apiKey, organization,config, environment)

//initialise mzaalo
mzaalo.initializeSDK()

//config can be set like blank object as well

//api key is organisations api key obtained while registering the organisation
  1. To send an event to Mzaalo servers
mzaalo.call_event(userId, eventType, metadata)

Use this function to submit events to mzaalo blockchain service.

Params

  • userId- The accepted userID type is string and is the userId as per sender's records
  • eventType- The accepted eventType is string and is as per the sender's configurations in rules core
  • organizationId- The accepted organisationId is string and is as per the organisation Id provided to the sender
  • metadata- This is optional but is custom payload that can be used by sender for further analysis of users

This is an async function which returns status of event submission as a promise

Algo Service

Functions

  • get_balance: To get balance for an account

    mzaalo.get_balance(userId)

    Params:

    • userId - The accepted type is string .
  • get_transactions: To get transactions

    mzaalo.get_transactions(userId)

    Params:

    • userId- The accepted type is string .

Rule Service

Functions

  • create_rule : To create a new rule

    mzaalo.create_rule(rule, name, description)

    Params:

    • rule - The accepted type is string .
    • name - The accepted type is string .
    • description - The accepted type is string .
  • get_rule : To get created rule

    mzaalo.get_rule(rule_id)

    Params:

    • rule_id - The accepted type is string .
  • update_rule : To update a rule

    mzaalo.update_rule(rule_id, rule)

    Params:

    • rule_id - The accepted type is string .

Event-rule Service

Functions

  • create_event_rule : To create an event rule

    mzaalo.create_event_rule(rule_id, event_type)

    Params:

    • rule_id - The accepted type is array of valid rule-id .
    • event_type - The accepted type is string.
  • get_event_rule : To get created event rule

    mzaalo.get_event_rule(event_type)

    Params:

    • event_type - The accepted type is string .

Errors

  1. Config error
ReferenceError: config is not defined

Please create a config file as per provided

  1. Default configuration error
{
  error: 'Unable to fetch default configuration',
  ......

Please check whether you are able to access the url provided in response of error and make sure it is accessible from your run time environment

  1. Default configuration url missing
default configuration Url Missing

Please check the configuration url

  1. Error in getting token
FAILED_TO_REGENERATE_TOKEN

Token url may not be getting valid api key

  1. If there is some error in Mzaalo object initialisation then you will get the error as below
Instance not initialized

Url may not be working at all

  1. Error in token url
ERROR_GETTING_TOKEN_URL
  1. Error in inputs type in event submission function
INPUT_TYPE_ERROR
  1. Token generation error
FAILED_TO_REGENERATE_TOKEN
  1. Any other major error
SDK_ERROR