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

kyberutils

v1.0.10

Published

```javescript

Downloads

6

Readme


declare const swapConfig: {
    KS_TOKEN_API: string;
    KS_SWAP_ROUTE: string;
    KS_SWAP_ROUTE_BUILD: string;
};
type Route = {
    pool: string;
    tokenIn: string;
    swapAmount: string;
    tokenOut: string;
    amountOut: string;
    limitReturnAmount: string;
    exchange: string;
    poolLength: number;
    poolType: string;
    extra: string;
};
declare enum ChargeFeeBy {
    CURRENCY_IN = "currency_in",
    CURRENCY_OUT = "currency_out",
    NONE = ""
}
type RawRouteSummary = {
    tokenIn: string;
    amountIn: string;
    amountInUsd: string;
    tokenOut: string;
    amountOut: string;
    amountOutUsd: string;
    tokenOutMarketPriceAvailable: null;
    gas: string;
    gasUsd: string;
    gasPrice: string;
    extraFee: {
        feeAmount: string;
        chargeFeeBy: ChargeFeeBy;
        isInBps: boolean;
        feeReceiver: string;
        feeAmountUsd: string;
    };
    route: Route[][];
};
type BuildRoutePayload = {
    routeSummary: RawRouteSummary;
    deadline: number;
    slippageTolerance: number;
    sender: string;
    recipient: string;
    source: 'kyberswap';
    skipSimulateTx: boolean;
    permit?: string;
};
interface ISwapPrice {
    tokenIn: string;
    tokenOut: string;
    amountIn: string;
    saveGas: boolean;
    gasInclude: boolean;
}

declare const getRouteSummary: (chain: string, params: ISwapPrice) => Promise<any>;
declare const postRouteBuild: (chain: string, params: BuildRoutePayload) => Promise<any>;

export { type BuildRoutePayload, type ISwapPrice, type RawRouteSummary, type Route, getRouteSummary, postRouteBuild, swapConfig };

getRouteSummary params

  • eg:
    amountIn: 1000000
    gasInclude: true
    saveGas: false
    tokenIn: 0x3c499c542cEF5E3811e1192ce70d8cC03d5c3359
    tokenOut: 0xc2132D05D31c914a87C6611C10748AEb04B58e8F

getRouteSummary result

  • eg:
"routeSummary": {
    "tokenIn": "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
    "amountIn": "1000000",
    "amountInUsd": "0",
    "tokenInMarketPriceAvailable": false,
    "tokenOut": "0xc2132d05d31c914a87c6611c10748aeb04b58e8f",
    "amountOut": "999523",
    "amountOutUsd": "0.998970263781",
    "tokenOutMarketPriceAvailable": false,
    "gas": "290000",
    "gasPrice": "65191477521",
    "gasUsd": "0.009813235952093942",
    "extraFee": {
        "feeAmount": "0",
        "chargeFeeBy": "",
        "isInBps": false,
        "feeReceiver": ""
    },
    "route": [
        [
            {
                "pool": "0xc0aaf2992b04d3424768d7ba3f1f1979dc14ae46",
                "tokenIn": "0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",
                "tokenOut": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
                "limitReturnAmount": "0",
                "swapAmount": "1000000",
                "amountOut": "999602",
                "exchange": "kyberswap-elastic",
                "poolLength": 2,
                "poolType": "elastic",
                "poolExtra": null,
                "extra": {}
            },
            {
                "pool": "0x38766867c0ee0bd530777f5f19b0d0d28d270ab8",
                "tokenIn": "0x2791bca1f2de4661ed88a30c99a7a9449aa84174",
                "tokenOut": "0xc2132d05d31c914a87c6611c10748aeb04b58e8f",
                "limitReturnAmount": "0",
                "swapAmount": "999602",
                "amountOut": "999523",
                "exchange": "kyberswap",
                "poolLength": 2,
                "poolType": "dmm",
                "poolExtra": null,
                "extra": null
            }
        ]
    ]
},
"routerAddress": "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5"

postRouteBuild params

  • eg:
deadline: 1697425374
recipient: "0x69e58330fd71c0034de6cfa06a0552d52d8df766"
routeSummary: ...
sender: "0x6764e71d06f5947784b81718a834affaf548b5cb"
skipSimulateTx: false
slippageTolerance: 50
source: "kyberswap"

postRouteBuild result

-eg:

{
    "amountIn": "1000000",
    "amountInUsd": "0",
    "amountOut": "999523",
    "amountOutUsd": "0.998970263781",
    "gas": "290000",
    "gasUsd": "0.009813235952093942",
    "outputChange": {
        "amount": "0",
        "percent": 0,
        "level": 0
    },
    "data": "xxx",
    "routerAddress": "0x6131B5fae19EA4f9D964eAc0408E4408b66337b5"
},