Repository navigation
Price & token sources: The Forge as a built-in token index - #898
Open
awizardxch wants to merge 5 commits into
Open
awizardxch wants to merge 5 commits into
awizardxch wants to merge 5 commits into
Conversation
A new Settings > Network > Price & Token Sources section lists the sources Sage already uses, with what each provides and a switch: Dexie (CAT prices; its names and icons are saved by the wallet's own sync) and CoinGecko (the XCH/USD rate). The user can add custom token indexes (one https JSON document, version 1, listing CATs with a name, ticker, https icon and price in XCH) and reorder all sources with up/down buttons. For each value, the first enabled source that has it wins and later sources only fill gaps: a CAT's price in XCH, the XCH/USD rate, and a display-only label for a CAT with no name. Index labels never replace a name the wallet has (from the user, Dexie or chia_updateCat) and are never written to it. Indexes are fetched on the existing 60-second price refresh, validated (version, network, text bounds matching chia_updateCat, https icons, finite positive prices), and a failed fetch keeps the last good copy. Nothing is stored until the user changes the list, and the defaults (Dexie then CoinGecko, both on, no custom sources) make exactly the requests Sage made before. The single tokenIndexUrl key from an earlier build of this branch is read once into the list. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
A note on the red checks: the two iOS jobs and Android fail at the signing step, because GitHub doesn't pass this repo's signing secrets to a PR from a fork. The iOS log shows |
…oken page A token the wallet already named (for example through chia_updateCat) kept "CAT" and no icon, because a suggestion was made only for a token with no name. Each of name, ticker and icon is now suggested where the token has none, and an existing value is still never replaced. The token page's card also shows the suggested ticker and icon; its edit dialog keeps starting from, and saving, the wallet's own record. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
awizardxch
force-pushed
the
feat/forge-token-source
branch
from
October 17, 2026 19:04
80230e3 to
15ff63d
Compare
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Adds The Forge (forge.awizard.dev) to the built-in sources, on by default and placed after Dexie and CoinGecko, so it only fills what they lack: AMM prices for CATs Dexie has no price for, and display-only names and icons for Forge-traded CATs and Forge LP tokens that have no name. Its index is the same token index format (version 1), one keyless, CDN-cached GET per refresh, at token-index/v1/mainnet.json or testnet11.json by network. A list saved before this source existed gains it in the same place, after Dexie and CoinGecko. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
awizardxch
force-pushed
the
feat/forge-token-source
branch
from
October 17, 2026 19:06
15ff63d to
59845ea
Compare
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.
Depends on #897 (Price & token sources). Review that one first; this PR is the single commit on top of it.
Problem
Many CATs trade only in AMM pools, with no order book on Dexie. Dexie has no
last_pricefor them, so Sage values them at $0. The liquidity tokens those pools mint aren't registered with Dexie, so Sage shows them as "Unknown CAT". After #897 a user can fix this by adding a token index by hand, but that requires knowing that an index exists and pasting its URL.Change
The Forge (forge.awizard.dev, an AMM for Chia CATs) becomes a built-in source in the Price & Token Sources list, beside Dexie and CoinGecko:
Because it comes after Dexie and CoinGecko, it only fills what they lack. A CAT that Dexie prices keeps Dexie's price, and the XCH/USD rate stays CoinGecko's. The Forge's names, tickers and icons are display-only suggestions for what a token lacks, under the same rules as any token index in #897. They never replace a value the wallet has and are never written to it. The user can turn The Forge off or move it like any other source.
It reads the same token index format (version 1) as a custom source, at a URL that depends on the network:
https://forge.awizard.dev/token-index/v1/mainnet.jsonhttps://forge.awizard.dev/token-index/v1/testnet11.jsonA source list saved before this source existed gains it in the same place, after Dexie and CoinGecko, switched on.
The diff is one source entry in
src/lib/priceSources.ts(name, homepage, a URL per network) and its tests insrc/lib/priceSources.test.ts. The Settings row, fetching, validation and priority all come from #897.Why on by default
This adds a default host, which is a fair thing to question, so here is the reasoning:
Cache-Control: public, max-age=60, s-maxage=300, stale-while-revalidate=86400, so wallets' polls are answered by the CDN (X-Vercel-Cache: HITafter the first call), not by the Forge's servers. CORS is*.If maintainers would rather not add a default host, it's a one-line change (
enabledByDefault: false). The Forge would then still be listed, ready to switch on, without making a request until the user does. Happy to switch it.How to test
pnpm test:unit(src/lib/priceSources.test.ts),pnpm lint,pnpm tsc -b.forge.awizard.dev/token-index/v1/mainnet.jsonper refresh (testnet11.jsonon testnet), beside the Dexie and CoinGecko requests.forge.awizard.dev(or go offline): Sage shows what it shows without the source, with only a console warning.🤖 Generated with Claude Code