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:
@@ -25,3 +25,16 @@ func (bc *BlockClient) Get(ctx context.Context, blockID string) (*models.Block,
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
||||
// GetInterchain traces a block to the validator (verification) blocks that
|
||||
// validated it and the public-chain interchain anchors those validator blocks
|
||||
// were bundled into.
|
||||
func (bc *BlockClient) GetInterchain(ctx context.Context, blockID string) (*models.InterchainTrace, error) {
|
||||
var resp models.InterchainTrace
|
||||
path := fmt.Sprintf("/api/v1/block/%s/interchain", blockID)
|
||||
err := bc.client.Get(ctx, path, &resp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user