common

package
v0.0.0-...-953790c Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2018 License: MPL-2.0 Imports: 28 Imported by: 0

Documentation

Overview

Package common is a generated GoMock package.

Package common is a generated GoMock package.

Index

Constants

View Source
const (
	// MessageIDKey is a key for message ID
	// This ID is required to track from which chat a given send transaction request is coming.
	MessageIDKey = contextKey("message_id")
)

Variables

View Source
var (
	ErrInvalidFromAddress = errors.New("Failed to parse From Address")
	ErrInvalidToAddress   = errors.New("Failed to parse To Address")
)

contains series of errors for parsing operations.

View Source
var (
	ErrDeprecatedMethod = errors.New("Method is depricated and will be removed in future release")
)

errors

View Source
var (
	ErrInvalidAccountAddressOrKey = errors.New("cannot parse address or key to valid account address")
)

errors

Functions

func Fatalf

func Fatalf(reason interface{}, args ...interface{})

Fatalf is used to halt the execution. When called the function prints stack end exits. Failure is logged into both StdErr and StdOut.

func FromAddress

func FromAddress(accountAddress string) common.Address

FromAddress converts account address from string to common.Address. The function is useful to format "From" field of send transaction struct.

func ImportTestAccount

func ImportTestAccount(keystoreDir, accountFile string) error

ImportTestAccount imports keystore from static resources, see "static/keys" folder

func MessageIDFromContext

func MessageIDFromContext(ctx context.Context) string

MessageIDFromContext returns message id from context (if exists)

func NameOf

func NameOf(f interface{}) string

NameOf returns name of caller, at runtime

func PanicAfter

func PanicAfter(waitSeconds time.Duration, abort chan struct{}, desc string)

PanicAfter throws panic() after waitSeconds, unless abort channel receives notification

func ParseAccountString

func ParseAccountString(account string) (accounts.Account, error)

ParseAccountString parses hex encoded string and returns is as accounts.Account.

func ParseJSONArray

func ParseJSONArray(items string) ([]string, error)

ParseJSONArray parses JSON array into Go array of string

func ToAddress

func ToAddress(accountAddress string) *common.Address

ToAddress converts account address from string to *common.Address. The function is useful to format "To" field of send transaction struct.

Types

type APIDetailedResponse

type APIDetailedResponse struct {
	Status      bool            `json:"status"`
	Message     string          `json:"message,omitempty"`
	FieldErrors []APIFieldError `json:"field_errors,omitempty"`
}

APIDetailedResponse represents a generic response with possible errors.

func (APIDetailedResponse) Error

func (r APIDetailedResponse) Error() string

type APIError

type APIError struct {
	Message string `json:"message"`
}

APIError represents a single error.

func (APIError) Error

func (e APIError) Error() string

type APIFieldError

type APIFieldError struct {
	Parameter string     `json:"parameter,omitempty"`
	Errors    []APIError `json:"errors"`
}

APIFieldError represents a set of errors related to a parameter.

func (APIFieldError) Error

func (e APIFieldError) Error() string

type APIResponse

type APIResponse struct {
	Error string `json:"error"`
}

APIResponse generic response from API

type AccountInfo

type AccountInfo struct {
	Address  string `json:"address"`
	PubKey   string `json:"pubkey"`
	Mnemonic string `json:"mnemonic"`
	Error    string `json:"error"`
}

AccountInfo represents account's info

type AccountManager

type AccountManager interface {
	// CreateAccount creates an internal geth account
	// BIP44-compatible keys are generated: CKD#1 is stored as account key, CKD#2 stored as sub-account root
	// Public key of CKD#1 is returned, with CKD#2 securely encoded into account key file (to be used for
	// sub-account derivations)
	CreateAccount(password string) (address, pubKey, mnemonic string, err error)

	// CreateChildAccount creates sub-account for an account identified by parent address.
	// CKD#2 is used as root for master accounts (when parentAddress is "").
	// Otherwise (when parentAddress != ""), child is derived directly from parent.
	CreateChildAccount(parentAddress, password string) (address, pubKey string, err error)

	// RecoverAccount re-creates master key using given details.
	// Once master key is re-generated, it is inserted into keystore (if not already there).
	RecoverAccount(password, mnemonic string) (address, pubKey string, err error)

	// VerifyAccountPassword tries to decrypt a given account key file, with a provided password.
	// If no error is returned, then account is considered verified.
	VerifyAccountPassword(keyStoreDir, address, password string) (*keystore.Key, error)

	// SelectAccount selects current account, by verifying that address has corresponding account which can be decrypted
	// using provided password. Once verification is done, decrypted key is injected into Whisper (as a single identity,
	// all previous identities are removed).
	SelectAccount(address, password string) error

	// ReSelectAccount selects previously selected account, often, after node restart.
	ReSelectAccount() error

	// SelectedAccount returns currently selected account
	SelectedAccount() (*SelectedExtKey, error)

	// Logout clears whisper identities
	Logout() error

	// Accounts returns handler to process account list request
	Accounts() ([]common.Address, error)

	// AccountsRPCHandler returns RPC wrapper for Accounts()
	AccountsRPCHandler() rpc.Handler

	// AddressToDecryptedAccount tries to load decrypted key for a given account.
	// The running node, has a keystore directory which is loaded on start. Key file
	// for a given address is expected to be in that directory prior to node start.
	AddressToDecryptedAccount(address, password string) (accounts.Account, *keystore.Key, error)
}

