clients

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Mar 24, 2026 License: MIT Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Retry

func Retry(timeout time.Duration, f func() error) error

func RetryCtx

func RetryCtx(ctx context.Context, timeout time.Duration, f func() error) error

Types

type GRPCClient

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

func NewGRPCClient

func NewGRPCClient(t *testing.T, impl Implementation, port string) *GRPCClient

func (*GRPCClient) Close

func (c *GRPCClient) Close(t testing.TB)

func (*GRPCClient) GetAddressByAlias

func (c *GRPCClient) GetAddressByAlias(t *testing.T, alias string) []byte

func (*GRPCClient) GetAssetBalance

func (c *GRPCClient) GetAssetBalance(t *testing.T, address proto.WavesAddress, id []byte) *waves.Amount

func (*GRPCClient) GetAssetsInfo

func (c *GRPCClient) GetAssetsInfo(t *testing.T, id []byte) *g.AssetInfoResponse

func (*GRPCClient) GetBlock

func (c *GRPCClient) GetBlock(t *testing.T, height uint64) *g.BlockWithHeight

func (*GRPCClient) GetDataEntries

func (c *GRPCClient) GetDataEntries(t *testing.T, address proto.WavesAddress) []*waves.DataEntry

GetDataEntries returns all data entries for account.

func (*GRPCClient) GetDataEntryByKey

func (c *GRPCClient) GetDataEntryByKey(t *testing.T, address proto.WavesAddress, key string) *waves.DataEntry

GetDataEntryByKey return data entries for account by key.

func (*GRPCClient) GetFeatureActivationStatusInfo

func (c *GRPCClient) GetFeatureActivationStatusInfo(t *testing.T, h int32) *g.ActivationStatusResponse

func (*GRPCClient) GetHeight

func (c *GRPCClient) GetHeight(t *testing.T) *client.BlocksHeight

func (*GRPCClient) GetTransactionsStatuses

func (c *GRPCClient) GetTransactionsStatuses(t *testing.T, txIDs []crypto.Digest) []*g.TransactionStatus

func (*GRPCClient) GetWavesBalance

func (c *GRPCClient) GetWavesBalance(t *testing.T, address proto.WavesAddress) *g.BalanceResponse_WavesBalances

type HTTPClient

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

func NewHTTPClient

func NewHTTPClient(t testing.TB, impl Implementation, port string) *HTTPClient

func (*HTTPClient) AssetBalance

func (c *HTTPClient) AssetBalance(
	t testing.TB, address proto.WavesAddress, assetID crypto.Digest,
) *client.AssetsBalanceAndAsset

func (*HTTPClient) BlockFinalized

func (c *HTTPClient) BlockFinalized(t testing.TB) *proto.BlockHeader

func (*HTTPClient) BlockHeader

func (c *HTTPClient) BlockHeader(t testing.TB, height proto.Height) *client.Headers

func (*HTTPClient) CommitmentGeneratorsAt

func (c *HTTPClient) CommitmentGeneratorsAt(t testing.TB, height proto.Height) []client.GeneratorInfoResponse

func (*HTTPClient) ConnectedPeers

func (c *HTTPClient) ConnectedPeers() ([]*client.PeersConnectedRow, *client.Response, error)

func (*HTTPClient) ConnectedPeersCtx

func (c *HTTPClient) ConnectedPeersCtx(ctx context.Context) ([]*client.PeersConnectedRow, *client.Response, error)

func (*HTTPClient) GetAssetDetails

func (c *HTTPClient) GetAssetDetails(assetID crypto.Digest) (*client.AssetsDetail, error)

func (*HTTPClient) GetHeight

func (c *HTTPClient) GetHeight(t testing.TB, opts ...config.WaitOption) *client.BlocksHeight

func (*HTTPClient) HeightFinalized

func (c *HTTPClient) HeightFinalized(t testing.TB) proto.Height

func (*HTTPClient) PrintMsg

func (c *HTTPClient) PrintMsg(t testing.TB, msg string)

func (*HTTPClient) Rewards

func (c *HTTPClient) Rewards(t testing.TB) *client.RewardInfo

func (*HTTPClient) RewardsAtHeight

func (c *HTTPClient) RewardsAtHeight(t testing.TB, height proto.Height) *client.RewardInfo

