Wormhole deposits by recipient, for wallets that should not have to ask Quantus's indexer #22
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Why
The Quantus browser extension (quantus/extension#14) is gaining a read-only wormhole balance. A wormhole address's
System.Accountbalance is everything it ever received: an exit credits the exit account and records a nullifier, and nothing debits the wormhole address. What is still spendable is the deposits whose nullifierN(secret, transfer_count)has not been used. So a wallet needs, for each of its wormhole addresses, everyWormhole::NativeTransferredto it:transfer_countto compute the nullifier,amountto add up, andleaf_indexfor a later proof.The chain has no reverse index from recipient to leaves (
ZkTree::Leavesis keyed by leaf index). The mobile wallet asks Quantus's Subsquid (sqm.quantus.com), which tells Quantus which addresses belong to one person. This observer already stores every one of those events inchain_event, with the recipient inaccounts[]under a GIN index. What's missing is a way to ask for them by recipient:/v1/chains/{chain}/events/Wormhole/NativeTransferredpages through every deposit on the chain./v1/chains/{chain}/accounts/{address}returns one address at a time, mixed with all its other activity, newest first. A miner's reward address has tens of thousands of deposits interleaved withMinerRewarded.What
GET /v1/chains/{chain}/wormhole/deposits?to=<addr>,<addr>,…&after=<height>:<event_index>&limit=<n>to: up to 100 addresses, SS58 or 0x hex. A malformed one is a 400 that names it.nextset when there are more.to(hex) and its SS58,amountas a decimal string (it is a u128),transfer_count,leaf_index,height,event_index,at.indexed_from/indexed_to. A testnet still backfilling has a partial answer, and a client must be able to say so instead of showing a low balance as if it were complete. Clients can cross-check the count against the chain'sWormhole::TransferCount.Not in scope