client

package
v0.0.0-...-753aa41 Latest Latest
Warning

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

Go to latest
Published: May 19, 2023 License: LGPL-3.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetMessageBytes

func GetMessageBytes(m []byte) *api.BytesMessage

GetMessageBytes return grpc message from bytes

func GetMessageNumber

func GetMessageNumber(n int64) *api.NumberMessage

GetMessageNumber return grpc message number

func GetPaginatedMessage

func GetPaginatedMessage(offset int64, limit int64) *api.PaginatedMessage

GetPaginatedMessage return grpc message number

Types

type GrpcClient

type GrpcClient struct {
	Address string
	Conn    *grpc.ClientConn
	Client  api.WalletClient
	// contains filtered or unexported fields
}

GrpcClient controller structure

func NewGrpcClient

func NewGrpcClient(address string) *GrpcClient

NewGrpcClient create grpc controller

func NewGrpcClientWithTimeout

func NewGrpcClientWithTimeout(address string, timeout time.Duration) *GrpcClient

NewGrpcClientWithTimeout create grpc controller

func (*GrpcClient) AssetIssue

func (g *GrpcClient) AssetIssue(from, name, description, abbr, urlStr string,
	precision int32, totalSupply, startTime, endTime, FreeAssetNetLimit, PublicFreeAssetNetLimit int64,
	trxNum, icoNum, voteScore int32, frozenSupply map[string]string) (*api.TransactionExtention, error)

AssetIssue create a new asset TRC10

func (*GrpcClient) Broadcast

func (g *GrpcClient) Broadcast(tx *core.Transaction) (*api.Return, error)

Broadcast broadcast TX

func (*GrpcClient) CreateAccount

func (g *GrpcClient) CreateAccount(from, addr string) (*api.TransactionExtention, error)

CreateAccount activate tron account

func (*GrpcClient) CreateWitness

func (g *GrpcClient) CreateWitness(from, urlStr string) (*api.TransactionExtention, error)

CreateWitness upgrade account to network witness

func (*GrpcClient) DeployContract

func (g *GrpcClient) DeployContract(from, contractName string,
	abi *core.SmartContract_ABI, codeStr string,
	feeLimit, curPercent, oeLimit int64,
) (*api.TransactionExtention, error)

DeployContract and return tx result

func (*GrpcClient) ExchangeByID

func (g *GrpcClient) ExchangeByID(id int64) (*core.Exchange, error)

ExchangeByID returns exchangeDetails

func (*GrpcClient) ExchangeCreate

func (g *GrpcClient) ExchangeCreate(
	from string,
	tokenID1 string,
	amountToken1 int64,
	tokenID2 string,
	amountToken2 int64,
) (*api.TransactionExtention, error)

ExchangeCreate from two tokens (TRC10/TRX) only

func (*GrpcClient) ExchangeInject

func (g *GrpcClient) ExchangeInject(
	from string,
	exchangeID int64,
	tokenID string,
	amountToken int64,
) (*api.TransactionExtention, error)

ExchangeInject both tokens into banco pair (the second token is taken info transaction process)

func (*GrpcClient) ExchangeList

func (g *GrpcClient) ExchangeList(page int64, limit ...int) (*api.ExchangeList, error)

ExchangeList of bancor TRC10, use page -1 to list all

func (*GrpcClient) ExchangeTrade

func (g *GrpcClient) ExchangeTrade(
	from string,
	exchangeID int64,
	tokenID string,
	amountToken int64,
	amountExpected int64,
) (*api.TransactionExtention, error)

ExchangeTrade on bancor TRC10

func (*GrpcClient) ExchangeWithdraw

func (g *GrpcClient) ExchangeWithdraw(
	from string,
	exchangeID int64,
	tokenID string,
	amountToken int64,
) (*api.TransactionExtention, error)

ExchangeWithdraw both tokens into banco pair (the second token is taken info transaction process)

func (*GrpcClient) FreezeBalance

func (g *GrpcClient) FreezeBalance(from, delegateTo string,
	resource core.ResourceCode, frozenBalance int64) (*api.TransactionExtention, error)

FreezeBalance from base58 address

func (*GrpcClient) GetAccount

func (g *GrpcClient) GetAccount(addr string) (*core.Account, error)

GetAccount from BASE58 address

func (*GrpcClient) GetAccountDetailed

func (g *GrpcClient) GetAccountDetailed(addr string) (*account.Account, error)

GetAccountDetailed from BASE58 address

func (*GrpcClient) GetAccountNet

func (g *GrpcClient) GetAccountNet(addr string) (*api.AccountNetMessage, error)

GetAccountNet return account resources from BASE58 address

func (*GrpcClient) GetAccountResource

func (g *GrpcClient) GetAccountResource(addr string) (*api.AccountResourceMessage, error)

GetAccountResource from BASE58 address

func (*GrpcClient) GetAssetIssueByAccount

