client

package
v0.2.10 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 27, 2026 License: Apache-2.0 Imports: 37 Imported by: 2

README

Blockchain API Version Discovery

The client package provides multi-version discovery and negotiation between Akash clients (akt CLI, SDKs) and nodes. A node advertises the API versions it supports; the client picks the best mutual match and instantiates the corresponding versioned client.

Discovery Response

Every discovery endpoint returns the same Akash protobuf message:

{
  "client_info": { "api_version": "v1beta3" },
  "supported_versions": [
    {
      "api_version": "v1beta4",
      "modules": [
        { "module": "deployment", "version": "v1beta4" },
        { "module": "market",     "version": "v1beta5" },
        { "module": "oracle",     "version": "v2" }
      ],
      "features": []
    },
    {
      "api_version": "v1beta3",
      "modules": [ ... ]
    }
  ],
  "chain_id": "akashnet-2",
  "node_version": "v0.36.0",
  "min_client_version": "v0.30.0"
}
Field Description
client_info.api_version Oldest supported version. Kept for backward compatibility with old clients that only read this field.
supported_versions All API versions the node supports, newest first. Each entry lists the per-module versions it bundles.
supported_versions[].features Reserved for future capability flags (e.g. "authz", "feegrant"). Currently empty. Clients should ignore unknown feature strings.
chain_id Network identifier (e.g. akashnet-2).
node_version Node software version.
min_client_version Minimum client version the node accepts. This is advisory data only — the node does not enforce it at the transport level. Clients are expected to read this field and self-check: refuse to proceed if their own version is below the minimum, or warn the user.
Backward Compatibility
  • Old clients connecting to new nodes read only client_info.api_version (v1beta3), ignore the new fields, and continue working.
  • New clients connecting to old nodes see an empty supported_versions list and fall back to client_info.api_version.

Endpoints

Discovery is available on three transports. All return the same data.

Transport Endpoint Notes
CometBFT JSON-RPC POST / {"method":"akash"} Registered automatically via init() when the package is imported.
gRPC akash.discovery.v1.Discovery/GetInfo Requires explicit RegisterDiscoveryService call on the gRPC server.
REST GET /akash/discovery/v1/info gRPC-Gateway route; requires RegisterDiscoveryHandlerServer.

Server Side

1. Configure the Registry

Create a VersionRegistry during node startup. DefaultRegistry includes v1beta3 and v1beta4 with their module version mappings.

import aclient "pkg.akt.dev/go/node/client"

registry := aclient.DefaultRegistry(
    aclient.WithChainID(chainID),
    aclient.WithNodeVersion(version.Version),
    aclient.WithMinClientVersion("v0.30.0"),
)

// Set the global registry. This configures the CometBFT JSON-RPC
// "akash" route — no further action needed for JSON-RPC.
aclient.SetRegistry(registry)
2. Register gRPC Discovery Service

Call RegisterDiscoveryService on the gRPC server. The function accepts gogogrpc.Server, so it works both inside Cosmos SDK's RegisterGRPCServerWithSkipCheckHeader and with a bare *grpc.Server.

func (app *App) RegisterGRPCServerWithSkipCheckHeader(server gogogrpc.Server, skip bool) {
    app.BaseApp.RegisterGRPCServerWithSkipCheckHeader(server, skip)

    // Register Akash Discovery alongside Cosmos module query services.
    aclient.RegisterDiscoveryService(server, aclient.GetRegistry())
}
3. Register REST Gateway Route

Register the gRPC-Gateway handler in RegisterAPIRoutes so the REST endpoint is available at GET /akash/discovery/v1/info.

func (app *App) RegisterAPIRoutes(apiSvr *api.Server, cfg config.APIConfig) {
    // ... existing route registrations ...

    aclient.RegisterDiscoveryHandlerServer(
        context.Background(),
        apiSvr.GRPCGatewayRouter,
        aclient.NewDiscoveryServer(aclient.GetRegistry()),
    )
}

Client Side

The discovery sub-package provides typed convenience functions that handle negotiation and return concrete client interfaces.

