userwallet

package
v0.24.5 Latest Latest
Warning

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

Go to latest
Published: Jun 4, 2024 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AuthClientUser added in v0.22.1

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

AuthClientUser is a test user that uses the auth client to talk to directly to a node Note: AuthClientUser is **not** thread-safe for a single wallet (creates nonce conflicts etc.)

func NewUserWallet

func NewUserWallet(wal wallet.Wallet, rpcEndpoint string, logger gethlog.Logger) *AuthClientUser

func (*AuthClientUser) AwaitReceipt added in v0.22.1

func (s *AuthClientUser) AwaitReceipt(ctx context.Context, txHash *gethcommon.Hash) (*types.Receipt, error)

func (*AuthClientUser) EnsureClientSetup added in v0.22.1

func (s *AuthClientUser) EnsureClientSetup(ctx context.Context) error

EnsureClientSetup creates an authenticated RPC client (with a viewing key generated, signed and registered) when first called Also fetches current nonce value.

func (*AuthClientUser) Init added in v0.22.1

Init forces VK setup: currently the faucet http server requires a viewing key for a wallet to even *receive* funds :(

func (*AuthClientUser) NativeBalance added in v0.22.1

func (s *AuthClientUser) NativeBalance(ctx context.Context) (*big.Int, error)

func (*AuthClientUser) SendFunds added in v0.22.1

func (s *AuthClientUser) SendFunds(ctx context.Context, addr gethcommon.Address, value *big.Int) (*gethcommon.Hash, error)

func (*AuthClientUser) SendTransaction added in v0.22.1

func (s *AuthClientUser) SendTransaction(ctx context.Context, tx types.TxData) (*gethcommon.Hash, error)

func (*AuthClientUser) Wallet added in v0.22.1

func (s *AuthClientUser) Wallet() wallet.Wallet

type GatewayUser added in v0.22.1

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

func NewGatewayUser added in v0.22.1

func NewGatewayUser(wal wallet.Wallet, gatewayURL string, gatewayWSURL string, logger gethlog.Logger) (*GatewayUser, error)

func (*GatewayUser) AwaitReceipt added in v0.22.1

func (g *GatewayUser) AwaitReceipt(ctx context.Context, txHash *gethcommon.Hash) (*types.Receipt, error)

func (*GatewayUser) Client added in v0.24.2

func (g *GatewayUser) Client() *ethclient.Client

func (*GatewayUser) NativeBalance added in v0.22.1

func (g *GatewayUser) NativeBalance(ctx context.Context) (*big.Int, error)

func (*GatewayUser) SendFunds added in v0.22.1

func (g *GatewayUser) SendFunds(ctx context.Context, addr gethcommon.Address, value *big.Int) (*gethcommon.Hash, error)

func (*GatewayUser) WSClient added in v0.24.1

func (g *GatewayUser) WSClient() (*ethclient.Client, error)

func (*GatewayUser) Wallet added in v0.22.1

func (g *GatewayUser) Wallet() wallet.Wallet

type User added in v0.22.1

type User interface {
	Wallet() wallet.Wallet
	SendFunds(ctx context.Context, addr gethcommon.Address, value *big.Int) (*gethcommon.Hash, error)
	AwaitReceipt(ctx context.Context, txHash *gethcommon.Hash) (*types.Receipt, error)
	NativeBalance(ctx context.Context) (*big.Int, error)
}

User - abstraction for networktest users - two implementations initially: 1. AuthClientUser - a user that uses the auth client to talk to the network 2. GatewayUser - a user that uses the gateway to talk to the network

This abstraction allows us to use the same tests for both types of users

Jump to

Keyboard shortcuts

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