func (g *GrpcClient) GetAssetIssueByAccount(address string) (*api.AssetIssueList, error)

GetAssetIssueByAccount list asset issued by account

func (*GrpcClient) GetAssetIssueByID

func (g *GrpcClient) GetAssetIssueByID(tokenID string) (*core.AssetIssueContract, error)

GetAssetIssueByID list asset issued by ID

func (*GrpcClient) GetAssetIssueByName

func (g *GrpcClient) GetAssetIssueByName(name string) (*core.AssetIssueContract, error)

GetAssetIssueByName list asset issued by name

func (*GrpcClient) GetAssetIssueList

func (g *GrpcClient) GetAssetIssueList(page int64, limit ...int) (*api.AssetIssueList, error)

GetAssetIssueList list all TRC10

func (*GrpcClient) GetBlockByID

func (g *GrpcClient) GetBlockByID(id string) (*core.Block, error)

GetBlockByID block from hash

func (*GrpcClient) GetBlockByLatestNum

func (g *GrpcClient) GetBlockByLatestNum(num int64) (*api.BlockListExtention, error)

GetBlockByLatestNum return block list till num

func (*GrpcClient) GetBlockByLimitNext

func (g *GrpcClient) GetBlockByLimitNext(start, end int64) (*api.BlockListExtention, error)

GetBlockByLimitNext return list of block start/end

func (*GrpcClient) GetBlockByNum

func (g *GrpcClient) GetBlockByNum(num int64) (*api.BlockExtention, error)

GetBlockByNum block from number

func (*GrpcClient) GetBlockInfoByNum

func (g *GrpcClient) GetBlockInfoByNum(num int64) (*api.TransactionInfoList, error)

GetBlockInfoByNum block from number

func (*GrpcClient) GetContractABI

func (g *GrpcClient) GetContractABI(contractAddress string) (*core.SmartContract_ABI, error)

GetContractABI return smartContract

func (*GrpcClient) GetDelegatedResources

func (g *GrpcClient) GetDelegatedResources(address string) ([]*api.DelegatedResourceList, error)

GetDelegatedResources from BASE58 address

func (*GrpcClient) GetNextMaintenanceTime

func (g *GrpcClient) GetNextMaintenanceTime() (*api.NumberMessage, error)

GetNextMaintenanceTime get next epoch timestamp

func (*GrpcClient) GetNodeInfo

func (g *GrpcClient) GetNodeInfo() (*core.NodeInfo, error)

GetNodeInfo current connection

func (*GrpcClient) GetNowBlock

func (g *GrpcClient) GetNowBlock() (*api.BlockExtention, error)

GetNowBlock return TIP block

func (*GrpcClient) GetRewardsInfo

func (g *GrpcClient) GetRewardsInfo(addr string) (int64, error)

GetRewardsInfo from BASE58 address

func (*GrpcClient) GetTransactionByID

func (g *GrpcClient) GetTransactionByID(id string) (*core.Transaction, error)

GetTransactionByID returns transaction details by ID

func (*GrpcClient) GetTransactionInfoByBlockNum

func (g *GrpcClient) GetTransactionInfoByBlockNum(num int64) (*api.TransactionInfoList, error)

GetTransactionInfoByBlockNum returns TransactionInfo data for all transactions contained in a specified block

func (*GrpcClient) GetTransactionInfoByID

func (g *GrpcClient) GetTransactionInfoByID(id string) (*core.TransactionInfo, error)

GetTransactionInfoByID returns transaction receipt by ID

func (*GrpcClient) GetWitnessBrokerage

func (g *GrpcClient) GetWitnessBrokerage(witness string) (float64, error)

GetWitnessBrokerage from witness address

func (*GrpcClient) ListNodes

func (g *GrpcClient) ListNodes() (*api.NodeList, error)

ListNodes provides list of network nodes

func (*GrpcClient) ListWitnesses

func (g *GrpcClient) ListWitnesses() (*api.WitnessList, error)

ListWitnesses return all witnesses

func (*GrpcClient) ParseTRC20NumericProperty

func (g *GrpcClient) ParseTRC20NumericProperty(data string) (*big.Int, error)

ParseTRC20NumericProperty get number from data

func (*GrpcClient) ParseTRC20StringProperty

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

ParseTRC20StringProperty get string from data

func (*GrpcClient) ParticipateAssetIssue

func (g *GrpcClient) ParticipateAssetIssue(from, issuerAddress,
	tokenID string, amount int64) (*api.TransactionExtention, error)

ParticipateAssetIssue TRC10 ICO

func (*GrpcClient) ProposalApprove

func (g *GrpcClient) ProposalApprove(from string, id int64, confirm bool) (*api.TransactionExtention, error)

ProposalApprove change URL info

func (*GrpcClient) ProposalCreate

func (g *GrpcClient) ProposalCreate(from string, parameters map[int64]int64) (*api.TransactionExtention, error)

ProposalCreate create proposal based on parameter list

func (*GrpcClient) ProposalWithdraw

