Documentation
¶
Index ¶
- Constants
- Variables
- func DebugBroadcastError(err error) string
- func ExtractTxHashFromResponse(resp interface{}) string
- func ExtractTxResponseFromError(err error) *sdktypes.TxResponse
- func GenerateSDLHash(sdl string) []byte
- func LogTransactionDetails(txResp *sdktypes.TxResponse)
- func ParseAkashError(rawLog string) map[string]string
- func RenderSDLToYAML(sdl *resourcev1alpha1.SDL) (string, error)
- func ValidateTransactionPreBroadcast(msg sdktypes.Msg, accountAddress string) error
- type AkashClient
- func New(ctx context.Context, configuration AkashProviderConfiguration) *AkashClient
- func NewFromManagedResource(ctx context.Context, kubeClient client.Client, usage resource.Tracker, ...) (*AkashClient, error)
- func NewFromProviderConfig(ctx context.Context, kubeClient client.Client, ...) (*AkashClient, error)
- func NewWithSecretRef(ctx context.Context, kubeClient client.Client, secretRef SecretReference, ...) *AkashClient
- func (ak *AkashClient) AddFunds(ctx context.Context, dseq string, amount int64) error
- func (ak *AkashClient) BroadcastWithMonitoring(ctx context.Context, msgs []sdktypes.Msg) (*sdktypes.TxResponse, error)
- func (ak *AkashClient) CloseDeployment(ctx context.Context, dseq string, owner string) error
- func (ak *AkashClient) CloseLease(ctx context.Context, seqs clienttypes.Seqs, provider string) (string, error)
- func (ak *AkashClient) CreateCertificate(ctx context.Context, domains []string, owner string) (*CertificateInfo, error)
- func (ak *AkashClient) CreateDeployment(ctx context.Context, req clienttypes.DeploymentCreateRequest) (clienttypes.Seqs, error)
- func (ak *AkashClient) CreateLease(ctx context.Context, seqs clienttypes.Seqs, provider string) (string, error)
- func (ak *AkashClient) GenerateSDLHash(sdl *types.SDL) (string, error)
- func (ak *AkashClient) GetBid(ctx context.Context, bidId string) (*clienttypes.Bid, error)
- func (ak *AkashClient) GetBids(ctx context.Context, dseq string, owner string) (clienttypes.Bids, error)
- func (ak *AkashClient) GetCertificate(ctx context.Context, serial string, owner string) (*CertificateInfo, error)
- func (ak *AkashClient) GetCertificates(ctx context.Context, owner string) ([]CertificateInfo, error)
- func (ak *AkashClient) GetContext() context.Context
- func (ak *AkashClient) GetCredentials() ([]byte, error)
- func (ak *AkashClient) GetDeployment(ctx context.Context, dseq string, owner string) (clienttypes.Deployment, error)
- func (ak *AkashClient) GetDeployments(owner string) ([]clienttypes.DeploymentId, error)
- func (ak *AkashClient) GetLease(ctx context.Context, seqs clienttypes.Seqs, provider string) (string, error)
- func (ak *AkashClient) GetLeaseManifest(seqs clienttypes.Seqs, provider string) (string, error)
- func (ak *AkashClient) GetLeaseServices(seqs clienttypes.Seqs, provider string) (string, error)
- func (ak *AkashClient) GetLeases(ctx context.Context, dseq string, owner string) ([]bidv1.Lease, error)
- func (ak *AkashClient) GetManifestStatus(ctx context.Context, lease LeaseInfo, certPEM, keyPEM []byte) (*ManifestStatus, error)
- func (ak *AkashClient) GetOrders(ctx context.Context, dseq string, owner string) ([]marketv1beta5.Order, error)
- func (ak *AkashClient) GetPath() string
- func (ak *AkashClient) GetServiceStatus(seqs clienttypes.Seqs, provider, serviceName string) (string, error)
- func (ak *AkashClient) NetworkDiagnostics(ctx context.Context) error
- func (ak *AkashClient) ProviderHostURI(ctx context.Context, providerAddr string) (string, error)
- func (ak *AkashClient) QuickDiagnostic() error
- func (ak *AkashClient) RefreshCredentials() error
- func (ak *AkashClient) RevokeCertificate(ctx context.Context, serial string, owner string) error
- func (ak *AkashClient) SendManifest(dseq string, provider string, manifestLocation string) (string, error)
- func (ak *AkashClient) SendManifestToProvider(ctx context.Context, lease LeaseInfo, sdl string, certPEM, keyPEM []byte) (*ManifestStatus, error)
- func (ak *AkashClient) SetCredentialCacheTTL(ttl time.Duration)
- func (ak *AkashClient) SetGlobalTransactionNote(note string)
- func (ak *AkashClient) UpdateDeployment(ctx context.Context, dseq string, sdl string) error
- func (ak *AkashClient) UpdateManifest(ctx context.Context, lease LeaseInfo, sdl string, certPEM, keyPEM []byte) (*ManifestStatus, error)
- func (ak *AkashClient) ValidateCertificate(certInfo *CertificateInfo, autoRenew bool, validityDays int32) (bool, error)
- func (ak *AkashClient) ValidateManifestSDL(sdlContent string) []ManifestError
- func (ak *AkashClient) ValidateSDL(sdl *types.SDL) []string
- func (ak *AkashClient) WaitForTransactionConfirmation(txHash string, timeoutSeconds int) error
- type AkashProviderConfiguration
- type CertificateInfo
- type EncodingConfig
- type Expose
- type LeaseInfo
- type ManifestError
- type ManifestServiceInfo
- type ManifestStatus
- type NodeClient
- type Profiles
- type ProviderConfigInfo
- type QueryClient
- func (q *QueryClient) Auth() authtypes.QueryClient
- func (q *QueryClient) Bank() banktypes.QueryClient
- func (q *QueryClient) Cert() certcli.QueryClient
- func (q *QueryClient) Deployment() deploymentcli.QueryClient
- func (q *QueryClient) Market() marketcli.QueryClient
- func (q *QueryClient) Provider() providercli.QueryClient
- func (q *QueryClient) Staking() stakingtypes.QueryClient
- type SDLDocument
- type SecretReference
- type Service
- type ServiceEndpoint
- type TxClient
Constants ¶
const ( CertificateStateValid = "valid" CertificateStateExpired = "expired" CertificateStateRevoked = "revoked" )
Certificate states
const ( // Default key and keyring settings DefaultKeyName = "default" DefaultKeyringBackend = "test" // Default network settings DefaultNet = "mainnet" DefaultChainId = "akashnet-2" DefaultNode = "https://rpc.akashnet.io:443" // Default version and paths DefaultVersion = "0.18.0" DefaultHome = "/tmp/.akash" DefaultPath = "/usr/local/bin/akash" DefaultProvidersApi = "https://akash-api.polkachu.com" // Validation constants KeyringBackendOS = "os" KeyringBackendFile = "file" KeyringBackendTest = "test" KeyringBackendMemory = "memory" NetworkMainnet = "mainnet" NetworkTestnet = "testnet" NetworkSandbox = "sandbox" )
Default configuration constants for Akash provider
const (
// Akash network constants
Bech32PrefixAccAddr = "akash"
)
const DepositDenom = "uact"
DepositDenom is the deposit denomination required by node v2 BME for new deployments.
Variables ¶
var ErrManifestNotFound = errors.New("manifest not found on provider")
Functions ¶
func DebugBroadcastError ¶
DebugBroadcastError provides detailed debugging information for broadcast errors
func ExtractTxHashFromResponse ¶
func ExtractTxHashFromResponse(resp interface{}) string
ExtractTxHashFromResponse attempts to extract transaction hash from broadcast response
func ExtractTxResponseFromError ¶
func ExtractTxResponseFromError(err error) *sdktypes.TxResponse
ExtractTxResponseFromError attempts to extract transaction response details from an error
func GenerateSDLHash ¶
GenerateSDLHash returns manifest.Version() bytes for the given SDL.
func LogTransactionDetails ¶
func LogTransactionDetails(txResp *sdktypes.TxResponse)
LogTransactionDetails logs comprehensive transaction information
func ParseAkashError ¶
ParseAkashError extracts meaningful information from Akash-specific errors
func RenderSDLToYAML ¶
func RenderSDLToYAML(sdl *resourcev1alpha1.SDL) (string, error)
RenderSDLToYAML produces the canonical YAML SDL string from a SDL CR.
Types ¶
type AkashClient ¶
type AkashClient struct {
Config AkashProviderConfiguration
// contains filtered or unexported fields
}
func New ¶
func New(ctx context.Context, configuration AkashProviderConfiguration) *AkashClient
New creates a new AkashClient with direct credential configuration (legacy)
func NewFromManagedResource ¶
func NewFromManagedResource(ctx context.Context, kubeClient client.Client, usage resource.Tracker, mg resource.Managed, pcInfo ProviderConfigInfo) (*AkashClient, error)
NewFromManagedResource creates a new AkashClient that automatically loads credentials and configuration from the ProviderConfig referenced by the managed resource
func NewFromProviderConfig ¶
func NewFromProviderConfig(ctx context.Context, kubeClient client.Client, credSource xpv1.CredentialsSource, credSelectors xpv1.CommonCredentialSelectors, config AkashProviderConfiguration) (*AkashClient, error)
NewFromProviderConfig creates a new AkashClient from ProviderConfig credentials (legacy)
func NewWithSecretRef ¶
func NewWithSecretRef(ctx context.Context, kubeClient client.Client, secretRef SecretReference, config AkashProviderConfiguration) *AkashClient
NewWithSecretRef creates a new AkashClient that loads credentials from a Kubernetes secret
func (*AkashClient) BroadcastWithMonitoring ¶
func (ak *AkashClient) BroadcastWithMonitoring(ctx context.Context, msgs []sdktypes.Msg) (*sdktypes.TxResponse, error)
BroadcastWithMonitoring broadcasts a transaction with enhanced error handling
func (*AkashClient) CloseDeployment ¶
CloseDeployment closes an existing deployment
func (*AkashClient) CloseLease ¶
func (ak *AkashClient) CloseLease(ctx context.Context, seqs clienttypes.Seqs, provider string) (string, error)
CloseLease broadcasts MsgCloseLease for the lease identified by the given sequence numbers + provider. The reason is recorded as Owner-initiated close.
func (*AkashClient) CreateCertificate ¶
func (ak *AkashClient) CreateCertificate(ctx context.Context, domains []string, owner string) (*CertificateInfo, error)
CreateCertificate generates a fresh ECDSA-P256 keypair, builds an Akash-format self-signed x509 certificate, and broadcasts MsgCreateCertificate so the chain registers the public key. Returns the cert + key PEM bytes so callers can persist them (typically to a Kubernetes Secret) for later mTLS use.
func (*AkashClient) CreateDeployment ¶
func (ak *AkashClient) CreateDeployment(ctx context.Context, req clienttypes.DeploymentCreateRequest) (clienttypes.Seqs, error)
CreateDeployment creates a new deployment with SDL content and deposit amount. The deposit denom is fixed to uact (DepositDenom) per node v2 BME.
func (*AkashClient) CreateLease ¶
func (ak *AkashClient) CreateLease(ctx context.Context, seqs clienttypes.Seqs, provider string) (string, error)
CreateLease broadcasts MsgCreateLease for the given bid (owner from client configuration, sequence numbers + provider identify the bid). Returns the transaction hash on success.
func (*AkashClient) GenerateSDLHash ¶
func (ak *AkashClient) GenerateSDLHash(sdl *types.SDL) (string, error)
GenerateSDLHash creates a deterministic hash of the SDL
func (*AkashClient) GetBid ¶
func (ak *AkashClient) GetBid(ctx context.Context, bidId string) (*clienttypes.Bid, error)
GetBid retrieves a specific bid by its bidId (format: owner-dseq-gseq-oseq-provider)
func (*AkashClient) GetBids ¶
func (ak *AkashClient) GetBids(ctx context.Context, dseq string, owner string) (clienttypes.Bids, error)
GetBids retrieves all bids on chain for the given owner+dseq. Queries the market module via chain-sdk gRPC.
func (*AkashClient) GetCertificate ¶
func (ak *AkashClient) GetCertificate(ctx context.Context, serial string, owner string) (*CertificateInfo, error)
GetCertificate fetches a certificate from chain by (owner, serial).
func (*AkashClient) GetCertificates ¶
func (ak *AkashClient) GetCertificates(ctx context.Context, owner string) ([]CertificateInfo, error)
GetCertificates lists all certificates on chain for a given owner.
func (*AkashClient) GetContext ¶
func (ak *AkashClient) GetContext() context.Context
func (*AkashClient) GetCredentials ¶
func (ak *AkashClient) GetCredentials() ([]byte, error)
GetCredentials returns the current credentials, loading from secret if needed
func (*AkashClient) GetDeployment ¶
func (ak *AkashClient) GetDeployment(ctx context.Context, dseq string, owner string) (clienttypes.Deployment, error)
GetDeployment retrieves deployment details by DSEQ and owner
func (*AkashClient) GetDeployments ¶
func (ak *AkashClient) GetDeployments(owner string) ([]clienttypes.DeploymentId, error)
func (*AkashClient) GetLease ¶
func (ak *AkashClient) GetLease(ctx context.Context, seqs clienttypes.Seqs, provider string) (string, error)
GetLease queries the chain for a single lease and returns its state string ("active" | "insufficient_funds" | "closed" | "reclaiming" | "invalid").
func (*AkashClient) GetLeaseManifest ¶
func (ak *AkashClient) GetLeaseManifest(seqs clienttypes.Seqs, provider string) (string, error)
func (*AkashClient) GetLeaseServices ¶
func (ak *AkashClient) GetLeaseServices(seqs clienttypes.Seqs, provider string) (string, error)
func (*AkashClient) GetLeases ¶
func (ak *AkashClient) GetLeases(ctx context.Context, dseq string, owner string) ([]bidv1.Lease, error)
GetLeases returns all leases on chain for the given owner+dseq. Used by the Deployment controller to derive the deployment phase (e.g., active lease implies "leased"; no leases + closed orders implies "expired").
func (*AkashClient) GetManifestStatus ¶
func (ak *AkashClient) GetManifestStatus( ctx context.Context, lease LeaseInfo, certPEM, keyPEM []byte, ) (*ManifestStatus, error)
GetManifestStatus queries the provider's lease status endpoint over mTLS.
func (*AkashClient) GetOrders ¶
func (ak *AkashClient) GetOrders(ctx context.Context, dseq string, owner string) ([]marketv1beta5.Order, error)
GetOrders returns all orders on chain for the given owner+dseq. Used by the Deployment controller to derive whether a bid window is currently open.
func (*AkashClient) GetPath ¶
func (ak *AkashClient) GetPath() string
func (*AkashClient) GetServiceStatus ¶
func (ak *AkashClient) GetServiceStatus(seqs clienttypes.Seqs, provider, serviceName string) (string, error)
func (*AkashClient) NetworkDiagnostics ¶
func (ak *AkashClient) NetworkDiagnostics(ctx context.Context) error
NetworkDiagnostics performs comprehensive network and client diagnostics
func (*AkashClient) ProviderHostURI ¶
ProviderHostURI returns the on-chain HostURI for a provider by bech32 address.
func (*AkashClient) QuickDiagnostic ¶
func (ak *AkashClient) QuickDiagnostic() error
QuickDiagnostic performs a quick diagnostic check before transactions
func (*AkashClient) RefreshCredentials ¶
func (ak *AkashClient) RefreshCredentials() error
RefreshCredentials forces a refresh of cached credentials from the secret
func (*AkashClient) RevokeCertificate ¶
RevokeCertificate broadcasts MsgRevokeCertificate for the given certificate.
func (*AkashClient) SendManifest ¶
func (*AkashClient) SendManifestToProvider ¶
func (ak *AkashClient) SendManifestToProvider( ctx context.Context, lease LeaseInfo, sdl string, certPEM, keyPEM []byte, ) (*ManifestStatus, error)
SendManifestToProvider PUTs the manifest to the provider over mTLS.
func (*AkashClient) SetCredentialCacheTTL ¶
func (ak *AkashClient) SetCredentialCacheTTL(ttl time.Duration)
SetCredentialCacheTTL sets the time-to-live for credential caching
func (*AkashClient) SetGlobalTransactionNote ¶
func (ak *AkashClient) SetGlobalTransactionNote(note string)
func (*AkashClient) UpdateDeployment ¶
UpdateDeployment updates an existing deployment with new SDL content
func (*AkashClient) UpdateManifest ¶
func (ak *AkashClient) UpdateManifest( ctx context.Context, lease LeaseInfo, sdl string, certPEM, keyPEM []byte, ) (*ManifestStatus, error)
UpdateManifest pushes a new SDL to the provider — same endpoint as create.
func (*AkashClient) ValidateCertificate ¶
func (ak *AkashClient) ValidateCertificate(certInfo *CertificateInfo, autoRenew bool, validityDays int32) (bool, error)
ValidateCertificate decides whether a certificate needs renewal under an auto-renew policy. Currently checks: expired/revoked are terminal failures; otherwise renewal is needed when within 30 days of expiry.
func (*AkashClient) ValidateManifestSDL ¶
func (ak *AkashClient) ValidateManifestSDL(sdlContent string) []ManifestError
ValidateManifestSDL parses the SDL as YAML and checks required fields.
func (*AkashClient) ValidateSDL ¶
func (ak *AkashClient) ValidateSDL(sdl *types.SDL) []string
ValidateSDL validates an SDL structure according to Akash requirements
func (*AkashClient) WaitForTransactionConfirmation ¶
func (ak *AkashClient) WaitForTransactionConfirmation(txHash string, timeoutSeconds int) error
WaitForTransactionConfirmation provides a simple wait mechanism
type CertificateInfo ¶
type CertificateInfo struct {
Serial string `json:"serial"`
Owner string `json:"owner"`
Issuer string `json:"issuer"`
Subject string `json:"subject"`
NotBefore int64 `json:"notBefore"`
NotAfter int64 `json:"notAfter"`
State string `json:"state"`
Fingerprint string `json:"fingerprint"`
// PEM is the certificate PEM block (CERTIFICATE).
PEM string `json:"pem"`
// PubkeyPEM is the public key PEM block (EC PUBLIC KEY) — what was sent
// to the chain alongside Cert.
PubkeyPEM string `json:"pubkeyPem,omitempty"`
// PrivateKeyPEM is the freshly generated private key PEM block
// (EC PRIVATE KEY). Only populated by CreateCertificate; queries from
// chain leave this empty since the chain never stores private keys.
// Controllers route this into a Kubernetes Secret for downstream
// mTLS clients (Manifest delivery, lease status, etc.).
PrivateKeyPEM string `json:"privateKeyPem,omitempty"`
CreatedAt int64 `json:"createdAt"`
ExpiresAt int64 `json:"expiresAt"`
}
CertificateInfo represents detailed certificate information from the Akash network
type EncodingConfig ¶
type EncodingConfig struct {
InterfaceRegistry types.InterfaceRegistry
Codec codec.Codec
TxConfig sdkclient.TxConfig
Amino *codec.LegacyAmino
}
EncodingConfig specifies the concrete encoding types to use for a given app.
type ManifestError ¶
type ManifestError struct {
Field string `json:"field"`
Message string `json:"message"`
Code string `json:"code"`
}
ManifestError represents a validation error from the provider
type ManifestServiceInfo ¶
type ManifestServiceInfo struct {
Name string `json:"name"`
Image string `json:"image"`
Available bool `json:"available"`
Endpoints []ServiceEndpoint `json:"endpoints"`
}
ManifestServiceInfo represents information about a service in the manifest
type ManifestStatus ¶
type ManifestStatus struct {
State string `json:"state"`
Version string `json:"version"`
DeployedAt int64 `json:"deployedAt"`
Services []ManifestServiceInfo `json:"services"`
ValidationErrors []ManifestError `json:"validationErrors"`
ProviderResponse string `json:"providerResponse"`
}
ManifestStatus represents the status of a manifest
type NodeClient ¶
type NodeClient struct {
// contains filtered or unexported fields
}
NodeClient provides Akash node client functionality
func NewNodeClient ¶
func NewNodeClient(ctx context.Context, clientCtx sdkclient.Context) *NodeClient
NewNodeClient creates a new NodeClient
func (*NodeClient) Context ¶
func (c *NodeClient) Context() sdkclient.Context
Context returns the client context
func (*NodeClient) GetContext ¶
func (c *NodeClient) GetContext() context.Context
GetContext returns the Go context
type ProviderConfigInfo ¶
type ProviderConfigInfo struct {
Source xpv1.CredentialsSource
CredentialSelectors xpv1.CommonCredentialSelectors
PassphraseSource *xpv1.CredentialsSource
PassphraseSelectors *xpv1.CommonCredentialSelectors
Configuration *apisv1alpha1.AkashConfiguration
}
ProviderConfigInfo contains the credentials and configuration information from a ProviderConfig
type QueryClient ¶
type QueryClient struct {
// contains filtered or unexported fields
}
QueryClient provides query functionality
func (*QueryClient) Auth ¶
func (q *QueryClient) Auth() authtypes.QueryClient
Auth returns the auth query client
func (*QueryClient) Bank ¶
func (q *QueryClient) Bank() banktypes.QueryClient
Bank returns the bank query client
func (*QueryClient) Cert ¶
func (q *QueryClient) Cert() certcli.QueryClient
Cert returns the certificate query client
func (*QueryClient) Deployment ¶
func (q *QueryClient) Deployment() deploymentcli.QueryClient
Deployment returns the deployment query client
func (*QueryClient) Market ¶
func (q *QueryClient) Market() marketcli.QueryClient
Market returns the market query client (orders, bids, leases)
func (*QueryClient) Provider ¶
func (q *QueryClient) Provider() providercli.QueryClient
Provider returns the provider query client
func (*QueryClient) Staking ¶
func (q *QueryClient) Staking() stakingtypes.QueryClient
Staking returns the staking query client
type SDLDocument ¶
type SDLDocument struct {
Version string `yaml:"version"`
Services map[string]Service `yaml:"services"`
Profiles *Profiles `yaml:"profiles,omitempty"`
}
SDLDocument represents the structure of an Akash SDL document
type SecretReference ¶
type ServiceEndpoint ¶
type ServiceEndpoint struct {
URI string `json:"uri"`
Port int32 `json:"port"`
Host string `json:"host"`
}
ServiceEndpoint represents an endpoint for a service
type TxClient ¶
type TxClient struct {
// contains filtered or unexported fields
}
TxClient provides transaction functionality
func (*TxClient) BroadcastMsgs ¶
func (t *TxClient) BroadcastMsgs(ctx context.Context, msgs ...sdktypes.Msg) (*sdktypes.TxResponse, error)
BroadcastMsgs broadcasts messages using the client context