Documentation
¶
Overview ¶
Package libyaci provides a dynamic gRPC client that uses server reflection to invoke methods without precompiled protobuf stubs.
Basic Usage ¶
client, err := libyaci.Dial(ctx, "localhost:9090", libyaci.WithInsecure())
if err != nil {
log.Fatal(err)
}
defer client.Close()
resp, err := client.Invoke(
"cosmos.bank.v1beta1.Query.Balance",
[]byte(`{"address":"cosmos1...", "denom":"uatom"}`),
)
Invocation Methods ¶
Invoke returns JSON bytes:
resp, err := client.Invoke("package.Service.Method", []byte(`{}`))
InvokeJSON marshals/unmarshals Go types:
var result ResponseType
err := client.InvokeJSON("package.Service.Method", request, &result)
InvokeRaw returns the dynamic protobuf message:
msg, err := client.InvokeRaw("package.Service.Method", nil)
field := msg.ProtoReflect().Get(msg.Descriptor().Fields().ByName("field"))
Service Discovery ¶
services := client.ListServices()
methods, err := client.ListMethods("cosmos.bank.v1beta1.Query")
input, output, err := client.DescribeMethod("cosmos.bank.v1beta1.Query.Balance")
Cosmos SDK Convenience Methods ¶
High-level methods for common Cosmos SDK queries:
// Block queries block, err := client.GetLatestBlock() height, err := client.GetLatestBlockHeight() block, err := client.GetBlockByHeight(12345) earliest, err := client.GetEarliestBlockHeight() // Transaction queries txs, err := client.GetTxsByHeight(12345) txsParsed, err := client.GetTxsByHeightParsed(12345) // Chain info chainID, err := client.GetChainID() denom, err := client.GetBondDenom() // Account queries validators, err := client.GetAllValidators() // returns map[address]moniker modules, err := client.GetModuleAccounts() // returns map[address]name balance, err := client.GetBalance(address, denom) balances, err := client.GetAllBalances(address) delegations, err := client.GetDelegations(delegatorAddr)
Configuration ¶
client, err := libyaci.Dial(ctx, "grpc.example.com:443",
libyaci.WithInsecure(),
libyaci.WithMaxRetries(5),
libyaci.WithMaxRecvMsgSize(16*1024*1024),
libyaci.WithDialTimeout(30*time.Second),
libyaci.WithProtoDir("./protos"), // local protos for deprecated types
)
ALPN Connection Issues ¶
If connections fail with "missing selected ALPN property" errors (common with older Cosmos nodes), import the alpnfix subpackage before any gRPC imports:
import _ "github.com/Cordtus/libyaci/alpnfix"
Deprecated Type Resolution ¶
Historical blockchain data may contain message types from deprecated modules that no longer exist on the server. Use WithProtoDir to provide local .proto files for these types:
client, err := libyaci.Dial(ctx, addr,
libyaci.WithProtoDir("./protos"), // protos/tendermint/liquidity/v1beta1/*.proto
)
Thread Safety ¶
Client and Resolver are safe for concurrent use. The proto registry uses read-write locks when fetching descriptors on-demand.
Performance ¶
Initial connection fetches all descriptors from the server, which may take several seconds for servers with many services. Subsequent calls use cached descriptors. Reuse the client instance for best performance.
Index ¶
- Variables
- func DisableALPNEnforcement()
- func IsUnsupportedMethod(err error) bool
- type AccountInfoResponse
- type AccountResponse
- type AccountsResponse
- type AllBalancesResponse
- type AllEvidenceResponse
- type AllowanceResponse
- type AllowancesResponse
- type AnnualProvisionsResponse
- type AppliedPlanResponse
- type AuthParamsResponse
- type BalanceResponse
- type BankParamsResponse
- type Bech32PrefixResponse
- type BlockResponse
- type BlockResultsResponse
- type BlockWithTxsResponse
- type Catalog
- func (c *Catalog) ChainInfo() ChainInfo
- func (c *Catalog) HasMethod(method string) bool
- func (c *Catalog) HasService(service string) bool
- func (c *Catalog) MessageTypesByPackage(pkg string) []MessageInfo
- func (c *Catalog) Messages() []MessageInfo
- func (c *Catalog) Method(method string) (MethodInfo, bool)
- func (c *Catalog) Methods() []MethodInfo
- func (c *Catalog) QueryServices() []ServiceInfo
- func (c *Catalog) Service(service string) (ServiceInfo, bool)
- func (c *Catalog) Services() []ServiceInfo
- type ChainInfo
- type Client
- func (c *Client) Catalog() *Catalog
- func (c *Client) ChainInfo() ChainInfo
- func (c *Client) Close() error
- func (c *Client) Conn() *grpc.ClientConn
- func (c *Client) DecodeTxBytes(rawBytes []byte) ([]byte, error)
- func (c *Client) DescribeMethod(method string) (input, output string, err error)
- func (c *Client) DetectChainInfo(ctx context.Context) (ChainInfo, error)
- func (c *Client) ExtractField(method string, request []byte, fieldName string) (interface{}, error)
- func (c *Client) GetAccount(address string) (*AccountResponse, error)
- func (c *Client) GetAccountInfo(address string) (*AccountInfoResponse, error)
- func (c *Client) GetAccounts(paginationKey string) (*AccountsResponse, error)
- func (c *Client) GetAllBalances(address string) (*AllBalancesResponse, error)
- func (c *Client) GetAllEvidence() (*AllEvidenceResponse, error)
- func (c *Client) GetAllValidators() (map[string]string, error)
- func (c *Client) GetAllowance(granter, grantee string) (*AllowanceResponse, error)
- func (c *Client) GetAllowances(grantee string) (*AllowancesResponse, error)
- func (c *Client) GetAllowancesByGranter(granter string) (*AllowancesResponse, error)
- func (c *Client) GetAnnualProvisions() (string, error)
- func (c *Client) GetAppliedPlan(name string) (*AppliedPlanResponse, error)
- func (c *Client) GetAuthParams() (*AuthParamsResponse, error)
- func (c *Client) GetBalance(address, denom string) (*BalanceResponse, error)
- func (c *Client) GetBankParams() (*BankParamsResponse, error)
- func (c *Client) GetBech32Prefix() (string, error)
- func (c *Client) GetBlockByHeight(height int64) (*BlockResponse, error)
- func (c *Client) GetBlockResults(height int64) (*BlockResultsResponse, error)
- func (c *Client) GetBlockWithTxs(height int64) (*BlockWithTxsResponse, error)
- func (c *Client) GetBondDenom() (string, error)
- func (c *Client) GetChainID() (string, error)
- func (c *Client) GetCommunityPool() (*CommunityPoolResponse, error)
- func (c *Client) GetCurrentPlan() (*CurrentPlanResponse, error)
- func (c *Client) GetDelegation(delegatorAddr, validatorAddr string) (*DelegationResponse, error)
- func (c *Client) GetDelegationRewards(delegatorAddr, validatorAddr string) (*DelegationRewardsResponse, error)
- func (c *Client) GetDelegationTotalRewards(delegatorAddr string) (*DelegationTotalRewardsResponse, error)
- func (c *Client) GetDelegations(delegatorAddr string) (*DelegationsResponse, error)
- func (c *Client) GetDelegatorUnbondingDelegations(delegatorAddr string) (*UnbondingDelegationsResponse, error)
- func (c *Client) GetDelegatorValidators(delegatorAddr string) (*ValidatorsResponse, error)
- func (c *Client) GetDelegatorWithdrawAddress(delegatorAddr string) (string, error)
- func (c *Client) GetDenomMetadata(denom string) (*DenomMetadataResponse, error)
- func (c *Client) GetDenomOwners(denom string) (*DenomOwnersResponse, error)
- func (c *Client) GetDenomsMetadata() (*DenomsMetadataResponse, error)
- func (c *Client) GetDistributionParams() (*DistributionParamsResponse, error)
- func (c *Client) GetEarliestBlockHeight() (int64, error)
- func (c *Client) GetEvidence(hash string) (*EvidenceResponse, error)
- func (c *Client) GetGovParams() (*GovParamsResponse, error)
- func (c *Client) GetGranteeGrants(grantee string) (*GrantsResponse, error)
- func (c *Client) GetGranterGrants(granter string) (*GrantsResponse, error)
- func (c *Client) GetGrants(granter, grantee string) (*GrantsResponse, error)
- func (c *Client) GetIBCChannel(portID, channelID string) (*IBCChannelResponse, error)
- func (c *Client) GetIBCChannels() (*IBCChannelsResponse, error)
- func (c *Client) GetIBCClientConnections(clientID string) ([]string, error)
- func (c *Client) GetIBCClientState(clientID string) (*IBCClientStateResponse, error)
- func (c *Client) GetIBCClientStates() (*IBCClientStatesResponse, error)
- func (c *Client) GetIBCConnection(connectionID string) (*IBCConnectionResponse, error)
- func (c *Client) GetIBCConnectionChannels(connectionID string) (*IBCChannelsResponse, error)
- func (c *Client) GetIBCConnections() (*IBCConnectionsResponse, error)
- func (c *Client) GetIBCDenomHash(trace string) (string, error)
- func (c *Client) GetIBCDenomTrace(hash string) (*IBCDenomTraceResponse, error)
- func (c *Client) GetIBCDenomTraces() (*IBCDenomTracesResponse, error)
- func (c *Client) GetIBCEscrowAddress(portID, channelID string) (string, error)
- func (c *Client) GetIBCTotalEscrowForDenom(denom string) (*IBCTotalEscrowResponse, error)
- func (c *Client) GetIBCTransferParams() (*IBCTransferParamsResponse, error)
- func (c *Client) GetInflation() (string, error)
- func (c *Client) GetLatestBlock() (*BlockResponse, error)
- func (c *Client) GetLatestBlockHeight() (int64, error)
- func (c *Client) GetLatestBlockResults() (*BlockResultsResponse, error)
- func (c *Client) GetLatestValidatorSet() (*ValidatorSetResponse, error)
- func (c *Client) GetMethodDescriptor(method string) (protoreflect.MethodDescriptor, error)
- func (c *Client) GetMintParams() (*MintParamsResponse, error)
- func (c *Client) GetModuleAccountByName(name string) (*AccountResponse, error)
- func (c *Client) GetModuleAccounts() (map[string]string, error)
- func (c *Client) GetModuleVersions() (*ModuleVersionsResponse, error)
- func (c *Client) GetNodeInfo() (*NodeInfoResponse, error)
- func (c *Client) GetProposal(proposalID uint64) (*ProposalResponse, error)
- func (c *Client) GetProposalDeposits(proposalID uint64) (*DepositsResponse, error)
- func (c *Client) GetProposalVotes(proposalID uint64) (*VotesResponse, error)
- func (c *Client) GetProposals(status string) (*ProposalsResponse, error)
- func (c *Client) GetRedelegations(delegatorAddr string) (*RedelegationsResponse, error)
- func (c *Client) GetSigningInfo(consAddr string) (*SigningInfoResponse, error)
- func (c *Client) GetSigningInfos() (*SigningInfosResponse, error)
- func (c *Client) GetSlashingParams() (*SlashingParamsResponse, error)
- func (c *Client) GetSpendableBalances(address string) (*SpendableBalancesResponse, error)
- func (c *Client) GetStakingParams() (*StakingParamsResponse, error)
- func (c *Client) GetStakingPool() (*StakingPoolResponse, error)
- func (c *Client) GetSupplyOf(denom string) (*SupplyOfResponse, error)
- func (c *Client) GetSyncing() (bool, error)
- func (c *Client) GetTallyResult(proposalID uint64) (*TallyResultResponse, error)
- func (c *Client) GetTotalSupply() (*TotalSupplyResponse, error)
- func (c *Client) GetTx(hash string) (*TxResponse, error)
- func (c *Client) GetTxsByHeight(height int64) ([]byte, error)
- func (c *Client) GetTxsByHeightParsed(height int64) (*TxsEventResponse, error)
- func (c *Client) GetUnbondingDelegation(delegatorAddr, validatorAddr string) (*UnbondingDelegationResponse, error)
- func (c *Client) GetValidator(validatorAddr string) (*ValidatorResponse, error)
- func (c *Client) GetValidatorCommission(validatorAddr string) (*ValidatorCommissionResponse, error)
- func (c *Client) GetValidatorDelegations(validatorAddr string) (*DelegationsResponse, error)
- func (c *Client) GetValidatorOutstandingRewards(validatorAddr string) (*ValidatorOutstandingRewardsResponse, error)
- func (c *Client) GetValidatorSetByHeight(height int64) (*ValidatorSetResponse, error)
- func (c *Client) GetValidators(status string) (*ValidatorsResponse, error)
- func (c *Client) Invoke(method string, request []byte) ([]byte, error)
- func (c *Client) InvokeContext(ctx context.Context, method string, request []byte) ([]byte, error)
- func (c *Client) InvokeJSON(method string, request interface{}, result interface{}) error
- func (c *Client) InvokeRaw(method string, request []byte) (*dynamicpb.Message, error)
- func (c *Client) InvokeRawContext(ctx context.Context, method string, request []byte) (*dynamicpb.Message, error)
- func (c *Client) InvokeWithRetry(method string, request []byte, maxRetries uint) ([]byte, error)
- func (c *Client) InvokeWithRetryContext(ctx context.Context, method string, request []byte, maxRetries uint) ([]byte, error)
- func (c *Client) ListMethods(serviceName string) ([]string, error)
- func (c *Client) ListServices() []string
- func (c *Client) Method(name string) (*Method, error)
- func (c *Client) NewMessage(fullName string) (*Request, error)
- func (c *Client) Resolver() *Resolver
- func (c *Client) SupportsBlockResults() bool
- func (c *Client) SupportsMethod(method string) bool
- func (c *Client) SupportsService(service string) bool
- type Coin
- type CommunityPoolResponse
- type CurrentPlanResponse
- type DelegationResponse
- type DelegationRewardsResponse
- type DelegationTotalRewardsResponse
- type DelegationsResponse
- type DenomMetadataResponse
- type DenomOwnersResponse
- type DenomsMetadataResponse
- type DepositsResponse
- type DistributionParamsResponse
- type Event
- type EventAttribute
- type EvidenceResponse
- type ExecTxResult
- type FallbackRegistry
- func (r *FallbackRegistry) Files() *protoregistry.Files
- func (r *FallbackRegistry) FindDescriptorByName(name protoreflect.FullName) (protoreflect.Descriptor, error)
- func (r *FallbackRegistry) FindDescriptorByNameContext(ctx context.Context, name protoreflect.FullName) (protoreflect.Descriptor, error)
- func (r *FallbackRegistry) MergeInto(target *protoregistry.Files) error
- func (r *FallbackRegistry) ProtoDir() *ProtoDir
- func (r *FallbackRegistry) RegisterFileDescriptor(fdProto *descriptorpb.FileDescriptorProto) error
- func (r *FallbackRegistry) RegisterFileDescriptorSet(fds *descriptorpb.FileDescriptorSet) error
- func (r *FallbackRegistry) SetProtoDir(dir *ProtoDir)
- type GovParamsResponse
- type GrantsResponse
- type IBCChannelResponse
- type IBCChannelsResponse
- type IBCClientStateResponse
- type IBCClientStatesResponse
- type IBCConnectionResponse
- type IBCConnectionsResponse
- type IBCDenomHashResponse
- type IBCDenomTraceResponse
- type IBCDenomTracesResponse
- type IBCEscrowAddressResponse
- type IBCTotalEscrowResponse
- type IBCTransferParamsResponse
- type InflationResponse
- type MessageInfo
- type Method
- func (m *Method) Call(ctx context.Context, req *Request) (*Response, error)
- func (m *Method) CallMap(ctx context.Context, values map[string]any) (*Response, error)
- func (m *Method) EachPage(ctx context.Context, values map[string]any, fn func(*Response) error) error
- func (m *Method) Info() MethodInfo
- func (m *Method) NewRequest() *Request
- func (m *Method) RequestFromMap(values map[string]any) (*Request, error)
- type MethodInfo
- type MintParamsResponse
- type ModuleAccountsResponse
- type ModuleVersionsResponse
- type NodeInfoResponse
- type Option
- func WithDialOptions(opts ...grpc.DialOption) Option
- func WithDialTimeout(timeout time.Duration) Option
- func WithDisableALPNEnforcement() Option
- func WithFallbackRegistry(fb *FallbackRegistry) Option
- func WithGlobalFallback() Option
- func WithInsecure() Option
- func WithMaxRecvMsgSize(size int) Option
- func WithMaxRetries(n uint) Option
- func WithMinSDKVersion(version string) Option
- func WithProtoDir(path string) Option
- func WithSDKVersion(version string) Option
- type PaginationResp
- type ProposalResponse
- type ProposalsResponse
- type ProtoDir
- type RedelegationsResponse
- type Request
- type Resolver
- func (r *Resolver) CreatePatchedResolver(messageType, fieldName string) (*Resolver, error)
- func (r *Resolver) Files() *protoregistry.Files
- func (r *Resolver) FindExtensionByName(_ protoreflect.FullName) (protoreflect.ExtensionType, error)
- func (r *Resolver) FindExtensionByNumber(_ protoreflect.FullName, _ protoreflect.FieldNumber) (protoreflect.ExtensionType, error)
- func (r *Resolver) FindMessageByName(name protoreflect.FullName) (protoreflect.MessageType, error)
- func (r *Resolver) FindMessageByURL(url string) (protoreflect.MessageType, error)
- func (r *Resolver) FindMethodDescriptor(serviceName, methodName string) (protoreflect.MethodDescriptor, error)
- func (r *Resolver) ResetStats()
- func (r *Resolver) Stats() ResolverStats
- type ResolverStats
- type Response
- type ServiceInfo
- type SigningInfoResponse
- type SigningInfosResponse
- type SlashingParamsResponse
- type SpendableBalancesResponse
- type StakingParamsResponse
- type StakingPoolResponse
- type SupplyOfResponse
- type SyncingResponse
- type TallyResultResponse
- type TotalSupplyResponse
- type TxResponse
- type TxsEventResponse
- type TypeNotFoundError
- type UnbondingDelegationResponse
- type UnbondingDelegationsResponse
- type UnsupportedMethodError
- type ValidatorCommissionResponse
- type ValidatorOutstandingRewardsResponse
- type ValidatorResponse
- type ValidatorSetResponse
- type ValidatorUpdate
- type ValidatorsResponse
- type VotesResponse
- type WithdrawAddressResponse
Constants ¶
This section is empty.
Variables ¶
var ErrUnsupportedMethod = errors.New("unsupported method")
ErrUnsupportedMethod is returned when the connected server does not expose a requested method through reflection.
Functions ¶
func DisableALPNEnforcement ¶ added in v0.9.0
func DisableALPNEnforcement()
DisableALPNEnforcement globally disables ALPN enforcement for all gRPC connections in the process. This is useful when you know all your target servers don't support ALPN. Call this before creating any clients.
This function is safe to call multiple times; it only takes effect once.
func IsUnsupportedMethod ¶ added in v1.0.0
IsUnsupportedMethod reports whether err indicates missing reflected method support on the connected server.
Types ¶
type AccountInfoResponse ¶ added in v0.3.0
type AccountInfoResponse struct {
Info struct {
Address string `json:"address"`
PubKey any `json:"pubKey"`
AccountNumber string `json:"accountNumber"`
Sequence string `json:"sequence"`
} `json:"info"`
}
AccountInfoResponse represents account info response.
type AccountResponse ¶ added in v0.3.0
type AccountResponse struct {
Account json.RawMessage `json:"account"`
}
AccountResponse represents an account query response.
type AccountsResponse ¶ added in v0.3.0
type AccountsResponse struct {
Accounts []json.RawMessage `json:"accounts"`
Pagination *PaginationResp `json:"pagination,omitempty"`
}
AccountsResponse represents the accounts query response.
type AllBalancesResponse ¶ added in v0.3.0
type AllBalancesResponse struct {
Balances []Coin `json:"balances"`
Pagination *PaginationResp `json:"pagination,omitempty"`
}
AllBalancesResponse represents multiple coin balances.
type AllEvidenceResponse ¶ added in v0.3.0
type AllEvidenceResponse struct {
Evidence []json.RawMessage `json:"evidence"`
Pagination *PaginationResp `json:"pagination,omitempty"`
}
AllEvidenceResponse represents all evidence response.
type AllowanceResponse ¶ added in v0.3.0
type AllowanceResponse struct {
Allowance json.RawMessage `json:"allowance"`
}
AllowanceResponse represents fee allowance response.
type AllowancesResponse ¶ added in v0.3.0
type AllowancesResponse struct {
Allowances []json.RawMessage `json:"allowances"`
Pagination *PaginationResp `json:"pagination,omitempty"`
}
AllowancesResponse represents fee allowances response.
type AnnualProvisionsResponse ¶ added in v0.3.0
type AnnualProvisionsResponse struct {
AnnualProvisions string `json:"annualProvisions"`
}
AnnualProvisionsResponse represents annual provisions response.
type AppliedPlanResponse ¶ added in v0.3.0
type AppliedPlanResponse struct {
Height string `json:"height"`
}
AppliedPlanResponse represents applied plan response.
type AuthParamsResponse ¶ added in v0.3.0
type AuthParamsResponse struct {
Params struct {
MaxMemoCharacters string `json:"maxMemoCharacters"`
TxSigLimit string `json:"txSigLimit"`
TxSizeCostPerByte string `json:"txSizeCostPerByte"`
SigVerifyCostEd25519 string `json:"sigVerifyCostEd25519"`
SigVerifyCostSecp256k1 string `json:"sigVerifyCostSecp256k1"`
} `json:"params"`
}
AuthParamsResponse represents auth params response.
type BalanceResponse ¶ added in v0.3.0
type BalanceResponse struct {
Balance struct {
Denom string `json:"denom"`
Amount string `json:"amount"`
} `json:"balance"`
}
BalanceResponse represents a single coin balance.
type BankParamsResponse ¶ added in v0.3.0
type BankParamsResponse struct {
Params struct {
SendEnabled []any `json:"sendEnabled"`
DefaultSendEnabled bool `json:"defaultSendEnabled"`
} `json:"params"`
}
BankParamsResponse represents bank params response.
type Bech32PrefixResponse ¶ added in v0.3.0
type Bech32PrefixResponse struct {
Bech32Prefix string `json:"bech32Prefix"`
}
Bech32PrefixResponse represents bech32 prefix response.
type BlockResponse ¶ added in v0.3.0
type BlockResponse struct {
Block struct {
Header struct {
Height string `json:"height"`
Time string `json:"time"`
ChainID string `json:"chainId"`
} `json:"header"`
Data struct {
Txs []string `json:"txs"`
} `json:"data"`
} `json:"block"`
BlockID struct {
Hash string `json:"hash"`
} `json:"blockId"`
}
BlockResponse represents the structure returned by GetLatestBlock and GetBlockByHeight.
type BlockResultsResponse ¶ added in v1.0.0
type BlockResultsResponse struct {
Height int64 `json:"height,string"`
TxsResults []ExecTxResult `json:"txsResults,omitempty"`
FinalizeBlockEvents []Event `json:"finalizeBlockEvents,omitempty"`
ValidatorUpdates []ValidatorUpdate `json:"validatorUpdates,omitempty"`
ConsensusParamUpdate json.RawMessage `json:"consensusParamUpdates,omitempty"`
AppHash string `json:"appHash,omitempty"`
}
BlockResultsResponse represents the response from GetBlockResults and GetLatestBlockResults. Contains finalize_block_events which include consensus-level events like slashing and jailing.
func (*BlockResultsResponse) FindSlashingEvents ¶ added in v1.0.0
func (r *BlockResultsResponse) FindSlashingEvents() []Event
FindSlashingEvents searches block results for slashing-related events. Returns events with types: "slash", "liveness", "jail".
type BlockWithTxsResponse ¶ added in v0.3.0
type BlockWithTxsResponse struct {
Txs []json.RawMessage `json:"txs"`
BlockID json.RawMessage `json:"blockId"`
Block json.RawMessage `json:"block"`
Pagination *PaginationResp `json:"pagination,omitempty"`
}
BlockWithTxsResponse represents block with transactions response.
type Catalog ¶ added in v1.0.0
type Catalog struct {
// contains filtered or unexported fields
}
Catalog is an immutable snapshot of services, methods, and message types advertised by server reflection at client initialization time.
func (*Catalog) ChainInfo ¶ added in v1.0.0
ChainInfo returns configured or detected chain metadata.
func (*Catalog) HasMethod ¶ added in v1.0.0
HasMethod reports whether the connected server exposes a method.
func (*Catalog) HasService ¶ added in v1.0.0
HasService reports whether the connected server exposes a service.
func (*Catalog) MessageTypesByPackage ¶ added in v1.0.0
func (c *Catalog) MessageTypesByPackage(pkg string) []MessageInfo
MessageTypesByPackage returns reflected messages in the requested proto package sorted by full name.
func (*Catalog) Messages ¶ added in v1.0.0
func (c *Catalog) Messages() []MessageInfo
Messages returns all reflected message types sorted by full name.
func (*Catalog) Method ¶ added in v1.0.0
func (c *Catalog) Method(method string) (MethodInfo, bool)
Method returns metadata for a reflected method.
func (*Catalog) Methods ¶ added in v1.0.0
func (c *Catalog) Methods() []MethodInfo
Methods returns all reflected methods sorted by full name.
func (*Catalog) QueryServices ¶ added in v1.0.0
func (c *Catalog) QueryServices() []ServiceInfo
QueryServices returns advertised services named Query, which is the standard Cosmos SDK module query-service convention.
func (*Catalog) Service ¶ added in v1.0.0
func (c *Catalog) Service(service string) (ServiceInfo, bool)
Service returns metadata for a reflected service.
func (*Catalog) Services ¶ added in v1.0.0
func (c *Catalog) Services() []ServiceInfo
Services returns all reflected services sorted by name.
type ChainInfo ¶ added in v1.0.0
type ChainInfo struct {
ChainID string
AppName string
AppVersion string
SDKVersion string
MinSDKVersion string
ReflectionVersion string
}
ChainInfo contains configured or detected metadata about the connected chain. Reflected capabilities remain the source of truth for method availability.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a dynamic gRPC client that uses server reflection to invoke methods.
func Dial ¶
Dial creates a new reflection-based gRPC client connected to the specified address. The client will automatically fetch proto descriptors from the server using reflection.
func (*Client) Conn ¶
func (c *Client) Conn() *grpc.ClientConn
Conn returns the underlying gRPC connection.
func (*Client) DecodeTxBytes ¶ added in v0.2.0
DecodeTxBytes decodes raw protobuf transaction bytes to JSON. The raw bytes should be the protobuf-encoded cosmos.tx.v1beta1.Tx message. Handles UTF-8 errors by patching string fields that contain binary data.
func (*Client) DescribeMethod ¶
DescribeMethod returns a human-readable description of a method's input and output types.
func (*Client) DetectChainInfo ¶ added in v1.0.0
DetectChainInfo queries GetNodeInfo when available and records chain metadata for diagnostics. Missing GetNodeInfo returns partial configured metadata.
func (*Client) ExtractField ¶
ExtractField invokes a method and extracts a specific field from the response.
func (*Client) GetAccount ¶ added in v0.3.0
func (c *Client) GetAccount(address string) (*AccountResponse, error)
GetAccount fetches account information by address.
func (*Client) GetAccountInfo ¶ added in v0.3.0
func (c *Client) GetAccountInfo(address string) (*AccountInfoResponse, error)
GetAccountInfo fetches account info (address, pubkey, account number, sequence).
func (*Client) GetAccounts ¶ added in v0.3.0
func (c *Client) GetAccounts(paginationKey string) (*AccountsResponse, error)
GetAccounts fetches all accounts with pagination.
func (*Client) GetAllBalances ¶ added in v0.3.0
func (c *Client) GetAllBalances(address string) (*AllBalancesResponse, error)
GetAllBalances fetches all balances for an address.
func (*Client) GetAllEvidence ¶ added in v0.3.0
func (c *Client) GetAllEvidence() (*AllEvidenceResponse, error)
GetAllEvidence fetches all evidence.
func (*Client) GetAllValidators ¶ added in v0.3.0
GetAllValidators fetches all validators (all statuses) with pagination handling. Returns a map of operator address -> moniker.
func (*Client) GetAllowance ¶ added in v0.3.0
func (c *Client) GetAllowance(granter, grantee string) (*AllowanceResponse, error)
GetAllowance fetches the fee allowance of a grantee by granter.
func (*Client) GetAllowances ¶ added in v0.3.0
func (c *Client) GetAllowances(grantee string) (*AllowancesResponse, error)
GetAllowances fetches all allowances for a grantee.
func (*Client) GetAllowancesByGranter ¶ added in v0.3.0
func (c *Client) GetAllowancesByGranter(granter string) (*AllowancesResponse, error)
GetAllowancesByGranter fetches all allowances given by a granter.
func (*Client) GetAnnualProvisions ¶ added in v0.3.0
GetAnnualProvisions fetches the current annual provisions.
func (*Client) GetAppliedPlan ¶ added in v0.3.0
func (c *Client) GetAppliedPlan(name string) (*AppliedPlanResponse, error)
GetAppliedPlan fetches the height at which a plan was applied.
func (*Client) GetAuthParams ¶ added in v0.3.0
func (c *Client) GetAuthParams() (*AuthParamsResponse, error)
GetAuthParams fetches auth module parameters.
func (*Client) GetBalance ¶ added in v0.3.0
func (c *Client) GetBalance(address, denom string) (*BalanceResponse, error)
GetBalance fetches the balance of a specific denom for an address.
func (*Client) GetBankParams ¶ added in v0.3.0
func (c *Client) GetBankParams() (*BankParamsResponse, error)
GetBankParams fetches bank module parameters.
func (*Client) GetBech32Prefix ¶ added in v0.3.0
GetBech32Prefix fetches the bech32 prefix used by the chain.
func (*Client) GetBlockByHeight ¶ added in v0.3.0
func (c *Client) GetBlockByHeight(height int64) (*BlockResponse, error)
GetBlockByHeight fetches block information for a given height.
func (*Client) GetBlockResults ¶ added in v1.0.0
func (c *Client) GetBlockResults(height int64) (*BlockResultsResponse, error)
GetBlockResults fetches block results for a given height. Block results contain finalize_block_events which include consensus-level events like validator slashing, jailing, and validator set updates. Requires cosmos-sdk v0.53+ with the GetBlockResults RPC enabled.
func (*Client) GetBlockWithTxs ¶ added in v0.3.0
func (c *Client) GetBlockWithTxs(height int64) (*BlockWithTxsResponse, error)
GetBlockWithTxs fetches a block with all transactions at a specific height.
func (*Client) GetBondDenom ¶ added in v0.3.0
GetBondDenom fetches the bond denom from staking params.
func (*Client) GetChainID ¶ added in v0.3.0
GetChainID extracts the chain ID from node info.
func (*Client) GetCommunityPool ¶ added in v0.3.0
func (c *Client) GetCommunityPool() (*CommunityPoolResponse, error)
GetCommunityPool fetches the community pool balance.
func (*Client) GetCurrentPlan ¶ added in v0.3.0
func (c *Client) GetCurrentPlan() (*CurrentPlanResponse, error)
GetCurrentPlan fetches the current upgrade plan (if any).
func (*Client) GetDelegation ¶ added in v0.3.0
func (c *Client) GetDelegation(delegatorAddr, validatorAddr string) (*DelegationResponse, error)
GetDelegation fetches a specific delegation.
func (*Client) GetDelegationRewards ¶ added in v0.3.0
func (c *Client) GetDelegationRewards(delegatorAddr, validatorAddr string) (*DelegationRewardsResponse, error)
GetDelegationRewards fetches rewards for a specific delegation.
func (*Client) GetDelegationTotalRewards ¶ added in v0.3.0
func (c *Client) GetDelegationTotalRewards(delegatorAddr string) (*DelegationTotalRewardsResponse, error)
GetDelegationTotalRewards fetches total rewards for all delegations of a delegator.
func (*Client) GetDelegations ¶ added in v0.3.0
func (c *Client) GetDelegations(delegatorAddr string) (*DelegationsResponse, error)
GetDelegations fetches delegations for a delegator address.
func (*Client) GetDelegatorUnbondingDelegations ¶ added in v0.3.0
func (c *Client) GetDelegatorUnbondingDelegations(delegatorAddr string) (*UnbondingDelegationsResponse, error)
GetDelegatorUnbondingDelegations fetches all unbonding delegations for a delegator.
func (*Client) GetDelegatorValidators ¶ added in v0.3.0
func (c *Client) GetDelegatorValidators(delegatorAddr string) (*ValidatorsResponse, error)
GetDelegatorValidators fetches all validators a delegator is delegating to.
func (*Client) GetDelegatorWithdrawAddress ¶ added in v0.3.0
GetDelegatorWithdrawAddress fetches the withdraw address for a delegator.
func (*Client) GetDenomMetadata ¶ added in v0.3.0
func (c *Client) GetDenomMetadata(denom string) (*DenomMetadataResponse, error)
GetDenomMetadata fetches metadata for a specific denomination.
func (*Client) GetDenomOwners ¶ added in v0.3.0
func (c *Client) GetDenomOwners(denom string) (*DenomOwnersResponse, error)
GetDenomOwners fetches all owners of a specific denomination.
func (*Client) GetDenomsMetadata ¶ added in v0.3.0
func (c *Client) GetDenomsMetadata() (*DenomsMetadataResponse, error)
GetDenomsMetadata fetches metadata for all denominations.
func (*Client) GetDistributionParams ¶ added in v0.3.0
func (c *Client) GetDistributionParams() (*DistributionParamsResponse, error)
GetDistributionParams fetches distribution module parameters.
func (*Client) GetEarliestBlockHeight ¶ added in v0.3.0
GetEarliestBlockHeight finds the earliest available block height. First tries to fetch block 1; if pruned, parses error or falls back to binary search.
func (*Client) GetEvidence ¶ added in v0.3.0
func (c *Client) GetEvidence(hash string) (*EvidenceResponse, error)
GetEvidence fetches a specific evidence by hash.
func (*Client) GetGovParams ¶ added in v0.3.0
func (c *Client) GetGovParams() (*GovParamsResponse, error)
GetGovParams fetches governance module parameters.
func (*Client) GetGranteeGrants ¶ added in v0.3.0
func (c *Client) GetGranteeGrants(grantee string) (*GrantsResponse, error)
GetGranteeGrants fetches all grants received by a grantee.
func (*Client) GetGranterGrants ¶ added in v0.3.0
func (c *Client) GetGranterGrants(granter string) (*GrantsResponse, error)
GetGranterGrants fetches all grants given by a granter.
func (*Client) GetGrants ¶ added in v0.3.0
func (c *Client) GetGrants(granter, grantee string) (*GrantsResponse, error)
GetGrants fetches grants for a granter/grantee pair.
func (*Client) GetIBCChannel ¶ added in v0.3.0
func (c *Client) GetIBCChannel(portID, channelID string) (*IBCChannelResponse, error)
GetIBCChannel fetches a specific IBC channel.
func (*Client) GetIBCChannels ¶ added in v0.3.0
func (c *Client) GetIBCChannels() (*IBCChannelsResponse, error)
GetIBCChannels fetches all IBC channels.
func (*Client) GetIBCClientConnections ¶ added in v0.3.0
GetIBCClientConnections fetches all connections for a client.
func (*Client) GetIBCClientState ¶ added in v0.3.0
func (c *Client) GetIBCClientState(clientID string) (*IBCClientStateResponse, error)
GetIBCClientState fetches a specific IBC client state.
func (*Client) GetIBCClientStates ¶ added in v0.3.0
func (c *Client) GetIBCClientStates() (*IBCClientStatesResponse, error)
GetIBCClientStates fetches all IBC client states.
func (*Client) GetIBCConnection ¶ added in v0.3.0
func (c *Client) GetIBCConnection(connectionID string) (*IBCConnectionResponse, error)
GetIBCConnection fetches a specific IBC connection.
func (*Client) GetIBCConnectionChannels ¶ added in v0.3.0
func (c *Client) GetIBCConnectionChannels(connectionID string) (*IBCChannelsResponse, error)
GetIBCConnectionChannels fetches all channels for a connection.
func (*Client) GetIBCConnections ¶ added in v0.3.0
func (c *Client) GetIBCConnections() (*IBCConnectionsResponse, error)
GetIBCConnections fetches all IBC connections.
func (*Client) GetIBCDenomHash ¶ added in v0.3.0
GetIBCDenomHash calculates the hash for a denom trace path.
func (*Client) GetIBCDenomTrace ¶ added in v0.3.0
func (c *Client) GetIBCDenomTrace(hash string) (*IBCDenomTraceResponse, error)
GetIBCDenomTrace fetches the denom trace for an IBC denom hash.
func (*Client) GetIBCDenomTraces ¶ added in v0.3.0
func (c *Client) GetIBCDenomTraces() (*IBCDenomTracesResponse, error)
GetIBCDenomTraces fetches all denom traces.
func (*Client) GetIBCEscrowAddress ¶ added in v0.3.0
GetIBCEscrowAddress fetches the escrow address for a channel.
func (*Client) GetIBCTotalEscrowForDenom ¶ added in v0.3.0
func (c *Client) GetIBCTotalEscrowForDenom(denom string) (*IBCTotalEscrowResponse, error)
GetIBCTotalEscrowForDenom fetches total amount escrowed for a denom.
func (*Client) GetIBCTransferParams ¶ added in v0.3.0
func (c *Client) GetIBCTransferParams() (*IBCTransferParamsResponse, error)
GetIBCTransferParams fetches IBC transfer module parameters.
func (*Client) GetInflation ¶ added in v0.3.0
GetInflation fetches the current inflation rate.
func (*Client) GetLatestBlock ¶ added in v0.3.0
func (c *Client) GetLatestBlock() (*BlockResponse, error)
GetLatestBlock fetches the latest block from the chain.
func (*Client) GetLatestBlockHeight ¶ added in v0.3.0
GetLatestBlockHeight returns the latest block height as an int64.
func (*Client) GetLatestBlockResults ¶ added in v1.0.0
func (c *Client) GetLatestBlockResults() (*BlockResultsResponse, error)
GetLatestBlockResults fetches block results for the latest block. Block results contain finalize_block_events which include consensus-level events like validator slashing, jailing, and validator set updates. Requires cosmos-sdk v0.53+ with the GetBlockResults RPC enabled.
func (*Client) GetLatestValidatorSet ¶ added in v0.3.0
func (c *Client) GetLatestValidatorSet() (*ValidatorSetResponse, error)
GetLatestValidatorSet fetches the latest validator set.
func (*Client) GetMethodDescriptor ¶
func (c *Client) GetMethodDescriptor(method string) (protoreflect.MethodDescriptor, error)
GetMethodDescriptor returns the method descriptor for a given method.
func (*Client) GetMintParams ¶ added in v0.3.0
func (c *Client) GetMintParams() (*MintParamsResponse, error)
GetMintParams fetches mint module parameters.
func (*Client) GetModuleAccountByName ¶ added in v0.3.0
func (c *Client) GetModuleAccountByName(name string) (*AccountResponse, error)
GetModuleAccountByName fetches a module account by name.
func (*Client) GetModuleAccounts ¶ added in v0.3.0
GetModuleAccounts fetches all module accounts. Returns a map of address -> module name.
func (*Client) GetModuleVersions ¶ added in v0.3.0
func (c *Client) GetModuleVersions() (*ModuleVersionsResponse, error)
GetModuleVersions fetches module versions.
func (*Client) GetNodeInfo ¶ added in v0.3.0
func (c *Client) GetNodeInfo() (*NodeInfoResponse, error)
GetNodeInfo fetches node information including chain ID.
func (*Client) GetProposal ¶ added in v0.3.0
func (c *Client) GetProposal(proposalID uint64) (*ProposalResponse, error)
GetProposal fetches a single governance proposal by ID.
func (*Client) GetProposalDeposits ¶ added in v0.3.0
func (c *Client) GetProposalDeposits(proposalID uint64) (*DepositsResponse, error)
GetProposalDeposits fetches deposits for a proposal.
func (*Client) GetProposalVotes ¶ added in v0.3.0
func (c *Client) GetProposalVotes(proposalID uint64) (*VotesResponse, error)
GetProposalVotes fetches votes for a proposal.
func (*Client) GetProposals ¶ added in v0.3.0
func (c *Client) GetProposals(status string) (*ProposalsResponse, error)
GetProposals fetches all governance proposals. Status can be: PROPOSAL_STATUS_UNSPECIFIED, PROPOSAL_STATUS_DEPOSIT_PERIOD, PROPOSAL_STATUS_VOTING_PERIOD, PROPOSAL_STATUS_PASSED, PROPOSAL_STATUS_REJECTED, PROPOSAL_STATUS_FAILED, or empty for all.
func (*Client) GetRedelegations ¶ added in v0.3.0
func (c *Client) GetRedelegations(delegatorAddr string) (*RedelegationsResponse, error)
GetRedelegations fetches redelegations for a delegator.
func (*Client) GetSigningInfo ¶ added in v0.3.0
func (c *Client) GetSigningInfo(consAddr string) (*SigningInfoResponse, error)
GetSigningInfo fetches signing info for a validator consensus address.
func (*Client) GetSigningInfos ¶ added in v0.3.0
func (c *Client) GetSigningInfos() (*SigningInfosResponse, error)
GetSigningInfos fetches signing info for all validators.
func (*Client) GetSlashingParams ¶ added in v0.3.0
func (c *Client) GetSlashingParams() (*SlashingParamsResponse, error)
GetSlashingParams fetches slashing module parameters.
func (*Client) GetSpendableBalances ¶ added in v0.3.0
func (c *Client) GetSpendableBalances(address string) (*SpendableBalancesResponse, error)
GetSpendableBalances fetches spendable balances for an address.
func (*Client) GetStakingParams ¶ added in v0.3.0
func (c *Client) GetStakingParams() (*StakingParamsResponse, error)
GetStakingParams fetches staking parameters.
func (*Client) GetStakingPool ¶ added in v0.3.0
func (c *Client) GetStakingPool() (*StakingPoolResponse, error)
GetStakingPool fetches the current staking pool info (bonded/not bonded tokens).
func (*Client) GetSupplyOf ¶ added in v0.3.0
func (c *Client) GetSupplyOf(denom string) (*SupplyOfResponse, error)
GetSupplyOf fetches the supply of a specific denomination.
func (*Client) GetSyncing ¶ added in v0.3.0
GetSyncing returns whether the node is currently syncing.
func (*Client) GetTallyResult ¶ added in v0.3.0
func (c *Client) GetTallyResult(proposalID uint64) (*TallyResultResponse, error)
GetTallyResult fetches the tally result for a proposal.
func (*Client) GetTotalSupply ¶ added in v0.3.0
func (c *Client) GetTotalSupply() (*TotalSupplyResponse, error)
GetTotalSupply fetches the total supply of all coins.
func (*Client) GetTx ¶ added in v0.3.0
func (c *Client) GetTx(hash string) (*TxResponse, error)
GetTx fetches a transaction by hash.
func (*Client) GetTxsByHeight ¶ added in v0.3.0
GetTxsByHeight fetches all transactions for a given block height. Returns raw JSON response for flexibility in parsing.
func (*Client) GetTxsByHeightParsed ¶ added in v0.3.0
func (c *Client) GetTxsByHeightParsed(height int64) (*TxsEventResponse, error)
GetTxsByHeightParsed fetches transactions and returns them in a structured format.
func (*Client) GetUnbondingDelegation ¶ added in v0.3.0
func (c *Client) GetUnbondingDelegation(delegatorAddr, validatorAddr string) (*UnbondingDelegationResponse, error)
GetUnbondingDelegation fetches a specific unbonding delegation.
func (*Client) GetValidator ¶ added in v0.3.0
func (c *Client) GetValidator(validatorAddr string) (*ValidatorResponse, error)
GetValidator fetches a single validator by operator address.
func (*Client) GetValidatorCommission ¶ added in v0.3.0
func (c *Client) GetValidatorCommission(validatorAddr string) (*ValidatorCommissionResponse, error)
GetValidatorCommission fetches accumulated commission for a validator.
func (*Client) GetValidatorDelegations ¶ added in v0.3.0
func (c *Client) GetValidatorDelegations(validatorAddr string) (*DelegationsResponse, error)
GetValidatorDelegations fetches all delegations to a validator.
func (*Client) GetValidatorOutstandingRewards ¶ added in v0.3.0
func (c *Client) GetValidatorOutstandingRewards(validatorAddr string) (*ValidatorOutstandingRewardsResponse, error)
GetValidatorOutstandingRewards fetches outstanding rewards for a validator.
func (*Client) GetValidatorSetByHeight ¶ added in v0.3.0
func (c *Client) GetValidatorSetByHeight(height int64) (*ValidatorSetResponse, error)
GetValidatorSetByHeight fetches the validator set at a specific height.
func (*Client) GetValidators ¶ added in v0.3.0
func (c *Client) GetValidators(status string) (*ValidatorsResponse, error)
GetValidators fetches validators with optional status filter. Status can be: BOND_STATUS_BONDED, BOND_STATUS_UNBONDED, BOND_STATUS_UNBONDING, or empty for all.
func (*Client) Invoke ¶
Invoke calls the specified gRPC method with the given JSON request payload. The method should be specified as "package.Service.Method" (e.g., "cosmos.bank.v1beta1.Query.Balance"). Returns the response as JSON bytes.
func (*Client) InvokeContext ¶ added in v1.0.0
InvokeContext calls the specified gRPC method with a caller-controlled context.
func (*Client) InvokeJSON ¶
InvokeJSON is a convenience method that accepts and returns Go values instead of JSON bytes. The request will be marshaled to JSON and the response will be unmarshaled into the result.
func (*Client) InvokeRaw ¶
InvokeRaw calls the method and returns the dynamic protobuf message directly. This is useful when you need to access specific fields without JSON marshaling.
func (*Client) InvokeRawContext ¶ added in v1.0.0
func (c *Client) InvokeRawContext(ctx context.Context, method string, request []byte) (*dynamicpb.Message, error)
InvokeRawContext calls the method and returns the dynamic protobuf message directly using a caller-controlled context.
func (*Client) InvokeWithRetry ¶
InvokeWithRetry calls the specified gRPC method with custom retry count.
func (*Client) InvokeWithRetryContext ¶ added in v1.0.0
func (c *Client) InvokeWithRetryContext(ctx context.Context, method string, request []byte, maxRetries uint) ([]byte, error)
InvokeWithRetryContext calls the specified gRPC method with custom retry count and a caller-controlled context.
func (*Client) ListMethods ¶
ListMethods returns all methods for a given service.
func (*Client) ListServices ¶
ListServices returns all services available on the connected server.
func (*Client) NewMessage ¶ added in v1.0.0
NewMessage creates an empty reflected message by full type name.
func (*Client) Resolver ¶
Resolver returns the underlying type resolver, useful for custom protojson operations.
func (*Client) SupportsBlockResults ¶ added in v1.0.0
SupportsBlockResults reports whether the connected server advertises the block-results RPCs through reflection.
func (*Client) SupportsMethod ¶ added in v1.0.0
SupportsMethod reports whether the connected server exposes a method.
func (*Client) SupportsService ¶ added in v1.0.0
SupportsService reports whether the connected server exposes a service.
type CommunityPoolResponse ¶ added in v0.3.0
type CommunityPoolResponse struct {
Pool []struct {
Denom string `json:"denom"`
Amount string `json:"amount"`
} `json:"pool"`
}
CommunityPoolResponse represents community pool response.
type CurrentPlanResponse ¶ added in v0.3.0
type CurrentPlanResponse struct {
Plan *struct {
Name string `json:"name"`
Height string `json:"height"`
Info string `json:"info"`
} `json:"plan"`
}
CurrentPlanResponse represents current upgrade plan response.
type DelegationResponse ¶ added in v0.3.0
type DelegationResponse struct {
DelegationResponse struct {
Delegation struct {
DelegatorAddress string `json:"delegatorAddress"`
ValidatorAddress string `json:"validatorAddress"`
Shares string `json:"shares"`
} `json:"delegation"`
Balance Coin `json:"balance"`
} `json:"delegationResponse"`
}
DelegationResponse represents a single delegation response.
type DelegationRewardsResponse ¶ added in v0.3.0
type DelegationRewardsResponse struct {
Rewards []struct {
Denom string `json:"denom"`
Amount string `json:"amount"`
} `json:"rewards"`
}
DelegationRewardsResponse represents delegation rewards response.
type DelegationTotalRewardsResponse ¶ added in v0.3.0
type DelegationTotalRewardsResponse struct {
Rewards []struct {
ValidatorAddress string `json:"validatorAddress"`
Reward []struct {
Denom string `json:"denom"`
Amount string `json:"amount"`
} `json:"reward"`
} `json:"rewards"`
Total []struct {
Denom string `json:"denom"`
Amount string `json:"amount"`
} `json:"total"`
}
DelegationTotalRewardsResponse represents total rewards response.
type DelegationsResponse ¶ added in v0.3.0
type DelegationsResponse struct {
DelegationResponses []struct {
Delegation struct {
DelegatorAddress string `json:"delegatorAddress"`
ValidatorAddress string `json:"validatorAddress"`
Shares string `json:"shares"`
} `json:"delegation"`
Balance Coin `json:"balance"`
} `json:"delegationResponses"`
Pagination *PaginationResp `json:"pagination,omitempty"`
}
DelegationsResponse represents delegator delegations response.
type DenomMetadataResponse ¶ added in v0.3.0
type DenomMetadataResponse struct {
Metadata struct {
Description string `json:"description"`
Base string `json:"base"`
Display string `json:"display"`
Name string `json:"name"`
Symbol string `json:"symbol"`
DenomUnits []struct {
Denom string `json:"denom"`
Exponent uint32 `json:"exponent"`
Aliases []string `json:"aliases"`
} `json:"denomUnits"`
} `json:"metadata"`
}
DenomMetadataResponse represents denom metadata response.
type DenomOwnersResponse ¶ added in v0.3.0
type DenomOwnersResponse struct {
DenomOwners []struct {
Address string `json:"address"`
Balance Coin `json:"balance"`
} `json:"denomOwners"`
Pagination *PaginationResp `json:"pagination,omitempty"`
}
DenomOwnersResponse represents denom owners response.
type DenomsMetadataResponse ¶ added in v0.3.0
type DenomsMetadataResponse struct {
Metadatas []json.RawMessage `json:"metadatas"`
Pagination *PaginationResp `json:"pagination,omitempty"`
}
DenomsMetadataResponse represents all denoms metadata response.
type DepositsResponse ¶ added in v0.3.0
type DepositsResponse struct {
Deposits []json.RawMessage `json:"deposits"`
Pagination *PaginationResp `json:"pagination,omitempty"`
}
DepositsResponse represents proposal deposits response.
type DistributionParamsResponse ¶ added in v0.3.0
type DistributionParamsResponse struct {
Params struct {
CommunityTax string `json:"communityTax"`
BaseProposerReward string `json:"baseProposerReward"`
BonusProposerReward string `json:"bonusProposerReward"`
WithdrawAddrEnabled bool `json:"withdrawAddrEnabled"`
} `json:"params"`
}
DistributionParamsResponse represents distribution params response.
type Event ¶ added in v1.0.0
type Event struct {
Type string `json:"type"`
Attributes []EventAttribute `json:"attributes,omitempty"`
}
Event represents an ABCI event from block results.
func (*Event) GetEventAttribute ¶ added in v1.0.0
GetEventAttribute returns the value of an attribute by key, or empty string if not found.
type EventAttribute ¶ added in v1.0.0
type EventAttribute struct {
Key string `json:"key"`
Value string `json:"value"`
Index bool `json:"index,omitempty"`
}
EventAttribute represents a key-value attribute in an ABCI event.
type EvidenceResponse ¶ added in v0.3.0
type EvidenceResponse struct {
Evidence json.RawMessage `json:"evidence"`
}
EvidenceResponse represents evidence response.
type ExecTxResult ¶ added in v1.0.0
type ExecTxResult struct {
Code uint32 `json:"code"`
Data string `json:"data,omitempty"`
Log string `json:"log,omitempty"`
Info string `json:"info,omitempty"`
GasWanted int64 `json:"gasWanted,string,omitempty"`
GasUsed int64 `json:"gasUsed,string,omitempty"`
Events []Event `json:"events,omitempty"`
Codespace string `json:"codespace,omitempty"`
}
ExecTxResult represents a transaction execution result.
type FallbackRegistry ¶ added in v0.4.0
type FallbackRegistry struct {
// contains filtered or unexported fields
}
FallbackRegistry holds pre-compiled proto descriptors for types that may not be available via server reflection (e.g., deprecated modules).
func GlobalFallback ¶ added in v0.4.0
func GlobalFallback() *FallbackRegistry
GlobalFallback returns the global fallback registry. Use this to register fallback descriptors that should be available to all clients.
func NewFallbackRegistry ¶ added in v0.4.0
func NewFallbackRegistry() *FallbackRegistry
NewFallbackRegistry creates a new empty fallback registry.
func (*FallbackRegistry) Files ¶ added in v0.4.0
func (r *FallbackRegistry) Files() *protoregistry.Files
Files returns the underlying file registry.
func (*FallbackRegistry) FindDescriptorByName ¶ added in v0.4.0
func (r *FallbackRegistry) FindDescriptorByName(name protoreflect.FullName) (protoreflect.Descriptor, error)
FindDescriptorByName looks up a descriptor by its full name. First checks the in-memory registry, then the local proto directory if configured.
func (*FallbackRegistry) FindDescriptorByNameContext ¶ added in v1.0.0
func (r *FallbackRegistry) FindDescriptorByNameContext(ctx context.Context, name protoreflect.FullName) (protoreflect.Descriptor, error)
FindDescriptorByNameContext looks up a descriptor by full name using the supplied context for lazy proto directory loading.
func (*FallbackRegistry) MergeInto ¶ added in v0.4.0
func (r *FallbackRegistry) MergeInto(target *protoregistry.Files) error
MergeInto merges this fallback registry into a target protoregistry.Files. This is used during resolver initialization.
func (*FallbackRegistry) ProtoDir ¶ added in v0.7.0
func (r *FallbackRegistry) ProtoDir() *ProtoDir
ProtoDir returns the configured proto directory, or nil if none.
func (*FallbackRegistry) RegisterFileDescriptor ¶ added in v0.4.0
func (r *FallbackRegistry) RegisterFileDescriptor(fdProto *descriptorpb.FileDescriptorProto) error
RegisterFileDescriptor registers a single file descriptor proto. Dependencies must be registered first.
func (*FallbackRegistry) RegisterFileDescriptorSet ¶ added in v0.4.0
func (r *FallbackRegistry) RegisterFileDescriptorSet(fds *descriptorpb.FileDescriptorSet) error
RegisterFileDescriptorSet registers multiple file descriptor protos. Files are registered in order, so dependencies should come first.
func (*FallbackRegistry) SetProtoDir ¶ added in v0.7.0
func (r *FallbackRegistry) SetProtoDir(dir *ProtoDir)
SetProtoDir configures a local proto directory for fallback resolution. The directory will be loaded lazily when first needed.
type GovParamsResponse ¶ added in v0.3.0
type GovParamsResponse struct {
VotingParams json.RawMessage `json:"votingParams,omitempty"`
DepositParams json.RawMessage `json:"depositParams,omitempty"`
TallyParams json.RawMessage `json:"tallyParams,omitempty"`
Params json.RawMessage `json:"params,omitempty"`
}
GovParamsResponse represents gov params response.
type GrantsResponse ¶ added in v0.3.0
type GrantsResponse struct {
Grants []struct {
Authorization json.RawMessage `json:"authorization"`
Expiration string `json:"expiration,omitempty"`
} `json:"grants"`
Pagination *PaginationResp `json:"pagination,omitempty"`
}
GrantsResponse represents authz grants response.
type IBCChannelResponse ¶ added in v0.3.0
type IBCChannelResponse struct {
Channel struct {
State string `json:"state"`
Ordering string `json:"ordering"`
Counterparty struct {
PortID string `json:"portId"`
ChannelID string `json:"channelId"`
} `json:"counterparty"`
ConnectionHops []string `json:"connectionHops"`
Version string `json:"version"`
} `json:"channel"`
ProofHeight struct {
RevisionNumber string `json:"revisionNumber"`
RevisionHeight string `json:"revisionHeight"`
} `json:"proofHeight"`
}
IBCChannelResponse represents a single IBC channel response.
type IBCChannelsResponse ¶ added in v0.3.0
type IBCChannelsResponse struct {
Channels []struct {
State string `json:"state"`
Ordering string `json:"ordering"`
Counterparty struct {
PortID string `json:"portId"`
ChannelID string `json:"channelId"`
} `json:"counterparty"`
ConnectionHops []string `json:"connectionHops"`
Version string `json:"version"`
PortID string `json:"portId"`
ChannelID string `json:"channelId"`
} `json:"channels"`
Pagination *PaginationResp `json:"pagination,omitempty"`
Height struct {
RevisionNumber string `json:"revisionNumber"`
RevisionHeight string `json:"revisionHeight"`
} `json:"height"`
}
IBCChannelsResponse represents IBC channels response.
type IBCClientStateResponse ¶ added in v0.3.0
type IBCClientStateResponse struct {
ClientState json.RawMessage `json:"clientState"`
ProofHeight struct {
RevisionNumber string `json:"revisionNumber"`
RevisionHeight string `json:"revisionHeight"`
} `json:"proofHeight"`
}
IBCClientStateResponse represents a single IBC client state response.
type IBCClientStatesResponse ¶ added in v0.3.0
type IBCClientStatesResponse struct {
ClientStates []struct {
ClientID string `json:"clientId"`
ClientState json.RawMessage `json:"clientState"`
} `json:"clientStates"`
Pagination *PaginationResp `json:"pagination,omitempty"`
}
IBCClientStatesResponse represents IBC client states response.
type IBCConnectionResponse ¶ added in v0.3.0
type IBCConnectionResponse struct {
Connection struct {
ClientID string `json:"clientId"`
Versions json.RawMessage `json:"versions"`
State string `json:"state"`
Counterparty struct {
ClientID string `json:"clientId"`
ConnectionID string `json:"connectionId"`
Prefix struct {
KeyPrefix string `json:"keyPrefix"`
} `json:"prefix"`
} `json:"counterparty"`
DelayPeriod string `json:"delayPeriod"`
} `json:"connection"`
ProofHeight struct {
RevisionNumber string `json:"revisionNumber"`
RevisionHeight string `json:"revisionHeight"`
} `json:"proofHeight"`
}
IBCConnectionResponse represents a single IBC connection response.
type IBCConnectionsResponse ¶ added in v0.3.0
type IBCConnectionsResponse struct {
Connections []struct {
ID string `json:"id"`
ClientID string `json:"clientId"`
Versions json.RawMessage `json:"versions"`
State string `json:"state"`
Counterparty struct {
ClientID string `json:"clientId"`
ConnectionID string `json:"connectionId"`
Prefix struct {
KeyPrefix string `json:"keyPrefix"`
} `json:"prefix"`
} `json:"counterparty"`
DelayPeriod string `json:"delayPeriod"`
} `json:"connections"`
Pagination *PaginationResp `json:"pagination,omitempty"`
Height struct {
RevisionNumber string `json:"revisionNumber"`
RevisionHeight string `json:"revisionHeight"`
} `json:"height"`
}
IBCConnectionsResponse represents IBC connections response.
type IBCDenomHashResponse ¶ added in v0.3.0
type IBCDenomHashResponse struct {
Hash string `json:"hash"`
}
IBCDenomHashResponse represents IBC denom hash response.
type IBCDenomTraceResponse ¶ added in v0.3.0
type IBCDenomTraceResponse struct {
DenomTrace struct {
Path string `json:"path"`
BaseDenom string `json:"baseDenom"`
} `json:"denomTrace"`
}
IBCDenomTraceResponse represents IBC denom trace response.
type IBCDenomTracesResponse ¶ added in v0.3.0
type IBCDenomTracesResponse struct {
DenomTraces []struct {
Path string `json:"path"`
BaseDenom string `json:"baseDenom"`
} `json:"denomTraces"`
Pagination *PaginationResp `json:"pagination,omitempty"`
}
IBCDenomTracesResponse represents IBC denom traces response.
type IBCEscrowAddressResponse ¶ added in v0.3.0
type IBCEscrowAddressResponse struct {
EscrowAddress string `json:"escrowAddress"`
}
IBCEscrowAddressResponse represents IBC escrow address response.
type IBCTotalEscrowResponse ¶ added in v0.3.0
type IBCTotalEscrowResponse struct {
Amount Coin `json:"amount"`
}
IBCTotalEscrowResponse represents total escrow for denom response.
type IBCTransferParamsResponse ¶ added in v0.3.0
type IBCTransferParamsResponse struct {
Params struct {
SendEnabled bool `json:"sendEnabled"`
ReceiveEnabled bool `json:"receiveEnabled"`
} `json:"params"`
}
IBCTransferParamsResponse represents IBC transfer params response.
type InflationResponse ¶ added in v0.3.0
type InflationResponse struct {
Inflation string `json:"inflation"`
}
InflationResponse represents inflation response.
type MessageInfo ¶ added in v1.0.0
MessageInfo describes a reflected protobuf message.
type Method ¶ added in v1.0.0
type Method struct {
// contains filtered or unexported fields
}
Method is a reusable reflected gRPC method handle.
func (*Method) Call ¶ added in v1.0.0
Call invokes this reflected method with a descriptor-backed request.
func (*Method) CallMap ¶ added in v1.0.0
CallMap creates a request from a map and invokes this method.
func (*Method) EachPage ¶ added in v1.0.0
func (m *Method) EachPage(ctx context.Context, values map[string]any, fn func(*Response) error) error
EachPage invokes a reflected method once per page for standard Cosmos SDK request/response messages that use pagination.key and pagination.next_key. If the method has no pagination fields, it invokes the method once.
func (*Method) Info ¶ added in v1.0.0
func (m *Method) Info() MethodInfo
Info returns reflected method metadata.
func (*Method) NewRequest ¶ added in v1.0.0
NewRequest creates an empty descriptor-backed request for this method.
type MethodInfo ¶ added in v1.0.0
type MethodInfo struct {
FullName string
Service string
Name string
Input string
Output string
ClientStreaming bool
ServerStreaming bool
}
MethodInfo describes a reflected gRPC method.
type MintParamsResponse ¶ added in v0.3.0
type MintParamsResponse struct {
Params struct {
MintDenom string `json:"mintDenom"`
InflationRateChange string `json:"inflationRateChange"`
InflationMax string `json:"inflationMax"`
InflationMin string `json:"inflationMin"`
GoalBonded string `json:"goalBonded"`
BlocksPerYear string `json:"blocksPerYear"`
} `json:"params"`
}
MintParamsResponse represents mint params response.
type ModuleAccountsResponse ¶ added in v0.3.0
type ModuleAccountsResponse struct {
Accounts []struct {
Type string `json:"@type"`
BaseAccount struct {
Address string `json:"address"`
} `json:"baseAccount"`
Name string `json:"name"`
Permissions []string `json:"permissions"`
} `json:"accounts"`
}
ModuleAccountsResponse represents the module accounts query response.
type ModuleVersionsResponse ¶ added in v0.3.0
type ModuleVersionsResponse struct {
ModuleVersions []struct {
Name string `json:"name"`
Version string `json:"version"`
} `json:"moduleVersions"`
}
ModuleVersionsResponse represents module versions response.
type NodeInfoResponse ¶ added in v0.3.0
type NodeInfoResponse struct {
DefaultNodeInfo struct {
Network string `json:"network"`
Moniker string `json:"moniker"`
} `json:"defaultNodeInfo"`
ApplicationVersion struct {
Name string `json:"name"`
AppName string `json:"appName"`
Version string `json:"version"`
GitCommit string `json:"gitCommit"`
BuildTags string `json:"buildTags"`
GoVersion string `json:"goVersion"`
CosmosSDKVersion string `json:"cosmosSdkVersion"`
BuildDeps []struct {
Path string `json:"path"`
Version string `json:"version"`
Sum string `json:"sum"`
} `json:"buildDeps"`
} `json:"applicationVersion"`
}
NodeInfoResponse represents the response from GetNodeInfo.
type Option ¶
type Option func(*options)
Option configures the Client.
func WithDialOptions ¶
func WithDialOptions(opts ...grpc.DialOption) Option
WithDialOptions appends additional gRPC dial options.
func WithDialTimeout ¶ added in v0.2.0
WithDialTimeout sets a timeout for the initial connection and descriptor fetching. If not set, the timeout is controlled by the context passed to Dial().
func WithDisableALPNEnforcement ¶ added in v0.9.0
func WithDisableALPNEnforcement() Option
WithDisableALPNEnforcement disables ALPN (Application-Layer Protocol Negotiation) enforcement for TLS connections. This is needed for some gRPC servers that don't properly support ALPN negotiation.
Starting with grpc-go v1.67, ALPN is enforced by default. Some servers, particularly older or misconfigured ones, fail the TLS handshake because they don't include the required ALPN property in their response.
Use this option if you encounter errors like:
"transport: authentication handshake failed: credentials: cannot check peer: missing selected ALPN property"
IMPORTANT: Due to grpc-go's initialization order, this option may not work if grpc-go has already cached the environment variable. For reliable ALPN bypass, use one of these approaches instead:
1. Import the alpnfix package before any grpc imports:
import (
_ "github.com/Cordtus/libyaci/alpnfix" // Must be first!
"github.com/Cordtus/libyaci"
)
2. Set the environment variable before running:
GRPC_ENFORCE_ALPN_ENABLED=false ./your-program
This option is kept for cases where the above approaches are impractical.
func WithFallbackRegistry ¶ added in v0.4.0
func WithFallbackRegistry(fb *FallbackRegistry) Option
WithFallbackRegistry sets a custom fallback registry for resolving types that are not available via server reflection (e.g., deprecated modules).
func WithGlobalFallback ¶ added in v0.4.0
func WithGlobalFallback() Option
WithGlobalFallback uses the global fallback registry (shared across clients). This is useful when multiple clients need to share the same fallback descriptors.
func WithMaxRecvMsgSize ¶
WithMaxRecvMsgSize sets the maximum message size the client can receive.
func WithMaxRetries ¶
WithMaxRetries sets the maximum number of retries for failed calls.
func WithMinSDKVersion ¶ added in v1.0.0
WithMinSDKVersion records the minimum Cosmos SDK version expected by the caller. This is diagnostic metadata; reflection still decides what methods can be called.
func WithProtoDir ¶ added in v0.7.0
WithProtoDir configures a directory containing .proto files to use as fallback when server reflection fails to resolve a type. Proto files are compiled and registered, providing definitions for deprecated types.
The directory should contain .proto files with proper package declarations. Imports are resolved relative to the directory root, and standard protobuf imports (google/protobuf/*) are automatically available.
Proto files are loaded lazily on first type resolution failure.
Example:
client, err := libyaci.Dial(ctx, addr,
libyaci.WithProtoDir("/path/to/protos"),
)
When a type like "tendermint.liquidity.v1beta1.MsgSwapWithinBatch" cannot be resolved via server reflection, the client will look for it in the local proto files.
Directory structure should mirror the proto package path:
protos/ tendermint/liquidity/v1beta1/tx.proto cosmos/base/v1beta1/coin.proto
func WithSDKVersion ¶ added in v1.0.0
WithSDKVersion records the target chain's Cosmos SDK version for diagnostics. Reflected service and method descriptors remain the source of truth for method availability.
type PaginationResp ¶ added in v0.3.0
type PaginationResp struct {
NextKey string `json:"nextKey,omitempty"`
Total string `json:"total,omitempty"`
}
PaginationResp represents pagination info in responses.
type ProposalResponse ¶ added in v0.3.0
type ProposalResponse struct {
Proposal json.RawMessage `json:"proposal"`
}
ProposalResponse represents a single proposal response.
type ProposalsResponse ¶ added in v0.3.0
type ProposalsResponse struct {
Proposals []json.RawMessage `json:"proposals"`
Pagination *PaginationResp `json:"pagination,omitempty"`
}
ProposalsResponse represents gov proposals response.
type ProtoDir ¶ added in v0.7.0
type ProtoDir struct {
// contains filtered or unexported fields
}
ProtoDir represents a directory containing .proto files that can be loaded as fallback types when server reflection fails to resolve deprecated types.
func NewProtoDir ¶ added in v0.7.0
NewProtoDir creates a ProtoDir for the given directory path. The directory is not loaded until Load() is called or a lookup triggers lazy loading.
func (*ProtoDir) FindDescriptorByName ¶ added in v0.7.0
func (p *ProtoDir) FindDescriptorByName(ctx context.Context, name protoreflect.FullName) (protoreflect.Descriptor, error)
FindDescriptorByName looks up a descriptor by full name. Triggers lazy loading if not already loaded.
func (*ProtoDir) IsLoaded ¶ added in v0.7.0
IsLoaded returns whether the proto directory has been loaded.
func (*ProtoDir) Load ¶ added in v0.7.0
Load compiles all .proto files in the directory and registers them. This method is safe to call multiple times (subsequent calls are no-ops). Uses protocompile to parse proto files with automatic import resolution.
func (*ProtoDir) Registry ¶ added in v0.7.0
func (p *ProtoDir) Registry() *protoregistry.Files
Registry returns the underlying file registry. Returns nil if not yet loaded.
type RedelegationsResponse ¶ added in v0.3.0
type RedelegationsResponse struct {
RedelegationResponses []struct {
Redelegation struct {
DelegatorAddress string `json:"delegatorAddress"`
ValidatorSrcAddress string `json:"validatorSrcAddress"`
ValidatorDstAddress string `json:"validatorDstAddress"`
Entries []struct {
CreationHeight string `json:"creationHeight"`
CompletionTime string `json:"completionTime"`
InitialBalance string `json:"initialBalance"`
SharesDst string `json:"sharesDst"`
} `json:"entries"`
} `json:"redelegation"`
Entries []struct {
RedelegationEntry struct {
CreationHeight string `json:"creationHeight"`
CompletionTime string `json:"completionTime"`
InitialBalance string `json:"initialBalance"`
SharesDst string `json:"sharesDst"`
} `json:"redelegationEntry"`
Balance string `json:"balance"`
} `json:"entries"`
} `json:"redelegationResponses"`
Pagination *PaginationResp `json:"pagination,omitempty"`
}
RedelegationsResponse represents redelegations response.
type Request ¶ added in v1.0.0
type Request struct {
// contains filtered or unexported fields
}
Request is a descriptor-backed dynamic protobuf request.
type Resolver ¶
type Resolver struct {
// contains filtered or unexported fields
}
Resolver provides thread-safe resolution of protobuf types using server reflection. It implements protoregistry.MessageTypeResolver and protoregistry.ExtensionTypeResolver.
func (*Resolver) CreatePatchedResolver ¶ added in v0.6.1
CreatePatchedResolver creates a new temporary Resolver with a specific field patched from TYPE_STRING to TYPE_BYTES. This is used to recover from UTF-8 validation errors when string fields contain binary data. The original resolver is NOT modified - the returned resolver is for one-time use.
func (*Resolver) Files ¶
func (r *Resolver) Files() *protoregistry.Files
Files returns the underlying file registry.
func (*Resolver) FindExtensionByName ¶
func (r *Resolver) FindExtensionByName(_ protoreflect.FullName) (protoreflect.ExtensionType, error)
FindExtensionByName is not implemented (returns NotFound).
func (*Resolver) FindExtensionByNumber ¶
func (r *Resolver) FindExtensionByNumber(_ protoreflect.FullName, _ protoreflect.FieldNumber) (protoreflect.ExtensionType, error)
FindExtensionByNumber is not implemented (returns NotFound).
func (*Resolver) FindMessageByName ¶
func (r *Resolver) FindMessageByName(name protoreflect.FullName) (protoreflect.MessageType, error)
FindMessageByName finds a message type by its full name. This method is called automatically when unmarshaling protobuf Any types. It first checks the primary registry, then attempts server reflection, and finally falls back to the fallback registry for deprecated types.
func (*Resolver) FindMessageByURL ¶
func (r *Resolver) FindMessageByURL(url string) (protoreflect.MessageType, error)
FindMessageByURL finds a message type by its type URL (used in protobuf Any types).
func (*Resolver) FindMethodDescriptor ¶
func (r *Resolver) FindMethodDescriptor(serviceName, methodName string) (protoreflect.MethodDescriptor, error)
FindMethodDescriptor finds a method descriptor by service and method name.
func (*Resolver) ResetStats ¶ added in v0.5.0
func (r *Resolver) ResetStats()
ResetStats resets all cache statistics to zero.
func (*Resolver) Stats ¶ added in v0.5.0
func (r *Resolver) Stats() ResolverStats
Stats returns cache hit/miss statistics for the resolver. This is useful for diagnosing performance issues with type resolution.
type ResolverStats ¶ added in v0.5.0
type ResolverStats struct {
CacheHits uint64 // Types found in cache (no gRPC call)
CacheMisses uint64 // Types that required gRPC fetch
FallbackHits uint64 // Types found in fallback registry
FallbackMisses uint64 // Types not found anywhere
}
ResolverStats contains cache hit/miss statistics for the resolver.
type Response ¶ added in v1.0.0
type Response struct {
// contains filtered or unexported fields
}
Response is a descriptor-backed dynamic protobuf response.
func (*Response) Field ¶ added in v1.0.0
func (r *Response) Field(path string) (protoreflect.Value, error)
Field returns a top-level or dot-separated nested field value.
type ServiceInfo ¶ added in v1.0.0
type ServiceInfo struct {
Name string
Methods []MethodInfo
}
ServiceInfo describes a reflected gRPC service.
type SigningInfoResponse ¶ added in v0.3.0
type SigningInfoResponse struct {
ValSigningInfo struct {
Address string `json:"address"`
StartHeight string `json:"startHeight"`
IndexOffset string `json:"indexOffset"`
JailedUntil string `json:"jailedUntil"`
Tombstoned bool `json:"tombstoned"`
MissedBlocksCounter string `json:"missedBlocksCounter"`
} `json:"valSigningInfo"`
}
SigningInfoResponse represents signing info response.
type SigningInfosResponse ¶ added in v0.3.0
type SigningInfosResponse struct {
Info []json.RawMessage `json:"info"`
Pagination *PaginationResp `json:"pagination,omitempty"`
}
SigningInfosResponse represents all signing infos response.
type SlashingParamsResponse ¶ added in v0.3.0
type SlashingParamsResponse struct {
Params struct {
SignedBlocksWindow string `json:"signedBlocksWindow"`
MinSignedPerWindow string `json:"minSignedPerWindow"`
DowntimeJailDuration string `json:"downtimeJailDuration"`
SlashFractionDoubleSign string `json:"slashFractionDoubleSign"`
SlashFractionDowntime string `json:"slashFractionDowntime"`
} `json:"params"`
}
SlashingParamsResponse represents slashing params response.
type SpendableBalancesResponse ¶ added in v0.3.0
type SpendableBalancesResponse struct {
Balances []Coin `json:"balances"`
Pagination *PaginationResp `json:"pagination,omitempty"`
}
SpendableBalancesResponse represents spendable balances response.
type StakingParamsResponse ¶ added in v0.3.0
type StakingParamsResponse struct {
Params struct {
BondDenom string `json:"bondDenom"`
UnbondingTime string `json:"unbondingTime"`
MaxValidators uint32 `json:"maxValidators"`
MaxEntries uint32 `json:"maxEntries"`
HistoricalEntries uint32 `json:"historicalEntries"`
MinCommissionRate string `json:"minCommissionRate"`
} `json:"params"`
}
StakingParamsResponse represents the staking params query response.
type StakingPoolResponse ¶ added in v0.3.0
type StakingPoolResponse struct {
Pool struct {
NotBondedTokens string `json:"notBondedTokens"`
BondedTokens string `json:"bondedTokens"`
} `json:"pool"`
}
StakingPoolResponse represents staking pool response.
type SupplyOfResponse ¶ added in v0.3.0
type SupplyOfResponse struct {
Amount Coin `json:"amount"`
}
SupplyOfResponse represents supply of a single denom response.
type SyncingResponse ¶ added in v0.3.0
type SyncingResponse struct {
Syncing bool `json:"syncing"`
}
SyncingResponse represents the syncing status response.
type TallyResultResponse ¶ added in v0.3.0
type TallyResultResponse struct {
Tally struct {
YesCount string `json:"yesCount"`
AbstainCount string `json:"abstainCount"`
NoCount string `json:"noCount"`
NoWithVetoCount string `json:"noWithVetoCount"`
} `json:"tally"`
}
TallyResultResponse represents tally result response.
type TotalSupplyResponse ¶ added in v0.3.0
type TotalSupplyResponse struct {
Supply []Coin `json:"supply"`
Pagination *PaginationResp `json:"pagination,omitempty"`
}
TotalSupplyResponse represents total supply response.
type TxResponse ¶ added in v0.3.0
type TxResponse struct {
Tx json.RawMessage `json:"tx"`
TxResponse json.RawMessage `json:"txResponse"`
}
TxResponse represents a single transaction response.
type TxsEventResponse ¶ added in v0.3.0
type TxsEventResponse struct {
Txs []json.RawMessage `json:"txs"`
TxResponses []json.RawMessage `json:"txResponses"`
Pagination *PaginationResp `json:"pagination,omitempty"`
Total string `json:"total,omitempty"`
}
TxsEventResponse represents the response from GetTxsEvent.
type TypeNotFoundError ¶ added in v0.7.0
type TypeNotFoundError struct {
TypeName string // full proto type name that was not found
OriginalErr error // underlying error from the resolution attempt
Hint string // suggestion for how to fix the issue
}
TypeNotFoundError provides detailed information when a type cannot be resolved via server reflection or fallback registries.
func (*TypeNotFoundError) Error ¶ added in v0.7.0
func (e *TypeNotFoundError) Error() string
Error implements the error interface with a helpful message.
func (*TypeNotFoundError) Unwrap ¶ added in v0.7.0
func (e *TypeNotFoundError) Unwrap() error
Unwrap returns the underlying error for use with errors.Is/errors.As.
type UnbondingDelegationResponse ¶ added in v0.3.0
type UnbondingDelegationResponse struct {
Unbond struct {
DelegatorAddress string `json:"delegatorAddress"`
ValidatorAddress string `json:"validatorAddress"`
Entries []struct {
CreationHeight string `json:"creationHeight"`
CompletionTime string `json:"completionTime"`
InitialBalance string `json:"initialBalance"`
Balance string `json:"balance"`
} `json:"entries"`
} `json:"unbond"`
}
UnbondingDelegationResponse represents unbonding delegation response.
type UnbondingDelegationsResponse ¶ added in v0.3.0
type UnbondingDelegationsResponse struct {
UnbondingResponses []struct {
DelegatorAddress string `json:"delegatorAddress"`
ValidatorAddress string `json:"validatorAddress"`
Entries []struct {
CreationHeight string `json:"creationHeight"`
CompletionTime string `json:"completionTime"`
InitialBalance string `json:"initialBalance"`
Balance string `json:"balance"`
} `json:"entries"`
} `json:"unbondingResponses"`
Pagination *PaginationResp `json:"pagination,omitempty"`
}
UnbondingDelegationsResponse represents multiple unbonding delegations.
type UnsupportedMethodError ¶ added in v1.0.0
type UnsupportedMethodError struct {
Method string
Service string
SDKVersion string
Reason string
Available []string
AvailableServices []string
}
UnsupportedMethodError describes a method that is not available on the connected server according to reflected descriptors.
func (*UnsupportedMethodError) Error ¶ added in v1.0.0
func (e *UnsupportedMethodError) Error() string
func (*UnsupportedMethodError) Unwrap ¶ added in v1.0.0
func (e *UnsupportedMethodError) Unwrap() error
type ValidatorCommissionResponse ¶ added in v0.3.0
type ValidatorCommissionResponse struct {
Commission struct {
Commission []struct {
Denom string `json:"denom"`
Amount string `json:"amount"`
} `json:"commission"`
} `json:"commission"`
}
ValidatorCommissionResponse represents validator commission response.
type ValidatorOutstandingRewardsResponse ¶ added in v0.3.0
type ValidatorOutstandingRewardsResponse struct {
Rewards struct {
Rewards []struct {
Denom string `json:"denom"`
Amount string `json:"amount"`
} `json:"rewards"`
} `json:"rewards"`
}
ValidatorOutstandingRewardsResponse represents outstanding rewards response.
type ValidatorResponse ¶ added in v0.3.0
type ValidatorResponse struct {
Validator struct {
OperatorAddress string `json:"operatorAddress"`
ConsensusPubkey any `json:"consensusPubkey"`
Jailed bool `json:"jailed"`
Status string `json:"status"`
Tokens string `json:"tokens"`
DelegatorShares string `json:"delegatorShares"`
Description struct {
Moniker string `json:"moniker"`
Identity string `json:"identity"`
Website string `json:"website"`
SecurityContact string `json:"securityContact"`
Details string `json:"details"`
} `json:"description"`
UnbondingHeight string `json:"unbondingHeight"`
UnbondingTime string `json:"unbondingTime"`
Commission struct {
CommissionRates struct {
Rate string `json:"rate"`
MaxRate string `json:"maxRate"`
MaxChangeRate string `json:"maxChangeRate"`
} `json:"commissionRates"`
UpdateTime string `json:"updateTime"`
} `json:"commission"`
MinSelfDelegation string `json:"minSelfDelegation"`
} `json:"validator"`
}
ValidatorResponse represents a single validator response.
type ValidatorSetResponse ¶ added in v0.3.0
type ValidatorSetResponse struct {
BlockHeight string `json:"blockHeight"`
Validators []struct {
Address string `json:"address"`
PubKey any `json:"pubKey"`
VotingPower string `json:"votingPower"`
ProposerPriority string `json:"proposerPriority"`
} `json:"validators"`
Pagination *PaginationResp `json:"pagination,omitempty"`
}
ValidatorSetResponse represents the validator set response.
type ValidatorUpdate ¶ added in v1.0.0
type ValidatorUpdate struct {
PubKey json.RawMessage `json:"pubKey,omitempty"`
Power int64 `json:"power,string"`
}
ValidatorUpdate represents a validator update from block results.
type ValidatorsResponse ¶ added in v0.3.0
type ValidatorsResponse struct {
Validators []struct {
OperatorAddress string `json:"operatorAddress"`
Description struct {
Moniker string `json:"moniker"`
} `json:"description"`
Status string `json:"status"`
Tokens string `json:"tokens"`
} `json:"validators"`
Pagination *PaginationResp `json:"pagination,omitempty"`
}
ValidatorsResponse represents the validators query response.
type VotesResponse ¶ added in v0.3.0
type VotesResponse struct {
Votes []json.RawMessage `json:"votes"`
Pagination *PaginationResp `json:"pagination,omitempty"`
}
VotesResponse represents proposal votes response.
type WithdrawAddressResponse ¶ added in v0.3.0
type WithdrawAddressResponse struct {
WithdrawAddress string `json:"withdrawAddress"`
}
WithdrawAddressResponse represents withdraw address response.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package alpnfix provides a workaround for grpc-go's ALPN enforcement.
|
Package alpnfix provides a workaround for grpc-go's ALPN enforcement. |
|
examples
|
|
|
cli
command
Example demonstrates how to use libyaci to call Cosmos SDK gRPC methods without any precompiled protobuf stubs.
|
Example demonstrates how to use libyaci to call Cosmos SDK gRPC methods without any precompiled protobuf stubs. |