testutils

package
v0.0.0-...-05bc493 Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: MIT, Apache-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	WalletCreatePath     = walletPath + "/create"
	WalletGetBalancePath = walletPath + "/get_balance"
	WalletAddAmountPath  = walletPath + "/add_amount"
	WalletTransferPath   = walletPath + "/transfer"
	WalletDeletePath     = walletPath + "/delete"
)
View Source
const StartBalance uint = 1000000000 // nolint:unused,deadcode,varcheck

Variables

This section is empty.

Functions

func AddAmountToWallet

func AddAmountToWallet(ctx context.Context, url, ref string, amount uint) error

Adds amount to wallet.

func CreateSimpleWallet

func CreateSimpleWallet(ctx context.Context) (string, error)

Creates wallet and returns it's reference.

func GetPorts

func GetPorts() []string

func GetURL

func GetURL(path, host, port string) string

Creates full URL for http request.

func GetWalletBalance

func GetWalletBalance(ctx context.Context, url, ref string) (uint, error)

Returns wallet balance.

func ResetHTTPClient

func ResetHTTPClient()

func SendAPIRequest

func SendAPIRequest(ctx context.Context, url string, body interface{}) ([]byte, error)

func SetAPIPorts

func SetAPIPorts(ports []string)

SetAPIPorts is not thread safe, it is supposed to be called before bench run, right after launchnet is configured

func SetAPIPortsByAddresses

func SetAPIPortsByAddresses(apiAddresses []string)

SetAPIPortsByAddresses is not thread safe, it is supposed to be called before bench run, right after launchnet is configured

Types

type WalletAddAmountRequestBody

type WalletAddAmountRequestBody struct {
	To     string `json:"to"`
	Amount uint   `json:"amount"`
}

nolint:unused,deadcode

type WalletAddAmountResponse

type WalletAddAmountResponse struct {
	Err     string `json:"error"`
	TraceID string `json:"traceID"`
}

nolint:unused

func UnmarshalWalletAddAmountResponse

func UnmarshalWalletAddAmountResponse(resp []byte) (WalletAddAmountResponse, error)

type WalletCreateResponse

type WalletCreateResponse struct {
	Err     string `json:"error"`
	Ref     string `json:"reference"`
	TraceID string `json:"traceID"`
}

nolint:unused

func UnmarshalWalletCreateResponse

func UnmarshalWalletCreateResponse(resp []byte) (WalletCreateResponse, error)

type WalletDeleteRequestBody

type WalletDeleteRequestBody struct {
	Ref string `json:"walletRef"`
}

nolint:unused,deadcode

type WalletDeleteResponse

type WalletDeleteResponse struct {
	Err     string `json:"error"`
	TraceID string `json:"traceID"`
}

nolint:unused,deadcode

func UnmarshalWalletDeleteResponse

func UnmarshalWalletDeleteResponse(resp []byte) (WalletDeleteResponse, error)

type WalletGetBalanceRequestBody

type WalletGetBalanceRequestBody struct {
	Ref string `json:"walletRef"`
}

nolint:unused,deadcode

type WalletGetBalanceResponse

type WalletGetBalanceResponse struct {
	Err     string `json:"error"`
	Amount  uint   `json:"amount"`
	TraceID string `json:"traceID"`
}

nolint:unused,deadcode

func UnmarshalWalletGetBalanceResponse

func UnmarshalWalletGetBalanceResponse(resp []byte) (WalletGetBalanceResponse, error)

type WalletTransferRequestBody

type WalletTransferRequestBody struct {
	To     string `json:"to"`
	From   string `json:"from"`
	Amount uint   `json:"amount"`
}

nolint:unused,deadcode

type WalletTransferResponse

type WalletTransferResponse struct {
	Err     string `json:"error"`
	TraceID string `json:"traceID"`
}

nolint:unused

func UnmarshalWalletTransferResponse

func UnmarshalWalletTransferResponse(resp []byte) (WalletTransferResponse, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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