import aclient "pkg.akt.dev/go/node/client/discovery"

// For queries (read-only):
lightCl, err := aclient.DiscoverLightClient(ctx, cctx)

// For transactions (read + write):
cl, err := aclient.DiscoverClient(ctx, cctx, opts...)

// For raw queries without tx support:
qcl, err := aclient.DiscoverQueryClient(ctx, cctx)

These functions call the CometBFT JSON-RPC "akash" route, negotiate the best version, and return a client for that version.

The opts parameter accepts cltypes.ClientOption functions from pkg.akt.dev/go/node/client/types. These configure the transaction factory used by the full Client (not needed for read-only light/query clients):

import cltypes "pkg.akt.dev/go/node/client/types"

cl, err := aclient.DiscoverClient(ctx, cctx,
    cltypes.WithGasPrices("0.025uakt"),
    cltypes.WithGasAdjustment(1.5),
    cltypes.WithGas(cltypes.GasSetting{Simulate: true}),
    cltypes.WithSkipConfirm(true),
)
Using the Low-Level API

The base client package exposes the negotiation machinery directly via callback-style SetupFn functions.

import aclient "pkg.akt.dev/go/node/client"

var myClient aclient.Client

err := aclient.DiscoverClient(ctx, cctx, func(cl interface{}) error {
    var ok bool
    if myClient, ok = cl.(aclient.Client); !ok {
        return fmt.Errorf("unexpected client type %T", cl)
    }
    return nil
}, opts...)
How Negotiation Works
  1. The client calls queryClientInfo, which invokes the "akash" JSON-RPC route on the connected node.
  2. negotiateVersion inspects the response:
    • If SupportedVersions is populated (new node), it intersects the server's versions with clientPreferenceOrder (newest first) and returns the first match.
    • If SupportedVersions is empty (old node), it falls back to ClientInfo.ApiVersion.
  3. The negotiated version string selects the factory function (v1beta4.NewClient, v1beta3.NewClient, etc.).
Client preference: [v1beta4, v1beta3]  (newest first)
Server supports:   [v1beta4, v1beta3]
Negotiated:        v1beta4
Negotiation Failure

When the server's SupportedVersions and the client's clientPreferenceOrder have no overlap, negotiateVersion returns an empty string. The subsequent newClientForVersion("") call fails with ErrUnknownClientVersion. This is a hard error — no fallback is attempted.

The same error is returned when an old node reports a ClientInfo.ApiVersion that the client does not recognise (e.g. a future version the client binary predates).

Callers should handle ErrUnknownClientVersion as a signal that the client and node are incompatible and the user needs to upgrade one or the other.

Offline Mode

When cctx.Offline is true, discovery is skipped and v1beta3 is assumed.

Adding a New API Version

To add a new composite API version (e.g. v1beta5):

  1. Define module versions in registry.go:

    var v1beta5Modules = []ModuleVersion{
        {Module: "deployment", Version: "v1beta5"},
        // ...
    }
    
  2. Add the version constant in client.go:

    const VersionV1beta5 = "v1beta5"
    
  3. Add to clientPreferenceOrder in client.go (newest first):

    var clientPreferenceOrder = []string{VersionV1beta5, VersionV1beta4, VersionV1beta3}
    
  4. Create the client package v1beta5/client.go.

    If module interfaces are unchanged, delegate to the previous version:

    package v1beta5
    
    type Client = v1beta4.Client
    // ...
    func NewClient(ctx context.Context, cctx sdkclient.Context, opts ...cltypes.ClientOption) (Client, error) {
        return v1beta4.NewClient(ctx, cctx, opts...)
    }
    

    If a module introduces a new interface (e.g. deployment/v1beta5 adds or changes query methods), copy v1beta4/ and update the imports and composite interfaces. Follow the pattern in v1beta3/query.go — each module's QueryClient is imported as a type alias and wired into the composite queryClient struct:

    package v1beta5
    
    import (
        dtypes "pkg.akt.dev/go/node/deployment/v1beta5" // new module version
        mtypes "pkg.akt.dev/go/node/market/v1beta5"     // unchanged — same import
    )
    
    // QueryClient exposes the new deployment/v1beta5 interface.
    type QueryClient interface {
        Deployment() dtypes.QueryClient  // updated return type
        Market()     mtypes.QueryClient
        // ...
    }
    

    The composite Client, LightClient, and TxClient interfaces must be updated to match. This is intentionally a breaking change within the versioned package — callers that pin to v1beta4 are unaffected.

  5. Add switch cases in newClientForVersion, newLightClientForVersion, and newQueryClientForVersion in client.go.

  6. Register in DefaultRegistry in registry.go (newest first):

    func DefaultRegistry(opts ...RegistryOption) *VersionRegistry {
        return NewRegistry([]VersionInfo{
            {ApiVersion: VersionV1beta5, Modules: v1beta5Modules},
            {ApiVersion: VersionV1beta4, Modules: v1beta4Modules},
            {ApiVersion: VersionV1beta3, Modules: v1beta3Modules},
        }, opts...)
    }
    
  7. Regenerate protos if any proto messages changed: make proto-gen-go.