AccountManager defines expected methods for managing Status accounts

type CompleteTransactionResult

type CompleteTransactionResult struct {
	ID    string `json:"id"`
	Hash  string `json:"hash"`
	Error string `json:"error"`
}

CompleteTransactionResult is a JSON returned from transaction complete function (used in exposed method)

type CompleteTransactionsResult

type CompleteTransactionsResult struct {
	Results map[string]CompleteTransactionResult `json:"results"`
}

CompleteTransactionsResult is list of results from CompleteTransactions() (used in exposed method)

type DiscardTransactionResult

type DiscardTransactionResult struct {
	ID    string `json:"id"`
	Error string `json:"error"`
}

DiscardTransactionResult is a JSON returned from transaction discard function

type DiscardTransactionsResult

type DiscardTransactionsResult struct {
	Results map[string]DiscardTransactionResult `json:"results"`
}

DiscardTransactionsResult is a list of results from DiscardTransactions()

type EnqueuedTxHandler

type EnqueuedTxHandler func(*QueuedTx)

EnqueuedTxHandler is a function that receives queued/pending transactions, when they get queued

type EnqueuedTxReturnHandler

type EnqueuedTxReturnHandler func(*QueuedTx, error)

EnqueuedTxReturnHandler is a function that receives response when tx is complete (both on success and error)

type JailCell

type JailCell interface {
	// Set a value inside VM.
	Set(string, interface{}) error
	// Get a value from VM.
	Get(string) (otto.Value, error)
	// Run an arbitrary JS code. Input maybe string or otto.Script.
	Run(interface{}) (otto.Value, error)
	// Call an arbitrary JS function by name and args.
	Call(item string, this interface{}, args ...interface{}) (otto.Value, error)
	// Stop stops background execution of cell.
	Stop() error
}

JailCell represents single jail cell, which is basically a JavaScript VM. It's designed to be a transparent wrapper around otto.VM's methods.

type JailManager

type JailManager interface {
	// Call executes given JavaScript function w/i a jail cell context identified by the chatID.
	Call(chatID, this, args string) string

	// CreateCell creates a new jail cell.
	CreateCell(chatID string) (JailCell, error)

	// Parse creates a new jail cell context, with the given chatID as identifier.
	// New context executes provided JavaScript code, right after the initialization.
	// DEPRECATED in favour of CreateAndInitCell.
	Parse(chatID, js string) string

	// CreateAndInitCell creates a new jail cell and initialize it
	// with web3 and other handlers.
	CreateAndInitCell(chatID string, code ...string) string

	// Cell returns an existing instance of JailCell.
	Cell(chatID string) (JailCell, error)

	// Execute allows to run arbitrary JS code within a cell.
	Execute(chatID, code string) string

	// SetBaseJS allows to setup initial JavaScript to be loaded on each jail.CreateAndInitCell().
	SetBaseJS(js string)

	// Stop stops all background activity of jail
	Stop()
}

JailManager defines methods for managing jailed environments

type MessageState

type MessageState struct {
	// Type defines Direction type: IncomingMessage or OutgoingMessage.
	Type string `json:"type"`
	// Protocol defines means of transmission in whisper: RPC or P2P.
	Protocol string `json:"protocol"`
	// Status defines current status of message: Pending, Delivered, Rejected, etc.
	Status string `json:"status"`
	// Envelope struct holding encrypted message.
	Envelope []byte `json:"envelope"`
	// Time in of sent time of message.
	TimeSent uint32 `json:"time,omitempty"`
	// Received defines time when delivery notification was received
	Received time.Time `json:"received"`
	// Payload associated with envelope.
	Payload []byte `json:"payload,omitempty"`
	// Hash defines the Envelope's hash
	Hash string `json:"envelope_hash"`
	// FromDevice defines the device sending message if value is extractable.
	FromDevice string `json:"from_device,omitempty"`
	// ToDevice defines the receiving message if value is extractable.
	ToDevice string `json:"to_device,omitempty"`
	// RejectionError defines the error message when message ending with a Rejected status.
	RejectionError string `json:"rejection_reason,omitempty"`
	// Source of message when type is Outgoing which contains raw rpc data.
	Source whisper.NewMessage `json:"source,omitempty"`
}

MessageState defines a struct to hold given facts about a message stat.

type MockAccountManager

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

MockAccountManager is a mock of AccountManager interface

func NewMockAccountManager

func NewMockAccountManager(ctrl *gomock.Controller) *MockAccountManager

NewMockAccountManager creates a new mock instance

func (*MockAccountManager) Accounts

func (m *MockAccountManager) Accounts() ([]common.Address, error)

Accounts mocks base method

func (*MockAccountManager) AccountsRPCHandler

func (m *MockAccountManager) AccountsRPCHandler() rpc.Handler

AccountsRPCHandler mocks base method

func (*MockAccountManager) AddressToDecryptedAccount

func (m *MockAccountManager) AddressToDecryptedAccount(address, password string) (accounts.Account, *keystore.Key, error)

AddressToDecryptedAccount mocks base method

func (*MockAccountManager) CreateAccount

func (m *MockAccountManager) CreateAccount(password string) (string, string, string, error)

CreateAccount mocks base method

