GithubHelp home page GithubHelp logo

luckystarz007 / blockscanchat-sdk Goto Github PK

View Code? Open in Web Editor NEW

This project forked from blockscan/blockscanchat-sdk

0.0 0.0 0.0 171 KB

NPM Package for Blockscan Chat APIs

License: MIT License

Shell 0.31% JavaScript 99.69%

blockscanchat-sdk's Introduction

Blockscan Chat SDK

A Blockscan Chat API wrapper written in NodeJS

Prerequisites

Set Up

  1. Install this package in your project directory
npm i blockscanchat-sdk
  1. Ensure the "type" parameter in the package.json of your project's root directory is set to "module"
...
  "type": "module",
...

Usage

  1. Import the package to your project
import BlockscanChat from 'blockscanchat-sdk'; 
  1. Initalize the SDK by passing in the Blockscan API_KEY and API_URL parameters specified as your environment variables
BlockscanChat.init(api_key, api_url)
  1. Generally, for all methods, the calling convention is
BlockscanChat.<MODULE_NAME>('METHOD_NAME', {PARAMETERS})

Example (if method does not require parameters):

BlockscanChat.message('getLocalMsgCount')

Example (if method requires parameters):

BlockscanChat.message('getExternalMsgCount', {address: 'EXTERNAL_WALLET_ADDRESS'})

MESSAGE ENDPOINT

getLocalMsgCount

Gets unread message count of your apikey address

Parameters: None
Usage:

BlockscanChat.message('getLocalMsgCount')

getExternalMsgCount

Gets unread message count of external address (you must have additional apikey permissions)

Parameters:

  • address (REQUIRED) -> Address you want to check the number of messages for
    Usage:
BlockscanChat.message('getExternalMsgCount', {address: 'WALLET_ADDRESS'})

getFirstMsgId

Gets the First Message ID

Parameters: None
Usage:

BlockscanChat.message('getFirstMsgId')

getLastMsgId

Gets the Last Message ID

Parameters: None
Usage:

BlockscanChat.message('getLastMsgId')

getAllMsg

Gets unread message count of your apikey address

Parameters:

  • startID (OPTIONAL) -> Integer message ID to start searching for chats
  • offset (OPTIONAL) -> Number of chats displayed per page, maximum is 100
  • cType (OPTIONAL) -> Chat Type, 0 = All, 1 = Incoming Messages, 2 = Outgoing Messages

Usage:

No parameters

BlockscanChat.message('getAllMsg')

With parameters

BlockscanChat.message('getAllMsg', {startID: 539070, offset: 99, cType: 2})

sendMsg

Sends a message to a wallet address

Parameters:

  • address (REQUIRED) -> Address you want to send the message to
  • message (REQUIRED) -> Message you want to sent to that address

Usage:

BlockscanChat.message('sendMsg', {address: 'TARGET_ADDRESS', message: 'YOUR_MESSAGE'})

markAllMsgAsRead

All messages with a particular address will be marked as read

Parameters:

  • address (REQUIRED) -> The address with which you want to mark the messages as read
    Usage:
BlockscanChat.message('markAllMsgAsRead', {address: 'WALLET_ADDRESS'})

blockscanchat-sdk's People

Contributors

0xyudhishthra avatar homeyong avatar wchuan11 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.