eth

package
v0.0.0-...-5aa55fc Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2024 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckEthSign

func CheckEthSign(ethAddress string, originData string, ethSign string) bool

CheckEthSign check whether Ethereum signature correct

func GetEthClientByChainId

func GetEthClientByChainId(chainId uint64) (*ethclient.Client, error)

func GetEvmClientByChainId

func GetEvmClientByChainId(chainId uint64) (*rpcclient.EvmClient, error)

func GetLoadBalanceByChainId

func GetLoadBalanceByChainId(chainId uint64) (loadbalance.LoadBalance, error)

func Init

func Init()

func InitClients

func InitClients(chainId uint64, rawurls []string)

Types

type Client

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

func GetClientByChainId

func GetClientByChainId(chainId uint64) (*Client, error)

func NewClient

func NewClient(rawurl string) (*Client, error)

func NewClientByConnected

func NewClientByConnected(client *ethclient.Client) (*Client, error)

func (*Client) BlockByHash

func (c *Client) BlockByHash(hash common.Hash) (*types.Block, error)

func (*Client) BlockNumber

func (c *Client) BlockNumber(ctx context.Context) (uint64, error)

func (*Client) ChainID

func (c *Client) ChainID(ctx context.Context) (*big.Int, error)

func (*Client) Client

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

func (*Client) EstimateGas

func (c *Client) EstimateGas(ctx context.Context, msg ethereum.CallMsg) (uint64, error)

func (*Client) FilterLogs

func (c *Client) FilterLogs(ctx context.Context, query ethereum.FilterQuery) ([]types.Log, error)

func (*Client) HeaderByNumber

func (c *Client) HeaderByNumber(ctx context.Context, number *big.Int) (*types.Header, error)

func (*Client) NetworkID

func (c *Client) NetworkID(ctx context.Context) (*big.Int, error)

func (*Client) Nonce

func (c *Client) Nonce(ctx context.Context, fromAddress common.Address) (uint64, error)

func (*Client) SendRAWTransaction

func (c *Client) SendRAWTransaction(ctx context.Context, pk *PrivateKey, rawByte []byte) (*types.Transaction, error)

func (*Client) SubscribeFilterLogs

func (c *Client) SubscribeFilterLogs(ctx context.Context, q ethereum.FilterQuery, ch chan<- types.Log) (ethereum.Subscription, error)

func (*Client) SuggestGasPrice

func (c *Client) SuggestGasPrice(ctx context.Context) (*big.Int, error)

func (*Client) TransactionByHash

func (c *Client) TransactionByHash(txHash common.Hash) (tx *types.Transaction, isPending bool, err error)

func (*Client) TransactionReceipt

func (c *Client) TransactionReceipt(txHash common.Hash) (*types.Receipt, error)

func (*Client) TransferringETH

func (c *Client) TransferringETH(ctx context.Context, pk *PrivateKey, toAddress common.Address, amount *big.Int) (*types.Transaction, error)

type PrivateKey

type PrivateKey struct {
	// contains filtered or unexported fields
}
var PriKey *PrivateKey

func NewPrivateKey

func NewPrivateKey(hex string) (*PrivateKey, error)

func NewPrivateKeyFromECDSA

func NewPrivateKeyFromECDSA(key *ecdsa.PrivateKey) *PrivateKey

func (*PrivateKey) Address

func (p *PrivateKey) Address() common.Address

func (*PrivateKey) ETHSignature

func (p *PrivateKey) ETHSignature(fromByte []byte) (string, error)

func (*PrivateKey) GetPrivateKey

func (p *PrivateKey) GetPrivateKey() (key *ecdsa.PrivateKey)

func (*PrivateKey) Hex

func (p *PrivateKey) Hex() []byte

func (*PrivateKey) HexString

func (p *PrivateKey) HexString() string

func (*PrivateKey) MakeTransact

func (p *PrivateKey) MakeTransact(chainId *big.Int) (*bind.TransactOpts, error)

func (*PrivateKey) PublicKey

func (p *PrivateKey) PublicKey() *PublicKey

func (*PrivateKey) Sha256JWSSignature

func (p *PrivateKey) Sha256JWSSignature(fromByte []byte) (string, error)

func (*PrivateKey) Signature

func (p *PrivateKey) Signature(data []byte) ([]byte, error)

type PublicKey

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

func GetPublicKeyUseEthSign

func GetPublicKeyUseEthSign(originData string, ethSign string) (*PublicKey, error)

func NewPublicKey

func NewPublicKey(hex string) (*PublicKey, error)

func NewPublicKeyFromByte

func NewPublicKeyFromByte(data []byte) (*PublicKey, error)

func NewPublicKeyFromSignature

func NewPublicKeyFromSignature(oriData, signature []byte) (*PublicKey, error)

func (*PublicKey) Address

func (p *PublicKey) Address() common.Address

func (*PublicKey) EllipticMarshal

func (p *PublicKey) EllipticMarshal() []byte

func (*PublicKey) Hex

func (p *PublicKey) Hex() []byte

func (*PublicKey) HexString

func (p *PublicKey) HexString() string

func (*PublicKey) VerifyEcdsaSecp256ETHSignature2022Signature

func (p *PublicKey) VerifyEcdsaSecp256ETHSignature2022Signature(toByte []byte, signature string) (bool, error)

func (*PublicKey) VerifySha256JWSSignature

func (p *PublicKey) VerifySha256JWSSignature(data []byte, signature string) (bool, error)

func (*PublicKey) VerifySignature

func (p *PublicKey) VerifySignature(data, signature []byte) bool

Directories

Path Synopsis
contract
plp

Jump to

Keyboard shortcuts

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