biz

package
v0.0.0-...-a308a5f Latest Latest
Warning

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

Go to latest
Published: May 14, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const KEYSTORE_DIR = "%LocalAppData%\\Ethereum\\keystore" // TODO: Change with host os
View Source
const MY_PUBLIC_ADDRESS = "0x929548598a3b93362c5aa2a24de190d18e657ae0"
View Source
const PASSWORD = "P@ssw0rd" // TODO: Remove
View Source
const RECIPIENT_ADDRESS = "0xb02A2EdA1b317FBd16760128836B0Ac59B560e91"

Variables

View Source
var (
	// ErrUserNotFound is user not found.
	ErrUserNotFound = errors.NotFound(v1.ErrorReason_USER_NOT_FOUND.String(), "user not found")
)

ProviderSet is biz providers.

Functions

This section is empty.

Types

type AccountBalance

type AccountBalance struct {
	Account        string
	Balance        *big.Int
	PendingBalance *big.Int
}

type Greeter

type Greeter struct {
	Hello string
}

Greeter is a Greeter model.

type GreeterRepo

type GreeterRepo interface {
	Save(context.Context, *Greeter) (*Greeter, error)
	Update(context.Context, *Greeter) (*Greeter, error)
	FindByID(context.Context, int64) (*Greeter, error)
	ListByHello(context.Context, string) ([]*Greeter, error)
	ListAll(context.Context) ([]*Greeter, error)
}

GreeterRepo is a Greater repo.

type GreeterUsecase

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

GreeterUsecase is a Greeter usecase.

func NewGreeterUsecase

func NewGreeterUsecase(repo GreeterRepo, logger log.Logger) *GreeterUsecase

NewGreeterUsecase new a Greeter usecase.

func (*GreeterUsecase) CreateGreeter

func (uc *GreeterUsecase) CreateGreeter(ctx context.Context, g *Greeter) (*Greeter, error)

CreateGreeter creates a Greeter, and returns the new Greeter.

type KeystoreRepo

type KeystoreRepo interface {
	HasAddress(string) bool
	SignTransaction(accounts.Account, *types.Transaction, *big.Int) (*types.Transaction, error)
	SecretKeyOf(string, string) (string, error)
	Unlock(accounts.Account, string) error
}

type SendTransaction

type SendTransaction struct {
	SenderAccount string
	Password      string
	Recipient     string
	Amount        *big.Int
}

type TransactionResult

type TransactionResult struct {
	TransactionHash string
}

type TxCost

type TxCost struct {
	IsPending bool
	TxCost    string
}

type WalletUsecase

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

func NewWalletUsecase

func NewWalletUsecase(repo KeystoreRepo, logger log.Logger, cl *ethclient.Client) *WalletUsecase

func (*WalletUsecase) ReadBalance

func (s *WalletUsecase) ReadBalance(accountAddress string) (*AccountBalance, error)

Prints the balance of an account

func (*WalletUsecase) SendTransaction

func (s *WalletUsecase) SendTransaction(ctx context.Context, sendTx *SendTransaction) (*TransactionResult, error)

func (*WalletUsecase) SuggestGasPrice

func (s *WalletUsecase) SuggestGasPrice(ctx context.Context) (string, error)

func (*WalletUsecase) TransferAll

func (s *WalletUsecase) TransferAll(ctx context.Context, sendTx *SendTransaction) (*TransactionResult, error)

func (*WalletUsecase) TxCost

func (s *WalletUsecase) TxCost(ctx context.Context, txHashStr string) (*TxCost, error)

Jump to

Keyboard shortcuts

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