the Rust SDK can now talk to the MultiversX API, not just the gateway.
small PR title, useful change: mx-sdk-rs #2442, merged on 25 Nov.
quick context, because the two get mixed up.
the gateway asks the nodes. current state: an account's balance and nonce, a VM query, sending a transaction.
the API sits on top of indexed data. history, filters, pagination. "show me every contract deployed this week" is an API question, not a node question.
from Rust you mostly had the gateway. the PR adds API requests next to it:
- an account with code hash, owner and deploy tx (code optional, it can be big)
- a contract's upgrade history, newest first
- list and count contracts
- events by identifier, like SCDeploy or SCUpgrade, across the whole network
- transactions filtered by receiver, function and status
two details I like.
1. cursor pagination. you pass the search_after of the last item to get the next page, and a cursor only works with the same filters and sort. no page numbers shifting under you.
2. the examples. one lists the latest failed direct deploys (they are sent to the zero address) and prints why they failed. the reason is the second topic of the signalError event, base64-encoded. that one line saves an afternoon of digging.
what it opens: deploy monitors, contract dashboards, small indexers, all in Rust, without a side script in JS or Python for the history part.
one limit: the API is an indexed service, not consensus. for anything that settles money, check the final state through the gateway too.