func (*MockAccountManager) CreateChildAccount

func (m *MockAccountManager) CreateChildAccount(parentAddress, password string) (string, string, error)

CreateChildAccount mocks base method

func (*MockAccountManager) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockAccountManager) Logout

func (m *MockAccountManager) Logout() error

Logout mocks base method

func (*MockAccountManager) ReSelectAccount

func (m *MockAccountManager) ReSelectAccount() error

ReSelectAccount mocks base method

func (*MockAccountManager) RecoverAccount

func (m *MockAccountManager) RecoverAccount(password, mnemonic string) (string, string, error)

RecoverAccount mocks base method

func (*MockAccountManager) SelectAccount

func (m *MockAccountManager) SelectAccount(address, password string) error

SelectAccount mocks base method

func (*MockAccountManager) SelectedAccount

func (m *MockAccountManager) SelectedAccount() (*SelectedExtKey, error)

SelectedAccount mocks base method

func (*MockAccountManager) VerifyAccountPassword

func (m *MockAccountManager) VerifyAccountPassword(keyStoreDir, address, password string) (*keystore.Key, error)

VerifyAccountPassword mocks base method

type MockAccountManagerMockRecorder

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

MockAccountManagerMockRecorder is the mock recorder for MockAccountManager

func (*MockAccountManagerMockRecorder) Accounts

func (mr *MockAccountManagerMockRecorder) Accounts() *gomock.Call

Accounts indicates an expected call of Accounts

func (*MockAccountManagerMockRecorder) AccountsRPCHandler

func (mr *MockAccountManagerMockRecorder) AccountsRPCHandler() *gomock.Call

AccountsRPCHandler indicates an expected call of AccountsRPCHandler

func (*MockAccountManagerMockRecorder) AddressToDecryptedAccount

func (mr *MockAccountManagerMockRecorder) AddressToDecryptedAccount(address, password interface{}) *gomock.Call

AddressToDecryptedAccount indicates an expected call of AddressToDecryptedAccount

func (*MockAccountManagerMockRecorder) CreateAccount

func (mr *MockAccountManagerMockRecorder) CreateAccount(password interface{}) *gomock.Call

CreateAccount indicates an expected call of CreateAccount

func (*MockAccountManagerMockRecorder) CreateChildAccount

func (mr *MockAccountManagerMockRecorder) CreateChildAccount(parentAddress, password interface{}) *gomock.Call

CreateChildAccount indicates an expected call of CreateChildAccount

func (*MockAccountManagerMockRecorder) Logout

Logout indicates an expected call of Logout

func (*MockAccountManagerMockRecorder) ReSelectAccount

func (mr *MockAccountManagerMockRecorder) ReSelectAccount() *gomock.Call

ReSelectAccount indicates an expected call of ReSelectAccount

func (*MockAccountManagerMockRecorder) RecoverAccount

func (mr *MockAccountManagerMockRecorder) RecoverAccount(password, mnemonic interface{}) *gomock.Call

RecoverAccount indicates an expected call of RecoverAccount

func (*MockAccountManagerMockRecorder) SelectAccount

func (mr *MockAccountManagerMockRecorder) SelectAccount(address, password interface{}) *gomock.Call

SelectAccount indicates an expected call of SelectAccount

func (*MockAccountManagerMockRecorder) SelectedAccount

func (mr *MockAccountManagerMockRecorder) SelectedAccount() *gomock.Call

SelectedAccount indicates an expected call of SelectedAccount

func (*MockAccountManagerMockRecorder) VerifyAccountPassword

func (mr *MockAccountManagerMockRecorder) VerifyAccountPassword(keyStoreDir, address, password interface{}) *gomock.Call

VerifyAccountPassword indicates an expected call of VerifyAccountPassword

type MockJailCell

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

MockJailCell is a mock of JailCell interface

func NewMockJailCell

func NewMockJailCell(ctrl *gomock.Controller) *MockJailCell

NewMockJailCell creates a new mock instance

func (*MockJailCell) Call

func (m *MockJailCell) Call(item string, this interface{}, args ...interface{}) (otto.Value, error)

Call mocks base method

func (*MockJailCell) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockJailCell) Get

func (m *MockJailCell) Get(arg0 string) (otto.Value, error)

Get mocks base method

func (*MockJailCell) Run

func (m *MockJailCell) Run(arg0 interface{}) (otto.Value, error)

Run mocks base method

func (*MockJailCell) Set

func (m *MockJailCell) Set(arg0 string, arg1 interface{}) error

Set mocks base method

func (*MockJailCell) Stop

func (m *MockJailCell) Stop() error

Stop mocks base method

type MockJailCellMockRecorder

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

MockJailCellMockRecorder is the mock recorder for MockJailCell

func (*MockJailCellMockRecorder) Call

func (mr *MockJailCellMockRecorder) Call(item, this interface{}, args ...interface{}) *gomock.Call

Call indicates an expected call of Call

func (*MockJailCellMockRecorder) Get

func (mr *MockJailCellMockRecorder) Get(arg0 interface{}) *gomock.Call

Get indicates an expected call of Get

func (*MockJailCellMockRecorder) Run

func (mr *MockJailCellMockRecorder) Run(arg0 interface{}) *gomock.Call

Run indicates an expected call of Run

func (*MockJailCellMockRecorder) Set

