{"_id":"@10xswap/sdk","name":"@10xswap/sdk","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@10xswap/sdk","version":"1.0.0","description":"Official TypeScript SDK for 10xSwap - Algorand DeFi Platform","main":"./dist/index.js","module":"./dist/index.mjs","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","require":"./dist/index.js","import":"./dist/index.mjs"}},"scripts":{"build":"tsup src/index.ts --format cjs,esm --dts","dev":"tsup src/index.ts --format cjs,esm --dts --watch","lint":"eslint src --ext .ts","test":"jest","prepublishOnly":"npm run build"},"keywords":["algorand","defi","dex","swap","liquidity","automated-trading","sdk","typescript","10xswap","amm","blockchain"],"author":{"name":"10xSwap Team"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/10xswap/sdk.git"},"bugs":{"url":"https://github.com/10xswap/sdk/issues"},"homepage":"https://10xswap.com/developers","peerDependencies":{"algosdk":"^2.0.0 || ^3.0.0"},"dependencies":{"axios":"^1.6.0"},"devDependencies":{"@types/node":"^20.0.0","tsup":"^8.0.0","typescript":"^5.0.0","algosdk":"^3.4.0"},"engines":{"node":">=16.0.0"},"_id":"@10xswap/sdk@1.0.0","gitHead":"ea80f71c3b97e3a0ffb728bb28e8a83bb73a5aab","_nodeVersion":"22.18.0","_npmVersion":"10.9.3","dist":{"integrity":"sha512-AF3rVlVtxyHE3OCg83uDqo/tF5xIKy3E5Fynnz5rS43V3XSj3HInyNTMVPfh4+Ndkrky2okbg9NQyRUs7WZqSw==","shasum":"7e3d50b3b2558c64616875697da8d0bc7bf41456","tarball":"https://registry.npmjs.org/@10xswap/sdk/-/sdk-1.0.0.tgz","fileCount":7,"unpackedSize":97028,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIAvPDQ1qz29oB6aqYBbIlMu0J9cCKU9n+uc9aHZKItpuAiEA681hy01/jVmSQ1k8g0iOshojDxaKA5oeRu10y6hjEi0="}]},"_npmUser":{"name":"eshan27","email":"eshandas2002@gmail.com"},"directories":{},"maintainers":[{"name":"eshan27","email":"eshandas2002@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sdk_1.0.0_1764344887139_0.1994529759602932"},"_hasShrinkwrap":false}},"time":{"created":"2025-11-28T15:48:07.043Z","1.0.0":"2025-11-28T15:48:07.323Z","modified":"2025-11-28T15:48:07.592Z"},"maintainers":[{"name":"eshan27","email":"eshandas2002@gmail.com"}],"description":"Official TypeScript SDK for 10xSwap - Algorand DeFi Platform","homepage":"https://10xswap.com/developers","keywords":["algorand","defi","dex","swap","liquidity","automated-trading","sdk","typescript","10xswap","amm","blockchain"],"repository":{"type":"git","url":"git+https://github.com/10xswap/sdk.git"},"author":{"name":"10xSwap Team"},"bugs":{"url":"https://github.com/10xswap/sdk/issues"},"license":"MIT","readme":"# @10xswap/sdk\n\nOfficial TypeScript SDK for 10xSwap - The ultimate DeFi platform on Algorand.\n\n[![npm version](https://img.shields.io/npm/v/@10xswap/sdk)](https://www.npmjs.com/package/@10xswap/sdk)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)\n[![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue)](https://www.typescriptlang.org/)\n\n## 🚀 Features\n\n- **Multi-DEX Routing** - Find optimal swap routes across Tinyman, Pact, and 10xSwap\n- **Agent Wallets** - Encrypted wallet management for automated trading\n- **AutoPilot Rules** - Automated trading strategies (DCA, Rebalance, Rotate)\n- **Market Analysis** - AI-powered crypto analysis with predictions\n- **Liquidity Pools** - Constant product AMM (x * y = k model)\n- **Full TypeScript** - Complete type safety and IntelliSense support\n- **Network Agnostic** - Works on both testnet and mainnet\n\n## 📦 Installation\n\n```bash\nnpm install @10xswap/sdk algosdk\n```\n\n```bash\nyarn add @10xswap/sdk algosdk\n```\n\n```bash\npnpm add @10xswap/sdk algosdk\n```\n\n## 🎯 Quick Start\n\n### 1. Multi-DEX Swap Router\n\nFind the best swap route across all DEXs:\n\n```typescript\nimport { SwapRouter } from '@10xswap/sdk'\n\n// Initialize router\nconst router = new SwapRouter('testnet')\nawait router.initialize()\n\n// Find best route\nconst quote = await router.findBestRoute({\n  assetIn: 0,           // ALGO\n  assetOut: 10458941,   // USDC (testnet)\n  amount: 1000000,      // 1 ALGO\n  maxHops: 3,           // Allow multi-hop routing\n  slippage: 0.5         // 0.5% slippage tolerance\n})\n\nconsole.log('Best DEX:', quote.dex)\nconsole.log('Price Impact:', quote.priceImpact, '%')\nconsole.log('Min Received:', quote.minReceived)\n\n// Build and sign transaction\nconst txn = await router.buildSwapTransaction(quote, userAddress)\nconst signedTxn = await wallet.signTransaction(txn)\nconst result = await algodClient.sendRawTransaction(signedTxn).do()\n```\n\n### 2. Agent Wallet (Automated Trading)\n\nCreate an encrypted agent wallet for bots:\n\n```typescript\nimport { AgentWallet } from '@10xswap/sdk'\n\n// Create new agent wallet\nconst agent = await AgentWallet.create(userAddress, password, 'testnet')\n\nconsole.log('Agent Address:', agent.getAddress())\n\n// Get balance\nconst balance = await agent.getBalance()\nconsole.log('ALGO:', balance.algo)\nconsole.log('Assets:', balance.assets)\n\n// Opt-in to assets\nawait agent.optIn(10458941) // USDC\n\n// Transfer funds\nconst result = await agent.transfer({\n  to: recipientAddress,\n  amount: 500000,  // 0.5 ALGO\n  assetId: 0       // ALGO\n})\n\n// Execute swap\nconst quote = await router.findBestRoute({ ... })\nconst swapResult = await agent.swap(quote)\nconsole.log('Swap TX:', swapResult.txId)\n```\n\n### 3. AutoPilot Trading Rules\n\nCreate automated trading strategies:\n\n```typescript\nimport { AutoPilot } from '@10xswap/sdk'\n\nconst autopilot = new AutoPilot('testnet')\n\n// Create DCA rule: Buy USDC with ALGO when price drops 10%\nconst rule = await autopilot.createRule({\n  strategy: 'DCA',\n  assetIn: 0,          // ALGO\n  assetOut: 10458941,  // USDC\n  trigger: {\n    type: 'price_drop_pct',\n    value: 10,\n    window: '24h'\n  },\n  maxSpendUSD: 100,\n  maxSlippage: 0.5,\n  cooldownMinutes: 1440  // 24 hours\n}, ownerAddress)\n\nconsole.log('Rule ID:', rule.id)\n\n// Get all rules\nconst rules = await autopilot.getRules(ownerAddress)\n\n// Pause rule\nawait autopilot.updateRuleStatus(rule.id, 'paused', ownerAddress)\n\n// Manually execute rule\nawait autopilot.executeRule(rule.id, ownerAddress)\n\n// Delete rule\nawait autopilot.deleteRule(rule.id, ownerAddress)\n```\n\n### 4. Market Analysis\n\nAI-powered cryptocurrency analysis:\n\n```typescript\nimport { MarketAnalysis } from '@10xswap/sdk'\n\nconst analysis = new MarketAnalysis('testnet')\n\n// Comprehensive analysis\nconst result = await analysis.analyze({\n  coin: 'algorand',\n  horizonDays: 30,\n  tasks: ['analysis', 'prediction', 'strategy', 'charts'],\n  chartType: 'candlestick'\n})\n\nconsole.log('Summary:', result.summary)\nconsole.log('Insights:', result.insights)\nconsole.log('Predictions:', result.predictions)\nconsole.log('Price:', result.marketData?.price)\n\n// Fear & Greed Index\nconst fgi = await analysis.getFearGreedIndex()\nconsole.log('Sentiment:', fgi.valueClassification) // \"Extreme Fear\" | \"Fear\" | ...\n\n// Trending coins\nconst trending = await analysis.getTrendingAlgorandTokens()\n\n// Quick price check\nconst price = await MarketAnalysis.quickPrice('bitcoin')\nconsole.log('BTC Price:', price)\n\n// Compare multiple coins\nconst comparison = await analysis.compare(['bitcoin', 'ethereum', 'algorand'])\n```\n\n### 5. Liquidity Pools\n\nInteract with 10xSwap pools:\n\n```typescript\nimport { LiquidityPool } from '@10xswap/sdk'\n\nconst pool = new LiquidityPool(749739213, 'testnet') // Pool App ID\n\n// Get pool info\nconst info = await pool.getPoolInfo()\nconsole.log('Reserves:', info.reserve1, info.reserve2)\nconsole.log('Fee:', info.feeBps, 'bps')\nconsole.log('TVL:', info.totalLiquidity)\n\n// Get swap quote\nconst quote = await pool.getSwapQuote(0, 1000000) // 1 ALGO in\nconsole.log('Will receive:', quote.amountOut, 'USDC')\nconsole.log('Price impact:', quote.priceImpact, '%')\n\n// Execute swap\nconst swapTxn = await pool.swap(0, 1000000, quote.amountOut * 0.995, userAddress)\nconst signedSwap = await wallet.signTransaction(swapTxn)\nawait algodClient.sendRawTransaction(signedSwap).do()\n\n// Add liquidity\nconst addLiqTxn = await pool.addLiquidity({\n  amount1: 1000000,   // 1 ALGO\n  amount2: 2000000,   // 2 USDC\n  minLpTokens: 1000\n}, userAddress)\n\n// Remove liquidity\nconst removeLiqTxn = await pool.removeLiquidity(\n  1000,      // LP tokens to burn\n  900000,    // Min ALGO\n  1800000,   // Min USDC\n  userAddress\n)\n```\n\n## 📚 API Reference\n\n### SwapRouter\n\n| Method | Description |\n|--------|-------------|\n| `initialize()` | Fetch all pools and build routing graph |\n| `findBestRoute(request)` | Find optimal swap path across DEXs |\n| `buildSwapTransaction(quote, sender)` | Build unsigned transaction |\n| `getPools()` | Get all available pools |\n| `getPoolsForPair(asset1, asset2)` | Get pools for specific pair |\n\n### AgentWallet\n\n| Method | Description |\n|--------|-------------|\n| `create(userAddress, password, config)` | Create new encrypted wallet |\n| `recover(userAddress, password, config)` | Recover existing wallet |\n| `getAddress()` | Get wallet address |\n| `getBalance()` | Get ALGO and ASA balances |\n| `optIn(assetId)` | Opt-in to asset |\n| `transfer(params)` | Transfer ALGO or ASA |\n| `swap(quote)` | Execute swap using quote |\n\n### AutoPilot\n\n| Method | Description |\n|--------|-------------|\n| `createRule(config, owner)` | Create automated trading rule |\n| `getRules(owner)` | Get all rules for user |\n| `getRule(id, owner)` | Get specific rule |\n| `updateRuleStatus(id, status, owner)` | Pause/resume/cancel rule |\n| `updateRuleParameters(id, owner, updates)` | Update rule parameters |\n| `executeRule(id, owner)` | Manually execute rule |\n| `deleteRule(id, owner)` | Delete rule |\n| `getRuleStats(id, owner)` | Get execution statistics |\n\n### MarketAnalysis\n\n| Method | Description |\n|--------|-------------|\n| `analyze(request)` | Comprehensive crypto analysis |\n| `getFearGreedIndex()` | Get current market sentiment |\n| `getTrendingCoins()` | Get trending cryptocurrencies |\n| `getTrendingAlgorandTokens()` | Get trending Algorand tokens |\n| `getNews(coinId, limit)` | Get crypto news |\n| `getPrice(coinId)` | Get current price |\n| `compare(coins)` | Compare multiple coins |\n| `quickAnalyze(coin, network)` | Static quick analysis |\n| `quickPrice(coin, network)` | Static quick price |\n\n### LiquidityPool\n\n| Method | Description |\n|--------|-------------|\n| `getPoolInfo()` | Get pool state and reserves |\n| `getSwapQuote(assetIn, amountIn)` | Calculate swap output |\n| `createPool(asset1, asset2, feeBps, sender)` | Create new pool |\n| `addLiquidity(params, sender)` | Add liquidity to pool |\n| `removeLiquidity(lpTokens, minAmount1, minAmount2, sender)` | Remove liquidity |\n| `swap(assetIn, amountIn, minAmountOut, sender)` | Execute swap |\n| `calculatePriceImpact(assetIn, amountIn)` | Calculate price impact |\n| `getPrice(assetIn)` | Get current price ratio |\n| `getTVL()` | Get Total Value Locked |\n\n## 🔧 Configuration\n\n### Custom Algod Client\n\n```typescript\nimport { SwapRouter } from '@10xswap/sdk'\nimport algosdk from 'algosdk'\n\nconst algodClient = new algosdk.Algodv2('', 'https://testnet-api.4160.nodely.io', '')\n\nconst router = new SwapRouter({\n  network: 'testnet',\n  algodUrl: 'https://testnet-api.4160.nodely.io',\n  algodToken: '',\n  apiBaseUrl: 'http://localhost:3000/api'\n})\n```\n\n### Network Configuration\n\n```typescript\n// Testnet (default)\nconst router = new SwapRouter('testnet')\n\n// Mainnet\nconst router = new SwapRouter('mainnet')\n\n// Custom config\nconst router = new SwapRouter({\n  network: 'mainnet',\n  apiBaseUrl: 'https://10xswap.com/api'\n})\n```\n\n## 🔒 Security\n\n- **Agent wallets** use AES-256-GCM encryption\n- **Mnemonics** are encrypted at rest\n- **Private keys** never leave the client\n- **Password-based** key derivation (PBKDF2)\n\n## 🌐 Network Support\n\n| Network | Supported DEXs | Smart Contracts |\n|---------|---------------|-----------------|\n| Testnet | Tinyman V2, 10xSwap | ✅ |\n| Mainnet | Tinyman V2, Pact, 10xSwap | ✅ |\n\n## 📖 Documentation\n\n- [Developer Docs](https://10xswap.com/developers)\n- [API Reference](https://10xswap.com/api/docs)\n- [Smart Contracts](https://10xswap.com/developers#contracts)\n- [Examples](https://github.com/10xswap/sdk/tree/main/examples)\n\n## 🤝 Contributing\n\nContributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md) first.\n\n## 📄 License\n\nMIT © 10xSwap Team\n\n## 🔗 Links\n\n- [Website](https://10xswap.com)\n- [GitHub](https://github.com/10xswap/sdk)\n- [NPM](https://www.npmjs.com/package/@10xswap/sdk)\n- [Discord](https://discord.gg/10xswap)\n- [Twitter](https://twitter.com/10xswap)\n\n## 💡 Examples\n\nCheck out our [examples directory](https://github.com/10xswap/sdk/tree/main/examples) for more use cases:\n\n- [Trading Bot](https://github.com/10xswap/sdk/tree/main/examples/trading-bot)\n- [DCA Strategy](https://github.com/10xswap/sdk/tree/main/examples/dca-strategy)\n- [Liquidity Provider](https://github.com/10xswap/sdk/tree/main/examples/liquidity-provider)\n- [Price Monitor](https://github.com/10xswap/sdk/tree/main/examples/price-monitor)\n\n## 🆘 Support\n\n- [GitHub Issues](https://github.com/10xswap/sdk/issues)\n- [Discord Community](https://discord.gg/10xswap)\n- [Email Support](mailto:support@10xswap.com)\n","readmeFilename":"README.md","_rev":"1-92dc85af5efc83edc73fde288ff85de2"}