@opentrade/sdk
v1.0.7
Published
OpenTrade DEX SDK — swap, farming, SmartAllocator and arbitrage helpers for the MintMe chain
Maintainers
Readme
@opentrade/sdk
TypeScript SDK for the OpenTrade DEX on the MintMe blockchain.
Installation
npm install @opentrade/sdk viem
# or
pnpm add @opentrade/sdk viemFeatures
- Swap — quote and execute token swaps with multi-hop routing
- Farming — read pool info, emission rates, user positions
- SmartAllocator — TVL-based dynamic reward distribution; permissionless
rebalance()and community pool onboarding viaautoAddFarm() - Arbitrage — scan and execute arb opportunities across the DEX
- Tokens — TRADE, DROP balances, approvals, pending rewards
- ABIs — all contract ABIs for direct viem/wagmi usage
- Deployments — single source of truth for all contract addresses
Quick start
import { getSwapQuote, getAllPools, getTradeBalance, DEPLOYMENTS } from '@opentrade/sdk'
// Get a swap quote
const quote = await getSwapQuote({
tokenIn: DEPLOYMENTS.contracts.wmintme,
tokenOut: DEPLOYMENTS.contracts.tradeToken,
amountIn: 1_000_000_000_000_000_000n, // 1 MINTME
})
console.log('Expected out:', quote.amountOut)
// List all farming pools
const pools = await getAllPools()
pools.forEach(p => console.log(`pid ${p.pid}: ${p.lpSupply} LP staked`))
// Check TRADE balance
const balance = await getTradeBalance('0xYourAddress')SmartAllocator
import {
getSmartAllocatorInfo,
checkAutoAddEligibility,
autoAddFarm,
triggerRebalance,
createOpenTradeWalletClient,
} from '@opentrade/sdk'
// Check if a community LP pair qualifies for farm rewards
const { eligible, tvl, minTvl } = await checkAutoAddEligibility('0xLpPairAddress')
if (eligible) {
const wallet = createOpenTradeWalletClient(privateKey)
// Anyone can call this — no admin required
const txHash = await autoAddFarm(wallet, '0xLpPairAddress')
}
// Trigger TVL-proportional reward rebalance (permissionless)
const info = await getSmartAllocatorInfo()
if (info.canRebalance) {
await triggerRebalance(wallet)
}Chain
All calls target the MintMe chain (ID 24734) using https://node1.mintme.com as RPC.
Contract addresses
import { DEPLOYMENTS } from '@opentrade/sdk'
console.log(DEPLOYMENTS.contracts.router) // OpenTrade Router
console.log(DEPLOYMENTS.contracts.smartAllocator) // SmartAllocator v2License
MIT