func (mr *MockJailCellMockRecorder) Set(arg0, arg1 interface{}) *gomock.Call

Set indicates an expected call of Set

func (*MockJailCellMockRecorder) Stop

func (mr *MockJailCellMockRecorder) Stop() *gomock.Call

Stop indicates an expected call of Stop

type MockJailManager

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

MockJailManager is a mock of JailManager interface

func NewMockJailManager

func NewMockJailManager(ctrl *gomock.Controller) *MockJailManager

NewMockJailManager creates a new mock instance

func (*MockJailManager) Call

func (m *MockJailManager) Call(chatID, this, args string) string

Call mocks base method

func (*MockJailManager) Cell

func (m *MockJailManager) Cell(chatID string) (JailCell, error)

Cell mocks base method

func (*MockJailManager) CreateAndInitCell

func (m *MockJailManager) CreateAndInitCell(chatID string, code ...string) string

CreateAndInitCell mocks base method

func (*MockJailManager) CreateCell

func (m *MockJailManager) CreateCell(chatID string) (JailCell, error)

CreateCell mocks base method

func (*MockJailManager) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockJailManager) Execute

func (m *MockJailManager) Execute(chatID, code string) string

Execute mocks base method

func (*MockJailManager) Parse

func (m *MockJailManager) Parse(chatID, js string) string

Parse mocks base method

func (*MockJailManager) SetBaseJS

func (m *MockJailManager) SetBaseJS(js string)

SetBaseJS mocks base method

func (*MockJailManager) Stop

func (m *MockJailManager) Stop()

Stop mocks base method

type MockJailManagerMockRecorder

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

MockJailManagerMockRecorder is the mock recorder for MockJailManager

func (*MockJailManagerMockRecorder) Call

func (mr *MockJailManagerMockRecorder) Call(chatID, this, args interface{}) *gomock.Call

Call indicates an expected call of Call

func (*MockJailManagerMockRecorder) Cell

func (mr *MockJailManagerMockRecorder) Cell(chatID interface{}) *gomock.Call

Cell indicates an expected call of Cell

func (*MockJailManagerMockRecorder) CreateAndInitCell

func (mr *MockJailManagerMockRecorder) CreateAndInitCell(chatID interface{}, code ...interface{}) *gomock.Call

CreateAndInitCell indicates an expected call of CreateAndInitCell

func (*MockJailManagerMockRecorder) CreateCell

func (mr *MockJailManagerMockRecorder) CreateCell(chatID interface{}) *gomock.Call

CreateCell indicates an expected call of CreateCell

func (*MockJailManagerMockRecorder) Execute

func (mr *MockJailManagerMockRecorder) Execute(chatID, code interface{}) *gomock.Call

Execute indicates an expected call of Execute

func (*MockJailManagerMockRecorder) Parse

func (mr *MockJailManagerMockRecorder) Parse(chatID, js interface{}) *gomock.Call

Parse indicates an expected call of Parse

func (*MockJailManagerMockRecorder) SetBaseJS

func (mr *MockJailManagerMockRecorder) SetBaseJS(js interface{}) *gomock.Call

SetBaseJS indicates an expected call of SetBaseJS

func (*MockJailManagerMockRecorder) Stop

Stop indicates an expected call of Stop

type MockNodeManager

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

MockNodeManager is a mock of NodeManager interface

func NewMockNodeManager

func NewMockNodeManager(ctrl *gomock.Controller) *MockNodeManager

NewMockNodeManager creates a new mock instance

func (*MockNodeManager) AccountKeyStore

func (m *MockNodeManager) AccountKeyStore() (*keystore.KeyStore, error)

AccountKeyStore mocks base method

func (*MockNodeManager) AccountManager

func (m *MockNodeManager) AccountManager() (*accounts.Manager, error)

AccountManager mocks base method

func (*MockNodeManager) AddPeer

func (m *MockNodeManager) AddPeer(url string) error

AddPeer mocks base method

func (*MockNodeManager) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockNodeManager) IsNodeRunning

func (m *MockNodeManager) IsNodeRunning() bool

IsNodeRunning mocks base method

func (*MockNodeManager) LightEthereumService

func (m *MockNodeManager) LightEthereumService() (*les.LightEthereum, error)

LightEthereumService mocks base method

func (*MockNodeManager) Node

func (m *MockNodeManager) Node() (*node.Node, error)

Node mocks base method

func (*MockNodeManager) NodeConfig

func (m *MockNodeManager) NodeConfig() (*params.NodeConfig, error)

NodeConfig mocks base method

func (*MockNodeManager) PopulateStaticPeers

func (m *MockNodeManager) PopulateStaticPeers() error

PopulateStaticPeers mocks base method

func (*MockNodeManager) RPCClient

func (m *MockNodeManager) RPCClient() *rpc.Client

RPCClient mocks base method

func (*MockNodeManager) ResetChainData

func (m *MockNodeManager) ResetChainData() (<-chan struct{}, error)

ResetChainData mocks base method

func (*MockNodeManager) RestartNode

func (m *MockNodeManager) RestartNode() (<-chan struct{}, error)

RestartNode mocks base method

func (*MockNodeManager) StartNode

func (m *MockNodeManager) StartNode(config *params.NodeConfig) (<-chan struct{}, error)

StartNode mocks base method

