utils

package
v0.0.0-...-43207eb Latest Latest
Warning

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

Go to latest
Published: Dec 6, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AssetCode

func AssetCode(asset xdr.Asset) string

func IsEmpty

func IsEmpty[T any](v T) bool

IsEmpty checks if a value is empty.

func Memo

func Memo(memo xdr.Memo, txHash string) (*string, string)

Memo returns the memo value parsed to string and its type.

func OperationID

func OperationID(ledgerNumber, txNumber, opNumber int32) string

func OperationResult

func OperationResult(txResult xdr.TransactionResult, opNumber int) *xdr.OperationResultTr

func PointOf

func PointOf[T any](value T) *T

PointOf returns a pointer to the value

func SanitizeUTF8

func SanitizeUTF8(input string) string

SanitizeUTF8 sanitizes a string to comply to the UTF-8 character set and Postgres' code zero byte constraint

func SourceAccount

func SourceAccount(op xdr.Operation, txEnvelope xdr.TransactionEnvelope) string

func TransactionID

func TransactionID(ledgerNumber, txNumber int32) string

func UnwrapInterfaceToPointer

func UnwrapInterfaceToPointer[T any](i interface{}) *T

UnwrapInterfaceToPointer unwraps an interface to a pointer of the given type.

Types

type HTTPClient

type HTTPClient interface {
	Post(url string, t string, body io.Reader) (resp *http.Response, err error)
}

type MockHTTPClient

type MockHTTPClient struct {
	mock.Mock
}

func (*MockHTTPClient) Post

func (s *MockHTTPClient) Post(url, contentType string, body io.Reader) (resp *http.Response, err error)

Jump to

Keyboard shortcuts

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