hcnetcore

package
v1.11.1 Latest Latest
Warning

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

Go to latest
Published: Jun 10, 2024 License: Apache-2.0, Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// LiveState represents the state value returned by hcnet-core when a
	// ledger entry is live
	LiveState = "live"

	// DeadState represents the state value returned by hcnet-core when a
	// ledger entry is dead
	DeadState = "dead"
)
View Source
const (
	// PreflightStatusError represents the status value returned by hcnet-core when an error occurred from
	// processing a preflight request
	PreflightStatusError = "ERROR"

	// PreflightStatusOk represents the status value returned by hcnet-core when a preflight request
	// succeeded
	PreflightStatusOk = "OK"
)
View Source
const (
	// TXStatusError represents the status value returned by hcnet-core when an error occurred from
	// submitting a transaction
	TXStatusError = "ERROR"

	// TXStatusPending represents the status value returned by hcnet-core when a transaction has
	// been accepted for processing
	TXStatusPending = "PENDING"

	// TXStatusDuplicate represents the status value returned by hcnet-core when a submitted
	// transaction is a duplicate
	TXStatusDuplicate = "DUPLICATE"

	// TXStatusTryAgainLater represents the status value returned by hcnet-core when a submitted
	// transaction was not included in the previous 4 ledgers and get banned for being added in the
	// next few ledgers.
	TXStatusTryAgainLater = "TRY_AGAIN_LATER"
)

Variables

This section is empty.

Functions

func DecodeDiagnosticEvents added in v1.11.1

func DecodeDiagnosticEvents(events string) ([]xdr.DiagnosticEvent, error)

DecodeDiagnosticEvents returns the decoded events

func DiagnosticEventsToSlice added in v1.11.1

func DiagnosticEventsToSlice(events string) ([]string, error)

DiagnosticEventsToSlice transforms the base64 diagnostic events into a slice of individual base64-encoded diagnostic events

Types

type GetLedgerEntryResponse added in v1.11.1

type GetLedgerEntryResponse struct {
	State  string `json:"state"`
	Entry  string `json:"entry"`
	Ledger int64  `json:"ledger"`
}

GetLedgerEntryResponse is the response from Hcnet Core for the getLedgerEntry endpoint

type InfoResponse

type InfoResponse struct {
	Info struct {
		Build           string     `json:"build"`
		Network         string     `json:"network"`
		ProtocolVersion int        `json:"protocol_version"`
		State           string     `json:"state"`
		Ledger          LedgerInfo `json:"ledger"`
	}
}

InfoResponse is the json response returned from hcnet-core's /info endpoint.

func (*InfoResponse) IsSynced

func (resp *InfoResponse) IsSynced() bool

IsSynced returns a boolean indicating whether hcnetcore is synced with the network.

type LedgerInfo

type LedgerInfo struct {
	Age          int    `json:"age"`
	BaseFee      int    `json:"baseFee"`
	BaseReserve  int    `json:"baseReserve"`
	CloseTime    int    `json:"closeTime"`
	Hash         string `json:"hash"`
	MaxTxSetSize int    `json:"maxTxSetSize"`
	Num          int    `json:"num"`
	Version      int    `json:"version"`
}

LedgerInfo is the part of the hcnet-core's info json response. It's returned under `ledger` key

type PreflightResponse added in v1.11.1

type PreflightResponse struct {
	Status          string `json:"status"`
	Detail          string `json:"detail"`
	Result          string `json:"result"`
	Footprint       string `json:"footprint"`
	CPUInstructions uint64 `json:"cpu_insns"`
	MemoryBytes     uint64 `json:"mem_bytes"`
	Ledger          int64  `json:"ledger"`
}

PreflightResponse is the response from Hcnet Core for the preflight endpoint

type TXResponse

type TXResponse struct {
	Exception string `json:"exception"`
	Error     string `json:"error"`
	Status    string `json:"status"`
	// DiagnosticEvents is an optional base64-encoded XDR Variable-Length Array of DiagnosticEvents
	DiagnosticEvents string `json:"diagnostic_events,omitempty"`
}

TXResponse represents the response returned from a submission request sent to hcnet-core's /tx endpoint

func (*TXResponse) IsException

func (resp *TXResponse) IsException() bool

IsException returns true if the response represents an exception response from hcnet-core

Jump to

Keyboard shortcuts

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