-
Notifications
You must be signed in to change notification settings - Fork 323
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implemented GRPC client to query account sequence (#361)
* Added logic to generate GRPC client from cosmos.auth proto (#337) * Adding logic to use GRPC client (#337) * Grpc client connection retrieves account sequence (#337) * Removed the account sequence flag from the tx raw commands (#337) * Removed instructions to query and specify account sequence from tx raw command (#337) * Logic to fetch GRPC endpoint address from config (#337) * Fixing tests (#361) * Logic to use the address from the key seed (#337) * Update readme * Fix the tx output strings * Fix update client Co-authored-by: Anca Zamfir <zamfiranca@gmail.com>
- Loading branch information
1 parent
5c3dbe2
commit 6c933e9
Showing
23 changed files
with
245 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<unknown> | ||
15324920548c2629e51d837bcefc1cbc40797c5d |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/// BaseAccount defines a base account type. It contains all the necessary fields | ||
/// for basic account functionality. Any custom account type should extend this | ||
/// type for additional functionality (e.g. vesting). | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct BaseAccount { | ||
#[prost(string, tag="1")] | ||
pub address: std::string::String, | ||
#[prost(message, optional, tag="2")] | ||
pub pub_key: ::std::option::Option<::prost_types::Any>, | ||
#[prost(uint64, tag="3")] | ||
pub account_number: u64, | ||
#[prost(uint64, tag="4")] | ||
pub sequence: u64, | ||
} | ||
/// ModuleAccount defines an account for modules that holds coins on a pool. | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct ModuleAccount { | ||
#[prost(message, optional, tag="1")] | ||
pub base_account: ::std::option::Option<BaseAccount>, | ||
#[prost(string, tag="2")] | ||
pub name: std::string::String, | ||
#[prost(string, repeated, tag="3")] | ||
pub permissions: ::std::vec::Vec<std::string::String>, | ||
} | ||
/// Params defines the parameters for the auth module. | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct Params { | ||
#[prost(uint64, tag="1")] | ||
pub max_memo_characters: u64, | ||
#[prost(uint64, tag="2")] | ||
pub tx_sig_limit: u64, | ||
#[prost(uint64, tag="3")] | ||
pub tx_size_cost_per_byte: u64, | ||
#[prost(uint64, tag="4")] | ||
pub sig_verify_cost_ed25519: u64, | ||
#[prost(uint64, tag="5")] | ||
pub sig_verify_cost_secp256k1: u64, | ||
} | ||
/// QueryAccountRequest is the request type for the Query/Account RPC method. | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct QueryAccountRequest { | ||
/// address defines the address to query for. | ||
#[prost(string, tag="1")] | ||
pub address: std::string::String, | ||
} | ||
/// QueryAccountResponse is the response type for the Query/Account RPC method. | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct QueryAccountResponse { | ||
/// account defines the account of the corresponding address. | ||
#[prost(message, optional, tag="1")] | ||
pub account: ::std::option::Option<::prost_types::Any>, | ||
} | ||
/// QueryParamsRequest is the request type for the Query/Params RPC method. | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct QueryParamsRequest { | ||
} | ||
/// QueryParamsResponse is the response type for the Query/Params RPC method. | ||
#[derive(Clone, PartialEq, ::prost::Message)] | ||
pub struct QueryParamsResponse { | ||
/// params defines the parameters of the module. | ||
#[prost(message, optional, tag="1")] | ||
pub params: ::std::option::Option<Params>, | ||
} | ||
# [doc = r" Generated client implementations."] pub mod query_client { # ! [allow (unused_variables , dead_code , missing_docs)] use tonic :: codegen :: * ; # [doc = " Query defines the gRPC querier service."] pub struct QueryClient < T > { inner : tonic :: client :: Grpc < T > , } impl QueryClient < tonic :: transport :: Channel > { # [doc = r" Attempt to create a new client by connecting to a given endpoint."] pub async fn connect < D > (dst : D) -> Result < Self , tonic :: transport :: Error > where D : std :: convert :: TryInto < tonic :: transport :: Endpoint > , D :: Error : Into < StdError > , { let conn = tonic :: transport :: Endpoint :: new (dst) ? . connect () . await ? ; Ok (Self :: new (conn)) } } impl < T > QueryClient < T > where T : tonic :: client :: GrpcService < tonic :: body :: BoxBody > , T :: ResponseBody : Body + HttpBody + Send + 'static , T :: Error : Into < StdError > , < T :: ResponseBody as HttpBody > :: Error : Into < StdError > + Send , { pub fn new (inner : T) -> Self { let inner = tonic :: client :: Grpc :: new (inner) ; Self { inner } } pub fn with_interceptor (inner : T , interceptor : impl Into < tonic :: Interceptor >) -> Self { let inner = tonic :: client :: Grpc :: with_interceptor (inner , interceptor) ; Self { inner } } # [doc = " Account returns account details based on address."] pub async fn account (& mut self , request : impl tonic :: IntoRequest < super :: QueryAccountRequest > ,) -> Result < tonic :: Response < super :: QueryAccountResponse > , tonic :: Status > { self . inner . ready () . await . map_err (| e | { tonic :: Status :: new (tonic :: Code :: Unknown , format ! ("Service was not ready: {}" , e . into ())) }) ? ; let codec = tonic :: codec :: ProstCodec :: default () ; let path = http :: uri :: PathAndQuery :: from_static ("/cosmos.auth.v1beta1.Query/Account") ; self . inner . unary (request . into_request () , path , codec) . await } # [doc = " Params queries all parameters."] pub async fn params (& mut self , request : impl tonic :: IntoRequest < super :: QueryParamsRequest > ,) -> Result < tonic :: Response < super :: QueryParamsResponse > , tonic :: Status > { self . inner . ready () . await . map_err (| e | { tonic :: Status :: new (tonic :: Code :: Unknown , format ! ("Service was not ready: {}" , e . into ())) }) ? ; let codec = tonic :: codec :: ProstCodec :: default () ; let path = http :: uri :: PathAndQuery :: from_static ("/cosmos.auth.v1beta1.Query/Params") ; self . inner . unary (request . into_request () , path , codec) . await } } impl < T : Clone > Clone for QueryClient < T > { fn clone (& self) -> Self { Self { inner : self . inner . clone () , } } } impl < T > std :: fmt :: Debug for QueryClient < T > { fn fmt (& self , f : & mut std :: fmt :: Formatter < '_ >) -> std :: fmt :: Result { write ! (f , "QueryClient {{ ... }}") } } } |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.