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:
@@ -52,6 +52,20 @@ func (tc *TransactionClient) Get(ctx context.Context, transactionID string) (*mo
|
||||
return &resp, nil
|
||||
}
|
||||
|
||||
// GetInterchain traces a transaction to the validator (verification) blocks that
|
||||
// validated its prime block and the public-chain interchain anchors those
|
||||
// validator blocks were bundled into. If the transaction is still pending (not
|
||||
// yet in a block) the trace's slices are empty.
|
||||
func (tc *TransactionClient) GetInterchain(ctx context.Context, transactionID string) (*models.InterchainTrace, error) {
|
||||
var resp models.InterchainTrace
|
||||
path := fmt.Sprintf("/api/v1/transaction/%s/interchain", transactionID)
|
||||
err := tc.client.Get(ctx, path, &resp)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &resp, nil
|
||||
}
|
||||
|
||||
func (tc *TransactionClient) List(ctx context.Context) (*models.ListTransactionsResponse, error) {
|
||||
var resp models.ListTransactionsResponse
|
||||
path := "/api/v1/transaction/"
|
||||
|
||||
Reference in New Issue
Block a user