func (*HTTPClient) RollbackToHeight

func (c *HTTPClient) RollbackToHeight(t testing.TB, height uint64, returnTxToUtx bool) *proto.BlockID

func (*HTTPClient) SignCommit

func (*HTTPClient) StateHash

func (c *HTTPClient) StateHash(t testing.TB, height uint64, opts ...config.WaitOption) proto.StateHash

func (*HTTPClient) TransactionBroadcast

func (c *HTTPClient) TransactionBroadcast(transaction proto.Transaction) (*client.Response, error)

func (*HTTPClient) TransactionInfo

func (c *HTTPClient) TransactionInfo(t testing.TB, id crypto.Digest) proto.Transaction

func (*HTTPClient) TransactionInfoRaw

func (c *HTTPClient) TransactionInfoRaw(id crypto.Digest) (proto.Transaction, *client.Response, error)

func (*HTTPClient) WavesBalance

func (c *HTTPClient) WavesBalance(t testing.TB, address proto.WavesAddress) *client.AddressesBalance

type Implementation

type Implementation byte
const (
	NodeGo Implementation = iota
	NodeScala
)

func (Implementation) String

func (i Implementation) String() string

type NetClient

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

func NewNetClient

func NewNetClient(
	ctx context.Context, t testing.TB, impl Implementation, address string, peers []proto.PeerInfo,
) *NetClient

NewNetClient creates a new NetClient instance that connects to the specified Waves node. It establishes a TCP connection to given address. Parameter peers is a list of peer information that the client will use to respond to GetPeersMessage requests.

func (*NetClient) AwaitGetBlockMessage

func (c *NetClient) AwaitGetBlockMessage(timeout time.Duration) (proto.BlockID, error)

AwaitGetBlockMessage waits for a GetBlockMessage from the node for the specified timeout and returns the requested block ID.

func (*NetClient) AwaitMessage

func (c *NetClient) AwaitMessage(messageType reflect.Type, timeout time.Duration) (proto.Message, error)

AwaitMessage waits for a message from the node for the specified timeout.

func (*NetClient) AwaitMicroblockRequest

func (c *NetClient) AwaitMicroblockRequest(timeout time.Duration) (proto.BlockID, error)

AwaitMicroblockRequest waits for a MicroBlockRequestMessage from the node for the specified timeout and returns the received block ID.

func (*NetClient) AwaitScoreMessage

func (c *NetClient) AwaitScoreMessage(timeout time.Duration) (*big.Int, error)

AwaitScoreMessage waits for a ScoreMessage from the node for the specified timeout and returns the received score.

func (*NetClient) Close

func (c *NetClient) Close()

func (*NetClient) SendHandshake

func (c *NetClient) SendHandshake()

func (*NetClient) SendMessage

func (c *NetClient) SendMessage(m proto.Message)

func (*NetClient) SubscribeForMessages

func (c *NetClient) SubscribeForMessages(messageType ...reflect.Type) error

SubscribeForMessages adds specified types to the message waiting queue. Once the awaited message received the corresponding type is removed from the queue.

type NodeUniversalClient

type NodeUniversalClient struct {
	Implementation Implementation
	HTTPClient     *HTTPClient
	GRPCClient     *GRPCClient
	Connection     *NetClient
}

func NewNodeUniversalClient

func NewNodeUniversalClient(
	ctx context.Context, t *testing.T, impl Implementation, httpPort, grpcPort, netAddress string, peers []proto.PeerInfo,
) *NodeUniversalClient

func (*NodeUniversalClient) Close

func (c *NodeUniversalClient) Close(t testing.TB)

func (*NodeUniversalClient) Handshake

func (c *NodeUniversalClient) Handshake()

func (*NodeUniversalClient) SendEndMessage

func (c *NodeUniversalClient) SendEndMessage(t *testing.T)

func (*NodeUniversalClient) SendStartMessage

func (c *NodeUniversalClient) SendStartMessage(t *testing.T)

func (*NodeUniversalClient) WaitForHeight

func (c *NodeUniversalClient) WaitForHeight(t testing.TB, height uint64, opts ...config.WaitOption) uint64

func (*NodeUniversalClient) WaitForTransaction

