client

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Dec 24, 2024 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(ctx context.Context, 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(ctx context.Context, tx *core.Transaction) (*api.Return, error)

Broadcast broadcast TX

func (*GrpcClient) CreateAccount

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

CreateAccount activate tron account

func (*GrpcClient) CreateWitness

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

CreateWitness upgrade account to network witness

func (*GrpcClient) DelegateResource

func (g *GrpcClient) DelegateResource(ctx context.Context, from, to string, resource core.ResourceCode, delegateBalance int64, lock bool, lockPeriod int64) (*api.TransactionExtention, error)

DelegateResource from BASE58 address

func (*GrpcClient) DeployContract

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

DeployContract and return tx result

func (*GrpcClient) EstimateEnergy

func (g *GrpcClient) EstimateEnergy(ctx context.Context, from, contractAddress, method, jsonString string,
	tAmount int64, tTokenID string, tTokenAmount int64) (*api.EstimateEnergyMessage, error)

EstimateEnergy returns enery required

func (*GrpcClient) ExchangeByID

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

ExchangeByID returns exchangeDetails

func (*GrpcClient) ExchangeCreate

func (g *GrpcClient) ExchangeCreate(ctx context.Context,
	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(ctx context.Context,
	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(ctx context.Context, page int64, limit ...int) (*api.ExchangeList, error)

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

func (*GrpcClient) ExchangeTrade

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

ExchangeTrade on bancor TRC10

func (*GrpcClient) ExchangeWithdraw

func (g *GrpcClient) ExchangeWithdraw(ctx context.Context,
	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(ctx context.Context, from, delegateTo string,
	resource core.ResourceCode, frozenBalance int64) (*api.TransactionExtention, error)

FreezeBalance from base58 address

func (*GrpcClient) FreezeBalanceV2

func (g *GrpcClient) FreezeBalanceV2(ctx context.Context, from string,
	resource core.ResourceCode, frozenBalance int64) (*api.TransactionExtention, error)

FreezeBalance from base58 address

func (*GrpcClient) GetAccount

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

GetAccount from BASE58 address

func (*GrpcClient) GetAccountDetailed

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

GetAccountDetailed from BASE58 address

func (*GrpcClient) GetAccountNet

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

GetAccountNet return account resources from BASE58 address

func (*GrpcClient) GetAccountResource

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

GetAccountResource from BASE58 address

func (*GrpcClient) GetAssetIssueByAccount

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

GetAssetIssueByAccount list asset issued by account

func (*GrpcClient) GetAssetIssueByID

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

GetAssetIssueByID list asset issued by ID

func (*GrpcClient) GetAssetIssueByName

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

GetAssetIssueByName list asset issued by name

func (*GrpcClient) GetAssetIssueList

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

GetAssetIssueList list all TRC10

func (*GrpcClient) GetAvailableUnfreezeCount

func (g *GrpcClient) GetAvailableUnfreezeCount(ctx context.Context, from string) (*api.GetAvailableUnfreezeCountResponseMessage, error)

GetAvailableUnfreezeCount from base58 address

func (*GrpcClient) GetBandwidthPrices

func (g *GrpcClient) GetBandwidthPrices(ctx context.Context) (*api.PricesResponseMessage, error)

GetBandwidthPrices retrieves bandwidth prices

func (*GrpcClient) GetBlockByID

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

GetBlockByID block from hash

func (*GrpcClient) GetBlockByLatestNum

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

GetBlockByLatestNum return block list till num

func (*GrpcClient) GetBlockByLimitNext

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

GetBlockByLimitNext return list of block start/end

func (*GrpcClient) GetBlockByNum

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

GetBlockByNum block from number

func (*GrpcClient) GetBlockInfoByNum

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

GetBlockInfoByNum block from number

func (*GrpcClient) GetCanDelegatedMaxSize

func (g *GrpcClient) GetCanDelegatedMaxSize(ctx context.Context, address string, resource int32) (*api.CanDelegatedMaxSizeResponseMessage, error)

GetCanDelegatedMaxSize from BASE58 address

func (*GrpcClient) GetCanWithdrawUnfreezeAmount

func (g *GrpcClient) GetCanWithdrawUnfreezeAmount(ctx context.Context, from string, timestamp int64) (*api.CanWithdrawUnfreezeAmountResponseMessage, error)

GetCanWithdrawUnfreezeAmount from base58 address

func (*GrpcClient) GetChainParameters added in v1.0.6

func (g *GrpcClient) GetChainParameters(ctx context.Context) (*core.ChainParameters, error)

GetChainParameters returns chain parameters

func (*GrpcClient) GetContractABI

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

GetContractABI return smartContract

func (*GrpcClient) GetDelegatedResources

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

GetDelegatedResources from BASE58 address

func (*GrpcClient) GetDelegatedResourcesV2

func (g *GrpcClient) GetDelegatedResourcesV2(ctx context.Context, address string) ([]*api.DelegatedResourceList, error)

GetDelegatedResourcesV2 from BASE58 address

func (*GrpcClient) GetEnergyPrices

func (g *GrpcClient) GetEnergyPrices(ctx context.Context) (*api.PricesResponseMessage, error)

GetEnergyPrices retrieves energy prices

func (*GrpcClient) GetNextMaintenanceTime

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

GetNextMaintenanceTime get next epoch timestamp

func (*GrpcClient) GetNodeInfo

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

GetNodeInfo current connection

func (*GrpcClient) GetNowBlock

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

GetNowBlock return TIP block

func (*GrpcClient) GetRewardsInfo

func (g *GrpcClient) GetRewardsInfo(ctx context.Context, addr string) (int64, error)

GetRewardsInfo from BASE58 address

func (*GrpcClient) GetTransactionByID

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

GetTransactionByID returns transaction details by ID

func (*GrpcClient) GetTransactionInfoByID

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

GetTransactionInfoByID returns transaction receipt by ID

func (*GrpcClient) GetTransactionSignWeight

func (g *GrpcClient) GetTransactionSignWeight(ctx context.Context, tx *core.Transaction) (*api.TransactionSignWeight, error)

GetTransactionSignWeight queries transaction sign weight

func (*GrpcClient) GetWitnessBrokerage

func (g *GrpcClient) GetWitnessBrokerage(ctx context.Context, witness string) (float64, error)

GetWitnessBrokerage from witness address

func (*GrpcClient) ListNodes

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

ListNodes provides list of network nodes

func (*GrpcClient) ListWitnesses

func (g *GrpcClient) ListWitnesses(ctx context.Context) (*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(ctx context.Context, from, issuerAddress,
	tokenID string, amount int64) (*api.TransactionExtention, error)

ParticipateAssetIssue TRC10 ICO

func (*GrpcClient) ProposalApprove

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

ProposalApprove change URL info

func (*GrpcClient) ProposalCreate

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

ProposalCreate create proposal based on parameter list

func (*GrpcClient) ProposalWithdraw

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

func (*GrpcClient) ProposalsList

func (g *GrpcClient) ProposalsList(ctx context.Context) (*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(ctx context.Context, from, to, contract string, amount *big.Int, feeLimit int64) (*api.TransactionExtention, error)

TRC20Approve approve token to address

func (*GrpcClient) TRC20Call

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

TRC20Call make cosntant calll

func (*GrpcClient) TRC20ContractBalance

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

TRC20ContractBalance get Address balance

func (*GrpcClient) TRC20GetDecimals

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

TRC20GetDecimals get contract decimals

func (*GrpcClient) TRC20GetName

func (g *GrpcClient) TRC20GetName(ctx context.Context, contractAddress string) (string, error)

TRC20GetName get token name

func (*GrpcClient) TRC20GetSymbol

func (g *GrpcClient) TRC20GetSymbol(ctx context.Context, contractAddress string) (string, error)

TRC20GetSymbol get contract symbol

func (*GrpcClient) TRC20Send

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

TRC20Send send token to address

func (*GrpcClient) TotalTransaction

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

TotalTransaction return total transciton in network

func (*GrpcClient) Transfer

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

Transfer from to base58 address

func (*GrpcClient) TransferAsset

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

TransferAsset from to base58 address

func (*GrpcClient) TriggerConstantContract

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

TriggerConstantContract and return tx result

func (*GrpcClient) TriggerContract

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

TriggerContract and return tx result

func (*GrpcClient) UnDelegateResource

func (g *GrpcClient) UnDelegateResource(ctx context.Context, owner, receiver string, resource core.ResourceCode, delegateBalance int64, lock bool) (*api.TransactionExtention, error)

UnDelegateResource from BASE58 address

func (*GrpcClient) UnfreezeAsset

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

UnfreezeAsset from owner

func (*GrpcClient) UnfreezeBalance

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

UnfreezeBalance from base58 address

func (*GrpcClient) UnfreezeBalanceV2

func (g *GrpcClient) UnfreezeBalanceV2(ctx context.Context, from string, resource core.ResourceCode, unfreezeBalance int64) (*api.TransactionExtention, error)

UnfreezeBalance from base58 address

func (*GrpcClient) UpdateAccount

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

UpdateAccount change account name

func (*GrpcClient) UpdateAccountPermission

func (g *GrpcClient) UpdateAccountPermission(ctx context.Context, 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(ctx context.Context, from, description, urlStr string,
	newLimit, newPublicLimit int64) (*api.TransactionExtention, error)

UpdateAssetIssue information

func (*GrpcClient) UpdateBrokerage

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

UpdateBrokerage change SR comission fees

func (*GrpcClient) UpdateEnergyLimitContract

func (g *GrpcClient) UpdateEnergyLimitContract(ctx context.Context, from, contractAddress string, value int64) (*api.TransactionExtention, error)

UpdateEnergyLimitContract update contract enery limit

func (*GrpcClient) UpdateHash

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

UpdateHash after local changes

func (*GrpcClient) UpdateSettingContract

func (g *GrpcClient) UpdateSettingContract(ctx context.Context, from, contractAddress string, value int64) (*api.TransactionExtention, error)

UpdateSettingContract change contract owner consumption ratio

func (*GrpcClient) UpdateWitness

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

UpdateWitness change URL info

func (*GrpcClient) VoteWitnessAccount

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

VoteWitnessAccount change account vote

func (*GrpcClient) WithdrawBalance

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

WithdrawBalance rewards from account

func (*GrpcClient) WithdrawExpireUnfreeze

func (g *GrpcClient) WithdrawExpireUnfreeze(ctx context.Context, from string, timestamp int64) (*api.TransactionExtention, error)

WithdrawExpireUnfreeze from base58 address

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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