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

@bloxroute/solana-trader-client-ts

v2.2.0

Published

Solana Trader API SDK

Downloads

4,561

Readme

Solana Trader Typescript Client

Provides a Typescript SDK for bloXroute's Solana Trader API.

This library is exposes HTTP, websockets, and GRPC interfaces, and is compatible with both modern browser and node.js environments. Note that some methods and the GRPC interface is only available in node.js run-times, since some aspects of these functions are incompatible with browsers (e.g. http/2 requirement for GRPC, loading from environment, etc.)

Installation

npm i @bloxroute/solana-trader-client-ts

Usage

First, you will need an AUTH_HEADER from bloXroute (see the BDN user portal) . If you wish to create transactions you will also need your Solana PRIVATE_KEY available.

In node.js environments, you can specify both of these values in a .env file, or export them manually yourself. In the browser, you'll want to define them during run-time from user input, and probably use some wallet provider to handle the transaction signing.

A simple example:

import { HttpProvider } from "../bxsolana/provider/http.js"

const provider = new HttpProvider()

let req = await provider.getOrderbook({ market: "SOLUSDC", limit: 5 })
console.info(req)

Refer to the examples/ for more info. As mentioned above, you'll need an .env file for exported variables to execute the full suite. A proper .env file looks like something like this.

AUTH_HEADER="ZDIxYzE0NmItZWYxNi00ZmFmLTg5YWUtMzYwMTk4YzUyZmM4OjEwOWE5MzEzZDc2Yjg3M......................"
PRIVATE_KEY="3EhZ4Epe6QrcDKQRucdftv6vWXMnpTKDV4mekSPWZEcZnJV4huzesLHwASdVUzo......................"

A general note on transaction submission: methods named post* (e.g. postOrder) typically do not sign/submit the transaction, only return the raw unsigned transaction. This is mainly useful for generating transaction in browsers or if you want to handle your signing manually. You may also want to use the similarly named submit* methods (e.g. submitOrder), which generate, sign, and submit the transaction all at once.

Development

We use pbkit/pbkit to generate Typescript files from .proto definitions. You'll need to install their kit:

$ brew install pbkit/tap/pbkit

Clone the repo and install dependencies:

$ git clone https://github.com/bloXroute-Labs/solana-trader-client-ts.git
$ cd solana-trader-client-ts
$ npm i

Lint:

$ npm run lint

Format:

$ npm run format

Install precommit hooks:

$ npx husky install

Regenerate protobuf definitions:

$ npm run proto

How to Publish a new NPM release

We use np to publish new releases to npm. To make a new release, in the project directory use:

$ npm run release

Follow the menu items to select a version for the release (major, minor, patch).