Documentation

Overview

Package client is a reverse proxy.

It translates gRPC into RESTful JSON APIs.

Index

Constants

View Source
const (
	VersionV1beta3 = "v1beta3"
	VersionV1beta4 = "v1beta4"
)

Variables

View Source
var (
	ErrInvalidLengthAkash        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowAkash          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupAkash = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrDetectClientVersion  = errors.New("chain-sdk: unable detect client version")
	ErrUnknownClientVersion = errors.New("chain-sdk: unknown client version")
)
View Source
var (
	ErrInvalidLengthClientInfo        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowClientInfo          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupClientInfo = fmt.Errorf("proto: unexpected end of group")
)
View Source
var (
	ErrInvalidLengthService        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowService          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupService = fmt.Errorf("proto: unexpected end of group")
)
View Source
var Discovery_serviceDesc = _Discovery_serviceDesc

Functions

func DiscoverClient

func DiscoverClient(ctx context.Context, cctx sdkclient.Context, setup SetupFn, opts ...cltypes.ClientOption) error

DiscoverClient queries an RPC node to get the version of the client and executes a SetupFn function passing a new versioned Client instance as parameter. If any error occurs when calling the RPC node or the Cosmos SDK client Context is set to offline the default value of DefaultClientAPIVersion will be used. An error is returned if client discovery is not successful.

func DiscoverLightClient

func DiscoverLightClient(ctx context.Context, cctx sdkclient.Context, setup SetupFn) error

func DiscoverQueryClient

func DiscoverQueryClient(ctx context.Context, cctx sdkclient.Context, setup SetupFn) error

DiscoverQueryClient queries an RPC node to get the version of the client and executes a SetupFn function passing a new versioned QueryClient instance as parameter. If any error occurs when calling the RPC node or the Cosmos SDK client Context is set to offline the default value of DefaultClientAPIVersion will be used. An error is returned if client discovery is not successful.

func NewHTTPClient added in v0.1.8

func NewHTTPClient(ctx context.Context, remoteAddr string) (*http.Client, error)

NewHTTPClient is used to create an http client with some default parameters. We overwrite the http.Client.Dial so we can do http over tcp or unix. remoteAddr should be fully featured (eg. with tcp:// or unix://). An error will be returned in case of invalid remoteAddr.

func NormalizeEndpoint added in v0.2.9

func NormalizeEndpoint(rawURL string) string

NormalizeEndpoint ensures that a URL string contains an explicit port. When the port is absent it is inferred from the scheme:

https, wss → 443
http, ws, tcp → 80

Unix-socket URLs and URLs that already carry a port are returned unchanged. An empty or unparseable string is returned as-is.

func PrintJSON

func PrintJSON(ctx client.Context, v interface{}) error

func RegisterDiscoveryHandler added in v0.2.10

func RegisterDiscoveryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc.ClientConn) error

RegisterDiscoveryHandler registers the http handlers for service Discovery to "mux". The handlers forward requests to the grpc endpoint over "conn".

