pkg

package
v0.0.0-...-27df293 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2024 License: Apache-2.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GenesisPrivateKey = "32e3b56c9f2763d2332e6e4188e4755815ac96441e899de121969845e343c2ff"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockManager

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

func GetDefaultBlockManager

func GetDefaultBlockManager() *BlockManager

func (*BlockManager) GetBlockByIndex

func (bm *BlockManager) GetBlockByIndex(id uint64) (*types.Block, error)

func (*BlockManager) GetBlockTxnCountByIndex

func (bm *BlockManager) GetBlockTxnCountByIndex(index int) (bool, int, error)

func (*BlockManager) GetCurrentBlock

func (bm *BlockManager) GetCurrentBlock() (*types.Block, error)

func (*BlockManager) StopBlockChain

func (bm *BlockManager) StopBlockChain()

type CaseEthWallet

type CaseEthWallet struct {
	*EthWallet
	EthCount uint64 `json:"ethCount"`
}

func GenerateCaseWallets

func GenerateCaseWallets(initialEthCount uint64, wallets []*EthWallet) []*CaseEthWallet

func (*CaseEthWallet) Copy

func (c *CaseEthWallet) Copy() *CaseEthWallet

type EthWallet

type EthWallet struct {
	PK      string `json:"pk"`
	Address string `json:"address"`
}

func (*EthWallet) Copy

func (e *EthWallet) Copy() *EthWallet

type RawTxReq

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

type Step

type Step struct {
	From  *EthWallet `json:"from"`
	To    *EthWallet `json:"to"`
	Count uint64     `json:"count"`
}

type TransferCase

type TransferCase struct {
	Steps []*Step `json:"steps"`
	// address to wallet
	Original map[string]*CaseEthWallet `json:"original"`
	Expect   map[string]*CaseEthWallet `json:"expect"`
}

func (*TransferCase) AssertExpect

func (tc *TransferCase) AssertExpect(m *WalletManager, wallets []*EthWallet) (map[string]*CaseEthWallet, bool, error)

func (*TransferCase) Run

func (tc *TransferCase) Run(m *WalletManager) error

type TransferManager

type TransferManager struct{}

func NewTransferManager

func NewTransferManager() *TransferManager

func (*TransferManager) GenerateRandomTransferSteps

func (m *TransferManager) GenerateRandomTransferSteps(stepCount int, wallets []*CaseEthWallet) *TransferCase

func (*TransferManager) GenerateSameTargetTransferSteps

func (m *TransferManager) GenerateSameTargetTransferSteps(stepCount int, wallets []*CaseEthWallet, target *CaseEthWallet) *TransferCase

func (*TransferManager) GenerateTransferSteps

func (m *TransferManager) GenerateTransferSteps(wallets []*CaseEthWallet) *TransferCase

type WalletManager

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

func NewWalletManager

func NewWalletManager(cfg *evm.GethConfig, hostAddress string) *WalletManager

func (*WalletManager) AssertWallet

func (m *WalletManager) AssertWallet(w *EthWallet, count uint64)

func (*WalletManager) BatchGenerateRandomWallets

func (m *WalletManager) BatchGenerateRandomWallets(count int, initialEthCount uint64) ([]*EthWallet, error)

func (*WalletManager) CreateEthWalletByAddress

func (m *WalletManager) CreateEthWalletByAddress(initialEthCount uint64, privateKey, address string) (*EthWallet, error)

func (*WalletManager) GenerateRandomWallets

func (m *WalletManager) GenerateRandomWallets(count int, initialEthCount uint64) ([]*EthWallet, error)

func (*WalletManager) QueryEth

func (m *WalletManager) QueryEth(wallet *EthWallet) (uint64, error)

func (*WalletManager) TransferEth

func (m *WalletManager) TransferEth(from, to *EthWallet, amount, nonce uint64) error

Jump to

Keyboard shortcuts

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