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

simple-quickswap-sdk

v0.1.1-beta

Published

Simple easy to understand SDK for Quickswap to find you the best swap quote

Downloads

20

Readme

simple-quickswap-sdk

Quickswap SDK which handles the routes automatically for you, changes in trade quotes reactive subscriptions, exposure to formatted easy to understand information, bringing back the best trade quotes automatically, generating transactions for you and much more. All the Quickswap logic for you in a simple to easy understand interface to hook straight into your dApp without having to understand how it all works.

Please note this is not owned or maintained by Quickswap and is a open source package for anyone to use freely.

Features 🚀

🚀 Supports quickswap prices together and returns you the best price, so you do not need to query both yourself 🚀 Queries all the best routes and finds the best price for you 🚀 Exposes all the route paths it tried so you can see every detail in how it worked out the best price 🚀 Factor in the cost of the transaction into the quotes with 1 config change 🚀 Easy subscriptions to get alerted when the price moves or the trade expires 🚀 The transaction is generated for you, just fill it with the gas details and send it on its way 🚀 All the figures are all formatted for you, no need to worry about timing it back to its decimal formatted place, just render it straight onto your UI 🚀 Exposes all the tokens metadata for you, name, symbol, decimals 🚀 Uses multicall for every on chain lookup, so even though it could be doing 100 JSONRPC calls it is all put into a few calls meaning it can stay very fast 🚀 Tidy bundle size 🚀 Fully typescript supported with full generated typings 🚀 query many tokens in 1 jsonrpc call perfect to get token metadata fast 🚀 and much more!!

This repo is in beta phase and just suitable for fetching the price quotes

Sample usage:

import { UniswapPair, ChainId as UniswapChainId, UniswapPairSettings, UniswapVersion, TradeDirection} from 'simple-quickswap-sdk';


const uniswapPair = new UniswapPair({
    // the contract address of the token you want to convert FROM
    fromTokenContractAddress: token1Address,
    // the contract address of the token you want to convert TO
    toTokenContractAddress: token2Address,
    // the ethereum address of the user using this part of the dApp
    ethereumAddress: '0x207ca4370639120f9A049aF9CAB4fCaa608F2445',
    // you can pass in the provider url as well if you want
    providerUrl: Provider.PolygonMainnet,
    chainId: QuickChainId.MATIC,
    settings: new UniswapPairSettings({
      uniswapVersions: [UniswapVersion.v2],      
    })
  });
  const UniswapPairFactory = await uniswapPair.createFactory();
  const tradeRoutes = await UniswapPairFactory.findAllPossibleRoutesWithQuote('1',TradeDirection.input)