func RegisterDiscoveryHandlerClient added in v0.2.10

func RegisterDiscoveryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client DiscoveryClient) error

RegisterDiscoveryHandlerClient registers the http handlers for service Discovery to "mux". The handlers forward requests to the grpc endpoint over the given implementation of "DiscoveryClient". Note: the gRPC framework executes interceptors within the gRPC handler. If the passed in "DiscoveryClient" doesn't go through the normal gRPC flow (creating a gRPC client etc.) then it will be up to the passed in "DiscoveryClient" to call the correct interceptors.

func RegisterDiscoveryHandlerFromEndpoint added in v0.2.10

func RegisterDiscoveryHandlerFromEndpoint(ctx context.Context, mux *runtime.ServeMux, endpoint string, opts []grpc.DialOption) (err error)

RegisterDiscoveryHandlerFromEndpoint is same as RegisterDiscoveryHandler but automatically dials to "endpoint" and closes the connection when "ctx" gets done.

func RegisterDiscoveryHandlerServer added in v0.2.10

func RegisterDiscoveryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server DiscoveryServer) error

RegisterDiscoveryHandlerServer registers the http handlers for service Discovery to "mux". UnaryRPC :call DiscoveryServer directly. StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterDiscoveryHandlerFromEndpoint instead.

func RegisterDiscoveryServer added in v0.2.10

func RegisterDiscoveryServer(s grpc1.Server, srv DiscoveryServer)

func RegisterDiscoveryService added in v0.2.10

func RegisterDiscoveryService(server gogogrpc.Server, registry *VersionRegistry)

RegisterDiscoveryService registers the Discovery gRPC service on the given server. Accepts gogogrpc.Server so it can be called from within Cosmos SDK's RegisterGRPCServerWithSkipCheckHeader or with a concrete *grpc.Server.

func SetRegistry added in v0.2.10

func SetRegistry(r *VersionRegistry)

SetRegistry replaces the global version registry used by RPCAkash and GetRegistry. It must be called during node startup before the RPC server begins accepting requests. Passing nil panics.

Types

type Akash

type Akash struct {
	// ClientInfo holds information about the client.
	// Kept for backward compatibility. New clients should use supported_versions.
	ClientInfo ClientInfo `protobuf:"bytes,1,opt,name=client_info,json=clientInfo,proto3" json:"client_info" yaml:"client_info"`
	// SupportedVersions lists all API versions the node supports.
	// Clients should pick the best match from this list.
	SupportedVersions []VersionInfo `` /* 128-byte string literal not displayed */
	// ChainID is the identifier of the blockchain network.
	ChainID string `protobuf:"bytes,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id" yaml:"chain_id"`
	// NodeVersion is the software version of the node.
	NodeVersion string `protobuf:"bytes,4,opt,name=node_version,json=nodeVersion,proto3" json:"node_version" yaml:"node_version"`
	// MinClientVersion is the minimum client version the node accepts.
	MinClientVersion string `` /* 127-byte string literal not displayed */
}

Akash akash specific RPC parameters.

func RPCAkash

func RPCAkash(_ *cmtrpctypes.Context) (*Akash, error)

func (*Akash) Descriptor

func (*Akash) Descriptor() ([]byte, []int)

func (*Akash) GetChainID added in v0.2.10

func (m *Akash) GetChainID() string

func (*Akash) GetClientInfo

func (m *Akash) GetClientInfo() ClientInfo

func (*Akash) GetMinClientVersion added in v0.2.10

func (m *Akash) GetMinClientVersion() string

func (*Akash) GetNodeVersion added in v0.2.10

func (m *Akash) GetNodeVersion() string

func (*Akash) GetSupportedVersions added in v0.2.10

func (m *Akash) GetSupportedVersions() []VersionInfo

func (*Akash) Marshal

func (m *Akash) Marshal() (dAtA []byte, err error)

func (*Akash) MarshalTo

func (m *Akash) MarshalTo(dAtA []byte) (int, error)

func (*Akash) MarshalToSizedBuffer

func (m *Akash) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*Akash) ProtoMessage

