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

torch-liquidation-agent

v1.0.3

Published

lending position monitor and auto-liquidation skill using the torch-agent-kit

Readme

torch-liquidation-agent

Multi-token liquidation bot for Torch Market lending on Solana, built on solana-agent-kit + solana-agent-kit-torch-market.

Same functionality as torch-liquidation-bot but uses the Torch Agent Kit plugin instead of raw torchsdk — making it compatible with AI agent frameworks (LangChain, Vercel AI, OpenAI tools).

Install

npm install torch-liquidation-agent

How It Works

Every migrated token on Torch has a built-in lending market. Holders borrow SOL against their tokens. When a borrower's loan-to-value ratio exceeds 65%, anyone can liquidate the position and collect a 10% bonus on the collateral.

This bot finds those opportunities before other bots do by predicting which positions will go underwater:

  1. Scan -- discovers all tokens with active lending markets
  2. Profile -- checks each borrower's SAID reputation and trade history
  3. Score -- rates every loan on a 4-factor risk model (0-100)
  4. Liquidate -- executes when a position crosses the threshold and the profit exceeds your minimum

Quick Start

MODE=bot WALLET=<base58-private-key> RPC_URL=<rpc-endpoint> npx torch-liquidation-agent

Modes

bot (default) -- full liquidation bot

Runs two concurrent loops:

  • Scan loop (every 60s) -- finds tokens with active lending, snapshots prices
  • Score loop (every 15s) -- profiles borrowers, scores loans, executes liquidations
MODE=bot WALLET=<key> RPC_URL=<rpc> npx torch-liquidation-agent

info -- display lending parameters

# all migrated tokens with lending
MODE=info RPC_URL=<rpc> npx torch-liquidation-agent

# specific token
MODE=info MINT=<mint> RPC_URL=<rpc> npx torch-liquidation-agent

watch -- monitor your own loan health

MODE=watch MINT=<mint> WALLET=<key> RPC_URL=<rpc> npx torch-liquidation-agent

# with auto-repay if your position becomes liquidatable
MODE=watch MINT=<mint> WALLET=<key> AUTO_REPAY=true RPC_URL=<rpc> npx torch-liquidation-agent

Risk Scoring

Every loan gets a composite score from four weighted factors:

| Factor | Weight | What It Measures | |--------|--------|------------------| | LTV proximity | 40% | How close to the 65% liquidation threshold | | Price momentum | 30% | Collateral price trend (linear regression on recent snapshots) | | Wallet risk | 20% | SAID trust tier + trade win/loss ratio | | Interest burden | 10% | Accrued interest relative to collateral value |

Positions above the risk threshold (default: 60) are flagged and watched closely. Liquidatable positions with profit above your minimum are executed immediately, highest profit first.

Configuration

| Variable | Required | Default | Description | |----------|----------|---------|-------------| | RPC_URL | yes | -- | Solana RPC endpoint | | WALLET | bot/watch | -- | Base58 private key | | MODE | no | bot | bot, info, or watch | | MINT | info/watch | -- | Token mint address | | SCAN_INTERVAL_MS | no | 60000 | Token discovery interval | | SCORE_INTERVAL_MS | no | 15000 | Position scoring interval | | MIN_PROFIT_SOL | no | 0.01 | Minimum profit to execute liquidation | | RISK_THRESHOLD | no | 60 | Risk score cutoff for close monitoring | | PRICE_HISTORY | no | 20 | Price snapshots to keep for momentum | | LOG_LEVEL | no | info | debug, info, warn, error |

Architecture

src/
├── types.ts            — interfaces and contracts
├── config.ts           — env vars → SolanaAgentKit + typed config
├── logger.ts           — structured logging
├── utils.ts            — shared helpers
├── scanner.ts          — discovers tokens with active lending
├── wallet-profiler.ts  — SAID reputation + trade history
├── risk-scorer.ts      — 4-factor risk model
├── liquidator.ts       — executes liquidation txs via agent kit
├── monitor.ts          — scan + score orchestration
└── index.ts            — entry point

Differences from torch-liquidation-bot

| | bot (torchsdk) | agent (agent kit) | |---|---|---| | SDK | torchsdk direct | solana-agent-kit-torch-market plugin | | Transaction signing | Manual (sendAndConfirmTransaction) | Handled by SolanaAgentKit | | Holder discovery | torchsdk.getHolders() | Solana RPC getTokenLargestAccounts | | SAID verification | torchsdk.verifySaid() | Direct SAID API call | | AI agent compatible | No | Yes (LangChain, Vercel AI, OpenAI tools) |

Lending Parameters

| Parameter | Value | |-----------|-------| | Max LTV | 50% | | Liquidation threshold | 65% LTV | | Interest rate | 2% per epoch (~7 days) | | Liquidation bonus | 10% of collateral | | Min borrow | 0.1 SOL |

Testing

Requires Surfpool running a mainnet fork:

surfpool start --network mainnet --no-tui
pnpm test        # lending lifecycle test
pnpm test:bot    # bot module test (scanner, profiler, scorer, liquidator)

Security

  • Private keys loaded from env, never logged or transmitted
  • All transactions signed by SolanaAgentKit via KeypairWallet -- keys never leave your environment
  • Minimum profit threshold prevents unprofitable executions
  • Graceful shutdown on SIGINT

Links

License

MIT