Documentation
¶
Overview ¶
Package grpc_client package implements the gRPC methods usage interface.
Index ¶
- func ConvertStructToEvent(str *_struct.Struct) (api.Event, error)
- type Client
- func (c *Client) Address(address string, optionalHeight ...uint64) (*api_pb.AddressResponse, error)
- func (c *Client) AddressExtended(address string, delegated bool, optionalHeight ...uint64) (*api_pb.AddressResponse, error)
- func (c *Client) Addresses(addresses []string, optionalHeight ...uint64) (*api_pb.AddressesResponse, error)
- func (c *Client) AddressesExtended(addresses []string, delegated bool, optionalHeight ...uint64) (*api_pb.AddressesResponse, error)
- func (c *Client) Block(height uint64) (*api_pb.BlockResponse, error)
- func (c *Client) BlockExtended(height uint64, failedTxs, events bool, fieldsBlock ...string) (*api_pb.BlockResponse, error)
- func (c *Client) Blocks(from, to uint64, failedTxs, events bool, fieldsBlock ...string) (*api_pb.BlocksResponse, error)
- func (c *Client) Candidate(publicKey string, optionalHeight ...uint64) (*api_pb.CandidateResponse, error)
- func (c *Client) CandidateExtended(publicKey string, notShowStakes bool, optionalHeight ...uint64) (*api_pb.CandidateResponse, error)
- func (c *Client) Candidates(includeStakes bool, optionalHeight ...uint64) (*api_pb.CandidatesResponse, error)
- func (c *Client) CandidatesExtended(includeStakes, notShowStakes bool, status string, optionalHeight ...uint64) (*api_pb.CandidatesResponse, error)
- func (c *Client) CheckVersion(version string, isTestnet bool) error
- func (c *Client) CoinID(symbol string, optionalHeight ...uint64) (uint64, error)
- func (c *Client) CoinInfo(symbol string, optionalHeight ...uint64) (*api_pb.CoinInfoResponse, error)
- func (c *Client) CoinInfoByID(id uint64, optionalHeight ...uint64) (*api_pb.CoinInfoResponse, error)
- func (c *Client) CommissionVotes(target uint64, optionalHeight ...uint64) (*api_pb.CommissionVotesResponse, error)
- func (c *Client) ErrorBody(err error) (int, *api_pb.ErrorBody, error)
- func (c *Client) EstimateCoinIDBuy(coinToSell, coinToBuy uint64, valueToBuy string, coinCommission uint64, ...) (*api_pb.EstimateCoinBuyResponse, error)
- func (c *Client) EstimateCoinIDBuyExtended(coinToSell, coinToBuy uint64, valueToBuy string, coinCommission uint64, ...) (*api_pb.EstimateCoinBuyResponse, error)
- func (c *Client) EstimateCoinIDSell(coinToBuy, coinToSell uint64, valueToSell string, coinCommission uint64, ...) (*api_pb.EstimateCoinSellResponse, error)
- func (c *Client) EstimateCoinIDSellAll(coinToBuy, coinToSell uint64, gasPrice uint64, valueToSell string, ...) (*api_pb.EstimateCoinSellAllResponse, error)
- func (c *Client) EstimateCoinIDSellAllExtended(coinToBuy, coinToSell uint64, gasPrice uint64, valueToSell string, ...) (*api_pb.EstimateCoinSellAllResponse, error)
- func (c *Client) EstimateCoinIDSellExtended(coinToBuy, coinToSell uint64, valueToSell string, coinCommission uint64, ...) (*api_pb.EstimateCoinSellResponse, error)
- func (c *Client) EstimateCoinSymbolBuy(coinToSell, coinToBuy string, valueToBuy string, coinCommission string, ...) (*api_pb.EstimateCoinBuyResponse, error)
- func (c *Client) EstimateCoinSymbolBuyExtended(coinToSell, coinToBuy string, valueToBuy string, coinCommission string, ...) (*api_pb.EstimateCoinBuyResponse, error)
- func (c *Client) EstimateCoinSymbolSell(coinToBuy, coinToSell string, valueToSell string, coinCommission string, ...) (*api_pb.EstimateCoinSellResponse, error)
- func (c *Client) EstimateCoinSymbolSellAll(coinToBuy, coinToSell string, gasPrice uint64, valueToSell string, ...) (*api_pb.EstimateCoinSellAllResponse, error)
- func (c *Client) EstimateCoinSymbolSellAllExtended(coinToBuy, coinToSell string, gasPrice uint64, valueToSell string, ...) (*api_pb.EstimateCoinSellAllResponse, error)
- func (c *Client) EstimateCoinSymbolSellExtended(coinToBuy, coinToSell string, valueToSell string, coinCommission string, ...) (*api_pb.EstimateCoinSellResponse, error)
- func (c *Client) EstimateTxCommission(tx string, optionalHeight ...uint64) (*api_pb.EstimateTxCommissionResponse, error)
- func (c *Client) Events(height uint64, search ...string) (*api_pb.EventsResponse, error)
- func (c *Client) Frozen(address string, coinID *uint64, optionalHeight ...uint64) (*api_pb.FrozenResponse, error)
- func (c *Client) FrozenAll(addresses []string, coinIDs []uint64, startHeight, endHeight uint64, ...) (*api_pb.FrozenResponse, error)
- func (c *Client) GRPCClient() api_pb.ApiServiceClient
- func (c *Client) Genesis() (*api_pb.GenesisResponse, error)
- func (c *Client) HTTPError(statusError error) (statusCode int, json string, err error)
- func (c *Client) Halts(height uint64) (*api_pb.HaltsResponse, error)
- func (c *Client) LimitOrder(orderID uint64, optionalHeight ...uint64) (*api_pb.LimitOrderResponse, error)
- func (c *Client) LimitOrders(orderIDs []uint64, optionalHeight ...uint64) (*api_pb.LimitOrdersResponse, error)
- func (c *Client) LimitOrdersOfPool(sellCoin, buyCoin uint64, optionalHeight ...uint64) (*api_pb.LimitOrdersOfPoolResponse, error)
- func (c *Client) Marshal(m proto.Message) (json string, err error)
- func (c *Client) MaxGasPrice(optionalHeight ...uint64) (*api_pb.MaxGasPriceResponse, error)
- func (c *Client) MinGasPrice() (*api_pb.MinGasPriceResponse, error)
- func (c *Client) MissedBlocks(publicKey string, optionalHeight ...uint64) (*api_pb.MissedBlocksResponse, error)
- func (c *Client) NetInfo() (*api_pb.NetInfoResponse, error)
- func (c *Client) Nonce(address string) (uint64, error)
- func (c *Client) PriceCommission(optionalHeight ...uint64) (*api_pb.PriceCommissionResponse, error)
- func (c *Client) SendTransaction(tx string) (*api_pb.SendTransactionResponse, error)
- func (c *Client) Status() (*api_pb.StatusResponse, error)
- func (c *Client) Subscribe(query string) (api_pb.ApiService_SubscribeClient, error)
- func (c *Client) SwapPool(coin0, coin1 uint64, optionalHeight ...uint64) (*api_pb.SwapPoolResponse, error)
- func (c *Client) SwapPoolProvider(coin0, coin1 uint64, provider string, optionalHeight ...uint64) (*api_pb.SwapPoolResponse, error)
- func (c *Client) Transaction(hash string) (*api_pb.TransactionResponse, error)
- func (c *Client) Transactions(query string, page, perPage int) (*api_pb.TransactionsResponse, error)
- func (c *Client) UnconfirmedTxs(limit ...uint64) (*api_pb.UnconfirmedTxsResponse, error)
- func (c *Client) UpdateVotes(target uint64, optionalHeight ...uint64) (*api_pb.UpdateVotesResponse, error)
- func (c *Client) Validators(optionalHeight ...uint64) (*api_pb.ValidatorsResponse, error)
- func (c *Client) VersionNetwork() (*api_pb.VersionNetworkResponse, error)
- func (c *Client) WaitList(publicKey, address string, optionalHeight ...uint64) (*api_pb.WaitListResponse, error)
- func (c *Client) WithCallOption(opts ...grpc.CallOption) *Client
- func (c *Client) WithContextFunc(contextFunc func(context.Context) func() context.Context) *Client
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertStructToEvent ¶
ConvertStructToEvent returns Event model
Example ¶
package main import ( "github.com/MinterTeam/minter-go-sdk/v2/api" "github.com/MinterTeam/minter-go-sdk/v2/api/grpc_client" ) func mark(address, publicKey string) {} func doSomething1(*api.RewardEvent) {} func doSomething2(*api.SlashEvent) {} func doSomething3(*api.UnbondEvent) {} func doSomething4(*api.StakeKickEvent) {} func main() { client, _ := grpc_client.New("localhost:8842") events, _ := client.Events(2280) for _, data := range events.Events { event, _ := grpc_client.ConvertStructToEvent(data) switch e := event.(type) { case *api.RewardEvent: doSomething1(e) case *api.SlashEvent: doSomething2(e) case *api.UnbondEvent: doSomething3(e) case *api.StakeKickEvent: doSomething4(e) case *api.UpdateNetworkEvent, *api.UpdateCommissionsEvent: e.Type() } } }
Output:
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client gRPC
func (*Client) AddressExtended ¶ added in v2.1.0
func (c *Client) AddressExtended(address string, delegated bool, optionalHeight ...uint64) (*api_pb.AddressResponse, error)
AddressExtended returns coins list with balance, delegated and transaction count of an address.
func (*Client) Addresses ¶
func (c *Client) Addresses(addresses []string, optionalHeight ...uint64) (*api_pb.AddressesResponse, error)
Addresses returns list of addresses.
func (*Client) AddressesExtended ¶ added in v2.1.0
func (c *Client) AddressesExtended(addresses []string, delegated bool, optionalHeight ...uint64) (*api_pb.AddressesResponse, error)
AddressesExtended returns list of addresses with bipValue and delegated.
func (*Client) Block ¶
func (c *Client) Block(height uint64) (*api_pb.BlockResponse, error)
Block returns block data at given height.
func (*Client) BlockExtended ¶ added in v2.2.0
func (c *Client) BlockExtended(height uint64, failedTxs, events bool, fieldsBlock ...string) (*api_pb.BlockResponse, error)
BlockExtended returns block data at given height by filtered data.
func (*Client) Blocks ¶ added in v2.2.0
func (c *Client) Blocks(from, to uint64, failedTxs, events bool, fieldsBlock ...string) (*api_pb.BlocksResponse, error)
Blocks ...
func (*Client) Candidate ¶
func (c *Client) Candidate(publicKey string, optionalHeight ...uint64) (*api_pb.CandidateResponse, error)
Candidate returns candidate’s info by provided public_key.
func (*Client) CandidateExtended ¶ added in v2.1.0
func (c *Client) CandidateExtended(publicKey string, notShowStakes bool, optionalHeight ...uint64) (*api_pb.CandidateResponse, error)
CandidateExtended returns candidate’s info by provided public_key.
func (*Client) Candidates ¶
func (c *Client) Candidates(includeStakes bool, optionalHeight ...uint64) (*api_pb.CandidatesResponse, error)
Candidates returns list of candidates.
func (*Client) CandidatesExtended ¶ added in v2.1.0
func (c *Client) CandidatesExtended(includeStakes, notShowStakes bool, status string, optionalHeight ...uint64) (*api_pb.CandidatesResponse, error)
CandidatesExtended returns list of candidates.
func (*Client) CheckVersion ¶ added in v2.1.0
CheckVersion compares the prefix in the version name and checks the testnet mode
func (*Client) CoinInfo ¶
func (c *Client) CoinInfo(symbol string, optionalHeight ...uint64) (*api_pb.CoinInfoResponse, error)
CoinInfo returns information about coin symbol.
func (*Client) CoinInfoByID ¶
func (c *Client) CoinInfoByID(id uint64, optionalHeight ...uint64) (*api_pb.CoinInfoResponse, error)
CoinInfoByID returns information about coin ID.
func (*Client) CommissionVotes ¶ added in v2.2.0
func (c *Client) CommissionVotes(target uint64, optionalHeight ...uint64) (*api_pb.CommissionVotesResponse, error)
CommissionVotes returns ...
func (*Client) EstimateCoinIDBuy ¶
func (c *Client) EstimateCoinIDBuy(coinToSell, coinToBuy uint64, valueToBuy string, coinCommission uint64, optionalHeight ...uint64) (*api_pb.EstimateCoinBuyResponse, error)
EstimateCoinIDBuy returns estimate of buy coin transaction.
func (*Client) EstimateCoinIDBuyExtended ¶ added in v2.2.0
func (c *Client) EstimateCoinIDBuyExtended(coinToSell, coinToBuy uint64, valueToBuy string, coinCommission uint64, swapFrom string, route []uint64, optionalHeight ...uint64) (*api_pb.EstimateCoinBuyResponse, error)
EstimateCoinIDBuyExtended returns estimate of buy coin transaction with choice of the exchange source.
func (*Client) EstimateCoinIDSell ¶
func (c *Client) EstimateCoinIDSell(coinToBuy, coinToSell uint64, valueToSell string, coinCommission uint64, optionalHeight ...uint64) (*api_pb.EstimateCoinSellResponse, error)
EstimateCoinIDSell returns estimate of sell coin transaction.
func (*Client) EstimateCoinIDSellAll ¶
func (c *Client) EstimateCoinIDSellAll(coinToBuy, coinToSell uint64, gasPrice uint64, valueToSell string, optionalHeight ...uint64) (*api_pb.EstimateCoinSellAllResponse, error)
EstimateCoinIDSellAll returns estimate of sell all coin transaction.
func (*Client) EstimateCoinIDSellAllExtended ¶ added in v2.2.0
func (c *Client) EstimateCoinIDSellAllExtended(coinToBuy, coinToSell uint64, gasPrice uint64, valueToSell string, swapFrom string, route []uint64, optionalHeight ...uint64) (*api_pb.EstimateCoinSellAllResponse, error)
EstimateCoinIDSellAllExtended returns estimate of sell all coin transaction with choice of the exchange source.
func (*Client) EstimateCoinIDSellExtended ¶ added in v2.2.0
func (c *Client) EstimateCoinIDSellExtended(coinToBuy, coinToSell uint64, valueToSell string, coinCommission uint64, swapFrom string, route []uint64, optionalHeight ...uint64) (*api_pb.EstimateCoinSellResponse, error)
EstimateCoinIDSellExtended returns estimate of sell coin transaction with choice of the exchange source.
func (*Client) EstimateCoinSymbolBuy ¶
func (c *Client) EstimateCoinSymbolBuy(coinToSell, coinToBuy string, valueToBuy string, coinCommission string, optionalHeight ...uint64) (*api_pb.EstimateCoinBuyResponse, error)
EstimateCoinSymbolBuy returns estimate of buy coin transaction.
func (*Client) EstimateCoinSymbolBuyExtended ¶ added in v2.2.0
func (c *Client) EstimateCoinSymbolBuyExtended(coinToSell, coinToBuy string, valueToBuy string, coinCommission string, swapFrom string, route []uint64, optionalHeight ...uint64) (*api_pb.EstimateCoinBuyResponse, error)
EstimateCoinSymbolBuyExtended returns estimate of buy coin transaction with choice of the exchange source.
func (*Client) EstimateCoinSymbolSell ¶
func (c *Client) EstimateCoinSymbolSell(coinToBuy, coinToSell string, valueToSell string, coinCommission string, optionalHeight ...uint64) (*api_pb.EstimateCoinSellResponse, error)
EstimateCoinSymbolSell returns estimate of sell coin transaction.
func (*Client) EstimateCoinSymbolSellAll ¶
func (c *Client) EstimateCoinSymbolSellAll(coinToBuy, coinToSell string, gasPrice uint64, valueToSell string, optionalHeight ...uint64) (*api_pb.EstimateCoinSellAllResponse, error)
EstimateCoinSymbolSellAll returns estimate of sell all coin transaction.
func (*Client) EstimateCoinSymbolSellAllExtended ¶ added in v2.2.0
func (c *Client) EstimateCoinSymbolSellAllExtended(coinToBuy, coinToSell string, gasPrice uint64, valueToSell string, swapFrom string, route []uint64, optionalHeight ...uint64) (*api_pb.EstimateCoinSellAllResponse, error)
EstimateCoinSymbolSellAllExtended returns estimate of sell all coin transaction with choice of the exchange source.
func (*Client) EstimateCoinSymbolSellExtended ¶ added in v2.2.0
func (c *Client) EstimateCoinSymbolSellExtended(coinToBuy, coinToSell string, valueToSell string, coinCommission string, swapFrom string, route []uint64, optionalHeight ...uint64) (*api_pb.EstimateCoinSellResponse, error)
EstimateCoinSymbolSellExtended returns estimate of sell coin transaction with choice of the exchange source.
func (*Client) EstimateTxCommission ¶
func (c *Client) EstimateTxCommission(tx string, optionalHeight ...uint64) (*api_pb.EstimateTxCommissionResponse, error)
EstimateTxCommission returns estimate of encoding transaction with choice of the exchange source.
func (*Client) Frozen ¶
func (c *Client) Frozen(address string, coinID *uint64, optionalHeight ...uint64) (*api_pb.FrozenResponse, error)
Frozen returns frozen balance. Deprecated: Use FrozenAll instead.
func (*Client) FrozenAll ¶ added in v2.5.0
func (c *Client) FrozenAll(addresses []string, coinIDs []uint64, startHeight, endHeight uint64, optionalHeight ...uint64) (*api_pb.FrozenResponse, error)
FrozenAll returns frozen balance.
func (*Client) GRPCClient ¶
func (c *Client) GRPCClient() api_pb.ApiServiceClient
GRPCClient returns gRPC client api_pb.ApiServiceClient
func (*Client) Genesis ¶
func (c *Client) Genesis() (*api_pb.GenesisResponse, error)
Genesis returns genesis file.
func (*Client) Halts ¶
func (c *Client) Halts(height uint64) (*api_pb.HaltsResponse, error)
Halts returns the candidate votes for stopping the network at block.
func (*Client) LimitOrder ¶ added in v2.4.0
func (c *Client) LimitOrder(orderID uint64, optionalHeight ...uint64) (*api_pb.LimitOrderResponse, error)
LimitOrder returns ...
func (*Client) LimitOrders ¶ added in v2.4.0
func (c *Client) LimitOrders(orderIDs []uint64, optionalHeight ...uint64) (*api_pb.LimitOrdersResponse, error)
LimitOrders returns ...
func (*Client) LimitOrdersOfPool ¶ added in v2.4.0
func (c *Client) LimitOrdersOfPool(sellCoin, buyCoin uint64, optionalHeight ...uint64) (*api_pb.LimitOrdersOfPoolResponse, error)
LimitOrdersOfPool returns ...
func (*Client) MaxGasPrice ¶
func (c *Client) MaxGasPrice(optionalHeight ...uint64) (*api_pb.MaxGasPriceResponse, error)
MaxGasPrice returns current max gas.
func (*Client) MinGasPrice ¶
func (c *Client) MinGasPrice() (*api_pb.MinGasPriceResponse, error)
MinGasPrice returns current min gas price.
func (*Client) MissedBlocks ¶
func (c *Client) MissedBlocks(publicKey string, optionalHeight ...uint64) (*api_pb.MissedBlocksResponse, error)
MissedBlocks returns missed blocks by validator public key.
func (*Client) NetInfo ¶
func (c *Client) NetInfo() (*api_pb.NetInfoResponse, error)
NetInfo returns network info
func (*Client) PriceCommission ¶ added in v2.2.0
func (c *Client) PriceCommission(optionalHeight ...uint64) (*api_pb.PriceCommissionResponse, error)
PriceCommission returns ...
func (*Client) SendTransaction ¶
func (c *Client) SendTransaction(tx string) (*api_pb.SendTransactionResponse, error)
SendTransaction returns the result of sending signed tx. To ensure that transaction was successfully committed to the blockchain, you need to find the transaction by the hash and ensure that the status code equals to 0.
Example ¶
package main import ( "github.com/MinterTeam/minter-go-sdk/v2/api" "github.com/MinterTeam/minter-go-sdk/v2/api/grpc_client" "github.com/MinterTeam/minter-go-sdk/v2/transaction" "github.com/MinterTeam/minter-go-sdk/v2/wallet" "github.com/MinterTeam/node-grpc-gateway/api_pb" grpc_retry "github.com/grpc-ecosystem/go-grpc-middleware/retry" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" "io" "math/big" "time" ) func main() { client, _ := grpc_client.New("localhost:8842") coinID, _ := client.CoinID("SYMBOL") w, _ := wallet.Create("1 2 3 4 5 6 7 8 9 10 11 12", "") nonce, _ := client.Nonce(w.Address) data := transaction.NewSendData().SetCoin(coinID).SetValue(transaction.BipToPip(big.NewInt(1))).MustSetTo(w.Address) transactionsBuilder := transaction.NewBuilder(transaction.TestNetChainID) tx, _ := transactionsBuilder.NewTransaction(data) sign, _ := tx.SetNonce(nonce).Sign(w.PrivateKey) encode, _ := sign.Encode() hash, _ := sign.Hash() subscribeClient, _ := client.Subscribe(api.QueryHash(hash)) defer subscribeClient.CloseSend() res, err := client.WithCallOption( grpc_retry.WithCodes(codes.FailedPrecondition), grpc_retry.WithBackoff(grpc_retry.BackoffLinear(1*time.Second)), grpc_retry.WithMax(4), ).SendTransaction(encode) if err != nil { _, _, _ = client.ErrorBody(err) } if res.Code != 0 { panic(res.Log) } { recv, err := subscribeClient.Recv() if err == io.EOF { return } if code := status.Code(err); code != codes.OK { if code == codes.DeadlineExceeded || code == codes.Canceled { return } panic(err) } marshal, _ := client.Marshal(recv) findedTx, _ := api.SubscribeNewTxToTx(marshal) _, _ = findedTx.GetTransaction(), findedTx.Data().(*transaction.SendData) } // or { time.Sleep(5 * time.Second) response, _ := client.Transaction(hash) _, _ = client.Marshal(response) sendData := new(api_pb.SendData) _ = response.Data.UnmarshalTo(sendData) _, _ = client.Marshal(sendData) } }
Output:
func (*Client) Status ¶
func (c *Client) Status() (*api_pb.StatusResponse, error)
Status returns node status including pubkey, latest block.
func (*Client) Subscribe ¶
func (c *Client) Subscribe(query string) (api_pb.ApiService_SubscribeClient, error)
Subscribe returns a subscription for events by query.
func (*Client) SwapPool ¶ added in v2.2.0
func (c *Client) SwapPool(coin0, coin1 uint64, optionalHeight ...uint64) (*api_pb.SwapPoolResponse, error)
SwapPool returns total supply and reserves.
func (*Client) SwapPoolProvider ¶ added in v2.2.0
func (c *Client) SwapPoolProvider(coin0, coin1 uint64, provider string, optionalHeight ...uint64) (*api_pb.SwapPoolResponse, error)
SwapPoolProvider returns reserves and liquidity balance of provider.
func (*Client) Transaction ¶
func (c *Client) Transaction(hash string) (*api_pb.TransactionResponse, error)
Transaction returns transaction info.
func (*Client) Transactions ¶
func (c *Client) Transactions(query string, page, perPage int) (*api_pb.TransactionsResponse, error)
Transactions returns transactions by query.
func (*Client) UnconfirmedTxs ¶
func (c *Client) UnconfirmedTxs(limit ...uint64) (*api_pb.UnconfirmedTxsResponse, error)
UnconfirmedTxs returns unconfirmed transactions.
func (*Client) UpdateVotes ¶ added in v2.2.0
func (c *Client) UpdateVotes(target uint64, optionalHeight ...uint64) (*api_pb.UpdateVotesResponse, error)
UpdateVotes returns ...
func (*Client) Validators ¶
func (c *Client) Validators(optionalHeight ...uint64) (*api_pb.ValidatorsResponse, error)
Validators returns list of active validators.
func (*Client) VersionNetwork ¶ added in v2.2.0
func (c *Client) VersionNetwork() (*api_pb.VersionNetworkResponse, error)
VersionNetwork returns ...
func (*Client) WaitList ¶
func (c *Client) WaitList(publicKey, address string, optionalHeight ...uint64) (*api_pb.WaitListResponse, error)
WaitList returns the list of address stakes in waitlist.
func (*Client) WithCallOption ¶
func (c *Client) WithCallOption(opts ...grpc.CallOption) *Client
WithCallOption returns new Client with additional grpc.CallOption
func (*Client) WithContextFunc ¶
WithContextFunc returns new Client with new context Example:
timeout := func(c context.Context) func() context.Context { return func() context.Context { ctx, _ := context.WithTimeout(c, 10*time.Second) return ctx } }