testutil

package
v0.0.0-...-fa9a987 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: Apache-2.0, MIT Imports: 12 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 Reserialize

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

reserialize will drop internal fields set by constructors

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
	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) AddSignatures

func (tx *MockXcTx) AddSignatures(...xc.TxSignature) error

func (*MockXcTx) GetSignatures

func (tx *MockXcTx) GetSignatures() []xc.TxSignature

func (*MockXcTx) Hash

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

func (*MockXcTx) Serialize

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

func (*MockXcTx) Sighashes

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

Jump to

Keyboard shortcuts

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