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

@ston-fi/api

v0.14.0

Published

JavaScript client for Ston.fi Http API

Downloads

13,505

Readme

License npm version

TypeScript wrapper on top of the Ston.fi Http API

Installation

NPM

npm install @ston-fi/api

Yarn

yarn add @ston-fi/api

PNPM

pnpm install @ston-fi/api

Configuration

Zero config required, you can just create an instance

Optional configuration are also possible by providing an object of type StonApiClientOptions to the constructor

import { StonApiClient } from '@ston-fi/api';

const client = new StonApiClient();

Usage

// * routers

// get list of all available routers
const routers = await client.getRouters();

// get router by address
const router = await client.getRouter('EQ...');

// * assets

// get list of all DEX assets
const assets = await client.getAssets();

// get asset info by it address
const asset = await client.getAsset('EQ...');

// get list of all DEX assets based on query condition
const assets = await client.queryAssets({
  condition: `${AssetTag.DefaultSymbol} | ${AssetTag.WalletHasBalance}`,
  walletAddress: 'UQ...',
});

// search assets across of all DEX assets based on search string and query condition
const matchedAssets = await client.searchAssets({
  searchString: "USD",
  condition: `${AssetTag.LiquidityVeryHigh} | ${AssetTag.LiquidityHigh} | ${AssetTag.Popular}`,
  walletAddress: "UQ...",
});

// get list of all DEX assets with balances for a given wallet
const walletAssets = await client.getWalletAssets('UQ...');

// get asset info by it address with balance for a given wallet
const walletAsset = await client.getWalletAsset({ assetAddress: 'EQ...', walletAddress: 'UQ...' });

// * pools

// get list of all DEX pools
const pools = await client.getPools();

// get list of all DEX pools based on query condition
const pools = await client.queryPools({
  condition: `${AssetTag.LiquidityVeryHigh} | ${AssetTag.LiquidityHigh} | ${AssetTag.Popular}`,
  walletAddress: 'UQ...',
});

// get pool info by it address
const pool = await client.getPool('EQ...');

// get list of all DEX pools with balances for a given wallet
const walletPools = await client.getWalletPools('UQ...');

// get pool info by it address with balance for a given wallet
const walletPool = await client.getWalletPool({ poolAddress: 'EQ...', walletAddress: 'UQ...' });

// * farms

// get list of all DEX farms
const farms = await client.getFarms();

// get farm info by it address
const farm = await client.getFarm('EQ...');

// get list of all DEX farms with balances for a given wallet
const walletFarms = await client.getWalletFarms('UQ...');

// get farm info by it address with balance for a given wallet
const walletFarm = await client.getWalletFarm({ farmAddress: 'EQ...', walletAddress: 'UQ...' });

// get list of all DEX farms for a given pool
const poolFarms = await client.getFarmsByPool('EQ...');

// * swaps

// get list of tuples with all possible swap pairs on the DEX
const pairs = await client.getSwapPairs();

// simulate direct swap between two assets (sell asset for another)
const swapDirectSimulation = await client.simulateSwap({ /** */ });

// simulate reverse swap between two assets (buy asset for another)
const swapReverseSimulation = await client.simulateReverseSwap({ /** */ });

// get swap status by it id and some additional info (e.g. wallet address, etc.)
const swapStatus = await client.getSwapStatus({ /** */ });

// * operations

// get list of ALL operations during specified period of time on the platform
const operations = await client.getOperations({
  since: new Date('2024-08-05T12:00:00'),
  until: new Date('2024-08-06T21:00:00')
});

// get list of operations during specified period of time for a given wallet
const operations = await client.getWalletOperations({
  since: new Date('2024-06-01T12:00:00'),
  until: new Date('2024-08-06T21:00:00'),
  walletAddress: 'UQ...',
  opType: 'SendLiquidity' // optional; see type definition
});

Roadmap

  • and js-dock for each method
  • add more options in configuration
    • ? interceptors via ofetch
    • ? retry via ofetch
    • ? support request abortion via AbortController