biz

package
v0.0.0-...-7230577 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2022 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

ProviderSet is service providers.

Functions

This section is empty.

Types

type TronCli

type TronCli struct {
	Conn          *grpc.ClientConn
	TronWalletCli trxapi.WalletClient
	ApiKey        string
	GrpcTimeout   time.Duration
}

func NewTronCli

func NewTronCli() *TronCli

func (TronCli) GetBalance

func (c TronCli) GetBalance(ctx context.Context, addr string) (*big.Int, error)

func (TronCli) GetTRC20TokenBalance

func (c TronCli) GetTRC20TokenBalance(ctx context.Context, from, contractAddr string) (*big.Int, error)

func (*TronCli) ParseTRC20NumericProperty

func (c *TronCli) ParseTRC20NumericProperty(data string) (*big.Int, error)

ParseTRC20NumericProperty get number from data

func (*TronCli) ParseTRC20StringProperty

func (g *TronCli) ParseTRC20StringProperty(data string) (string, error)

ParseTRC20StringProperty get string from data

func (*TronCli) SetAPIKey

func (c *TronCli) SetAPIKey(apiKey string) error

SetAPIKey enable API on connection

func (*TronCli) SetTimeout

func (c *TronCli) SetTimeout(timeout time.Duration)

SetTimeout for Client connections

func (*TronCli) Stop

func (t *TronCli) Stop()

func (*TronCli) TRC20Call

func (c *TronCli) TRC20Call(from, contractAddress, data string, constant bool, feeLimit int64) (*api.TransactionExtention, error)

TRC20Call make cosntant calll

func (*TronCli) TRC20ContractBalance

func (c *TronCli) TRC20ContractBalance(addr, contractAddress string) (*big.Int, error)

TRC20ContractBalance get Address balance

func (*TronCli) TRC20GetDecimals

func (c *TronCli) TRC20GetDecimals(contractAddress string) (*big.Int, error)

TRC20GetDecimals get contract decimals

func (*TronCli) TRC20GetName

func (c *TronCli) TRC20GetName(contractAddress string) (string, error)

TRC20GetName get token name

func (*TronCli) TRC20GetSymbol

func (c *TronCli) TRC20GetSymbol(contractAddress string) (string, error)

TRC20GetSymbol get contract symbol

func (*TronCli) TRC20Send

func (c *TronCli) TRC20Send(from, to, contract string, amount *big.Int, feeLimit int64) (*api.TransactionExtention, error)

TRC20Send send toke to address

func (*TronCli) TriggerConstantContract

func (c *TronCli) TriggerConstantContract(from, contractAddress, method, jsonString string) (*api.TransactionExtention, error)

TriggerConstantContract and return tx result

func (*TronCli) TriggerContract

func (c *TronCli) TriggerContract(from, contractAddress, method, jsonString string,
	feeLimit, tAmount int64, tTokenID string, tTokenAmount int64) (*api.TransactionExtention, error)

TriggerContract and return tx result

func (*TronCli) UpdateHash

func (c *TronCli) UpdateHash(tx *api.TransactionExtention) error

UpdateHash after local changes

type TrxRepo

type TrxRepo interface {
	ListTransactions(ctx context.Context, addr, token string, pageNum, pageSize, queryType int) ([]interface{}, int, error)
}

TrxRepo is a trx repo.

type TrxUsecase

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

func NewTrxUsecase

func NewTrxUsecase(repo TrxRepo, logger *zap.Logger, cli *TronCli) *TrxUsecase

NewTrxUsecase new a Trx usecase.

func (*TrxUsecase) GetBalance

func (t *TrxUsecase) GetBalance(ctx context.Context, addr string) (*big.Int, error)

func (*TrxUsecase) GetTRC20TokenBalance

func (t *TrxUsecase) GetTRC20TokenBalance(ctx context.Context, addr, contractAddr string) (*big.Int, error)

Jump to

Keyboard shortcuts

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