Adding general getContractInfo EVM endpoint#1477
Merged
Conversation
cranycrane
requested changes
Apr 26, 2026
# Conflicts: # docs/api.md # server/public.go
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
The intention is to propagate
erc4626data with fiat rates to Suite :erc4626on websocket session start throughaccountInforequest for an accounterc4626values AND fiat rates later to have fresh dataAlso unifying existing
getAccountInfoprotocol with newgetContractInfomethod :includeErc4626flag and introducingprotocolsin requestprotocolsinstead of erc4626 in rootDetails
This PR adds a single-contract lookup endpoint so Suite can refresh current ERC-4626 vault numbers and fiat pricing for a token the user is actively interacting with, without reloading the full
accountInforesponse (whoseerc4626block is a snapshot taken at fetch time).Also unifies the protocol-enrichment shape between
getAccountInfoand the newgetContractInfoso both responses carry the sameprotocolswrapper.New endpoint
WebSocket
Method:
getContractInfoRequest:
{ "contract": "0x...", "currency": "usd", "protocols": ["erc4626"] }currency— optional. When present, response includesrates.secondaryRatein that currency.protocols— optional. Currently supported:erc4626. Unknown values are rejected.Response (
ContractInfoResult):{ "contract": "0x...", "standard": "ERC20", "name": "Vault Share", "symbol": "vETH", "decimals": 18, "rates": { "baseRate": 0.000523, "currency": "usd", "secondaryRate": 1.24 }, "protocols": { "erc4626": { /* asset, share, totalAssets, convertTo*, preview*, error? */ } }, "blockHeight": 12345678 }REST
Same response shape.
Errors
All errors are plain
APIErrormessages:"Missing contract"— empty contract param."Invalid contract, <parser error>"— contract string doesn't parse as an address on this chain."Contract not found"— address parses but is not a known contract (e.g. EOA)."Unknown protocol: <value>"— a protocol string outside the allowlist."getContractInfo is not supported on this coin"— endpoint called on a non-EVM Blockbook."protocols parameter is not supported on this coin"— non-emptyprotocolssent togetAccountInfoon a non-EVM Blockbook.Breaking changes to
getAccountInfo(from PR #1431, not yet released)includeErc4626: boolean→protocols: string[](pass["erc4626"]).erc4626field →protocols.erc4626(same payload, nested underprotocols).REST equivalent:
?includeErc4626=true→?protocols=erc4626.Behavior notes
blockHeightis the indexer's best block at request time. ERC-4626 values (totalAssets,convertTo*,preview*) come from liveeth_callagainst the backend, which may already be one or more blocks ahead of the indexer. TreatblockHeightas a floor.ratesis returned only when the contract's standard supports rates (fungible tokens) and at least a base rate or a requested currency is available. Whencurrencyis supplied, it is always echoed back, even if no secondary rate could be resolved.protocols.erc4626is returned only if the contract is detected as an ERC-4626 vault (viaasset()+totalAssets()probe). Partial failures while fetching vault fields are reported inprotocols.erc4626.errorrather than failing the whole response.Try it against dev Blockbooks
Shared variables:
Notes:
-nonwscatand-koncurlbypass the dev self-signed cert;-w 3gives the reply time to print before wscat exits.Ethereum
WS
getContractInfo:WS
getAccountInfo:REST
getContractInfo:REST
getAccountInfo:Base
WS
getContractInfo:WS
getAccountInfo:REST
getContractInfo:REST
getAccountInfo: