framework

package
v1.4.0 Latest Latest
Warning

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

Go to latest
Published: Feb 6, 2026 License: GPL-3.0 Imports: 37 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateChainSimulatorWrapper

func CreateChainSimulatorWrapper(args ArgChainSimulatorWrapper) *chainSimulatorWrapper

CreateChainSimulatorWrapper creates a new instance of the chain simulator wrapper

func EnsureTestContracts

func EnsureTestContracts(tb testing.TB)

EnsureTestContracts test if the contracts are present in the project, if not, download them

func GetContractPath

func GetContractPath(contractName string) string

GetContractPath returns the absolute path to the wasm file

func GetProxyRootPath

func GetProxyRootPath(templateFile string) string

GetProxyRootPath returns the absolute path to the proxy service root path

func IsChainSimulatorIsRunning

func IsChainSimulatorIsRunning() bool

IsChainSimulatorIsRunning returns true if the chain simulator is running at the defined adrress

func NewTestSession

func NewTestSession(
	proxyService ProxyComponentsHandler,
	username string,
	password string,
) *testSession

NewTestSession creates a new test session

Types

type ArgChainSimulatorWrapper

type ArgChainSimulatorWrapper struct {
	TB                           testing.TB
	ProxyCacherExpirationSeconds uint64
	ProxyMaxNoncesDelta          int
}

ArgChainSimulatorWrapper is the DTO used to create a new instance of proxy that relies on a chain simulator

type CryptoPaymentComponentsHandler

type CryptoPaymentComponentsHandler interface {
	StartCronJobs(ctx context.Context)
	GetSQLiteWrapper() factory.SQLiteWrapper
	GetBalanceProcessor() factory.BalanceProcessor
	GetContractHandler() process.ContractHandler
	GetHTTPServer() factory.HTTPServer
	Close()
}

CryptoPaymentComponentsHandler defines the operations supported by a component able to manage multiple components

type ESDTSupply

type ESDTSupply struct {
	Supply string `json:"supply"`
	Minted string `json:"minted"`
	Burned string `json:"burned"`
}

ESDTSupply represents the DTO that holds the supply values for a token

type MockCaptchaWrapper

type MockCaptchaWrapper struct {
	// contains filtered or unexported fields
}

func (*MockCaptchaWrapper) IsInterfaceNil

func (wrapper *MockCaptchaWrapper) IsInterfaceNil() bool

IsInterfaceNil -

func (*MockCaptchaWrapper) NewCaptcha

func (wrapper *MockCaptchaWrapper) NewCaptcha() string

NewCaptcha returns the current id as a string. Then it increments the id

func (*MockCaptchaWrapper) Reload

func (wrapper *MockCaptchaWrapper) Reload(_ string)

Reload does nothing

func (*MockCaptchaWrapper) VerifyString

func (wrapper *MockCaptchaWrapper) VerifyString(id string, digits string) bool

VerifyString returns true iof the id == digits

func (*MockCaptchaWrapper) WriteNoError

func (wrapper *MockCaptchaWrapper) WriteNoError(w io.Writer, id string)

WriteNoError writes the id to the writer

type MockEmailSender

type MockEmailSender struct {
	LastTo   string
	LastBody any
}

MockEmailSender -

func (*MockEmailSender) IsInterfaceNil

func (m *MockEmailSender) IsInterfaceNil() bool

IsInterfaceNil -

func (*MockEmailSender) SendEmail

func (m *MockEmailSender) SendEmail(to string, _ string, body any, _ string) error

SendEmail -

type Proxy

type Proxy interface {
	GetNetworkConfig(ctx context.Context) (*data.NetworkConfig, error)
	SendTransaction(ctx context.Context, tx *transaction.FrontendTransaction) (string, error)
	SendTransactions(ctx context.Context, txs []*transaction.FrontendTransaction) ([]string, error)
	ExecuteVMQuery(ctx context.Context, vmRequest *data.VmValueRequest) (*data.VmValuesResponseData, error)
	GetAccount(ctx context.Context, address core.AddressHandler) (*data.Account, error)
	GetNetworkStatus(ctx context.Context, shardID uint32) (*data.NetworkStatus, error)
	GetShardOfAddress(ctx context.Context, bech32Address string) (uint32, error)
	GetESDTTokenData(ctx context.Context, address core.AddressHandler, tokenIdentifier string, queryOptions api.AccountQueryOptions) (*data.ESDTFungibleTokenData, error)
	GetTransactionInfoWithResults(ctx context.Context, hash string) (*data.TransactionInfo, error)
	ProcessTransactionStatus(ctx context.Context, hexTxHash string) (transaction.TxStatus, error)
	IsInterfaceNil() bool
}

Proxy defines the behavior of a proxy able to serve MultiversX blockchain requests

type ProxyComponentsHandler

type ProxyComponentsHandler interface {
	StartCronJobs(ctx context.Context)
	GetSQLiteWrapper() proxyApi.KeyAccessProvider
	GetAPIEngine() proxyFactory.APIEngine
	Close()
}

ProxyComponentsHandler defines the operations supported by a component able to manage multiple components

type ProxyService

type ProxyService struct {
	testing.TB
	ChainSimulator *chainSimulatorWrapper

	Components  ProxyComponentsHandler
	EmailSender *MockEmailSender
}

ProxyService will hold all elements used by the proxy service

func NewProxyService

func NewProxyService(tb testing.TB) *ProxyService

NewProxyService creates a new ProxyService instance

func (*ProxyService) CreateService

func (ps *ProxyService) CreateService(cryptoPaymentURL string)

CreateService will assemble all the service processing components

func (*ProxyService) Setup

func (ps *ProxyService) Setup(_ context.Context)

Setup prepares the environment

func (*ProxyService) TearDown

func (ps *ProxyService) TearDown()

TearDown cleans up the test environment

Jump to

Keyboard shortcuts

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