func (c *NodeUniversalClient) WaitForTransaction(t testing.TB, id crypto.Digest, opts ...config.WaitOption)

type NodesClients

type NodesClients struct {
	GoClient    *NodeUniversalClient
	ScalaClient *NodeUniversalClient
}

func NewNodesClients

func NewNodesClients(
	ctx context.Context, t *testing.T, goIP, scalaIP string, goPorts, scalaPorts *d.PortConfig,
) *NodesClients

func (*NodesClients) BroadcastToGoNode

func (c *NodesClients) BroadcastToGoNode(t *testing.T, tx proto.Transaction) (*client.Response, error)

func (*NodesClients) BroadcastToNodes

func (c *NodesClients) BroadcastToNodes(t *testing.T, tx proto.Transaction,
	nodes []Implementation) (*client.Response, error, *client.Response, error)

func (*NodesClients) BroadcastToScalaNode

func (c *NodesClients) BroadcastToScalaNode(t *testing.T, tx proto.Transaction) (*client.Response, error)

func (*NodesClients) Close

func (c *NodesClients) Close(t *testing.T)

func (*NodesClients) GetMinNodesHeight

func (c *NodesClients) GetMinNodesHeight(t *testing.T) uint64

func (*NodesClients) Handshake

func (c *NodesClients) Handshake()

func (*NodesClients) SendEndMessage

func (c *NodesClients) SendEndMessage(t *testing.T)

func (*NodesClients) SendStartMessage

func (c *NodesClients) SendStartMessage(t *testing.T)

func (*NodesClients) SendToGoNode

func (c *NodesClients) SendToGoNode(t *testing.T, m proto.Message)

func (*NodesClients) SendToNodes

func (c *NodesClients) SendToNodes(t *testing.T, m proto.Message, nodes []Implementation)

func (*NodesClients) SendToScalaNode

func (c *NodesClients) SendToScalaNode(t *testing.T, m proto.Message)

func (*NodesClients) StateHashCmp

func (c *NodesClients) StateHashCmp(t *testing.T, height uint64) (proto.StateHash, proto.StateHash, bool)

func (*NodesClients) SynchronizedWavesBalances

func (c *NodesClients) SynchronizedWavesBalances(
	t *testing.T, addresses ...proto.WavesAddress,
) SynchronisedBalances

func (*NodesClients) WaitForConnectedPeers

func (c *NodesClients) WaitForConnectedPeers(ctx context.Context, timeout time.Duration) error

func (*NodesClients) WaitForHeight

func (c *NodesClients) WaitForHeight(t *testing.T, height uint64, opts ...config.WaitOption) uint64

WaitForHeight waits for nodes to get on given height. Exits if nodes' height already equal or greater than requested. Function returns actual nodes' height.

func (*NodesClients) WaitForNewHeight

func (c *NodesClients) WaitForNewHeight(t *testing.T) uint64

WaitForNewHeight waits for nodes to generate new block. Returns the height that was *before* generation of new block.

func (*NodesClients) WaitForStateHashEquality

func (c *NodesClients) WaitForStateHashEquality(t *testing.T)

func (*NodesClients) WaitForTransaction

func (c *NodesClients) WaitForTransaction(id crypto.Digest, timeout time.Duration) (error, error)

type NodesWavesBalance

type NodesWavesBalance struct {
	GoBalance    int64
	ScalaBalance int64
}

func (*NodesWavesBalance) Add

type NodesWavesBalanceAtHeight

type NodesWavesBalanceAtHeight struct {
	Balance NodesWavesBalance
	Height  proto.Height
}

type SynchronisedBalances

type SynchronisedBalances struct {
	Height proto.Height
	// contains filtered or unexported fields
}

SynchronisedBalances is a struct that contains BalanceInWaves of addresses and the height at which they were received.

func NewSynchronisedBalances

func NewSynchronisedBalances() SynchronisedBalances

func (*SynchronisedBalances) GetByAccountInfo

func (b *SynchronisedBalances) GetByAccountInfo(accountInfo *config.AccountInfo) NodesWavesBalance

func (*SynchronisedBalances) Put

func (b *SynchronisedBalances) Put(address proto.WavesAddress, balance NodesWavesBalance)

Jump to

Keyboard shortcuts

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