feat: add reference solver bot - #18
Merged
Merged
Conversation
Last roadmap item: a reference implementation showing how a solver connects to the /ws intent feed and executes the accept -> fill flow against the live REST API. Naive strategy - accepts every open intent it sees and fills at exactly minDstAmount, no pricing or real settlement, as documented in scripts/README.md. Adds npm run solver:demo and lints scripts/ alongside src/ and test/. Verified end-to-end against a real running instance: booted the app (3 seeded open intents), ran the bot for real, and watched it accept + fill all three via genuine WS events and HTTP calls. Confirmed via GET /api/v1/intents/open (3 -> 0) and GET /api/v1/stats (fillRate 0.2 -> 0.8, totalVolume increased correctly) that the fills actually persisted, not just logged.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Final item from the original migration/roadmap backlog: a reference solver bot demonstrating the accept → fill flow.
scripts/solver-bot.tsconnects to/ws, and for every open intent it sees (initial snapshot or liveintent_created) callsPOST /api/v1/intents/:id/acceptthenPOST /api/v1/intents/:id/fillminDstAmount, no pricing/profitability check or real settlement (documented clearly inscripts/README.mdso nobody mistakes it for production-ready)npm run solver:demoto run it; configurable viaAPI_BASE/WS_URL/SOLVER_ADDRESSenv varsscripts/now included innpm run lintscripts/README.mdTest plan
npm run typecheck/lint/build/test/test:e2eall passnpm run solver:demo, watched it accept and fill all three via genuine WebSocket events and real HTTP calls (logs show eachaccepted/filledper intent)GET /api/v1/intents/openwent from 3 → 0,GET /api/v1/statsfill rate went from0.2→0.8withtotalVolumeincreasing by the correct amount