@@ -1,6 +1,7 @@
|
||||
package client
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/hex"
|
||||
"errors"
|
||||
"fmt"
|
||||
@@ -43,7 +44,7 @@ func QueryTxsByEvents(clientCtx client.Context, events []string, page, limit int
|
||||
|
||||
// TODO: this may not always need to be proven
|
||||
// https://github.com/cosmos/cosmos-sdk/issues/6807
|
||||
resTxs, err := node.TxSearch(query, true, &page, &limit, orderBy)
|
||||
resTxs, err := node.TxSearch(context.Background(), query, true, &page, &limit, orderBy)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -78,7 +79,7 @@ func QueryTx(clientCtx client.Context, hashHexStr string) (*sdk.TxResponse, erro
|
||||
|
||||
//TODO: this may not always need to be proven
|
||||
// https://github.com/cosmos/cosmos-sdk/issues/6807
|
||||
resTx, err := node.Tx(hash, true)
|
||||
resTx, err := node.Tx(context.Background(), hash, true)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -120,7 +121,7 @@ func getBlocksForTxResults(clientCtx client.Context, resTxs []*ctypes.ResultTx)
|
||||
|
||||
for _, resTx := range resTxs {
|
||||
if _, ok := resBlocks[resTx.Height]; !ok {
|
||||
resBlock, err := node.Block(&resTx.Height)
|
||||
resBlock, err := node.Block(context.Background(), &resTx.Height)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package rest
|
||||
|
||||
import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
|
||||
@@ -13,7 +14,7 @@ import (
|
||||
// QueryGenesisTxs writes the genesis transactions to the response if no error
|
||||
// occurs.
|
||||
func QueryGenesisTxs(clientCtx client.Context, w http.ResponseWriter) {
|
||||
resultGenesis, err := clientCtx.Client.Genesis()
|
||||
resultGenesis, err := clientCtx.Client.Genesis(context.Background())
|
||||
if err != nil {
|
||||
rest.WriteErrorResponse(
|
||||
w, http.StatusInternalServerError,
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package utils_test
|
||||
|
||||
import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/simapp"
|
||||
@@ -23,7 +24,7 @@ type TxSearchMock struct {
|
||||
txs []tmtypes.Tx
|
||||
}
|
||||
|
||||
func (mock TxSearchMock) TxSearch(query string, prove bool, page, perPage *int, orderBy string) (*ctypes.ResultTxSearch, error) {
|
||||
func (mock TxSearchMock) TxSearch(ctx context.Context, query string, prove bool, page, perPage *int, orderBy string) (*ctypes.ResultTxSearch, error) {
|
||||
if page == nil {
|
||||
*page = 0
|
||||
}
|
||||
@@ -45,7 +46,7 @@ func (mock TxSearchMock) TxSearch(query string, prove bool, page, perPage *int,
|
||||
return rst, nil
|
||||
}
|
||||
|
||||
func (mock TxSearchMock) Block(height *int64) (*ctypes.ResultBlock, error) {
|
||||
func (mock TxSearchMock) Block(ctx context.Context, height *int64) (*ctypes.ResultBlock, error) {
|
||||
// any non nil Block needs to be returned. used to get time value
|
||||
return &ctypes.ResultBlock{Block: &tmtypes.Block{}}, nil
|
||||
}
|
||||
|
||||
@@ -126,14 +126,14 @@ func QueryTendermintHeader(clientCtx client.Context) (ibctmtypes.Header, int64,
|
||||
return ibctmtypes.Header{}, 0, err
|
||||
}
|
||||
|
||||
info, err := node.ABCIInfo()
|
||||
info, err := node.ABCIInfo(context.Background())
|
||||
if err != nil {
|
||||
return ibctmtypes.Header{}, 0, err
|
||||
}
|
||||
|
||||
height := info.Response.LastBlockHeight
|
||||
|
||||
commit, err := node.Commit(&height)
|
||||
commit, err := node.Commit(context.Background(), &height)
|
||||
if err != nil {
|
||||
return ibctmtypes.Header{}, 0, err
|
||||
}
|
||||
@@ -141,7 +141,7 @@ func QueryTendermintHeader(clientCtx client.Context) (ibctmtypes.Header, int64,
|
||||
page := 0
|
||||
count := 10_000
|
||||
|
||||
validators, err := node.Validators(&height, &page, &count)
|
||||
validators, err := node.Validators(context.Background(), &height, &page, &count)
|
||||
if err != nil {
|
||||
return ibctmtypes.Header{}, 0, err
|
||||
}
|
||||
@@ -168,14 +168,14 @@ func QueryNodeConsensusState(clientCtx client.Context) (*ibctmtypes.ConsensusSta
|
||||
return &ibctmtypes.ConsensusState{}, 0, err
|
||||
}
|
||||
|
||||
info, err := node.ABCIInfo()
|
||||
info, err := node.ABCIInfo(context.Background())
|
||||
if err != nil {
|
||||
return &ibctmtypes.ConsensusState{}, 0, err
|
||||
}
|
||||
|
||||
height := info.Response.LastBlockHeight
|
||||
|
||||
commit, err := node.Commit(&height)
|
||||
commit, err := node.Commit(context.Background(), &height)
|
||||
if err != nil {
|
||||
return &ibctmtypes.ConsensusState{}, 0, err
|
||||
}
|
||||
@@ -184,7 +184,7 @@ func QueryNodeConsensusState(clientCtx client.Context) (*ibctmtypes.ConsensusSta
|
||||
count := 10_000
|
||||
|
||||
nextHeight := height + 1
|
||||
nextVals, err := node.Validators(&nextHeight, &page, &count)
|
||||
nextVals, err := node.Validators(context.Background(), &nextHeight, &page, &count)
|
||||
if err != nil {
|
||||
return &ibctmtypes.ConsensusState{}, 0, err
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ func GetAppliedPlanCmd() *cobra.Command {
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
headers, err := node.BlockchainInfo(res.Height, res.Height)
|
||||
headers, err := node.BlockchainInfo(context.Background(), res.Height, res.Height)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user