Repository navigation
feat: add Chord action provider - #1566
Open
tuantqse90 wants to merge 1 commit into
Open
tuantqse90 wants to merge 1 commit into
tuantqse90 wants to merge 1 commit into
Conversation
Adds search_tokens, get_swap_quote and swap actions backed by the Chord API (best-route swaps through one router contract on Ethereum, Base, Arbitrum One, BNB Chain, Avalanche C-Chain, Monad, Robinhood Chain and Arc), with unit tests, a README and a changeset.
🟡 Heimdall Review Status
|
This branch has not been deployed
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.
Description
Adds a Chord action provider. Chord is a DEX aggregator: it quotes every venue it indexes on a chain, splits an order across venues when that gives a better output, and settles the trade through one router contract deployed at the same address (
0x1b1fee89a381e595fe6536b99ba91f3e16e9601a) on each supported chain.Actions:
search_tokens: searches Chord's token index on the wallet's chain by symbol, name or address, and flags whether each match is on the chain's curated listget_swap_quote: best route, expected and minimum output, price impact, fee and venues; sends nothingswap: approves the router for exactly the input amount when the allowance is too low, builds the transaction with the Chord API, refuses it unless it targets the Chord router on the wallet's chain, simulates it from the wallet, then sends it and reports the amount receivedNetworks: Ethereum (1), BNB Chain (56), Monad (143), Robinhood Chain (4663), Arc (5042), Base (8453), Arbitrum One (42161), Avalanche C-Chain (43114).
supportsNetworkreturns false elsewhere.No API key is needed (public limit 60 requests per minute per IP); an optional
apiKey/CHORD_API_KEYis sent asX-API-Key. Transactions are built unsigned and signed by the AgentKit wallet provider; Chord never takes custody of keys or funds.Details handled in the provider:
0x3600…0000, 6 decimals), approved and pulled like an ERC-20Tests
Unit tests:
src/action-providers/chord/chordActionProvider.test.ts, 43 tests (schemas, token normalization, sanitizer, every action's success and failure paths, approval reset, Arc mapping, transaction target and chain checks, simulation failure, reverted receipts). Full suite: 63 suites, 947 tests passing.pnpm run lint,pnpm run format:checkandtsc --noEmitpass.Manual check against the live API, through
AgentKit.fromwith aViemWalletProvideron a fresh, unfunded key (no chatbot, so no LLM in the loop; the action is invoked directly as the chatbot would):Checklist