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

scorechain-sdk

v1.0.2

Published

SDK for the Scorechain API

Downloads

12

Readme

Scorechain SDK for javascript

The goal of the Scorechain SDK for JavaScript is to simplify the integration of the Scorechain API into JavaScript applications. By providing a set of convenient functions and methods, developers can easily interact with the Scorechain API and access its features. This SDK aims to streamline the process of integrating Scorechain's blockchain analytics capabilities into JavaScript projects, enabling developers to leverage the power of Scorechain's technology with ease.

Getting Started

How to install

npm install scorechain-sdk --save

Usage

  • With Typescript
import { ScorechainConnector } from "scorechain-sdk";
const connector = new ScorechainConnector("MyScorechainApiKey");
  • With Javascript
const { ScorechainConnector } = require("scorechain-sdk")
const connector = new ScorechainConnector("MyScorechainApiKey");

All methods in the connector are wrapper for endpoints for endpoints of the Scorechain API :

  • getTransaction     Retrieve a transaction by its hash from the specified blockchain.
  • getAddress     Retrieve information about a specific address from the blockchain.
  • getTransactionScoringAnalysis     Get a real-time scoring analysis for a transaction.
  • getAddressScoringAnalysis     Get a real-time scoring analysis for a specific address.
  • getWalletScoringAnalysis     Get a real-time scoring analysis for a wallet.
  • feedTransaction     Feed a transaction for analysis by risk scenarios.
  • feedWithdrawal     Feed a not approved withdrawal for analysis by risk scenarios.

Example

Here is a simple example to send a transaction to the Transaction Monitoring System

const connector = new ScorechainConnector("MyScorechainApiKey")
const txid = "0x308b22a8e0e9e4e7d1b9fd1dfab74d7b37325b255e566f4d81edd457937c5e0c"
const address = "0x9f5A8089ecF94d3D4D7A53025d993E0cc29e2c5f"

connector.feedTransaction(txid, BlockchainEnum.ETHEREUM, ScoringDirection.INCOMING, address)

Here is a simple example of an address screening that you can call after detecting a deposit.

import { BlockchainEnum, ScorechainConnector, ScoringAnalysisType, SeverityEnum } from "scorechain-sdk";

(async () => {
    const connector = new ScorechainConnector("MyScorechainApiKey")
    const txid="0x308b22a8e0e9e4e7d1b9fd1dfab74d7b37325b255e566f4d81e7937c5e0c"
    const tx = await connector.getTransaction(txid, BlockchainEnum.ETHEREUM);
    const addressScore = await connector.getAddressScoringAnalysis(
        tx.operations[0].destinations[0].address,
        BlockchainEnum.ETHEREUM,
        "MAIN",
        ScoringAnalysisType.INCOMING,
        6
    );
    const severity = Object.keys(addressScore.analysis).reduce(
        (acc, analysis) => {
            if (addressScore.analysis[analysis]?.result?.score === addressScore.lowestScore) {
                acc = addressScore.analysis[analysis].result.severity;
            }
            return acc;
        },
        SeverityEnum.UNDEFINED_RISK
    )

    if (severity !== SeverityEnum.CRITICAL_RISK && severity !== SeverityEnum.HIGH_RISK) {
        console.log("Transaction is safe");
    } else {
        console.log("Transaction is risky");
    }
})()