func (*MockNodeManager) StopNode

func (m *MockNodeManager) StopNode() (<-chan struct{}, error)

StopNode mocks base method

func (*MockNodeManager) WhisperService

func (m *MockNodeManager) WhisperService() (*whisperv5.Whisper, error)

WhisperService mocks base method

type MockNodeManagerMockRecorder

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

MockNodeManagerMockRecorder is the mock recorder for MockNodeManager

func (*MockNodeManagerMockRecorder) AccountKeyStore

func (mr *MockNodeManagerMockRecorder) AccountKeyStore() *gomock.Call

AccountKeyStore indicates an expected call of AccountKeyStore

func (*MockNodeManagerMockRecorder) AccountManager

func (mr *MockNodeManagerMockRecorder) AccountManager() *gomock.Call

AccountManager indicates an expected call of AccountManager

func (*MockNodeManagerMockRecorder) AddPeer

func (mr *MockNodeManagerMockRecorder) AddPeer(url interface{}) *gomock.Call

AddPeer indicates an expected call of AddPeer

func (*MockNodeManagerMockRecorder) IsNodeRunning

func (mr *MockNodeManagerMockRecorder) IsNodeRunning() *gomock.Call

IsNodeRunning indicates an expected call of IsNodeRunning

func (*MockNodeManagerMockRecorder) LightEthereumService

func (mr *MockNodeManagerMockRecorder) LightEthereumService() *gomock.Call

LightEthereumService indicates an expected call of LightEthereumService

func (*MockNodeManagerMockRecorder) Node

Node indicates an expected call of Node

func (*MockNodeManagerMockRecorder) NodeConfig

func (mr *MockNodeManagerMockRecorder) NodeConfig() *gomock.Call

NodeConfig indicates an expected call of NodeConfig

func (*MockNodeManagerMockRecorder) PopulateStaticPeers

func (mr *MockNodeManagerMockRecorder) PopulateStaticPeers() *gomock.Call

PopulateStaticPeers indicates an expected call of PopulateStaticPeers

func (*MockNodeManagerMockRecorder) RPCClient

func (mr *MockNodeManagerMockRecorder) RPCClient() *gomock.Call

RPCClient indicates an expected call of RPCClient

func (*MockNodeManagerMockRecorder) ResetChainData

func (mr *MockNodeManagerMockRecorder) ResetChainData() *gomock.Call

ResetChainData indicates an expected call of ResetChainData

func (*MockNodeManagerMockRecorder) RestartNode

func (mr *MockNodeManagerMockRecorder) RestartNode() *gomock.Call

RestartNode indicates an expected call of RestartNode

func (*MockNodeManagerMockRecorder) StartNode

func (mr *MockNodeManagerMockRecorder) StartNode(config interface{}) *gomock.Call

StartNode indicates an expected call of StartNode

func (*MockNodeManagerMockRecorder) StopNode

func (mr *MockNodeManagerMockRecorder) StopNode() *gomock.Call

StopNode indicates an expected call of StopNode

func (*MockNodeManagerMockRecorder) WhisperService

func (mr *MockNodeManagerMockRecorder) WhisperService() *gomock.Call

WhisperService indicates an expected call of WhisperService

type MockNotifier

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

MockNotifier is a mock of Notifier interface

func NewMockNotifier

func NewMockNotifier(ctrl *gomock.Controller) *MockNotifier

NewMockNotifier creates a new mock instance

func (*MockNotifier) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockNotifier) Send

func (m *MockNotifier) Send(body string, payload go_fcm.NotificationPayload, tokens ...string) error

Send mocks base method

type MockNotifierMockRecorder

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

MockNotifierMockRecorder is the mock recorder for MockNotifier

func (*MockNotifierMockRecorder) Send

func (mr *MockNotifierMockRecorder) Send(body, payload interface{}, tokens ...interface{}) *gomock.Call

Send indicates an expected call of Send

type MockTxQueue

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

MockTxQueue is a mock of TxQueue interface

func NewMockTxQueue

func NewMockTxQueue(ctrl *gomock.Controller) *MockTxQueue

NewMockTxQueue creates a new mock instance

func (*MockTxQueue) Count

func (m *MockTxQueue) Count() int

Count mocks base method

func (*MockTxQueue) EXPECT

func (m *MockTxQueue) EXPECT() *MockTxQueueMockRecorder

EXPECT returns an object that allows the caller to indicate expected use

func (*MockTxQueue) Has

func (m *MockTxQueue) Has(id QueuedTxID) bool

Has mocks base method

func (*MockTxQueue) Remove

func (m *MockTxQueue) Remove(id QueuedTxID)

Remove mocks base method

func (*MockTxQueue) Reset

func (m *MockTxQueue) Reset()

Reset mocks base method

type MockTxQueueManager

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

MockTxQueueManager is a mock of TxQueueManager interface

func NewMockTxQueueManager

func NewMockTxQueueManager(ctrl *gomock.Controller) *MockTxQueueManager

NewMockTxQueueManager creates a new mock instance

func (*MockTxQueueManager) CompleteTransaction

func (m *MockTxQueueManager) CompleteTransaction(id QueuedTxID, password string) (common.Hash, error)

CompleteTransaction mocks base method

func (*MockTxQueueManager) CompleteTransactions

