test_utils

package
v0.0.0-...-eb19a62 Latest Latest
Warning

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

Go to latest
Published: May 16, 2024 License: GPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const EnvEthereumRpcUrl = `FLU_ETHEREUM_RPC_URL`

Variables

This section is empty.

Functions

func MockRpcClient

func MockRpcClient(rpcMethods_ map[string]interface{}, callMethods_ map[string]map[string]interface{}) (*ethclient.Client, error)

MockRpcClient to return an eth client connected to an endpoint that mocks the given methods. rpcMethods [methodName]response to provide a list of Ethereum RPC methods and how they should be mocked. callMethods[methodName]response to provide a list of eth_call contract methods and how they should respond.

Types

type TestStructure

type TestStructure struct {
	Transfer struct {
		Transaction ethTypes.Hash `json:"transaction"`
		Log         struct {
			Data    string           `json:"data"`
			Address ethTypes.Address `json:"address"`
			Topics  []ethTypes.Hash  `json:"topics"`
		} `json:"log"`
		Application int `json:"application"`
	} `json:"transfer"`
	Transaction struct {
		To   ethTypes.Address `json:"to"`
		From ethTypes.Address `json:"from"`
		Hash ethTypes.Hash    `json:"hash"`
	} `json:"transaction"`
	ExpectedSender    string `json:"expected_sender"`
	ExpectedRecipient string `json:"expected_recipient"`
	ExpectedFees      string `json:"expected_fees"`
	TokenDecimals     int    `json:"token_decimals"`
	ContractAddress   string `json:"contract_address"`
}

Jump to

Keyboard shortcuts

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