add GetInterchain: trace a transaction/block to validator blocks + interchain anchors

New Transaction.GetInterchain and Block.GetInterchain call the prime-node
/api/v1/{transaction,block}/{id}/interchain endpoints, returning an
InterchainTrace {blockId, validatorBlocks, interchainTransactions}. Adds local
VerificationBlock / InterchainTransaction / InterchainTrace model types.
This commit is contained in:
2026-06-02 14:12:49 -04:00
parent 621e359817
commit d945029f33
3 changed files with 63 additions and 0 deletions

View File

@@ -170,3 +170,39 @@ type ListResponse struct {
Items []interface{} `json:"items"`
TotalCount int `json:"total_count"`
}
// VerificationBlock is a validator's verification of a prime block.
type VerificationBlock struct {
Version string `json:"version"`
PrimeChainId string `json:"primeChainId"`
PrimeBlockId string `json:"primeBlockId"`
Timestamp string `json:"timestamp"`
VerifierPublicKey string `json:"verifierPublicKey"`
VerifierSignature string `json:"verifierSignature"`
}
// InterchainTransaction is an anchor broadcast to a public blockchain (e.g. ETH
// or BTC) that bundles one or more validator blocks. ValidatorBlocks holds the
// prime block ids covered; CoveredPrimeChainIds the prime chains they belong to.
type InterchainTransaction struct {
Id int `json:"id"`
Version string `json:"version"`
Timestamp string `json:"timestamp"`
ChainId string `json:"chainId"`
TransHash string `json:"transHash"`
BlockId string `json:"blockId"`
ValidatorBlocks []string `json:"validatorBlocks"`
ValidatorBlockhash string `json:"validatorBlockhash"`
Signature string `json:"signature"`
CoveredPrimeChainIds []string `json:"coveredPrimeChainIds"`
}
// InterchainTrace links a prime block to the validator (verification) blocks
// that validated it and the public-chain interchain anchors those validator
// blocks were bundled into. Returned by Transaction.GetInterchain and
// Block.GetInterchain.
type InterchainTrace struct {
BlockId string `json:"blockId"`
ValidatorBlocks []VerificationBlock `json:"validatorBlocks"`
InterchainTransactions []InterchainTransaction `json:"interchainTransactions"`
}