mock

package
v0.3.1-0...-684a909 Latest Latest
Warning

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

Go to latest
Published: Oct 21, 2024 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Header = &types.Header{
		ParentHash:  common.HexToHash("0x3a537c89809712367218bb171b3b1c46aa95df3dee7200ae9dc78f4052024068"),
		UncleHash:   common.HexToHash("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"),
		Coinbase:    common.HexToAddress("0x0000000000000000000000000000000000000000"),
		Root:        common.HexToHash("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"),
		TxHash:      common.HexToHash("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"),
		ReceiptHash: common.HexToHash("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"),
		Bloom:       types.Bloom{},
		Difficulty:  new(big.Int).SetInt64(2),
		Number:      new(big.Int).SetInt64(1),
		GasLimit:    100000,
		GasUsed:     2000,
		Time:        1234,
		Extra:       []byte{0x7f},
		MixDigest:   common.HexToHash("0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347"),
		Nonce:       types.BlockNonce{0x13},
	}
	EmptyHeader = &types.Header{}
)
View Source
var (
	SuccessMsgHash = [32]byte{0x1}
	SuccessId      = big.NewInt(1)
	FailSignal     = [32]byte{0x2}
)
View Source
var (
	MockChainID              = big.NewInt(167001)
	LatestBlockNumber        = big.NewInt(10)
	NotFoundTxHash           = common.HexToHash("0x123")
	SucceedTxHash            = common.HexToHash("0x456")
	FailTxHash               = common.HexToHash("0x789")
	BlockNum                 = 10
	PendingNonce      uint64 = 10
)
View Source
var ProcessMessageTx = types.NewTransaction(
	PendingNonce,
	common.HexToAddress(dummyAddress),
	big.NewInt(1),
	100,
	big.NewInt(10),
	nil,
)

Functions

This section is empty.

Types

type Blocker

type Blocker struct {
}

func (*Blocker) BlockByHash

func (b *Blocker) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)

func (*Blocker) BlockByNumber

func (b *Blocker) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)

type Bridge

type Bridge struct {
}

func (*Bridge) FilterMessageProcessed

func (b *Bridge) FilterMessageProcessed(
	opts *bind.FilterOpts,
	msgHash [][32]byte,
) (*bridge.BridgeMessageProcessedIterator, error)

func (*Bridge) FilterMessageSent

func (b *Bridge) FilterMessageSent(
	opts *bind.FilterOpts,
	signal [][32]byte,
) (*bridge.BridgeMessageSentIterator, error)

func (*Bridge) FilterMessageStatusChanged

func (b *Bridge) FilterMessageStatusChanged(
	opts *bind.FilterOpts,
	signal [][32]byte,
) (*bridge.BridgeMessageStatusChangedIterator, error)

func (*Bridge) IsMessageReceived

func (b *Bridge) IsMessageReceived(opts *bind.CallOpts, _message bridge.IBridgeMessage, _proof []byte) (bool, error)

func (*Bridge) IsMessageSent

func (b *Bridge) IsMessageSent(opts *bind.CallOpts, _message bridge.IBridgeMessage) (bool, error)

func (*Bridge) MessageStatus

func (b *Bridge) MessageStatus(opts *bind.CallOpts, msgHash [32]byte) (uint8, error)

func (*Bridge) ParseMessageSent

func (b *Bridge) ParseMessageSent(log types.Log) (*bridge.BridgeMessageSent, error)

func (*Bridge) Paused

func (b *Bridge) Paused(opts *bind.CallOpts) (bool, error)

func (*Bridge) ProcessMessage

func (b *Bridge) ProcessMessage(
	opts *bind.TransactOpts,
	_message bridge.IBridgeMessage,
	_proof []byte,
) (*types.Transaction, error)

func (*Bridge) SendMessage

func (b *Bridge) SendMessage(opts *bind.TransactOpts, _message bridge.IBridgeMessage) (*types.Transaction, error)

func (*Bridge) SuspendMessages

func (b *Bridge) SuspendMessages(
	opts *bind.TransactOpts,
	_msgHashes [][32]byte,
	_toSuspend bool,
) (*types.Transaction, error)

