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 🙏

© 2026 – Pkg Stats / Ryan Hefner

@10xswap/sdk

v1.0.0

Published

Official TypeScript SDK for 10xSwap - Algorand DeFi Platform

Readme

@10xswap/sdk

Official TypeScript SDK for 10xSwap - The ultimate DeFi platform on Algorand.

npm version License: MIT TypeScript

🚀 Features

  • Multi-DEX Routing - Find optimal swap routes across Tinyman, Pact, and 10xSwap
  • Agent Wallets - Encrypted wallet management for automated trading
  • AutoPilot Rules - Automated trading strategies (DCA, Rebalance, Rotate)
  • Market Analysis - AI-powered crypto analysis with predictions
  • Liquidity Pools - Constant product AMM (x * y = k model)
  • Full TypeScript - Complete type safety and IntelliSense support
  • Network Agnostic - Works on both testnet and mainnet

📦 Installation

npm install @10xswap/sdk algosdk
yarn add @10xswap/sdk algosdk
pnpm add @10xswap/sdk algosdk

🎯 Quick Start

1. Multi-DEX Swap Router

Find the best swap route across all DEXs:

import { SwapRouter } from '@10xswap/sdk'

// Initialize router
const router = new SwapRouter('testnet')
await router.initialize()

// Find best route
const quote = await router.findBestRoute({
  assetIn: 0,           // ALGO
  assetOut: 10458941,   // USDC (testnet)
  amount: 1000000,      // 1 ALGO
  maxHops: 3,           // Allow multi-hop routing
  slippage: 0.5         // 0.5% slippage tolerance
})

console.log('Best DEX:', quote.dex)
console.log('Price Impact:', quote.priceImpact, '%')
console.log('Min Received:', quote.minReceived)

// Build and sign transaction
const txn = await router.buildSwapTransaction(quote, userAddress)
const signedTxn = await wallet.signTransaction(txn)
const result = await algodClient.sendRawTransaction(signedTxn).do()

2. Agent Wallet (Automated Trading)

Create an encrypted agent wallet for bots:

import { AgentWallet } from '@10xswap/sdk'

// Create new agent wallet
const agent = await AgentWallet.create(userAddress, password, 'testnet')

console.log('Agent Address:', agent.getAddress())

// Get balance
const balance = await agent.getBalance()
console.log('ALGO:', balance.algo)
console.log('Assets:', balance.assets)

// Opt-in to assets
await agent.optIn(10458941) // USDC

// Transfer funds
const result = await agent.transfer({
  to: recipientAddress,
  amount: 500000,  // 0.5 ALGO
  assetId: 0       // ALGO
})

// Execute swap
const quote = await router.findBestRoute({ ... })
const swapResult = await agent.swap(quote)
console.log('Swap TX:', swapResult.txId)

3. AutoPilot Trading Rules

Create automated trading strategies:

import { AutoPilot } from '@10xswap/sdk'

const autopilot = new AutoPilot('testnet')

// Create DCA rule: Buy USDC with ALGO when price drops 10%
const rule = await autopilot.createRule({
  strategy: 'DCA',
  assetIn: 0,          // ALGO
  assetOut: 10458941,  // USDC
  trigger: {
    type: 'price_drop_pct',
    value: 10,
    window: '24h'
  },
  maxSpendUSD: 100,
  maxSlippage: 0.5,
  cooldownMinutes: 1440  // 24 hours
}, ownerAddress)

console.log('Rule ID:', rule.id)

// Get all rules
const rules = await autopilot.getRules(ownerAddress)

// Pause rule
await autopilot.updateRuleStatus(rule.id, 'paused', ownerAddress)

// Manually execute rule
await autopilot.executeRule(rule.id, ownerAddress)

// Delete rule
await autopilot.deleteRule(rule.id, ownerAddress)

4. Market Analysis

AI-powered cryptocurrency analysis:

import { MarketAnalysis } from '@10xswap/sdk'

const analysis = new MarketAnalysis('testnet')

// Comprehensive analysis
const result = await analysis.analyze({
  coin: 'algorand',
  horizonDays: 30,
  tasks: ['analysis', 'prediction', 'strategy', 'charts'],
  chartType: 'candlestick'
})

console.log('Summary:', result.summary)
console.log('Insights:', result.insights)
console.log('Predictions:', result.predictions)
console.log('Price:', result.marketData?.price)

// Fear & Greed Index
const fgi = await analysis.getFearGreedIndex()
console.log('Sentiment:', fgi.valueClassification) // "Extreme Fear" | "Fear" | ...

// Trending coins
const trending = await analysis.getTrendingAlgorandTokens()

// Quick price check
const price = await MarketAnalysis.quickPrice('bitcoin')
console.log('BTC Price:', price)

// Compare multiple coins
const comparison = await analysis.compare(['bitcoin', 'ethereum', 'algorand'])

5. Liquidity Pools

Interact with 10xSwap pools:

import { LiquidityPool } from '@10xswap/sdk'

const pool = new LiquidityPool(749739213, 'testnet') // Pool App ID

