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

ttxd-alpha

v1.0.0

Published

An SDK for building applications on top of V2,V3 and Solana exchanges

Downloads

78

Readme

TT-Alpha SDK

npm version npm bundle size (scoped version)

The latest version of the SDK is used in production in the DEX Interfaces, but it is considered Alpha testing software and may contain bugs or change significantly between patch versions.

Features

  • Multi-chain & multi-DEX support: Currently supports Ethereum, BNB Chain, Polygon, and Base, with more chains coming soon.
  • Modular architecture: Add additional DEXes and blockchains without refactoring core logic.
  • Lightweight: Designed for high performance, the SDK offers minimal overhead.

This ttxd-alpha SDK provides a unified way to interact with Uniswap V2, Uniswap V3, PancakeSwap, QuickSwap, SushiSwap, and Raydium V2 exchanges across multiple blockchains. With simple functions, you can swap tokens and manage liquidity seamlessly across Ethereum, BSC, Polygon, Base, and Solana.


Installation

Make sure you have Node.js installed. To install the SDK, run:

npm install ttxd-alpha

Examples of Using the SDK

1. V2 Exchanges: Uniswap V2

This example demonstrates a swap on Uniswap V2, but the same code works for other V2 exchanges by simply changing the exchange name and chainId.


import { swapV2 } from 'ttxd-alpha';

const provider = new ethers.providers.JsonRpcProvider('RPC URL'); // JsonRpcProvider instance
const signer = new ethers.Wallet('YOUR_PRIVATE_KEY', provider); // Wallet instance

(async () => {
    await swapV2({
        chainId: ChainId.Base, // ChainId
        exchange: "uniswapv2",
        token1: new Token(), // Token instance
        token2: new Token(), // Token instance
        amount: '1000000', // 1 USDC (raw amount)
        provider,
        signer,
    });
})();

Supported V2 Exchanges

| Exchange | Supported Networks | |-----------------|-----------------------------------| | "uniswapv2" | Ethereum, BSC, Polygon, Base | | "pancakeswapv2" | Ethereum, BSC, Base | | "quickswapv2" | Polygon | | "sushiswapv2" | Ethereum, BSC, Polygon |

2. V3 Exchanges: Uniswap V3

The following example demonstrates a swap using Uniswap V3. Similarly, it works for other V3 exchanges with minor changes.

import { swapV3 } from 'ttxd-alpha';

const provider = new ethers.providers.JsonRpcProvider('RPC URL'); // JsonRpcProvider instance
const signer = new ethers.Wallet('YOUR_PRIVATE_KEY', provider); // Wallet instance

(async () => {
    await swapV3({
        chainId: ChainId.BASE, //ChainId 
        exchange: "uniswapv3",
        tokenIn: new Token(), // Token instance
        tokenOut: new Token(), // Token instance
        fee: 500, // Pool fee
        amountIn: '1000000', // 1 USDC (raw amount)
        provider,
        signer,
    });
})();

Supported V3 Exchanges

| Exchange | Supported Networks | |-----------------|-----------------------------------| | "uniswapv3" | Ethereum, BSC, Polygon, Base | | "pancakeswapv3" | BSC, Base |

3. Solana : Raydium V2

This example demonstrates a swap using Raydium V2 on Solana. Raydium works with Pool IDs, so you must provide a specific pool ID and amount for the swap.


import { swapRaydium } from 'ttxd-alpha';

(async () => {
    await swapRaydium({
        poolId: 'POOL_ID', // Example pool ID
        amountIn: 0.005, // Amount in SOL
        privateKey: 'YOUR_PRIVATE_KEY', // Wallet private key
    });
})();

Supported Solana Exchanges "raydiumv2" - Solana

License

This project is licensed under the MIT License.