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

fork1-polymathnetwork-polymesh-sdk

v12.0.0

Published

High-level API to interact with the Polymesh blockchain

Downloads

1

Readme

semantic-release js-semistandard-style Coverage

@polymathnetwork/polymesh-sdk

Polymesh version

This release is compatible with Polymesh v4.0.0

Getting Started

Purpose

The Polymesh SDK's main goal is to provide external developers with a set of tools that will allow them to build powerful applications that interact with the Polymesh protocol. It focuses on abstracting away all the complexities of the Polymesh blockchain and expose a simple but complete interface. The result is a feature-rich, user-friendly node.js library.

Before moving on

This document assumes you are already familiar with Security Tokens in general and Polymath as well as Polymesh in particular.

Technical Pre-requisites

In order to use the Polymath SDK, you must install node (version 10) and npm. The library is written in typescript, but can also be used in plain javascript. This document will assume you are using typescript, but the translation to javascript is very simple.

Documentation

Token Studio SDK Walkthrough:

https://developers.polymath.network/token-studio-api-walkthrough/

Polymesh SDK API Reference:

https://developers.polymath.network/polymesh-sdk-api-reference/

How to use

Installation

npm i @polymathnetwork/polymesh-sdk --save

Or, if you're using yarn

yarn add @polymathnetwork/polymesh-sdk

Initializing the client

Before you can start registering Tickers and creating Security Tokens, you have to connect the Polymesh SDK client to a Polymesh node. This is a pretty straightforward process:

import { Polymesh } from '@polymathnetwork/polymesh-sdk';

async function run() {
  const polyClient = await Polymesh.connect({
    nodeUrl: 'wss://some-node-url.com',
    accountSeed: 'YOUWISH',
  });

  // do stuff with the client
}

Here is an overview of the parameters passed to the connect function:

  • nodeUrl is a URL that points to a running Polymesh node
  • accountSeed is the seed (akin to a private key) of the account that will be performing transactions

NOTE: if using the SDK on a browser environment (i.e. with the Polymesh wallet browser extension), there is no need to provide the account seed. Instead, you pass a Keyring object that contains the address, and a signer for that address (which you would typically get from the wallet extension)

import { Polymesh, Keyring } from '@polymathnetwork/polymesh-sdk';

async function run() {
  const keyring = new Keyring();
  keyring.addFromAddress(accountAddress);
  const signer = getSignerFromExtension(); // this is not an existing function, how you get this depends on the extension

  const polyClient = await Polymesh.connect({
    nodeUrl: 'wss://some-node-url.com',
    keyring,
    signer,
  });

  // do stuff with the client
}