Documentation
¶
Index ¶
- Constants
- Variables
- func IsCircleCI() bool
- func MethodSig(name string) []byte
- func MultiAddr(t *testing.T, cb ServerConfigCallback, c func(s *TestServer, addr string))
- func TestInfuraEndpoint(t *testing.T) string
- type Contract
- func (c *Contract) AddConstructor(args ...string)
- func (c *Contract) AddDualCaller(funcName string, args ...string)
- func (c *Contract) AddEvent(e *Event)
- func (c *Contract) AddOutputCaller(funcName string)
- func (c *Contract) Compile() (*compiler.Artifact, error)
- func (c *Contract) EmitEvent(funcName string, name string, args ...string)
- func (c *Contract) GetEvent(name string) *Event
- func (c *Contract) Print() string
- type Event
- type ServerConfigCallback
- type TestServer
- func (t *TestServer) Account(i int) web3.Address
- func (t *TestServer) Call(msg *web3.CallMsg) (string, error)
- func (t *TestServer) Close()
- func (t *TestServer) DeployContract(c *Contract) (*compiler.Artifact, web3.Address)
- func (t *TestServer) HTTPAddr() string
- func (t *TestServer) IPCPath() string
- func (t *TestServer) ProcessBlock() error
- func (t *TestServer) SendTxn(txn *web3.Transaction) (*web3.Receipt, error)
- func (t *TestServer) Transfer(address web3.Address, value *big.Int) *web3.Receipt
- func (t *TestServer) TxnTo(address web3.Address, method string) *web3.Receipt
- func (t *TestServer) WSAddr() string
- func (t *TestServer) WaitForReceipt(hash web3.Hash) (*web3.Receipt, error)
- type TestServerConfig
Constants ¶
const ( DefaultGasPrice = 1879048192 // 0x70000000 DefaultGasLimit = 5242880 // 0x500000 )
Variables ¶
var (
DummyAddr = web3.HexToAddress("0x015f68893a39b3ba0681584387670ff8b00f4db2")
)
Functions ¶
func MultiAddr ¶
func MultiAddr(t *testing.T, cb ServerConfigCallback, c func(s *TestServer, addr string))
MultiAddr creates new servers to test different addresses
func TestInfuraEndpoint ¶
TestInfuraEndpoint returns the testing infura endpoint to make testing requests
Types ¶
type Contract ¶
type Contract struct {
// contains filtered or unexported fields
}
Contract is a test contract
func (*Contract) AddConstructor ¶
AddConstructor creates a constructor with args that set contract variables
func (*Contract) AddDualCaller ¶
AddDualCaller adds a call function that returns the same values that takes
func (*Contract) AddOutputCaller ¶
AddOutputCaller adsd a view function that does not take any input
type Event ¶
type Event struct {
// contains filtered or unexported fields
}
Event is a test event
type ServerConfigCallback ¶
type ServerConfigCallback func(c *TestServerConfig)
ServerConfigCallback is the callback to modify the config
type TestServer ¶
type TestServer struct {
// contains filtered or unexported fields
}
TestServer is a Geth test server
func NewTestServer ¶
func NewTestServer(t *testing.T, cb ServerConfigCallback) *TestServer
NewTestServer creates a new Geth test server
func (*TestServer) Account ¶
func (t *TestServer) Account(i int) web3.Address
Account returns a specific account
func (*TestServer) Call ¶
func (t *TestServer) Call(msg *web3.CallMsg) (string, error)
Call sends a contract call
func (*TestServer) DeployContract ¶
func (t *TestServer) DeployContract(c *Contract) (*compiler.Artifact, web3.Address)
DeployContract deploys a contract with account 0 and returns the address
func (*TestServer) HTTPAddr ¶
func (t *TestServer) HTTPAddr() string
HTTPAddr returns the http endpoint
func (*TestServer) ProcessBlock ¶
func (t *TestServer) ProcessBlock() error
ProcessBlock processes a new block
func (*TestServer) SendTxn ¶
func (t *TestServer) SendTxn(txn *web3.Transaction) (*web3.Receipt, error)
SendTxn sends a transaction
func (*TestServer) Transfer ¶
func (t *TestServer) Transfer(address web3.Address, value *big.Int) *web3.Receipt
func (*TestServer) TxnTo ¶
func (t *TestServer) TxnTo(address web3.Address, method string) *web3.Receipt
TxnTo sends a transaction to a given method without any arguments
func (*TestServer) WSAddr ¶
func (t *TestServer) WSAddr() string
WSAddr returns the websocket endpoint
func (*TestServer) WaitForReceipt ¶
func (t *TestServer) WaitForReceipt(hash web3.Hash) (*web3.Receipt, error)
WaitForReceipt waits for the receipt
type TestServerConfig ¶
TestServerConfig is the configuration of the server