func (m *MockTxQueueManager) CompleteTransactions(ids []QueuedTxID, password string) map[QueuedTxID]RawCompleteTransactionResult

CompleteTransactions mocks base method

func (*MockTxQueueManager) CreateTransaction

func (m *MockTxQueueManager) CreateTransaction(ctx context.Context, args SendTxArgs) *QueuedTx

CreateTransaction mocks base method

func (*MockTxQueueManager) DiscardTransaction

func (m *MockTxQueueManager) DiscardTransaction(id QueuedTxID) error

DiscardTransaction mocks base method

func (*MockTxQueueManager) DiscardTransactions

func (m *MockTxQueueManager) DiscardTransactions(ids []QueuedTxID) map[QueuedTxID]RawDiscardTransactionResult

DiscardTransactions mocks base method

func (*MockTxQueueManager) EXPECT

EXPECT returns an object that allows the caller to indicate expected use

func (*MockTxQueueManager) NotifyOnQueuedTxReturn

func (m *MockTxQueueManager) NotifyOnQueuedTxReturn(queuedTx *QueuedTx, err error)

NotifyOnQueuedTxReturn mocks base method

func (*MockTxQueueManager) QueueTransaction

func (m *MockTxQueueManager) QueueTransaction(tx *QueuedTx) error

QueueTransaction mocks base method

func (*MockTxQueueManager) SendTransactionRPCHandler

func (m *MockTxQueueManager) SendTransactionRPCHandler(ctx context.Context, args ...interface{}) (interface{}, error)

SendTransactionRPCHandler mocks base method

func (*MockTxQueueManager) SetTransactionQueueHandler

func (m *MockTxQueueManager) SetTransactionQueueHandler(fn EnqueuedTxHandler)

SetTransactionQueueHandler mocks base method

func (*MockTxQueueManager) SetTransactionReturnHandler

func (m *MockTxQueueManager) SetTransactionReturnHandler(fn EnqueuedTxReturnHandler)

SetTransactionReturnHandler mocks base method

func (*MockTxQueueManager) Start

func (m *MockTxQueueManager) Start()

Start mocks base method

func (*MockTxQueueManager) Stop

func (m *MockTxQueueManager) Stop()

Stop mocks base method

func (*MockTxQueueManager) TransactionQueue

func (m *MockTxQueueManager) TransactionQueue() TxQueue

TransactionQueue mocks base method

func (*MockTxQueueManager) TransactionQueueHandler

func (m *MockTxQueueManager) TransactionQueueHandler() func(*QueuedTx)

TransactionQueueHandler mocks base method

func (*MockTxQueueManager) TransactionReturnHandler

func (m *MockTxQueueManager) TransactionReturnHandler() func(*QueuedTx, error)

TransactionReturnHandler mocks base method

func (*MockTxQueueManager) WaitForTransaction

func (m *MockTxQueueManager) WaitForTransaction(tx *QueuedTx) error

WaitForTransaction mocks base method

type MockTxQueueManagerMockRecorder

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

MockTxQueueManagerMockRecorder is the mock recorder for MockTxQueueManager

func (*MockTxQueueManagerMockRecorder) CompleteTransaction

func (mr *MockTxQueueManagerMockRecorder) CompleteTransaction(id, password interface{}) *gomock.Call

CompleteTransaction indicates an expected call of CompleteTransaction

func (*MockTxQueueManagerMockRecorder) CompleteTransactions

func (mr *MockTxQueueManagerMockRecorder) CompleteTransactions(ids, password interface{}) *gomock.Call

CompleteTransactions indicates an expected call of CompleteTransactions

func (*MockTxQueueManagerMockRecorder) CreateTransaction

func (mr *MockTxQueueManagerMockRecorder) CreateTransaction(ctx, args interface{}) *gomock.Call

CreateTransaction indicates an expected call of CreateTransaction

func (*MockTxQueueManagerMockRecorder) DiscardTransaction

func (mr *MockTxQueueManagerMockRecorder) DiscardTransaction(id interface{}) *gomock.Call

DiscardTransaction indicates an expected call of DiscardTransaction

func (*MockTxQueueManagerMockRecorder) DiscardTransactions

func (mr *MockTxQueueManagerMockRecorder) DiscardTransactions(ids interface{}) *gomock.Call

DiscardTransactions indicates an expected call of DiscardTransactions

func (*MockTxQueueManagerMockRecorder) NotifyOnQueuedTxReturn

func (mr *MockTxQueueManagerMockRecorder) NotifyOnQueuedTxReturn(queuedTx, err interface{}) *gomock.Call

NotifyOnQueuedTxReturn indicates an expected call of NotifyOnQueuedTxReturn

func (*MockTxQueueManagerMockRecorder) QueueTransaction

func (mr *MockTxQueueManagerMockRecorder) QueueTransaction(tx interface{}) *gomock.Call

QueueTransaction indicates an expected call of QueueTransaction

func (*MockTxQueueManagerMockRecorder) SendTransactionRPCHandler

func (mr *MockTxQueueManagerMockRecorder) SendTransactionRPCHandler(ctx interface{}, args ...interface{}) *gomock.Call

SendTransactionRPCHandler indicates an expected call of SendTransactionRPCHandler

func (*MockTxQueueManagerMockRecorder) SetTransactionQueueHandler

