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

@xuperchain/xuper-sdk

v2.4.0

Published

A simple JS(TS) SDK for XuperOS

Downloads

8

Readme

Xuper SDK JS

Build Status npm version

Xuper SDK (JS/TS) is a software development kit that allows developers to quickly use XuperChain.

The SDK provides a service interface that includes account, transaction, contract and various query functions. It can be used in a browser and Nodejs environment.


English | 简体中文

Usage

Install Npm package

npm install --save @xuperchain/xuper-sdk

Quick start

import XuperSDK from '@xuperchain/xuper-sdk';

const node = ''; // node
const chain = ''; // chain

const xsdk = XuperSDK.getInstance({
    node,
    chain
});

const start = async () => {
    const result = await xsdk.getBlockChains();
    console.log(result);
};

start();

Details - API reference

Code examples

Edit xuper-sdk-demo

Environments

  • Browser depends on window.crypto
  • Nodejs >= v10.0
In the Nodejs environment, gRPC is supported and used by default, you can choose to close it, and still use Http to request
XuperSDK.getInstance({
    ...,
    env: {
        node: {
            disableGRPC: true // disable gRPC
        }
    }
})

How to build a test environment

Read the documentation , compile and deploy XuperChain

Use XuperChain Docker image to build a single-node service

  1. Pull image (XuperChian v3.7 - Repository)

docker pull smilingxinyi/xuperchain

  1. Start container

docker run -d -p 8098:8098 -p 37101:37101 -p 47101:47101 --name xc smilingxinyi/xuperchain

API reference documentation

Link

Services

Account

service|name|link|state ---|---|---|:---: Create account|create|LINK|√ Retrieve account|retrieve|LINK|√ Import private key|import|LINK|√ Export private key|export|LINK|√ Chekc address|checkAddress|LINK|√ Check mnemonic|checkMnemonic|LINK|√ Balance|getBalance|LINK|√ Balance Detail|getBalanceDetail|LINK|√

Blockchain infomation

service|name|link|state ---|---|---|:---: Blockchains|getBlockChains|LINK|√ Status|checkStatus|LINK|√ Block by id|getBlockById|LINK|√ Block by height|getBlockByHeight|LINK|√

Transaction

service|name|link|state ---|---|---|:---: Make transfer|transfer|LINK|√ Post tx|postTransaction|LINK|√ Query tx|queryTransaction|LINK|√

Contract

service|name|link|state ---|---|---|:---: New contract account|createContractAccount|LINK|√ Contract list|getContracts|LINK|√ Deploy Wasm contract|deployWasmContract|LINK|√ Invoke Wasm contarct|invokeContarct|LINK|√ Deploy Solidity contract|deploySolidityContract|LINK|√ Invoke Solidity contarct|invokeSolidityContarct|LINK|√ Deploy Native contract|deployNativeContract|LINK|√ Invoke Native contarct|invokeContarct|LINK|√ Query ACL|queryACL|LINK|√ Query stat data about contract|queryContractStatData|LINK|√

Plugin

Endorsement service plugin

The plugin must be used on the public network

EndorsementPlugin

Example:


const params = {
    server: process.env.ENDORSE_SERVER, // ip, port
    fee: process.env.FEE, // fee
    endorseServiceCheckAddr: process.env.SERVICE_SIGN_ADDRESS, // sign address
    endorseServiceFeeAddr: process.env.SERVICE_FEE_ADDRESS // fee address
}

const xsdk = new XuperSDK({
    node,
    chain,
    plugins: [
        EndorsementPlugin({
            transfer: params,
            makeTransaction: params
        })
    ]
});