client

package
v0.0.0-...-05480a4 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2019 License: GPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAuthority

func AddAuthority(chain *Chain, address string) error

func Cleanup

func Cleanup(chain *Chain, lastBlock *big.Int, wg *sync.WaitGroup)

func Deposit

func Deposit(chain *Chain, value *big.Int, id string) error

id is the id of the chain to withdraw the deposit on ids are in hexidecimal

func DepositPrompt

func DepositPrompt(chain *Chain, ks *keystore.KeyStore)

func Filter

func Filter(chain *Chain, allChains []*Chain, filter *ethereum.FilterQuery, logsDone chan bool)

func FundBridge

func FundBridge(chain *Chain, value *big.Int) error

func FundPrompt

func FundPrompt(chain *Chain, ks *keystore.KeyStore)

func HandleDeposit

func HandleDeposit(chain *Chain, allChains []*Chain, txHash common.Hash, withdrawDone chan bool)

func Listen

func Listen(chain *Chain, ac []*Chain, e *Events, doneClient chan bool, ks *keystore.KeyStore, fl map[string]bool, wg *sync.WaitGroup)

main goroutine starts a client to listen on every chain

func ParseJsonForResult

func ParseJsonForResult(jsonStr string) (string, error)

this function parses jsonStr for the entry "result" and returns its value as a string

func PayBridge

func PayBridge(chain *Chain, value *big.Int) error

func PayBridgePrompt

func PayBridgePrompt(chain *Chain, ks *keystore.KeyStore)

func ReadLogs

func ReadLogs(chain *Chain, allChains []*Chain, logs []types.Log, logsDone chan bool)

func SendTx

func SendTx(chain *Chain, value *big.Int, data []byte) (common.Hash, error)

send a tx to chain with calldata

func SignMessage

func SignMessage(chain *Chain, msg []byte) ([]byte, error)

sign a message using chain.From account

func Withdraw

func Withdraw(chain *Chain, withdrawal *Withdrawal) error

func WithdrawTo

func WithdrawTo(chain *Chain, value *big.Int, id string) error

ids are in hexidecimal

func WithdrawToPrompt

func WithdrawToPrompt(chain *Chain, ks *keystore.KeyStore)

Types

type Call

type Call struct {
	Jsonrpc string   `json:"jsonrpc"`
	Method  string   `json:"method"`
	Params  []string `json:"params"`
	Id      int      `json:"id"`
}

used to json format an RPC call

type Chain

type Chain struct {
	Name       string            `json:"name"`
	Url        string            `json:"url"`
	Id         *big.Int          `json:"id,omitempty"`
	Contract   *common.Address   `json:"contractAddr"`
	GasPrice   *big.Int          `json:"gasPrice"`
	From       *common.Address   `json:"from"`
	Password   string            `json:"password,omitempty"`
	Client     *ethclient.Client `json:"client,omitempty"`
	Nonce      uint64            `json:"nonce,omitempty"`
	StartBlock *big.Int          `json:"startBlock,omitempty"`
}

func FindChain

func FindChain(id *big.Int, allChains []*Chain) *Chain

func FindChainByName

func FindChainByName(name string, allChains []*Chain) *Chain

type Events

type Events struct {
	DepositId      string
	CreationId     string
	WithdrawId     string
	BridgeFundedId string
	PaidId         string
}

events to listen for

type JsonRpcResponse

type JsonRpcResponse struct {
	Id      int    `json:"id,omitempty"`
	Jsonrpc string `json:"jsonrpc,omitempty"`
	Result  string `json:"result"`
}

**** helpers ****

type Resp

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

used for json format a response from an RPC call

type Withdrawal

type Withdrawal struct {
	Recipient string
	Value     *big.Int
	FromChain string
	TxHash    string
	Data      string
}

Jump to

Keyboard shortcuts

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