func (*Akash) ProtoMessage()

func (*Akash) Reset

func (m *Akash) Reset()

func (*Akash) Size

func (m *Akash) Size() (n int)

func (*Akash) String

func (m *Akash) String() string

func (*Akash) Unmarshal

func (m *Akash) Unmarshal(dAtA []byte) error

func (*Akash) XXX_DiscardUnknown

func (m *Akash) XXX_DiscardUnknown()

func (*Akash) XXX_Marshal

func (m *Akash) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Akash) XXX_Merge

func (m *Akash) XXX_Merge(src proto.Message)

func (*Akash) XXX_Size

func (m *Akash) XXX_Size() int

func (*Akash) XXX_Unmarshal

func (m *Akash) XXX_Unmarshal(b []byte) error

type Client

type Client interface {
	v1beta3.Client
}

type ClientInfo

type ClientInfo struct {
	// ApiVersion is the version of the API running on the client.
	ApiVersion string `protobuf:"bytes,1,opt,name=api_version,json=apiVersion,proto3" json:"api_version" yaml:"api_version"`
}

ClientInfo is the akash specific client info.

func (*ClientInfo) Descriptor

func (*ClientInfo) Descriptor() ([]byte, []int)

func (*ClientInfo) GetApiVersion

func (m *ClientInfo) GetApiVersion() string

func (*ClientInfo) Marshal

func (m *ClientInfo) Marshal() (dAtA []byte, err error)

func (*ClientInfo) MarshalTo

func (m *ClientInfo) MarshalTo(dAtA []byte) (int, error)

func (*ClientInfo) MarshalToSizedBuffer

func (m *ClientInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ClientInfo) ProtoMessage

func (*ClientInfo) ProtoMessage()

func (*ClientInfo) Reset

func (m *ClientInfo) Reset()

func (*ClientInfo) Size

func (m *ClientInfo) Size() (n int)

func (*ClientInfo) String

func (m *ClientInfo) String() string

func (*ClientInfo) Unmarshal

func (m *ClientInfo) Unmarshal(dAtA []byte) error

func (*ClientInfo) XXX_DiscardUnknown

func (m *ClientInfo) XXX_DiscardUnknown()

func (*ClientInfo) XXX_Marshal

func (m *ClientInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ClientInfo) XXX_Merge

func (m *ClientInfo) XXX_Merge(src proto.Message)

func (*ClientInfo) XXX_Size

func (m *ClientInfo) XXX_Size() int

func (*ClientInfo) XXX_Unmarshal

func (m *ClientInfo) XXX_Unmarshal(b []byte) error

type DiscoveryClient added in v0.2.10

type DiscoveryClient interface {
	// GetInfo returns the node's supported API versions and metadata.
	GetInfo(ctx context.Context, in *GetInfoRequest, opts ...grpc.CallOption) (*GetInfoResponse, error)
}

DiscoveryClient is the client API for Discovery service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream.

func NewDiscoveryClient added in v0.2.10

func NewDiscoveryClient(cc grpc1.ClientConn) DiscoveryClient

type DiscoveryServer added in v0.2.10

type DiscoveryServer interface {
	// GetInfo returns the node's supported API versions and metadata.
	GetInfo(context.Context, *GetInfoRequest) (*GetInfoResponse, error)
}

DiscoveryServer is the server API for Discovery service.

func NewDiscoveryServer added in v0.2.10

func NewDiscoveryServer(registry *VersionRegistry) DiscoveryServer

NewDiscoveryServer creates a new gRPC DiscoveryServer backed by the given registry. Passing a nil registry panics.

type GetInfoRequest added in v0.2.10

type GetInfoRequest struct {
}

GetInfoRequest is the request type for the Discovery/GetInfo RPC method.

func (*GetInfoRequest) Descriptor added in v0.2.10

func (*GetInfoRequest) Descriptor() ([]byte, []int)

func (*GetInfoRequest) Marshal added in v0.2.10

func (m *GetInfoRequest) Marshal() (dAtA []byte, err error)