type Caller

type Caller struct {
}

func (*Caller) CallContext

func (c *Caller) CallContext(ctx context.Context, result interface{}, method string, args ...interface{}) error

type DB

type DB struct {
}

func (*DB) DB

func (db *DB) DB() (*sql.DB, error)

func (*DB) GormDB

func (db *DB) GormDB() *gorm.DB

type EthClient

type EthClient struct {
}

func (*EthClient) BalanceAt

func (c *EthClient) BalanceAt(
	ctx context.Context,
	account common.Address,
	blockNumber *big.Int) (*big.Int, error)

func (*EthClient) BlockByHash

func (c *EthClient) BlockByHash(ctx context.Context, hash common.Hash) (*types.Block, error)

func (*EthClient) BlockByNumber

func (c *EthClient) BlockByNumber(ctx context.Context, number *big.Int) (*types.Block, error)

func (*EthClient) BlockNumber

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

func (*EthClient) ChainID

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

func (*EthClient) CodeAt

func (c *EthClient) CodeAt(ctx context.Context, account common.Address, blockNumber *big.Int) ([]byte, error)

func (*EthClient) EstimateGas

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

func (*EthClient) HeaderByHash

func (c *EthClient) HeaderByHash(ctx context.Context, hash common.Hash) (*types.Header, error)

func (*EthClient) HeaderByNumber

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

func (*EthClient) PendingNonceAt

func (c *EthClient) PendingNonceAt(ctx context.Context, account common.Address) (uint64, error)

func (*EthClient) SubscribeNewHead

func (c *EthClient) SubscribeNewHead(ctx context.Context, ch chan<- *types.Header) (ethereum.Subscription, error)

func (*EthClient) SuggestGasPrice

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

func (*EthClient) SuggestGasTipCap

func (c *EthClient) SuggestGasTipCap(ctx context.Context) (*big.Int, error)

func (*EthClient) TransactionByHash

func (c *EthClient) TransactionByHash(ctx context.Context, hash common.Hash) (*types.Transaction, bool, error)

func (*EthClient) TransactionReceipt

func (c *EthClient) TransactionReceipt(ctx context.Context, txHash common.Hash) (*types.Receipt, error)

func (*EthClient) TransactionSender

func (c *EthClient) TransactionSender(ctx context.Context, tx *types.Transaction, blockHash common.Hash, txIndex uint) (common.Address, error)

nolint: lll

type EventRepository

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

func NewEventRepository

func NewEventRepository() *EventRepository

func (*EventRepository) ChainDataSyncedEventByBlockNumberOrGreater

func (r *EventRepository) ChainDataSyncedEventByBlockNumberOrGreater(
	ctx context.Context,
	srcChainId uint64,
	syncedChainId uint64,
	blockNumber uint64,
) (*relayer.Event, error)

func (*EventRepository) Close

func (r *EventRepository) Close() error

func (*EventRepository) Delete

func (r *EventRepository) Delete(
	ctx context.Context,
	id int,
) error

func (*EventRepository) DeleteAllAfterBlockID

func (r *EventRepository) DeleteAllAfterBlockID(blockID uint64, srcChainID uint64, destChainID uint64) error

DeleteAllAfterBlockID is used when a reorg is detected

func (*EventRepository) FindAllByAddress

func (r *EventRepository) FindAllByAddress(
	ctx context.Context,
	req *http.Request,
	opts relayer.FindAllByAddressOpts,
) (*paginate.Page, error)

func (*EventRepository) FindLatestBlockID

func (r *EventRepository) FindLatestBlockID(
	ctx context.Context,
	event string,
	srcChainID uint64,
	destChainID uint64,
) (uint64, error)

GetLatestBlockID get latest block id

func (*EventRepository) FirstByEventAndMsgHash

func (r *EventRepository) FirstByEventAndMsgHash(
	ctx context.Context,
	event string,
	msgHash string,
) (*relayer.Event, error)

func (*EventRepository) FirstByMsgHash