func (g *GrpcClient) ProposalWithdraw(from string, id int64) (*api.TransactionExtention, error)

func (*GrpcClient) ProposalsList

func (g *GrpcClient) ProposalsList() (*api.ProposalList, error)

ProposalsList return all network proposals

func (*GrpcClient) Reconnect

func (g *GrpcClient) Reconnect(url string) error

Reconnect GRPC

func (*GrpcClient) SetAPIKey

func (g *GrpcClient) SetAPIKey(apiKey string) error

SetAPIKey enable API on connection

func (*GrpcClient) SetTimeout

func (g *GrpcClient) SetTimeout(timeout time.Duration)

SetTimeout for Client connections

func (*GrpcClient) Start

func (g *GrpcClient) Start(opts ...grpc.DialOption) error

Start initiate grpc connection

func (*GrpcClient) Stop

func (g *GrpcClient) Stop()

Stop GRPC Connection

func (*GrpcClient) TRC20Approve

func (g *GrpcClient) TRC20Approve(from, to, contract string, amount *big.Int, feeLimit int64) (*api.TransactionExtention, error)

TRC20Approve approve token to address

func (*GrpcClient) TRC20Call

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

TRC20Call make cosntant calll

func (*GrpcClient) TRC20ContractBalance

func (g *GrpcClient) TRC20ContractBalance(addr, contractAddress string) (*big.Int, error)

TRC20ContractBalance get Address balance

func (*GrpcClient) TRC20GetDecimals

func (g *GrpcClient) TRC20GetDecimals(contractAddress string) (*big.Int, error)

TRC20GetDecimals get contract decimals

func (*GrpcClient) TRC20GetName

func (g *GrpcClient) TRC20GetName(contractAddress string) (string, error)

TRC20GetName get token name

func (*GrpcClient) TRC20GetSymbol

func (g *GrpcClient) TRC20GetSymbol(contractAddress string) (string, error)

TRC20GetSymbol get contract symbol

func (*GrpcClient) TRC20Send

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

TRC20Send send token to address

func (*GrpcClient) TotalTransaction

func (g *GrpcClient) TotalTransaction() (*api.NumberMessage, error)

TotalTransaction return total transciton in network

func (*GrpcClient) Transfer

func (g *GrpcClient) Transfer(from, toAddress string, amount int64) (*api.TransactionExtention, error)

Transfer from to base58 address

func (*GrpcClient) TransferAsset

func (g *GrpcClient) TransferAsset(from, toAddress,
	assetName string, amount int64) (*api.TransactionExtention, error)

TransferAsset from to base58 address

func (*GrpcClient) TriggerConstantContract

func (g *GrpcClient) TriggerConstantContract(from, contractAddress, method, jsonString string) (*api.TransactionExtention, error)

TriggerConstantContract and return tx result

func (*GrpcClient) TriggerContract

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

TriggerContract and return tx result

func (*GrpcClient) UnfreezeAsset

func (g *GrpcClient) UnfreezeAsset(from string) (*api.TransactionExtention, error)

UnfreezeAsset from owner

func (*GrpcClient) UnfreezeBalance

func (g *GrpcClient) UnfreezeBalance(from, delegateTo string, resource core.ResourceCode) (*api.TransactionExtention, error)

UnfreezeBalance from base58 address

func (*GrpcClient) UpdateAccount

func (g *GrpcClient) UpdateAccount(from, accountName string) (*api.TransactionExtention, error)

UpdateAccount change account name

func (*GrpcClient) UpdateAccountPermission

func (g *GrpcClient) UpdateAccountPermission(from string, owner, witness map[string]interface{}, actives []map[string]interface{}) (*api.TransactionExtention, error)

UpdateAccountPermission change account permission

func (*GrpcClient) UpdateAssetIssue

func (g *GrpcClient) UpdateAssetIssue(from, description, urlStr string,
	newLimit, newPublicLimit int64) (*api.TransactionExtention, error)

UpdateAssetIssue information

func (*GrpcClient) UpdateBrokerage

func (g *GrpcClient) UpdateBrokerage(from string, comission int32) (*api.TransactionExtention, error)

UpdateBrokerage change SR comission fees

func (*GrpcClient) UpdateHash

func (g *GrpcClient) UpdateHash(tx *api.TransactionExtention) error

UpdateHash after local changes

func (*GrpcClient) UpdateWitness

func (g *GrpcClient) UpdateWitness(from, urlStr string) (*api.TransactionExtention, error)

UpdateWitness change URL info

func (*GrpcClient) VoteWitnessAccount

func (g *GrpcClient) VoteWitnessAccount(from string,
	witnessMap map[string]int64) (*api.TransactionExtention, error)

VoteWitnessAccount change account vote

func (*GrpcClient) WithdrawBalance

func (g *GrpcClient) WithdrawBalance(from string) (*api.TransactionExtention, error)

WithdrawBalance rewards from account

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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