func (*GetInfoRequest) MarshalTo added in v0.2.10

func (m *GetInfoRequest) MarshalTo(dAtA []byte) (int, error)

func (*GetInfoRequest) MarshalToSizedBuffer added in v0.2.10

func (m *GetInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GetInfoRequest) ProtoMessage added in v0.2.10

func (*GetInfoRequest) ProtoMessage()

func (*GetInfoRequest) Reset added in v0.2.10

func (m *GetInfoRequest) Reset()

func (*GetInfoRequest) Size added in v0.2.10

func (m *GetInfoRequest) Size() (n int)

func (*GetInfoRequest) String added in v0.2.10

func (m *GetInfoRequest) String() string

func (*GetInfoRequest) Unmarshal added in v0.2.10

func (m *GetInfoRequest) Unmarshal(dAtA []byte) error

func (*GetInfoRequest) XXX_DiscardUnknown added in v0.2.10

func (m *GetInfoRequest) XXX_DiscardUnknown()

func (*GetInfoRequest) XXX_Marshal added in v0.2.10

func (m *GetInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetInfoRequest) XXX_Merge added in v0.2.10

func (m *GetInfoRequest) XXX_Merge(src proto.Message)

func (*GetInfoRequest) XXX_Size added in v0.2.10

func (m *GetInfoRequest) XXX_Size() int

func (*GetInfoRequest) XXX_Unmarshal added in v0.2.10

func (m *GetInfoRequest) XXX_Unmarshal(b []byte) error

type GetInfoResponse added in v0.2.10

type GetInfoResponse struct {
	// Info contains the node's version and capability information.
	Info *Akash `protobuf:"bytes,1,opt,name=info,proto3" json:"info,omitempty"`
}

GetInfoResponse is the response type for the Discovery/GetInfo RPC method.

func (*GetInfoResponse) Descriptor added in v0.2.10

func (*GetInfoResponse) Descriptor() ([]byte, []int)

func (*GetInfoResponse) GetInfo added in v0.2.10

func (m *GetInfoResponse) GetInfo() *Akash

func (*GetInfoResponse) Marshal added in v0.2.10

func (m *GetInfoResponse) Marshal() (dAtA []byte, err error)

func (*GetInfoResponse) MarshalTo added in v0.2.10

func (m *GetInfoResponse) MarshalTo(dAtA []byte) (int, error)

func (*GetInfoResponse) MarshalToSizedBuffer added in v0.2.10

func (m *GetInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*GetInfoResponse) ProtoMessage added in v0.2.10

func (*GetInfoResponse) ProtoMessage()

func (*GetInfoResponse) Reset added in v0.2.10

func (m *GetInfoResponse) Reset()

func (*GetInfoResponse) Size added in v0.2.10

func (m *GetInfoResponse) Size() (n int)

func (*GetInfoResponse) String added in v0.2.10

func (m *GetInfoResponse) String() string

func (*GetInfoResponse) Unmarshal added in v0.2.10

func (m *GetInfoResponse) Unmarshal(dAtA []byte) error

func (*GetInfoResponse) XXX_DiscardUnknown added in v0.2.10

func (m *GetInfoResponse) XXX_DiscardUnknown()

func (*GetInfoResponse) XXX_Marshal added in v0.2.10

func (m *GetInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*GetInfoResponse) XXX_Merge added in v0.2.10

func (m *GetInfoResponse) XXX_Merge(src proto.Message)

func (*GetInfoResponse) XXX_Size added in v0.2.10

func (m *GetInfoResponse) XXX_Size() int

func (*GetInfoResponse) XXX_Unmarshal added in v0.2.10

func (m *GetInfoResponse) XXX_Unmarshal(b []byte) error

type LightClient

type LightClient interface {
	v1beta3.LightClient
}

type ModuleVersion added in v0.2.10

type ModuleVersion struct {
	// Module is the name of the module (e.g., "deployment", "market", "oracle").
	Module string `protobuf:"bytes,1,opt,name=module,proto3" json:"module" yaml:"module"`
	// Version is the API version of the module (e.g., "v1beta4", "v1beta5", "v2").
	Version string `protobuf:"bytes,2,opt,name=version,proto3" json:"version" yaml:"version"`
}

