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

pulsar_sdk_js

v1.0.3

Published

A convenient way for you to interact with Pulsar's Third Party APIs, using typified classes.

Downloads

320

Readme

alt text

This repository holds the code for our Javascript/Typescript SDK.

Commands

  • npm run build - Builds the SDK
  • npm run test api_key=YOUR_API_KEY_HERE - Runs the tests (Need to have an API key. Run create_sdk_test_account.py in microservices-monorepo to get one.)
  • npm pack - Creates a tarball of the SDK, which can be installed in other projects using npm install <path_to_tarball>, or published to NPM using npm publish (Needs npm run build before running this command)

Getting Started

Installation

To install the SDK, git clone the repository and run npm install in the root directory. This will install all the dependencies and build the SDK. If you'd like to use this SDK in your own project, you can run npm pack to create a tarball of the SDK, which you can then install in your project using npm install <path_to_tarball>. Alternatively, you can install the SDK directly from NPM using npm install pulsar_sdk_js.

Usage

To use the SDK, you need to import the PulsarSDK class from the pulsar_sdk_js package. You can then instantiate the class with your API key, and use the SDK to make requests to the API.

import { PulsarSDK } from 'pulsar_sdk_js'

const API_KEY = 'YOUR_API_KEY'
const sdk = new PulsarSDK(API_KEY)
const token = sdk.tokens.get_token_info_by_address_and_chain(TokenType.ADDRESS, ChainKeys.TERRA2, 'YOUR TOKEN ADDRESS')

An example fetching wallet balances:

import { ChainKeys, PulsarSDK } from 'pulsar_sdk_js'

const API_KEY = 'YOUR_API_KEY'
const ETHEREUM_TEST_WALLET = '0x77984dc88aab3d9c843256d7aabdc82540c94f69'

const sdk = new PulsarSDK(API_KEY)
const responsesList = []
for await (const response of sdk.balances.getWalletBalances(ETHEREUM_TEST_WALLET, ChainKeys.ETHEREUM)) {
    responsesList.push(response)
}

It's important to notice that the SDK uses async generators to iterate through the responses. This means that you can use a for await loop to iterate through the responses. This is necessary because the SDK uses Websockets to fetch the data, and the responses are streamed in real time.

Which will fetch you all the wallet balances for your wallet, provided the Chain is active in our environment. For more information, check out our documentation.

Pull Requests

In order to contribute, you need to create a new branch, make your changes and open a pull request. Before opening the pull request, run npm run build to build the SDK and npm run test to run the tests. If you're adding a new feature, make sure to add tests for it. In order to run the tests, you will need to have a server instance running in your machine, and then pass an API key to the tests, like this: npm run test --api_key=YOUR_API_KEY_HERE.

If the tests pass, you can open a pull request. This will then run the tests again, but on CircleCI connected to QA.

Make sure to npm pack before opening the pull request, and testing the SDK in a separate project, to make sure everything works as expected when installed from NPM.

To publish this repository, save your npm credentials:

  1. Generate an npm Access Token:

    1. Log in to your npm account.
    2. Navigate to the Access Tokens section under your account settings.
    3. Create a new token with the publish scope.
    4. Copy the generated token.
  2. Store the Token with npm:

    • Open your terminal.
    • Run the following command:
      npm set //registry.npmjs.org/:_authToken=your-npm-token
    • Replace your-npm-token with the token you copied from npm.

Publishing

To publish the SDK to the NPM registry:

  1. npm version patch/minor/major to increment the version number.
  2. npm test api_key=YOUR_API_KEY_HERE to make sure the tests pass.
  3. npm run build to build the SDK.
  4. npm pack to create a tarball of the SDK.
    1. Optionally, you can test the SDK in a separate project by installing the tarball using npm install <path_to_tarball> to make sure everything works as expected.
  5. npm publish <path_to_tarball> to publish the SDK to NPM.

Make sure to update the CHANGELOG.md file with the changes you've made.

Incrementing Version

  • Patch: For backward-compatible bug fixes.
    npm version patch
  • Minor: For backward-compatible new features.
    npm version minor
  • Major: For changes that break backward compatibility.
    npm version major

Setting a Specific Version

You can also set the version directly:

npm version 1.2.3

Replace 1.2.3 with your desired version number.

Changelog

0.1.42

  • Initial release.