mock

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2025 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package mock provides mock implementations for blockchain components.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type MockBlockchainClient

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

MockBlockchainClient is a mock implementation of blockchain.Client for testing.

func NewMockBlockchainClient

func NewMockBlockchainClient() *MockBlockchainClient

NewMockBlockchainClient creates a new instance of the mock blockchain client.

func (*MockBlockchainClient) CreateTransaction

func (m *MockBlockchainClient) CreateTransaction(ctx context.Context, params blockchain.TransactionParams) (string, error)

CreateTransaction creates a mock transaction.

func (*MockBlockchainClient) GetBalance

func (m *MockBlockchainClient) GetBalance(ctx context.Context, address string, assetID string) (string, error)

GetBalance gets a mock token balance.

func (*MockBlockchainClient) GetBlockCount

func (m *MockBlockchainClient) GetBlockCount(ctx context.Context) (int, error)

GetBlockCount returns the mock block count.

func (*MockBlockchainClient) GetStorage

func (m *MockBlockchainClient) GetStorage(ctx context.Context, scriptHash string, key string) (string, error)

GetStorage gets mock contract storage.

func (*MockBlockchainClient) GetTransaction

func (m *MockBlockchainClient) GetTransaction(ctx context.Context, txid string) (blockchain.Transaction, error)

GetTransaction gets a mock transaction.

func (*MockBlockchainClient) InvokeFunction

func (m *MockBlockchainClient) InvokeFunction(ctx context.Context, scriptHash, operation string, params []interface{}) (blockchain.InvocationResult, error)

InvokeFunction invokes a contract method on the blockchain (mock implementation).

func (*MockBlockchainClient) SendTransaction

func (m *MockBlockchainClient) SendTransaction(ctx context.Context, signedTx string) (string, error)

SendTransaction sends a mock transaction.

func (*MockBlockchainClient) SetBlockCount

func (m *MockBlockchainClient) SetBlockCount(count int)

SetBlockCount sets the mock block count to return.

func (*MockBlockchainClient) SetBlockCountDelay

func (m *MockBlockchainClient) SetBlockCountDelay(delay time.Duration)

SetBlockCountDelay sets a delay for the GetBlockCount method.

func (*MockBlockchainClient) SetInvokeFunctionResponse

func (m *MockBlockchainClient) SetInvokeFunctionResponse(scriptHash, operation string, stack []interface{})

SetInvokeFunctionResponse sets a mock response for a specific contract and operation.

func (*MockBlockchainClient) SetSendTransactionResponse

func (m *MockBlockchainClient) SetSendTransactionResponse(txid string)

SetSendTransactionResponse sets a mock response for sending a transaction.

func (*MockBlockchainClient) SignTransaction

func (m *MockBlockchainClient) SignTransaction(ctx context.Context, tx string, privateKey string) (string, error)

SignTransaction signs a mock transaction.

Jump to

Keyboard shortcuts

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