ModuleVersion describes a single module and its API version.

func (*ModuleVersion) Descriptor added in v0.2.10

func (*ModuleVersion) Descriptor() ([]byte, []int)

func (*ModuleVersion) GetModule added in v0.2.10

func (m *ModuleVersion) GetModule() string

func (*ModuleVersion) GetVersion added in v0.2.10

func (m *ModuleVersion) GetVersion() string

func (*ModuleVersion) Marshal added in v0.2.10

func (m *ModuleVersion) Marshal() (dAtA []byte, err error)

func (*ModuleVersion) MarshalTo added in v0.2.10

func (m *ModuleVersion) MarshalTo(dAtA []byte) (int, error)

func (*ModuleVersion) MarshalToSizedBuffer added in v0.2.10

func (m *ModuleVersion) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*ModuleVersion) ProtoMessage added in v0.2.10

func (*ModuleVersion) ProtoMessage()

func (*ModuleVersion) Reset added in v0.2.10

func (m *ModuleVersion) Reset()

func (*ModuleVersion) Size added in v0.2.10

func (m *ModuleVersion) Size() (n int)

func (*ModuleVersion) String added in v0.2.10

func (m *ModuleVersion) String() string

func (*ModuleVersion) Unmarshal added in v0.2.10

func (m *ModuleVersion) Unmarshal(dAtA []byte) error

func (*ModuleVersion) XXX_DiscardUnknown added in v0.2.10

func (m *ModuleVersion) XXX_DiscardUnknown()

func (*ModuleVersion) XXX_Marshal added in v0.2.10

func (m *ModuleVersion) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ModuleVersion) XXX_Merge added in v0.2.10

func (m *ModuleVersion) XXX_Merge(src proto.Message)

func (*ModuleVersion) XXX_Size added in v0.2.10

func (m *ModuleVersion) XXX_Size() int

func (*ModuleVersion) XXX_Unmarshal added in v0.2.10

func (m *ModuleVersion) XXX_Unmarshal(b []byte) error

type QueryClient

type QueryClient interface {
	v1beta3.QueryClient
}

type RPCClient

type RPCClient interface {
	client.CometRPC
	Akash(ctx context.Context) (*Akash, error)
}

func NewClient

func NewClient(ctx context.Context, remote string) (RPCClient, error)

NewClient allows for setting a custom http client (See New). An error is returned on invalid remote. The function panics when remote is nil.

type RegistryOption added in v0.2.10

type RegistryOption func(*VersionRegistry)

RegistryOption configures a VersionRegistry.

func WithChainID added in v0.2.10

func WithChainID(chainID string) RegistryOption

WithChainID sets the chain ID on the registry.

func WithMinClientVersion added in v0.2.10

func WithMinClientVersion(version string) RegistryOption

WithMinClientVersion sets the minimum required client version.

func WithNodeVersion added in v0.2.10

func WithNodeVersion(version string) RegistryOption

WithNodeVersion sets the node software version on the registry.

type SetupFn

type SetupFn func(interface{}) error

SetupFn defines a function that takes a parameter, ideally a Client or QueryClient. These functions must validate the client and make it accessible.

type UnimplementedDiscoveryServer added in v0.2.10

type UnimplementedDiscoveryServer struct {
}

UnimplementedDiscoveryServer can be embedded to have forward compatible implementations.

func (*UnimplementedDiscoveryServer) GetInfo added in v0.2.10

type VersionInfo added in v0.2.10

type VersionInfo struct {
	// ApiVersion is the composite API version identifier (e.g., "v1beta4").
	ApiVersion string `protobuf:"bytes,1,opt,name=api_version,json=apiVersion,proto3" json:"api_version" yaml:"api_version"`
	// Modules lists the per-module versions included in this API version.
	Modules []ModuleVersion `protobuf:"bytes,2,rep,name=modules,proto3" json:"modules" yaml:"modules"`
	// Features lists optional feature flags supported by this API version.
	Features []string `protobuf:"bytes,3,rep,name=features,proto3" json:"features" yaml:"features"`
}