func (mr *MockTxQueueManagerMockRecorder) SetTransactionQueueHandler(fn interface{}) *gomock.Call

SetTransactionQueueHandler indicates an expected call of SetTransactionQueueHandler

func (*MockTxQueueManagerMockRecorder) SetTransactionReturnHandler

func (mr *MockTxQueueManagerMockRecorder) SetTransactionReturnHandler(fn interface{}) *gomock.Call

SetTransactionReturnHandler indicates an expected call of SetTransactionReturnHandler

func (*MockTxQueueManagerMockRecorder) Start

Start indicates an expected call of Start

func (*MockTxQueueManagerMockRecorder) Stop

Stop indicates an expected call of Stop

func (*MockTxQueueManagerMockRecorder) TransactionQueue

func (mr *MockTxQueueManagerMockRecorder) TransactionQueue() *gomock.Call

TransactionQueue indicates an expected call of TransactionQueue

func (*MockTxQueueManagerMockRecorder) TransactionQueueHandler

func (mr *MockTxQueueManagerMockRecorder) TransactionQueueHandler() *gomock.Call

TransactionQueueHandler indicates an expected call of TransactionQueueHandler

func (*MockTxQueueManagerMockRecorder) TransactionReturnHandler

func (mr *MockTxQueueManagerMockRecorder) TransactionReturnHandler() *gomock.Call

TransactionReturnHandler indicates an expected call of TransactionReturnHandler

func (*MockTxQueueManagerMockRecorder) WaitForTransaction

func (mr *MockTxQueueManagerMockRecorder) WaitForTransaction(tx interface{}) *gomock.Call

WaitForTransaction indicates an expected call of WaitForTransaction

type MockTxQueueMockRecorder

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

MockTxQueueMockRecorder is the mock recorder for MockTxQueue

func (*MockTxQueueMockRecorder) Count

func (mr *MockTxQueueMockRecorder) Count() *gomock.Call

Count indicates an expected call of Count

func (*MockTxQueueMockRecorder) Has

func (mr *MockTxQueueMockRecorder) Has(id interface{}) *gomock.Call

Has indicates an expected call of Has

func (*MockTxQueueMockRecorder) Remove

func (mr *MockTxQueueMockRecorder) Remove(id interface{}) *gomock.Call

Remove indicates an expected call of Remove

func (*MockTxQueueMockRecorder) Reset

func (mr *MockTxQueueMockRecorder) Reset() *gomock.Call

Reset indicates an expected call of Reset

type NodeManager

type NodeManager interface {
	// StartNode start Status node, fails if node is already started
	StartNode(config *params.NodeConfig) (<-chan struct{}, error)

	// StopNode stop the running Status node.
	// Stopped node cannot be resumed, one starts a new node instead.
	StopNode() (<-chan struct{}, error)

	// RestartNode restart running Status node, fails if node is not running
	RestartNode() (<-chan struct{}, error)

	// ResetChainData remove chain data from data directory.
	// Node is stopped, and new node is started, with clean data directory.
	ResetChainData() (<-chan struct{}, error)

	// IsNodeRunning confirm that node is running
	IsNodeRunning() bool

	// NodeConfig returns reference to running node's configuration
	NodeConfig() (*params.NodeConfig, error)

	// Node returns underlying Status node
	Node() (*node.Node, error)

	// PopulateStaticPeers populates node's list of static bootstrap peers
	PopulateStaticPeers() error

	// AddPeer adds URL of static peer
	AddPeer(url string) error

	// LightEthereumService exposes reference to LES service running on top of the node
	LightEthereumService() (*les.LightEthereum, error)

	// WhisperService returns reference to running Whisper service
	WhisperService() (*whisper.Whisper, error)

	// AccountManager returns reference to node's account manager
	AccountManager() (*accounts.Manager, error)

	// AccountKeyStore returns reference to account manager's keystore
	AccountKeyStore() (*keystore.KeyStore, error)

	// RPCClient exposes reference to RPC client connected to the running node
	RPCClient() *rpc.Client
}

NodeManager defines expected methods for managing Status node

type NotificationConstructor

type NotificationConstructor func() Notifier

NotificationConstructor returns constructor of configured instance Notifier interface.

type Notifier

type Notifier interface {
	Send(body string, payload fcm.NotificationPayload, tokens ...string) error
}

Notifier manages Push Notifications.

type NotifyResult

type NotifyResult struct {
	Status bool   `json:"status"`
	Error  string `json:"error,omitempty"`
}

NotifyResult is a JSON returned from notify message

type QueuedTx

type QueuedTx struct {
	ID         QueuedTxID
	Hash       common.Hash
	Context    context.Context
	Args       SendTxArgs
	InProgress bool // true if transaction is being sent
	Done       chan struct{}
	Discard    chan struct{}
	Err        error
}

QueuedTx holds enough information to complete the queued transaction.

type QueuedTxID

type QueuedTxID string

QueuedTxID queued transaction identifier

type RPCCall

type RPCCall struct {
	ID     int64
	Method string
	Params []interface{}
}

RPCCall represents a unit of a rpc request which is to be executed.

func (RPCCall) ParseData

func (r RPCCall) ParseData() hexutil.Bytes

ParseData returns the bytes associated with the call.

func (RPCCall) ParseFromAddress

func (r RPCCall) ParseFromAddress() (gethcommon.Address, error)

