testutil

package
v0.0.0-...-2e7cf47 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: Apache-2.0, MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FromHex

func FromHex(s string) []byte

func FromTimeStamp

func FromTimeStamp(ts string) time.Time

func HumanToBlockchain

func HumanToBlockchain(amount string, decimals int) xc.AmountBlockchain

func JsonPrint

func JsonPrint(a any)

func Ref

func Ref[T any](s T) *T

func Reserialize

func Reserialize[T any](val *T) *T

reserialize will drop internal fields set by constructors

func TxInfoEqual

func TxInfoEqual(t *testing.T, expected, actual txinfo.TxInfo)

Produces more readable diffs when comparing TxInfo in unit tests

Types

type MockHTTPServer

type MockHTTPServer struct {
	*httptest.Server

	Counter     int
	Response    interface{}
	StatusCodes []int
	// contains filtered or unexported fields
}

MockHTTPServer is a mocked HTTP server

func MockHTTP

func MockHTTP(t *testing.T, response interface{}, status int) (mock *MockHTTPServer, close func())

MockHTTP creates a new MockHTTPServer given a response, or array of responses

type MockJSONRPCServer

type MockJSONRPCServer struct {
	*httptest.Server

	Counter    int
	ForceError int
	Response   interface{}
	// contains filtered or unexported fields
}

MockJSONRPCServer is a mocked RPC server

func MockJSONRPC

func MockJSONRPC(t *testing.T, response interface{}) (mock *MockJSONRPCServer, close func())

MockJSONRPC creates a new MockJSONRPCServer given a response, or array of responses

type MockXcTx

type MockXcTx struct {
	SerializedSignedTx []byte
	Signatures         []xc.TxSignature
}

An object that only supports .Serialize for SubmitTx()

func (*MockXcTx) Hash

func (tx *MockXcTx) Hash() xc.TxHash

func (*MockXcTx) Serialize

func (tx *MockXcTx) Serialize() ([]byte, error)

func (*MockXcTx) SetSignatures

func (tx *MockXcTx) SetSignatures(...*xc.SignatureResponse) error

func (*MockXcTx) Sighashes

func (tx *MockXcTx) Sighashes() ([]*xc.SignatureRequest, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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