// Get pool info
const info = await pool.getPoolInfo()
console.log('Reserves:', info.reserve1, info.reserve2)
console.log('Fee:', info.feeBps, 'bps')
console.log('TVL:', info.totalLiquidity)

// Get swap quote
const quote = await pool.getSwapQuote(0, 1000000) // 1 ALGO in
console.log('Will receive:', quote.amountOut, 'USDC')
console.log('Price impact:', quote.priceImpact, '%')

// Execute swap
const swapTxn = await pool.swap(0, 1000000, quote.amountOut * 0.995, userAddress)
const signedSwap = await wallet.signTransaction(swapTxn)
await algodClient.sendRawTransaction(signedSwap).do()

// Add liquidity
const addLiqTxn = await pool.addLiquidity({
  amount1: 1000000,   // 1 ALGO
  amount2: 2000000,   // 2 USDC
  minLpTokens: 1000
}, userAddress)

// Remove liquidity
const removeLiqTxn = await pool.removeLiquidity(
  1000,      // LP tokens to burn
  900000,    // Min ALGO
  1800000,   // Min USDC
  userAddress
)

📚 API Reference

SwapRouter

| Method | Description | |--------|-------------| | initialize() | Fetch all pools and build routing graph | | findBestRoute(request) | Find optimal swap path across DEXs | | buildSwapTransaction(quote, sender) | Build unsigned transaction | | getPools() | Get all available pools | | getPoolsForPair(asset1, asset2) | Get pools for specific pair |

AgentWallet

| Method | Description | |--------|-------------| | create(userAddress, password, config) | Create new encrypted wallet | | recover(userAddress, password, config) | Recover existing wallet | | getAddress() | Get wallet address | | getBalance() | Get ALGO and ASA balances | | optIn(assetId) | Opt-in to asset | | transfer(params) | Transfer ALGO or ASA | | swap(quote) | Execute swap using quote |

AutoPilot

| Method | Description | |--------|-------------| | createRule(config, owner) | Create automated trading rule | | getRules(owner) | Get all rules for user | | getRule(id, owner) | Get specific rule | | updateRuleStatus(id, status, owner) | Pause/resume/cancel rule | | updateRuleParameters(id, owner, updates) | Update rule parameters | | executeRule(id, owner) | Manually execute rule | | deleteRule(id, owner) | Delete rule | | getRuleStats(id, owner) | Get execution statistics |

MarketAnalysis

| Method | Description | |--------|-------------| | analyze(request) | Comprehensive crypto analysis | | getFearGreedIndex() | Get current market sentiment | | getTrendingCoins() | Get trending cryptocurrencies | | getTrendingAlgorandTokens() | Get trending Algorand tokens | | getNews(coinId, limit) | Get crypto news | | getPrice(coinId) | Get current price | | compare(coins) | Compare multiple coins | | quickAnalyze(coin, network) | Static quick analysis | | quickPrice(coin, network) | Static quick price |

LiquidityPool

| Method | Description | |--------|-------------| | getPoolInfo() | Get pool state and reserves | | getSwapQuote(assetIn, amountIn) | Calculate swap output | | createPool(asset1, asset2, feeBps, sender) | Create new pool | | addLiquidity(params, sender) | Add liquidity to pool | | removeLiquidity(lpTokens, minAmount1, minAmount2, sender) | Remove liquidity | | swap(assetIn, amountIn, minAmountOut, sender) | Execute swap | | calculatePriceImpact(assetIn, amountIn) | Calculate price impact | | getPrice(assetIn) | Get current price ratio | | getTVL() | Get Total Value Locked |

🔧 Configuration

Custom Algod Client

import { SwapRouter } from '@10xswap/sdk'
import algosdk from 'algosdk'

const algodClient = new algosdk.Algodv2('', 'https://testnet-api.4160.nodely.io', '')

const router = new SwapRouter({
  network: 'testnet',
  algodUrl: 'https://testnet-api.4160.nodely.io',
  algodToken: '',
  apiBaseUrl: 'http://localhost:3000/api'
})

Network Configuration

// Testnet (default)
const router = new SwapRouter('testnet')

// Mainnet
const router = new SwapRouter('mainnet')

// Custom config
const router = new SwapRouter({
  network: 'mainnet',
  apiBaseUrl: 'https://10xswap.com/api'
})

🔒 Security

  • Agent wallets use AES-256-GCM encryption
  • Mnemonics are encrypted at rest
  • Private keys never leave the client
  • Password-based key derivation (PBKDF2)

🌐 Network Support

| Network | Supported DEXs | Smart Contracts | |---------|---------------|-----------------| | Testnet | Tinyman V2, 10xSwap | ✅ | | Mainnet | Tinyman V2, Pact, 10xSwap | ✅ |

📖 Documentation

🤝 Contributing

Contributions are welcome! Please read our Contributing Guide first.

📄 License

MIT © 10xSwap Team

🔗 Links

💡 Examples

Check out our examples directory for more use cases:

🆘 Support