Loading...
Loading...
Bitflow DEX on Stacks — unified route ranking across SDK routes and HODLMM quotes, token swaps, market ticker data, HODLMM bin inspection and liquidity management, price impact analysis, and Keeper automation for scheduled orders. All operations are mainnet-only. No API key required for public routes during beta. Write operations require an unlocked wallet.
npx skill4agent add aibtcdev/skills bitflowswapadd-liquidity-simplewithdraw-liquidity-simplecreate-order--wallet-passwordbun run bitflow/bitflow.ts <subcommand> [options]STX1 STX = 1,000,000sBTC1 sBTC = 100,000,000USDCxaeUSDCUSDCUSDCxtoken-USDCx-autoaeUSDCtoken-aeusdcaeUSDCget-quoteget-routes --amount-inswap --amount-inreserve_xreserve_ybin.pricetokenY per tokenXbun run bitflow/bitflow.ts get-ticker [--base-currency <contractId>] [--target-currency <contractId>]--base-currency--target-currency{
"network": "mainnet",
"pairCount": 42,
"tickers": [
{
"ticker_id": "token-stx_token-sbtc",
"base_currency": "token-stx",
"target_currency": "token-sbtc",
"last_price": "0.000012",
"base_volume": "5000000",
"target_volume": "60",
"bid": "0.000011",
"ask": "0.000013",
"high": "0.000014",
"low": "0.000010",
"liquidity_in_usd": "1500000"
}
]
}bun run bitflow/bitflow.ts get-tokens{
"network": "mainnet",
"tokenCount": 15,
"tokens": [
{
"id": "token-stx",
"name": "Stacks",
"symbol": "STX",
"contractId": "token-stx",
"decimals": 6
},
{
"id": "token-USDCx-auto",
"name": "USDCx",
"symbol": "USDCx",
"contractId": "SP120SBRBQJ00MCWS7TM5R8WJNTTKD5K0HFRC2CNE.usdcx",
"decimals": 6,
"aliases": ["USDC"]
}
]
}bun run bitflow/bitflow.ts get-swap-targets --token-id <contractId>--token-id{
"network": "mainnet",
"inputToken": "token-stx",
"targetCount": 8,
"targets": ["token-sbtc", "token-USDCx-auto", "token-alex"]
}pool_idbun run bitflow/bitflow.ts get-hodlmm-pools [--suggested] [--sbtc-incentives] [--limit <number>]bun run bitflow/bitflow.ts get-hodlmm-bins --pool-id <poolId> [--allow-fallback]activeBinnearbyBinsapproxPricerawPricebun run bitflow/bitflow.ts get-hodlmm-position-bins --pool-id <poolId> [--address <stacksAddress>] [--fresh] [--allow-fallback]swapbun run bitflow/bitflow.ts get-quote --token-x <tokenId> --token-y <tokenId> --amount-in <decimal>--token-xtoken-stxtoken-sbtc--token-ytoken-sbtctoken-USDCx-autotoken-aeusdcaeUSDC--amount-in0.0001521.010^decimals{
"network": "mainnet",
"quote": {
"tokenIn": "token-stx",
"tokenOut": "token-sbtc",
"amountIn": "1.0",
"expectedAmountOut": "0.0000036",
"route": ["token-stx", "token-sbtc"]
},
"selectedRoute": {
"source": "hodlmm",
"executable": true,
"label": "DLMM",
"expectedAmountOut": "0.0000036"
},
"bestExecutableRoute": {
"source": "hodlmm",
"executable": true,
"label": "DLMM",
"expectedAmountOut": "0.0000036"
},
"priceImpact": {
"combinedImpact": 0.0023,
"combinedImpactPct": "0.23%",
"severity": "low",
"hops": [...],
"totalFeeBps": 30
}
}--amount-inbun run bitflow/bitflow.ts get-routes --token-x <tokenId> --token-y <tokenId> [--amount-in <decimal>]--token-x--token-ytoken-USDCx-autotoken-aeusdc--amount-in{
"network": "mainnet",
"tokenX": "token-stx",
"tokenY": "token-sbtc",
"routeCount": 3,
"routes": [
{
"source": "sdk",
"executable": true,
"tokenPath": ["token-stx", "token-sbtc"],
"dexPath": ["BITFLOW_XYK_XY_2"]
}
]
}--confirm-high-impactbun run bitflow/bitflow.ts swap \
--token-x <tokenId> --token-y <tokenId> --amount-in <decimal> \
[--slippage-tolerance <decimal>] [--fee <value>] [--confirm-high-impact]--token-x--token-y--amount-in0.0001521.010^decimals--slippage-tolerance--feelowmediumhigh--wallet-password--confirm-high-impact{
"success": true,
"txid": "abc123...",
"swap": {
"tokenIn": "token-stx",
"tokenOut": "token-sbtc",
"amountIn": "1.0",
"slippageTolerance": 0.01,
"priceImpact": { "combinedImpactPct": "0.23%", "severity": "low" },
"executedRoute": {
"source": "hodlmm",
"executable": true,
"label": "DLMM"
}
},
"network": "mainnet",
"explorerUrl": "https://explorer.hiro.so/txid/abc123...?chain=mainnet"
}bun run bitflow/bitflow.ts get-keeper-contract [--address <stacksAddress>]--address{
"network": "mainnet",
"address": "SP2...",
"contractIdentifier": "SP2...keeper-v1",
"status": "active"
}bun run bitflow/bitflow.ts add-liquidity-simple \
--pool-id <poolId> \
--bins '[{"activeBinOffset":0,"xAmount":"0","yAmount":"100000"}]' \
[--active-bin-tolerance '{"expectedBinId":500,"maxDeviation":"2"}'] \
[--slippage-tolerance <percent>] [--fee <value>] [--wallet-password <password>]get-hodlmm-binsSTXactiveBinOffsetactiveBinOffsetyAmountxAmountbun run bitflow/bitflow.ts withdraw-liquidity-simple \
--pool-id <poolId> \
--positions '[{"activeBinOffset":5,"amount":"392854","minXAmount":"1999000","minYAmount":"0"}]' \
[--fee <value>] [--wallet-password <password>]get-hodlmm-position-binsget-hodlmm-binsbun run bitflow/bitflow.ts create-order \
--contract-identifier <id> --action-type <type> \
--funding-tokens '{"token-stx":"1000000"}' --action-amount <units> \
[--min-received-amount <units>] [--auto-adjust]--contract-identifier--action-typeSWAP_XYK_SWAP_HELPER--funding-tokens--action-amount--min-received-amount--auto-adjust{
"success": true,
"network": "mainnet",
"orderId": "order-123",
"status": "pending",
"order": {
"contractIdentifier": "SP2...keeper-v1",
"actionType": "SWAP_XYK_SWAP_HELPER",
"fundingTokens": { "token-stx": "1000000" },
"actionAmount": "1000000"
}
}bun run bitflow/bitflow.ts get-order --order-id <id>--order-id{
"network": "mainnet",
"order": {
"orderId": "order-123",
"status": "completed",
"actionType": "SWAP_XYK_SWAP_HELPER",
"actionAmount": "1000000"
}
}bun run bitflow/bitflow.ts cancel-order --order-id <id>--order-id{
"network": "mainnet",
"orderId": "order-123",
"cancelled": true
}bun run bitflow/bitflow.ts get-keeper-user [--address <stacksAddress>]--address{
"network": "mainnet",
"userInfo": {
"stacksAddress": "SP2...",
"contracts": [{ "identifier": "SP2...keeper-v1", "status": "active" }],
"orders": [{ "orderId": "order-123", "status": "completed" }]
}
}BITFLOW_API_KEYBITFLOW_API_HOST--confirm-high-impactget-keeper-contractbun run wallet/wallet.ts unlock