func (r *EventRepository) FirstByMsgHash(
	ctx context.Context,
	msgHash string,
) (*relayer.Event, error)

func (*EventRepository) LatestChainDataSyncedEvent

func (r *EventRepository) LatestChainDataSyncedEvent(
	ctx context.Context,
	srcChainId uint64,
	syncedChainId uint64,
) (uint64, error)

func (*EventRepository) Save

func (*EventRepository) UpdateFeesAndProfitability

func (r *EventRepository) UpdateFeesAndProfitability(
	ctx context.Context,
	id int, opts *relayer.UpdateFeesAndProfitabilityOpts,
) error

func (*EventRepository) UpdateStatus

func (r *EventRepository) UpdateStatus(ctx context.Context, id int, status relayer.EventStatus) error

type Queue

type Queue struct {
}

func (*Queue) Ack

func (r *Queue) Ack(ctx context.Context, msg queue.Message) error

func (*Queue) Close

func (r *Queue) Close(ctx context.Context)

func (*Queue) Nack

func (r *Queue) Nack(ctx context.Context, msg queue.Message, requeue bool) error

func (*Queue) Notify

func (r *Queue) Notify(ctx context.Context, wg *sync.WaitGroup) error

func (*Queue) Publish

func (r *Queue) Publish(
	ctx context.Context,
	queueName string,
	msg []byte,
	headers map[string]interface{},
	expiration *string,
) error

func (*Queue) Start

func (r *Queue) Start(ctx context.Context, queueName string) error

func (*Queue) Subscribe

func (r *Queue) Subscribe(
	ctx context.Context,
	msgChan chan<- queue.Message,
	wg *sync.WaitGroup,
) error

type QuotaManager

type QuotaManager struct {
}

func (*QuotaManager) AvailableQuota

func (q *QuotaManager) AvailableQuota(opts *bind.CallOpts, _token common.Address, _leap *big.Int) (*big.Int, error)

func (*QuotaManager) QuotaPeriod

func (q *QuotaManager) QuotaPeriod(opts *bind.CallOpts) (*big.Int, error)

type SignalService

type SignalService struct {
}

func (*SignalService) FilterChainDataSynced

func (s *SignalService) FilterChainDataSynced(
	opts *bind.FilterOpts,
	chainid []uint64,
	blockId []uint64,
	kind [][32]byte,
) (*signalservice.SignalServiceChainDataSyncedIterator, error)

func (*SignalService) GetSignalSlot

func (s *SignalService) GetSignalSlot(
	opts *bind.CallOpts,
	_chainId uint64,
	_app common.Address,
	_signal [32]byte,
) ([32]byte, error)

func (*SignalService) GetSyncedChainData

func (s *SignalService) GetSyncedChainData(
	opts *bind.CallOpts,
	_chainId uint64,
	_kind [32]byte,
	_blockId uint64,
) (struct {
	BlockId   uint64
	ChainData [32]byte
}, error)

type Subscription

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

func (*Subscription) Err

func (s *Subscription) Err() <-chan error

func (*Subscription) Unsubscribe

func (s *Subscription) Unsubscribe()

type TokenVault

type TokenVault struct {
}

func (*TokenVault) CanonicalToBridged

func (t *TokenVault) CanonicalToBridged(
	opts *bind.CallOpts,
	chainID *big.Int,
	canonicalAddress common.Address,
) (common.Address, error)

type TxManager

type TxManager struct {
}

func (*TxManager) BlockNumber

func (t *TxManager) BlockNumber(ctx context.Context) (uint64, error)

BlockNumber returns the most recent block number from the underlying network.

func (*TxManager) Close

func (t *TxManager) Close()

Close the underlying connection

func (*TxManager) From

func (t *TxManager) From() common.Address

From returns the sending address associated with the instance of the transaction manager. It is static for a single instance of a TxManager.

func (*TxManager) IsClosed

func (t *TxManager) IsClosed() bool

func (*TxManager) Send

func (t *TxManager) Send(ctx context.Context, candidate txmgr.TxCandidate) (*types.Receipt, error)

Jump to

Keyboard shortcuts

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