utils

package
v0.0.0-...-56335b4 Latest Latest
Warning

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

Go to latest
Published: Jul 18, 2025 License: Apache-2.0, Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddLPOperations

func AddLPOperations(txMeta []xdr.OperationMeta, AssetA, AssetB xdr.Asset) []xdr.OperationMeta

func ConvertStroopValueToReal

func ConvertStroopValueToReal(input xdr.Int64) float64

ConvertStroopValueToReal converts a value in stroops, the smallest amount unit, into real units

func CreateSampleResultMeta

func CreateSampleResultMeta(successful bool, subOperationCount int) xdr.TransactionResultMeta

CreateSampleResultMeta creates Transaction results with the desired success flag and number of sub operation results

func CreateSampleTx

func CreateSampleTx(sequence int64, operationCount int) xdr.TransactionEnvelope

func CreateSampleTxMeta

func CreateSampleTxMeta(subOperationCount int, AssetA, AssetB xdr.Asset) *xdr.TransactionMetaV1

func ExtractEntryFromChange

func ExtractEntryFromChange(change ingest.Change) (xdr.LedgerEntry, xdr.LedgerEntryChangeType, bool, error)

ExtractEntryFromChange gets the most recent state of an entry from an ingestion change, as well as if the entry was deleted

func ExtractLedgerCloseTime

func ExtractLedgerCloseTime(ledger xdr.LedgerHeaderHistoryEntry) (time.Time, error)

ExtractLedgerCloseTime gets the close time of the provided ledger

func FarmHashAsset

func FarmHashAsset(assetCode, assetIssuer, assetType string) int64

func GetAccountAddressFromMuxedAccount

func GetAccountAddressFromMuxedAccount(account xdr.MuxedAccount) (string, error)

GetAccountAddressFromMuxedAccount takes in a muxed account and returns the address of the account

func GetCloseTime

func GetCloseTime(lcm xdr.LedgerCloseMeta) (time.Time, error)

func GetLedgerSequence

func GetLedgerSequence(lcm xdr.LedgerCloseMeta) uint32

func HashToHexString

func HashToHexString(inputHash xdr.Hash) string

HashToHexString is utility function that converts and xdr.Hash type to a hex string

func LedgerEntrySponsorToNullString

func LedgerEntrySponsorToNullString(entry xdr.LedgerEntry) null.String

func LedgerEntryToLedgerKeyHash

func LedgerEntryToLedgerKeyHash(ledgerEntry xdr.LedgerEntry) string

func LedgerKeyToLedgerKeyHash

func LedgerKeyToLedgerKeyHash(ledgerKey xdr.LedgerKey) string

func PanicOnError

func PanicOnError(err error)

PanicOnError is a function that panics if the provided error is not nil

func TimePointToUTCTimeStamp

func TimePointToUTCTimeStamp(providedTime xdr.TimePoint) (time.Time, error)

TimePointToUTCTimeStamp takes in an xdr TimePoint and converts it to a time.Time struct in UTC. It returns an error for negative timepoints

Types

type Claimant

type Claimant struct {
	Destination string             `json:"destination"`
	Predicate   xdr.ClaimPredicate `json:"predicate"`
}

Claimants

type HistoryArchiveLedgerAndLCM

type HistoryArchiveLedgerAndLCM struct {
	Ledger historyarchive.Ledger
	LCM    xdr.LedgerCloseMeta
}

type Path

type Path struct {
	AssetCode   string `json:"asset_code"`
	AssetIssuer string `json:"asset_issuer"`
	AssetType   string `json:"asset_type"`
}

Path is a representation of an asset without an ID that forms part of a path in a path payment

type Price

type Price struct {
	Numerator   int32 `json:"n"`
	Denominator int32 `json:"d"`
}

Price represents the price of an asset as a fraction

type SponsorshipOutput

type SponsorshipOutput struct {
	Operation      xdr.Operation
	OperationIndex uint32
}

type TestTransaction

type TestTransaction struct {
	Index         uint32
	EnvelopeXDR   string
	ResultXDR     string
	FeeChangesXDR string
	MetaXDR       string
	Hash          string
}

TestTransaction transaction meta

Jump to

Keyboard shortcuts

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