ethereum

package
v0.0.0-...-a287f25 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2021 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BigIntToAddressString

func BigIntToAddressString(n *big.Int) (addressString string, err error)

func HexArrayToAddresses

func HexArrayToAddresses(addresses []string) ([]gethCommon.Address, error)

func HexToAddress

func HexToAddress(str string) (addr gethCommon.Address, err error)

func HexToHash

func HexToHash(str string) (hash gethCommon.Hash, err error)

func MustHexToAddress

func MustHexToAddress(str string) gethCommon.Address

func MustHexToHash

func MustHexToHash(str string) gethCommon.Hash

func StringToBytes32

func StringToBytes32(str string) (result [32]byte)

Types

type Account

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

Account represents eth user account for further operations

func PrivateToAccount

func PrivateToAccount(p *ecdsa.PrivateKey, chainID *big.Int) (*Account, error)

PrivateToAccount imports an account from given private key

func (*Account) Address

func (acc *Account) Address() common.Address

func (*Account) PersonalSign

func (acc *Account) PersonalSign(msg []byte) ([]byte, error)

func (*Account) Signer

func (acc *Account) Signer() *bind.TransactOpts

Signer returns signer to sign transaction

func (*Account) String

func (acc *Account) String() string

type Client

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

func NewClient

func NewClient(ctx context.Context, providers []string, timeout time.Duration, tryTimes int, headers map[string]string) (*Client, error)

func (*Client) AddAccount

func (c *Client) AddAccount(private *ecdsa.PrivateKey) error

func (*Client) Allowance

func (c *Client) Allowance(ctx context.Context, token, owner, spender string, decimals int32) (decimal.Decimal, error)

func (*Client) BalanceOf

func (c *Client) BalanceOf(ctx context.Context, token, owner string, decimals int32) (decimal.Decimal, error)

func (*Client) BatchTradeDataPack

func (c *Client) BatchTradeDataPack(compressedOrders [][]byte, matchAmounts []decimal.Decimal, gasRewards []*big.Int) ([]byte, error)

func (*Client) DecryptKey

func (c *Client) DecryptKey(cipher []byte, password string) (*ecdsa.PrivateKey, error)

func (*Client) EncryptKey

func (c *Client) EncryptKey(pk *ecdsa.PrivateKey, password string) ([]byte, error)

func (*Client) FilterTradeFailed

func (c *Client) FilterTradeFailed(ctx context.Context, brokerAddress string, start, end uint64) ([]*model.TradeFailedEvent, error)

func (*Client) FilterTradeSuccess

func (c *Client) FilterTradeSuccess(ctx context.Context, brokerAddress string, start, end uint64) ([]*model.TradeSuccessEvent, error)

func (*Client) GetAccount

func (c *Client) GetAccount(account string) (*Account, error)

func (*Client) GetAccountStorage

func (c *Client) GetAccountStorage(ctx context.Context, readerAddress string, perpetualIndex int64, poolAddress, trader string) (*model.AccountStorage, error)

func (*Client) GetEthClient

func (c *Client) GetEthClient() *ethclient.Client

func (*Client) GetGasBalance

func (c *Client) GetGasBalance(ctx context.Context, brokerAddress string, address string) (decimal.Decimal, error)

func (*Client) GetGasPrice

func (c *Client) GetGasPrice(ctx context.Context, gasAddress string) ([]decimal.Decimal, error)

func (*Client) GetLatestBlockNumber

func (c *Client) GetLatestBlockNumber() (uint64, error)

func (*Client) GetLiquidityPoolStorage

func (c *Client) GetLiquidityPoolStorage(ctx context.Context, readerAddress, poolAddress string) (*model.LiquidityPoolStorage, error)

func (*Client) GetRelayerAccounts

func (c *Client) GetRelayerAccounts() []string

func (*Client) GetSignAccount

func (c *Client) GetSignAccount() (string, error)

func (*Client) HexToPrivate

func (c *Client) HexToPrivate(pk string) (*ecdsa.PrivateKey, string, error)

func (*Client) IsNotFoundError

func (c *Client) IsNotFoundError(err error) bool

func (*Client) ParseLogs

func (c *Client) ParseLogs(brokerAddress string, logs []*ethtypes.Log) ([]*model.TradeSuccessEvent, []*model.TradeFailedEvent)

func (*Client) PendingNonceAt

func (c *Client) PendingNonceAt(account string) (uint64, error)

func (*Client) SendTransaction

func (c *Client) SendTransaction(tx *model.LaunchTransaction) (string, error)

func (*Client) TransactionByHash

func (c *Client) TransactionByHash(txHash string) (bool, error)

func (*Client) WaitTransactionReceipt

func (c *Client) WaitTransactionReceipt(txHash string) (*model.Receipt, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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