ParseFromAddress returns the address associated with the RPCCall.

func (RPCCall) ParseGas

func (r RPCCall) ParseGas() *hexutil.Big

ParseGas returns the hex big associated with the call. nolint: dupl

func (RPCCall) ParseGasPrice

func (r RPCCall) ParseGasPrice() *hexutil.Big

ParseGasPrice returns the hex big associated with the call. nolint: dupl

func (RPCCall) ParseToAddress

func (r RPCCall) ParseToAddress() (gethcommon.Address, error)

ParseToAddress returns the gethcommon.Address associated with the call.

func (RPCCall) ParseValue

func (r RPCCall) ParseValue() *hexutil.Big

ParseValue returns the hex big associated with the call. nolint: dupl

func (RPCCall) ToSendTxArgs

func (r RPCCall) ToSendTxArgs() SendTxArgs

ToSendTxArgs converts RPCCall to SendTxArgs.

type RawCompleteTransactionResult

type RawCompleteTransactionResult struct {
	Hash  common.Hash
	Error error
}

RawCompleteTransactionResult is a JSON returned from transaction complete function (used internally)

type RawDiscardTransactionResult

type RawDiscardTransactionResult struct {
	Error error
}

RawDiscardTransactionResult is list of results from CompleteTransactions() (used internally)

type SelectedExtKey

type SelectedExtKey struct {
	Address     common.Address
	AccountKey  *keystore.Key
	SubAccounts []accounts.Account
}

SelectedExtKey is a container for currently selected (logged in) account

func (*SelectedExtKey) Hex

func (k *SelectedExtKey) Hex() string

Hex dumps address of a given extended key as hex string

type SendTxArgs

type SendTxArgs struct {
	From     common.Address  `json:"from"`
	To       *common.Address `json:"to"`
	Gas      *hexutil.Big    `json:"gas"`
	GasPrice *hexutil.Big    `json:"gasPrice"`
	Value    *hexutil.Big    `json:"value"`
	Data     hexutil.Bytes   `json:"data"`
	Nonce    *hexutil.Uint64 `json:"nonce"`
}

SendTxArgs represents the arguments to submit a new transaction into the transaction pool.

type StopRPCCallError

type StopRPCCallError struct {
	Err error
}

StopRPCCallError defines a error type specific for killing a execution process.

func (StopRPCCallError) Error

func (c StopRPCCallError) Error() string

Error returns the internal error associated with the critical error.

type TestConfig

type TestConfig struct {
	Node struct {
		SyncSeconds time.Duration
		HTTPPort    int
		WSPort      int
	}
	Account1 account
	Account2 account
	Account3 account
}

TestConfig contains shared (among different test packages) parameters

func LoadTestConfig

func LoadTestConfig(networkId int) (*TestConfig, error)

LoadTestConfig loads test configuration values from disk

type TxQueue

type TxQueue interface {
	// Remove removes a transaction from the queue.
	Remove(id QueuedTxID)

	// Reset resets the state of the queue.
	Reset()

	// Count returns a number of transactions in the queue.
	Count() int

	// Has returns true if a transaction is in the queue.
	Has(id QueuedTxID) bool
}

TxQueue is a queue of transactions.

type TxQueueManager

type TxQueueManager interface {
	// Start starts accepting new transaction in the queue.
	Start()

	// Stop stops accepting new transactions in the queue.
	Stop()

	// TransactionQueue returns a transaction queue.
	TransactionQueue() TxQueue

	// CreateTransactoin creates a new transaction.
	CreateTransaction(ctx context.Context, args SendTxArgs) *QueuedTx

	// QueueTransaction adds a new transaction to the queue.
	QueueTransaction(tx *QueuedTx) error

	// WaitForTransactions blocks until transaction is completed, discarded or timed out.
	WaitForTransaction(tx *QueuedTx) error

	// NotifyOnQueuedTxReturn notifies a handler when a transaction returns.
	NotifyOnQueuedTxReturn(queuedTx *QueuedTx, err error)

	// TransactionQueueHandler returns handler that processes incoming tx queue requests
	TransactionQueueHandler() func(queuedTx *QueuedTx)

	// TODO(adam): might be not needed
	SetTransactionQueueHandler(fn EnqueuedTxHandler)

	// TODO(adam): might be not needed
	SetTransactionReturnHandler(fn EnqueuedTxReturnHandler)

	SendTransactionRPCHandler(ctx context.Context, args ...interface{}) (interface{}, error)

	// TransactionReturnHandler returns handler that processes responses from internal tx manager
	TransactionReturnHandler() func(queuedTx *QueuedTx, err error)

	// CompleteTransaction instructs backend to complete sending of a given transaction
	CompleteTransaction(id QueuedTxID, password string) (common.Hash, error)

	// CompleteTransactions instructs backend to complete sending of multiple transactions
	CompleteTransactions(ids []QueuedTxID, password string) map[QueuedTxID]RawCompleteTransactionResult

	// DiscardTransaction discards a given transaction from transaction queue
	DiscardTransaction(id QueuedTxID) error

	// DiscardTransactions discards given multiple transactions from transaction queue
	DiscardTransactions(ids []QueuedTxID) map[QueuedTxID]RawDiscardTransactionResult
}

TxQueueManager defines expected methods for managing transaction queue

Jump to

Keyboard shortcuts

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