VersionInfo describes a complete API version and its metadata.

func (*VersionInfo) Descriptor added in v0.2.10

func (*VersionInfo) Descriptor() ([]byte, []int)

func (*VersionInfo) GetApiVersion added in v0.2.10

func (m *VersionInfo) GetApiVersion() string

func (*VersionInfo) GetFeatures added in v0.2.10

func (m *VersionInfo) GetFeatures() []string

func (*VersionInfo) GetModules added in v0.2.10

func (m *VersionInfo) GetModules() []ModuleVersion

func (*VersionInfo) Marshal added in v0.2.10

func (m *VersionInfo) Marshal() (dAtA []byte, err error)

func (*VersionInfo) MarshalTo added in v0.2.10

func (m *VersionInfo) MarshalTo(dAtA []byte) (int, error)

func (*VersionInfo) MarshalToSizedBuffer added in v0.2.10

func (m *VersionInfo) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*VersionInfo) ProtoMessage added in v0.2.10

func (*VersionInfo) ProtoMessage()

func (*VersionInfo) Reset added in v0.2.10

func (m *VersionInfo) Reset()

func (*VersionInfo) Size added in v0.2.10

func (m *VersionInfo) Size() (n int)

func (*VersionInfo) String added in v0.2.10

func (m *VersionInfo) String() string

func (*VersionInfo) Unmarshal added in v0.2.10

func (m *VersionInfo) Unmarshal(dAtA []byte) error

func (*VersionInfo) XXX_DiscardUnknown added in v0.2.10

func (m *VersionInfo) XXX_DiscardUnknown()

func (*VersionInfo) XXX_Marshal added in v0.2.10

func (m *VersionInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*VersionInfo) XXX_Merge added in v0.2.10

func (m *VersionInfo) XXX_Merge(src proto.Message)

func (*VersionInfo) XXX_Size added in v0.2.10

func (m *VersionInfo) XXX_Size() int

func (*VersionInfo) XXX_Unmarshal added in v0.2.10

func (m *VersionInfo) XXX_Unmarshal(b []byte) error

type VersionRegistry added in v0.2.10

type VersionRegistry struct {
	// contains filtered or unexported fields
}

VersionRegistry holds the server's supported API versions and metadata. It is used by both the CometBFT JSON-RPC handler and the gRPC Discovery service to produce version responses.

func DefaultRegistry added in v0.2.10

func DefaultRegistry(opts ...RegistryOption) *VersionRegistry

DefaultRegistry creates a registry with v1beta3 and v1beta4 support.

func GetRegistry added in v0.2.10

func GetRegistry() *VersionRegistry

GetRegistry returns the current global version registry.

func NewRegistry added in v0.2.10

func NewRegistry(versions []VersionInfo, opts ...RegistryOption) *VersionRegistry

NewRegistry creates a new VersionRegistry with the given supported versions.

func (*VersionRegistry) OldestVersion added in v0.2.10

func (r *VersionRegistry) OldestVersion() string

OldestVersion returns the lowest supported version string. Used as the value for ClientInfo.ApiVersion for backward compatibility with old clients.

func (*VersionRegistry) SetChainID added in v0.2.10

func (r *VersionRegistry) SetChainID(chainID string)

SetChainID updates the chain ID. Safe for concurrent use.

func (*VersionRegistry) SupportsVersion added in v0.2.10

func (r *VersionRegistry) SupportsVersion(v string) bool

SupportsVersion checks if a specific version is in the supported set.

func (*VersionRegistry) ToAkash added in v0.2.10

func (r *VersionRegistry) ToAkash() *Akash

ToAkash converts the registry state to a proto Akash response. ClientInfo.ApiVersion is set to the oldest supported version for backward compatibility.

Directories

Path Synopsis
Package v1beta4 provides the v1beta4 composite client for the Akash blockchain.
Package v1beta4 provides the v1beta4 composite client for the Akash blockchain.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL