Documentation
¶
Overview ¶
Package client provides a gRPC client for interacting with the TRON network.
Index ¶
- Variables
- func BlockExtentionWitnessAddress(block *api.BlockExtention) address.Address
- func BlockExtentionWitnessBase58(block *api.BlockExtention) string
- func BlockWitnessAddress(block *core.Block) address.Address
- func BlockWitnessBase58(block *core.Block) string
- func GRPCInsecure() grpc.DialOption
- func GetMessageBytes(m []byte) *api.BytesMessage
- func GetMessageNumber(n int64) *api.NumberMessage
- func GetPaginatedMessage(offset int64, limit int64) *api.PaginatedMessage
- type AccountService
- type AssetService
- type BlockService
- type ConstantCallOption
- type ContractService
- type ExchangeService
- type GovernanceService
- type GrpcClient
- func (g *GrpcClient) Account() AccountService
- func (g *GrpcClient) AssetIssue(from, name, description, abbr, urlStr string, precision int32, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) AssetIssueCtx(ctx context.Context, from, name, description, abbr, urlStr string, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) Assets() AssetService
- func (g *GrpcClient) Block() BlockService
- func (g *GrpcClient) Broadcast(tx *core.Transaction) (*api.Return, error)
- func (g *GrpcClient) BroadcastCtx(ctx context.Context, tx *core.Transaction) (*api.Return, error)
- func (g *GrpcClient) Contract() ContractService
- func (g *GrpcClient) CreateAccount(from, addr string) (*api.TransactionExtention, error)
- func (g *GrpcClient) CreateAccountCtx(ctx context.Context, from, addr string) (*api.TransactionExtention, error)
- func (g *GrpcClient) CreateWitness(from, urlStr string) (*api.TransactionExtention, error)
- func (g *GrpcClient) CreateWitnessCtx(ctx context.Context, from, urlStr string) (*api.TransactionExtention, error)
- func (g *GrpcClient) DelegateResource(from, to string, resource core.ResourceCode, delegateBalance int64, lock bool, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) DelegateResourceCtx(ctx context.Context, from, to string, resource core.ResourceCode, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) DeployContract(from, contractName string, abi *core.SmartContract_ABI, codeStr string, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) DeployContractCtx(ctx context.Context, from, contractName string, abi *core.SmartContract_ABI, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) EstimateEnergy(from, contractAddress, method, jsonString string, tAmount int64, ...) (*api.EstimateEnergyMessage, error)
- func (g *GrpcClient) EstimateEnergyCtx(ctx context.Context, from, contractAddress, method, jsonString string, ...) (*api.EstimateEnergyMessage, error)
- func (g *GrpcClient) EstimateEnergyWithData(from, contractAddress string, data []byte, tAmount int64, tTokenID string, ...) (*api.EstimateEnergyMessage, error)
- func (g *GrpcClient) EstimateEnergyWithDataCtx(ctx context.Context, from, contractAddress string, data []byte, tAmount int64, ...) (*api.EstimateEnergyMessage, error)
- func (g *GrpcClient) Exchange() ExchangeService
- func (g *GrpcClient) ExchangeByID(id int64) (*core.Exchange, error)
- func (g *GrpcClient) ExchangeByIDCtx(ctx context.Context, id int64) (*core.Exchange, error)
- func (g *GrpcClient) ExchangeCreate(from string, tokenID1 string, amountToken1 int64, tokenID2 string, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) ExchangeCreateCtx(ctx context.Context, from string, tokenID1 string, amountToken1 int64, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) ExchangeInject(from string, exchangeID int64, tokenID string, amountToken int64) (*api.TransactionExtention, error)
- func (g *GrpcClient) ExchangeInjectCtx(ctx context.Context, from string, exchangeID int64, tokenID string, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) ExchangeList(page int64, limit ...int) (*api.ExchangeList, error)
- func (g *GrpcClient) ExchangeListCtx(ctx context.Context, page int64, limit ...int) (*api.ExchangeList, error)
- func (g *GrpcClient) ExchangeTrade(from string, exchangeID int64, tokenID string, amountToken int64, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) ExchangeTradeCtx(ctx context.Context, from string, exchangeID int64, tokenID string, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) ExchangeWithdraw(from string, exchangeID int64, tokenID string, amountToken int64) (*api.TransactionExtention, error)
- func (g *GrpcClient) ExchangeWithdrawCtx(ctx context.Context, from string, exchangeID int64, tokenID string, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) FreezeBalance(from, delegateTo string, resource core.ResourceCode, frozenBalance int64) (*api.TransactionExtention, error)
- func (g *GrpcClient) FreezeBalanceCtx(ctx context.Context, from, delegateTo string, resource core.ResourceCode, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) FreezeBalanceV2(from string, resource core.ResourceCode, frozenBalance int64) (*api.TransactionExtention, error)
- func (g *GrpcClient) FreezeBalanceV2Ctx(ctx context.Context, from string, resource core.ResourceCode, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) GetAccount(addr string) (*core.Account, error)
- func (g *GrpcClient) GetAccountCtx(ctx context.Context, addr string) (*core.Account, error)
- func (g *GrpcClient) GetAccountDetailed(addr string) (*account.Account, error)
- func (g *GrpcClient) GetAccountDetailedCtx(ctx context.Context, addr string) (*account.Account, error)
- func (g *GrpcClient) GetAccountNet(addr string) (*api.AccountNetMessage, error)
- func (g *GrpcClient) GetAccountNetCtx(ctx context.Context, addr string) (*api.AccountNetMessage, error)
- func (g *GrpcClient) GetAccountResource(addr string) (*api.AccountResourceMessage, error)
- func (g *GrpcClient) GetAccountResourceCtx(ctx context.Context, addr string) (*api.AccountResourceMessage, error)
- func (g *GrpcClient) GetAssetIssueByAccount(address string) (*api.AssetIssueList, error)
- func (g *GrpcClient) GetAssetIssueByAccountCtx(ctx context.Context, address string) (*api.AssetIssueList, error)
- func (g *GrpcClient) GetAssetIssueByID(tokenID string) (*core.AssetIssueContract, error)
- func (g *GrpcClient) GetAssetIssueByIDCtx(ctx context.Context, tokenID string) (*core.AssetIssueContract, error)
- func (g *GrpcClient) GetAssetIssueByName(name string) (*core.AssetIssueContract, error)
- func (g *GrpcClient) GetAssetIssueByNameCtx(ctx context.Context, name string) (*core.AssetIssueContract, error)
- func (g *GrpcClient) GetAssetIssueList(page int64, limit ...int) (*api.AssetIssueList, error)
- func (g *GrpcClient) GetAssetIssueListCtx(ctx context.Context, page int64, limit ...int) (*api.AssetIssueList, error)
- func (g *GrpcClient) GetAvailableUnfreezeCount(from string) (*api.GetAvailableUnfreezeCountResponseMessage, error)
- func (g *GrpcClient) GetAvailableUnfreezeCountCtx(ctx context.Context, from string) (*api.GetAvailableUnfreezeCountResponseMessage, error)
- func (g *GrpcClient) GetBandwidthPriceHistory() ([]PriceEntry, error)
- func (g *GrpcClient) GetBandwidthPriceHistoryCtx(ctx context.Context) ([]PriceEntry, error)
- func (g *GrpcClient) GetBandwidthPrices() (*api.PricesResponseMessage, error)
- func (g *GrpcClient) GetBandwidthPricesCtx(ctx context.Context) (*api.PricesResponseMessage, error)
- func (g *GrpcClient) GetBlockByID(id string) (*core.Block, error)
- func (g *GrpcClient) GetBlockByIDCtx(ctx context.Context, id string) (*core.Block, error)
- func (g *GrpcClient) GetBlockByLatestNum(num int64) (*api.BlockListExtention, error)
- func (g *GrpcClient) GetBlockByLatestNumCtx(ctx context.Context, num int64) (*api.BlockListExtention, error)
- func (g *GrpcClient) GetBlockByLimitNext(start, end int64) (*api.BlockListExtention, error)
- func (g *GrpcClient) GetBlockByLimitNextCtx(ctx context.Context, start, end int64) (*api.BlockListExtention, error)
- func (g *GrpcClient) GetBlockByNum(num int64) (*api.BlockExtention, error)
- func (g *GrpcClient) GetBlockByNumCtx(ctx context.Context, num int64) (*api.BlockExtention, error)
- func (g *GrpcClient) GetBlockInfoByNum(num int64) (*api.TransactionInfoList, error)
- func (g *GrpcClient) GetBlockInfoByNumCtx(ctx context.Context, num int64) (*api.TransactionInfoList, error)
- func (g *GrpcClient) GetCanDelegatedMaxSize(address string, resource int32) (*api.CanDelegatedMaxSizeResponseMessage, error)
- func (g *GrpcClient) GetCanDelegatedMaxSizeCtx(ctx context.Context, address string, resource int32) (*api.CanDelegatedMaxSizeResponseMessage, error)
- func (g *GrpcClient) GetCanWithdrawUnfreezeAmount(from string, timestamp int64) (*api.CanWithdrawUnfreezeAmountResponseMessage, error)
- func (g *GrpcClient) GetCanWithdrawUnfreezeAmountCtx(ctx context.Context, from string, timestamp int64) (*api.CanWithdrawUnfreezeAmountResponseMessage, error)
- func (g *GrpcClient) GetContractABI(contractAddress string) (*core.SmartContract_ABI, error)
- func (g *GrpcClient) GetContractABICtx(ctx context.Context, contractAddress string) (*core.SmartContract_ABI, error)
- func (g *GrpcClient) GetContractABIResolved(contractAddress string) (*core.SmartContract_ABI, error)
- func (g *GrpcClient) GetContractABIResolvedCtx(ctx context.Context, contractAddress string) (*core.SmartContract_ABI, error)
- func (g *GrpcClient) GetDelegatedResources(address string) ([]*api.DelegatedResourceList, error)
- func (g *GrpcClient) GetDelegatedResourcesCtx(ctx context.Context, address string) ([]*api.DelegatedResourceList, error)
- func (g *GrpcClient) GetDelegatedResourcesV2(address string) ([]*api.DelegatedResourceList, error)
- func (g *GrpcClient) GetDelegatedResourcesV2Ctx(ctx context.Context, address string) ([]*api.DelegatedResourceList, error)
- func (g *GrpcClient) GetEnergyPriceHistory() ([]PriceEntry, error)
- func (g *GrpcClient) GetEnergyPriceHistoryCtx(ctx context.Context) ([]PriceEntry, error)
- func (g *GrpcClient) GetEnergyPrices() (*api.PricesResponseMessage, error)
- func (g *GrpcClient) GetEnergyPricesCtx(ctx context.Context) (*api.PricesResponseMessage, error)
- func (g *GrpcClient) GetMemoFee() (*api.PricesResponseMessage, error)
- func (g *GrpcClient) GetMemoFeeCtx(ctx context.Context) (*api.PricesResponseMessage, error)
- func (g *GrpcClient) GetMemoFeeHistory() ([]PriceEntry, error)
- func (g *GrpcClient) GetMemoFeeHistoryCtx(ctx context.Context) ([]PriceEntry, error)
- func (g *GrpcClient) GetNextMaintenanceTime() (*api.NumberMessage, error)
- func (g *GrpcClient) GetNextMaintenanceTimeCtx(ctx context.Context) (*api.NumberMessage, error)
- func (g *GrpcClient) GetNodeInfo() (*core.NodeInfo, error)
- func (g *GrpcClient) GetNodeInfoCtx(ctx context.Context) (*core.NodeInfo, error)
- func (g *GrpcClient) GetNowBlock() (*api.BlockExtention, error)
- func (g *GrpcClient) GetNowBlockCtx(ctx context.Context) (*api.BlockExtention, error)
- func (g *GrpcClient) GetPendingSize() (*api.NumberMessage, error)
- func (g *GrpcClient) GetPendingSizeCtx(ctx context.Context) (*api.NumberMessage, error)
- func (g *GrpcClient) GetPendingTransactionsByAddress(address string) ([]*core.Transaction, error)
- func (g *GrpcClient) GetPendingTransactionsByAddressCtx(ctx context.Context, address string) ([]*core.Transaction, error)
- func (g *GrpcClient) GetReceivedDelegatedResourcesV2(address string) ([]*api.DelegatedResourceList, error)
- func (g *GrpcClient) GetReceivedDelegatedResourcesV2Ctx(ctx context.Context, address string) ([]*api.DelegatedResourceList, error)
- func (g *GrpcClient) GetRewardsInfo(addr string) (int64, error)
- func (g *GrpcClient) GetRewardsInfoCtx(ctx context.Context, addr string) (int64, error)
- func (g *GrpcClient) GetTransactionByID(id string) (*core.Transaction, error)
- func (g *GrpcClient) GetTransactionByIDCtx(ctx context.Context, id string) (*core.Transaction, error)
- func (g *GrpcClient) GetTransactionFromPending(id string) (*core.Transaction, error)
- func (g *GrpcClient) GetTransactionFromPendingCtx(ctx context.Context, id string) (*core.Transaction, error)
- func (g *GrpcClient) GetTransactionInfoByID(id string) (*core.TransactionInfo, error)
- func (g *GrpcClient) GetTransactionInfoByIDCtx(ctx context.Context, id string) (*core.TransactionInfo, error)
- func (g *GrpcClient) GetTransactionListFromPending() (*api.TransactionIdList, error)
- func (g *GrpcClient) GetTransactionListFromPendingCtx(ctx context.Context) (*api.TransactionIdList, error)
- func (g *GrpcClient) GetTransactionSignWeight(tx *core.Transaction) (*api.TransactionSignWeight, error)
- func (g *GrpcClient) GetTransactionSignWeightCtx(ctx context.Context, tx *core.Transaction) (*api.TransactionSignWeight, error)
- func (g *GrpcClient) GetWitnessBrokerage(witness string) (float64, error)
- func (g *GrpcClient) GetWitnessBrokerageCtx(ctx context.Context, witness string) (float64, error)
- func (g *GrpcClient) Governance() GovernanceService
- func (g *GrpcClient) IsTransactionPending(id string) (bool, error)
- func (g *GrpcClient) IsTransactionPendingCtx(ctx context.Context, id string) (bool, error)
- func (g *GrpcClient) ListNodes() (*api.NodeList, error)
- func (g *GrpcClient) ListNodesCtx(ctx context.Context) (*api.NodeList, error)
- func (g *GrpcClient) ListWitnesses() (*api.WitnessList, error)
- func (g *GrpcClient) ListWitnessesCtx(ctx context.Context) (*api.WitnessList, error)
- func (g *GrpcClient) ListWitnessesPaginated(page int64, limit ...int) (*api.WitnessList, error)
- func (g *GrpcClient) ListWitnessesPaginatedCtx(ctx context.Context, page int64, limit ...int) (*api.WitnessList, error)
- func (g *GrpcClient) Network() NetworkService
- func (g *GrpcClient) ParseTRC20NumericProperty(data string) (*big.Int, error)
- func (g *GrpcClient) ParseTRC20StringProperty(data string) (string, error)
- func (g *GrpcClient) ParticipateAssetIssue(from, issuerAddress, tokenID string, amount int64) (*api.TransactionExtention, error)
- func (g *GrpcClient) ParticipateAssetIssueCtx(ctx context.Context, from, issuerAddress, tokenID string, amount int64) (*api.TransactionExtention, error)
- func (g *GrpcClient) Pending() PendingService
- func (g *GrpcClient) ProposalApprove(from string, id int64, confirm bool) (*api.TransactionExtention, error)
- func (g *GrpcClient) ProposalApproveCtx(ctx context.Context, from string, id int64, confirm bool) (*api.TransactionExtention, error)
- func (g *GrpcClient) ProposalCreate(from string, parameters map[int64]int64) (*api.TransactionExtention, error)
- func (g *GrpcClient) ProposalCreateCtx(ctx context.Context, from string, parameters map[int64]int64) (*api.TransactionExtention, error)
- func (g *GrpcClient) ProposalWithdraw(from string, id int64) (*api.TransactionExtention, error)
- func (g *GrpcClient) ProposalWithdrawCtx(ctx context.Context, from string, id int64) (*api.TransactionExtention, error)
- func (g *GrpcClient) ProposalsList() (*api.ProposalList, error)
- func (g *GrpcClient) ProposalsListCtx(ctx context.Context) (*api.ProposalList, error)
- func (g *GrpcClient) Reconnect(url string) error
- func (g *GrpcClient) Resource() ResourceService
- func (g *GrpcClient) SetAPIKey(apiKey string) error
- func (g *GrpcClient) SetContext(ctx context.Context) error
- func (g *GrpcClient) SetTimeout(timeout time.Duration)
- func (g *GrpcClient) Start(opts ...grpc.DialOption) error
- func (g *GrpcClient) Stop()
- func (g *GrpcClient) TRC20() TRC20Service
- func (g *GrpcClient) TRC20Approve(from, to, contract string, amount *big.Int, feeLimit int64, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) TRC20ApproveCtx(ctx context.Context, from, to, contract string, amount *big.Int, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) TRC20Call(from, contractAddress, data string, constant bool, feeLimit int64) (*api.TransactionExtention, error)
- func (g *GrpcClient) TRC20CallCtx(ctx context.Context, from, contractAddress, data string, constant bool, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) TRC20ContractBalance(addr, contractAddress string) (*big.Int, error)
- func (g *GrpcClient) TRC20ContractBalanceCtx(ctx context.Context, addr, contractAddress string) (*big.Int, error)
- func (g *GrpcClient) TRC20GetDecimals(contractAddress string) (*big.Int, error)
- func (g *GrpcClient) TRC20GetDecimalsCtx(ctx context.Context, contractAddress string) (*big.Int, error)
- func (g *GrpcClient) TRC20GetName(contractAddress string) (string, error)
- func (g *GrpcClient) TRC20GetNameCtx(ctx context.Context, contractAddress string) (string, error)
- func (g *GrpcClient) TRC20GetSymbol(contractAddress string) (string, error)
- func (g *GrpcClient) TRC20GetSymbolCtx(ctx context.Context, contractAddress string) (string, error)
- func (g *GrpcClient) TRC20Send(from, to, contract string, amount *big.Int, feeLimit int64, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) TRC20SendCtx(ctx context.Context, from, to, contract string, amount *big.Int, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) TRC20TransferFrom(owner, from, to, contract string, amount *big.Int, feeLimit int64, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) TRC20TransferFromCtx(ctx context.Context, owner, from, to, contract string, amount *big.Int, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) TotalTransaction() (*api.NumberMessage, error)
- func (g *GrpcClient) TotalTransactionCtx(ctx context.Context) (*api.NumberMessage, error)
- func (g *GrpcClient) Transfer(from, toAddress string, amount int64) (*api.TransactionExtention, error)
- func (g *GrpcClient) TransferAsset(from, toAddress, assetName string, amount int64) (*api.TransactionExtention, error)
- func (g *GrpcClient) TransferAssetCtx(ctx context.Context, from, toAddress, assetName string, amount int64) (*api.TransactionExtention, error)
- func (g *GrpcClient) TransferCtx(ctx context.Context, from, toAddress string, amount int64) (*api.TransactionExtention, error)
- func (g *GrpcClient) Transfers() TransferService
- func (g *GrpcClient) TriggerConstantContract(from, contractAddress, method, jsonString string, opts ...ConstantCallOption) (*api.TransactionExtention, error)
- func (g *GrpcClient) TriggerConstantContractCtx(ctx context.Context, from, contractAddress, method, jsonString string, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) TriggerConstantContractWithData(from, contractAddress string, data []byte, opts ...ConstantCallOption) (*api.TransactionExtention, error)
- func (g *GrpcClient) TriggerConstantContractWithDataCtx(ctx context.Context, from, contractAddress string, data []byte, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) TriggerContract(from, contractAddress, method, jsonString string, feeLimit, tAmount int64, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) TriggerContractCtx(ctx context.Context, from, contractAddress, method, jsonString string, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) TriggerContractWithData(from, contractAddress string, data []byte, feeLimit, tAmount int64, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) TriggerContractWithDataCtx(ctx context.Context, from, contractAddress string, data []byte, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) UnDelegateResource(owner, receiver string, resource core.ResourceCode, delegateBalance int64) (*api.TransactionExtention, error)
- func (g *GrpcClient) UnDelegateResourceCtx(ctx context.Context, owner, receiver string, resource core.ResourceCode, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) UnfreezeAsset(from string) (*api.TransactionExtention, error)
- func (g *GrpcClient) UnfreezeAssetCtx(ctx context.Context, from string) (*api.TransactionExtention, error)
- func (g *GrpcClient) UnfreezeBalance(from, delegateTo string, resource core.ResourceCode) (*api.TransactionExtention, error)
- func (g *GrpcClient) UnfreezeBalanceCtx(ctx context.Context, from, delegateTo string, resource core.ResourceCode) (*api.TransactionExtention, error)
- func (g *GrpcClient) UnfreezeBalanceV2(from string, resource core.ResourceCode, unfreezeBalance int64) (*api.TransactionExtention, error)
- func (g *GrpcClient) UnfreezeBalanceV2Ctx(ctx context.Context, from string, resource core.ResourceCode, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) UpdateAccount(from, accountName string) (*api.TransactionExtention, error)
- func (g *GrpcClient) UpdateAccountCtx(ctx context.Context, from, accountName string) (*api.TransactionExtention, error)
- func (g *GrpcClient) UpdateAccountPermission(from string, owner, witness map[string]interface{}, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) UpdateAccountPermissionCtx(ctx context.Context, from string, owner, witness map[string]interface{}, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) UpdateAssetIssue(from, description, urlStr string, newLimit, newPublicLimit int64) (*api.TransactionExtention, error)
- func (g *GrpcClient) UpdateAssetIssueCtx(ctx context.Context, from, description, urlStr string, ...) (*api.TransactionExtention, error)
- func (g *GrpcClient) UpdateBrokerage(from string, commission int32) (*api.TransactionExtention, error)
- func (g *GrpcClient) UpdateBrokerageCtx(ctx context.Context, from string, commission int32) (*api.TransactionExtention, error)
- func (g *GrpcClient) UpdateEnergyLimitContract(from, contractAddress string, value int64) (*api.TransactionExtention, error)
- func (g *GrpcClient) UpdateEnergyLimitContractCtx(ctx context.Context, from, contractAddress string, value int64) (*api.TransactionExtention, error)
- func (g *GrpcClient) UpdateHash(tx *api.TransactionExtention) error
- func (g *GrpcClient) UpdateSettingContract(from, contractAddress string, value int64) (*api.TransactionExtention, error)
- func (g *GrpcClient) UpdateSettingContractCtx(ctx context.Context, from, contractAddress string, value int64) (*api.TransactionExtention, error)
- func (g *GrpcClient) UpdateWitness(from, urlStr string) (*api.TransactionExtention, error)
- func (g *GrpcClient) UpdateWitnessCtx(ctx context.Context, from, urlStr string) (*api.TransactionExtention, error)
- func (g *GrpcClient) VoteWitnessAccount(from string, witnessMap map[string]int64) (*api.TransactionExtention, error)
- func (g *GrpcClient) VoteWitnessAccountCtx(ctx context.Context, from string, witnessMap map[string]int64) (*api.TransactionExtention, error)
- func (g *GrpcClient) WithdrawBalance(from string) (*api.TransactionExtention, error)
- func (g *GrpcClient) WithdrawBalanceCtx(ctx context.Context, from string) (*api.TransactionExtention, error)
- func (g *GrpcClient) WithdrawExpireUnfreeze(from string, timestamp int64) (*api.TransactionExtention, error)
- func (g *GrpcClient) WithdrawExpireUnfreezeCtx(ctx context.Context, from string, timestamp int64) (*api.TransactionExtention, error)
- type NetworkService
- type PendingService
- type PriceEntry
- type ResourceService
- type TRC20Option
- type TRC20Service
- type TransferService
Constants ¶
This section is empty.
Variables ¶
var ( // ErrEstimateEnergyNotSupported is returned when the connected TRON node // does not support the EstimateEnergy RPC. ErrEstimateEnergyNotSupported = errors.New("this node does not support estimate energy") // ErrNotConnected is returned when a client method is called without an active connection. ErrNotConnected = errors.New("client not connected") // ErrInvalidAddress is returned when an address parameter is malformed. ErrInvalidAddress = errors.New("invalid address") // ErrTimeout is returned when an operation exceeds its deadline. ErrTimeout = errors.New("operation timed out") // ErrZeroAmount is returned when an amount parameter is zero or negative. ErrZeroAmount = errors.New("amount must be greater than zero") // ErrInsufficientFee is returned when the fee limit is zero or negative. ErrInsufficientFee = errors.New("fee limit must be greater than zero") // ErrNoSigner is returned when a signing operation has no signer address. ErrNoSigner = errors.New("signer address required") )
Sentinel errors for client operations. Callers can test with errors.Is.
var ErrPendingTxNotFound = errors.New("transaction not found in pending pool")
ErrPendingTxNotFound is returned when a transaction is not found in the pending pool.
Functions ¶
func BlockExtentionWitnessAddress ¶ added in v0.24.3
func BlockExtentionWitnessAddress(block *api.BlockExtention) address.Address
BlockExtentionWitnessAddress returns the witness address from a BlockExtention as an address.Address. Returns nil if the block or header is nil.
func BlockExtentionWitnessBase58 ¶ added in v0.24.3
func BlockExtentionWitnessBase58(block *api.BlockExtention) string
BlockExtentionWitnessBase58 returns the witness address from a BlockExtention as a base58-encoded string. Returns an empty string if the block or header is nil.
func BlockWitnessAddress ¶ added in v0.24.3
BlockWitnessAddress returns the witness address from a Block as an address.Address. Returns nil if the block or header is nil.
func BlockWitnessBase58 ¶ added in v0.24.3
BlockWitnessBase58 returns the witness address from a Block as a base58-encoded string. Returns an empty string if the block or header is nil.
func GRPCInsecure ¶
func GRPCInsecure() grpc.DialOption
GRPCInsecure returns a grpc.DialOption that disables transport security.
func GetMessageBytes ¶
func GetMessageBytes(m []byte) *api.BytesMessage
GetMessageBytes wraps raw bytes into an api.BytesMessage for gRPC calls.
func GetMessageNumber ¶
func GetMessageNumber(n int64) *api.NumberMessage
GetMessageNumber wraps an int64 into an api.NumberMessage for gRPC calls.
func GetPaginatedMessage ¶
func GetPaginatedMessage(offset int64, limit int64) *api.PaginatedMessage
GetPaginatedMessage creates an api.PaginatedMessage with the given offset and limit.
Types ¶
type AccountService ¶ added in v0.26.0
type AccountService interface {
GetAccountCtx(ctx context.Context, addr string) (*core.Account, error)
GetRewardsInfoCtx(ctx context.Context, addr string) (int64, error)
GetAccountNetCtx(ctx context.Context, addr string) (*api.AccountNetMessage, error)
CreateAccountCtx(ctx context.Context, from, addr string) (*api.TransactionExtention, error)
UpdateAccountCtx(ctx context.Context, from, accountName string) (*api.TransactionExtention, error)
GetAccountDetailedCtx(ctx context.Context, addr string) (*account.Account, error)
WithdrawBalanceCtx(ctx context.Context, from string) (*api.TransactionExtention, error)
UpdateAccountPermissionCtx(ctx context.Context, from string, owner, witness map[string]interface{}, actives []map[string]interface{}) (*api.TransactionExtention, error)
}
AccountService provides account-related operations.
type AssetService ¶ added in v0.26.0
type AssetService interface {
GetAssetIssueByAccountCtx(ctx context.Context, address string) (*api.AssetIssueList, error)
GetAssetIssueByNameCtx(ctx context.Context, name string) (*core.AssetIssueContract, error)
GetAssetIssueByIDCtx(ctx context.Context, tokenID string) (*core.AssetIssueContract, error)
GetAssetIssueListCtx(ctx context.Context, page int64, limit ...int) (*api.AssetIssueList, error)
AssetIssueCtx(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)
UpdateAssetIssueCtx(ctx context.Context, from, description, urlStr string, newLimit, newPublicLimit int64) (*api.TransactionExtention, error)
TransferAssetCtx(ctx context.Context, from, toAddress, assetName string, amount int64) (*api.TransactionExtention, error)
ParticipateAssetIssueCtx(ctx context.Context, from, issuerAddress, tokenID string, amount int64) (*api.TransactionExtention, error)
UnfreezeAssetCtx(ctx context.Context, from string) (*api.TransactionExtention, error)
}
AssetService provides TRC10 asset operations.
type BlockService ¶ added in v0.26.0
type BlockService interface {
GetNowBlockCtx(ctx context.Context) (*api.BlockExtention, error)
GetBlockByNumCtx(ctx context.Context, num int64) (*api.BlockExtention, error)
GetBlockInfoByNumCtx(ctx context.Context, num int64) (*api.TransactionInfoList, error)
GetBlockByIDCtx(ctx context.Context, id string) (*core.Block, error)
GetBlockByLimitNextCtx(ctx context.Context, start, end int64) (*api.BlockListExtention, error)
GetBlockByLatestNumCtx(ctx context.Context, num int64) (*api.BlockListExtention, error)
}
BlockService provides block query operations.
type ConstantCallOption ¶ added in v0.25.2
type ConstantCallOption func(*core.TriggerSmartContract)
ConstantCallOption configures optional fields on a TriggerSmartContract used by constant (read-only) contract calls. This allows callers to set values like CallValue or TokenValue without breaking backward compatibility.
func WithCallValue ¶ added in v0.25.2
func WithCallValue(value int64) ConstantCallOption
WithCallValue sets the TRX call value (in sun) on a constant contract call. This is required to accurately simulate payable functions that depend on msg.value.
func WithTokenValue ¶ added in v0.25.2
func WithTokenValue(tokenID string, amount int64) (ConstantCallOption, error)
WithTokenValue sets the TRC10 token ID and amount on a constant contract call. It returns an error if tokenID is not a valid integer.
type ContractService ¶ added in v0.26.0
type ContractService interface {
UpdateEnergyLimitContractCtx(ctx context.Context, from, contractAddress string, value int64) (*api.TransactionExtention, error)
UpdateSettingContractCtx(ctx context.Context, from, contractAddress string, value int64) (*api.TransactionExtention, error)
TriggerConstantContractCtx(ctx context.Context, from, contractAddress, method, jsonString string, opts ...ConstantCallOption) (*api.TransactionExtention, error)
TriggerContractCtx(ctx context.Context, from, contractAddress, method, jsonString string, feeLimit, tAmount int64, tTokenID string, tTokenAmount int64) (*api.TransactionExtention, error)
TriggerConstantContractWithDataCtx(ctx context.Context, from, contractAddress string, data []byte, opts ...ConstantCallOption) (*api.TransactionExtention, error)
TriggerContractWithDataCtx(ctx context.Context, from, contractAddress string, data []byte, feeLimit, tAmount int64, tTokenID string, tTokenAmount int64) (*api.TransactionExtention, error)
EstimateEnergyCtx(ctx context.Context, from, contractAddress, method, jsonString string, tAmount int64, tTokenID string, tTokenAmount int64) (*api.EstimateEnergyMessage, error)
EstimateEnergyWithDataCtx(ctx context.Context, from, contractAddress string, data []byte, tAmount int64, tTokenID string, tTokenAmount int64) (*api.EstimateEnergyMessage, error)
DeployContractCtx(ctx context.Context, from, contractName string, abi *core.SmartContract_ABI, codeStr string, feeLimit, curPercent, oeLimit int64) (*api.TransactionExtention, error)
GetContractABICtx(ctx context.Context, contractAddress string) (*core.SmartContract_ABI, error)
GetContractABIResolvedCtx(ctx context.Context, contractAddress string) (*core.SmartContract_ABI, error)
}
ContractService provides smart contract operations.
type ExchangeService ¶ added in v0.26.0
type ExchangeService interface {
ExchangeListCtx(ctx context.Context, page int64, limit ...int) (*api.ExchangeList, error)
ExchangeByIDCtx(ctx context.Context, id int64) (*core.Exchange, error)
ExchangeCreateCtx(ctx context.Context, from string, tokenID1 string, amountToken1 int64, tokenID2 string, amountToken2 int64) (*api.TransactionExtention, error)
ExchangeInjectCtx(ctx context.Context, from string, exchangeID int64, tokenID string, amountToken int64) (*api.TransactionExtention, error)
ExchangeWithdrawCtx(ctx context.Context, from string, exchangeID int64, tokenID string, amountToken int64) (*api.TransactionExtention, error)
ExchangeTradeCtx(ctx context.Context, from string, exchangeID int64, tokenID string, amountToken int64, amountExpected int64) (*api.TransactionExtention, error)
}
ExchangeService provides TRC10 exchange (bancor) operations.
type GovernanceService ¶ added in v0.26.0
type GovernanceService interface {
ListWitnessesCtx(ctx context.Context) (*api.WitnessList, error)
ListWitnessesPaginatedCtx(ctx context.Context, page int64, limit ...int) (*api.WitnessList, error)
CreateWitnessCtx(ctx context.Context, from, urlStr string) (*api.TransactionExtention, error)
UpdateWitnessCtx(ctx context.Context, from, urlStr string) (*api.TransactionExtention, error)
VoteWitnessAccountCtx(ctx context.Context, from string, witnessMap map[string]int64) (*api.TransactionExtention, error)
GetWitnessBrokerageCtx(ctx context.Context, witness string) (float64, error)
UpdateBrokerageCtx(ctx context.Context, from string, commission int32) (*api.TransactionExtention, error)
ProposalsListCtx(ctx context.Context) (*api.ProposalList, error)
ProposalCreateCtx(ctx context.Context, from string, parameters map[int64]int64) (*api.TransactionExtention, error)
ProposalApproveCtx(ctx context.Context, from string, id int64, confirm bool) (*api.TransactionExtention, error)
ProposalWithdrawCtx(ctx context.Context, from string, id int64) (*api.TransactionExtention, error)
}
GovernanceService provides witness and proposal operations.
type GrpcClient ¶
type GrpcClient struct {
Address string
Conn *grpc.ClientConn
Client api.WalletClient
// contains filtered or unexported fields
}
GrpcClient provides access to the TRON network via gRPC.
func NewGrpcClient ¶
func NewGrpcClient(address string) *GrpcClient
NewGrpcClient creates a new GrpcClient with a default timeout of 5 seconds.
func NewGrpcClientWithTimeout ¶
func NewGrpcClientWithTimeout(address string, timeout time.Duration) *GrpcClient
NewGrpcClientWithTimeout creates a new GrpcClient with the specified timeout.
func (*GrpcClient) Account ¶ added in v0.26.0
func (g *GrpcClient) Account() AccountService
Account returns the AccountService backed by this client.
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) AssetIssueCtx ¶ added in v0.24.3
func (g *GrpcClient) AssetIssueCtx(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)
AssetIssueCtx is the context-aware version of AssetIssue.
func (*GrpcClient) Assets ¶ added in v0.26.0
func (g *GrpcClient) Assets() AssetService
Assets returns the AssetService backed by this client.
func (*GrpcClient) Block ¶ added in v0.26.0
func (g *GrpcClient) Block() BlockService
Block returns the BlockService backed by this client.
func (*GrpcClient) Broadcast ¶
func (g *GrpcClient) Broadcast(tx *core.Transaction) (*api.Return, error)
Broadcast submits a signed transaction to the network.
func (*GrpcClient) BroadcastCtx ¶ added in v0.24.3
func (g *GrpcClient) BroadcastCtx(ctx context.Context, tx *core.Transaction) (*api.Return, error)
BroadcastCtx is the context-aware version of Broadcast.
func (*GrpcClient) Contract ¶ added in v0.26.0
func (g *GrpcClient) Contract() ContractService
Contract returns the ContractService backed by this client.
func (*GrpcClient) CreateAccount ¶
func (g *GrpcClient) CreateAccount(from, addr string) (*api.TransactionExtention, error)
CreateAccount activate tron account
func (*GrpcClient) CreateAccountCtx ¶ added in v0.24.3
func (g *GrpcClient) CreateAccountCtx(ctx context.Context, from, addr string) (*api.TransactionExtention, error)
CreateAccountCtx is the context-aware version of CreateAccount.
func (*GrpcClient) CreateWitness ¶
func (g *GrpcClient) CreateWitness(from, urlStr string) (*api.TransactionExtention, error)
CreateWitness upgrade account to network witness
func (*GrpcClient) CreateWitnessCtx ¶ added in v0.24.3
func (g *GrpcClient) CreateWitnessCtx(ctx context.Context, from, urlStr string) (*api.TransactionExtention, error)
CreateWitnessCtx is the context-aware version of CreateWitness.
func (*GrpcClient) DelegateResource ¶
func (g *GrpcClient) DelegateResource(from, to string, resource core.ResourceCode, delegateBalance int64, lock bool, lockPeriod int64) (*api.TransactionExtention, error)
DelegateResource from BASE58 address
func (*GrpcClient) DelegateResourceCtx ¶ added in v0.24.3
func (g *GrpcClient) DelegateResourceCtx(ctx context.Context, from, to string, resource core.ResourceCode, delegateBalance int64, lock bool, lockPeriod int64) (*api.TransactionExtention, error)
DelegateResourceCtx is the context-aware version of DelegateResource.
func (*GrpcClient) DeployContract ¶
func (g *GrpcClient) DeployContract(from, contractName string, abi *core.SmartContract_ABI, codeStr string, feeLimit, curPercent, oeLimit int64, ) (*api.TransactionExtention, error)
DeployContract deploys a new smart contract and returns the unsigned transaction.
func (*GrpcClient) DeployContractCtx ¶ added in v0.24.3
func (g *GrpcClient) DeployContractCtx(ctx context.Context, from, contractName string, abi *core.SmartContract_ABI, codeStr string, feeLimit, curPercent, oeLimit int64, ) (*api.TransactionExtention, error)
DeployContractCtx is the context-aware version of DeployContract.
func (*GrpcClient) EstimateEnergy ¶
func (g *GrpcClient) EstimateEnergy(from, contractAddress, method, jsonString string, tAmount int64, tTokenID string, tTokenAmount int64) (*api.EstimateEnergyMessage, error)
EstimateEnergy returns the estimated energy required for a contract call.
func (*GrpcClient) EstimateEnergyCtx ¶ added in v0.24.3
func (g *GrpcClient) EstimateEnergyCtx(ctx context.Context, from, contractAddress, method, jsonString string, tAmount int64, tTokenID string, tTokenAmount int64) (*api.EstimateEnergyMessage, error)
EstimateEnergyCtx is the context-aware version of EstimateEnergy.
func (*GrpcClient) EstimateEnergyWithData ¶ added in v0.25.2
func (g *GrpcClient) EstimateEnergyWithData(from, contractAddress string, data []byte, tAmount int64, tTokenID string, tTokenAmount int64) (*api.EstimateEnergyMessage, error)
EstimateEnergyWithData returns the estimated energy using pre-packed ABI data, bypassing the JSON string → parse → pack pipeline.
func (*GrpcClient) EstimateEnergyWithDataCtx ¶ added in v0.25.2
func (g *GrpcClient) EstimateEnergyWithDataCtx(ctx context.Context, from, contractAddress string, data []byte, tAmount int64, tTokenID string, tTokenAmount int64) (*api.EstimateEnergyMessage, error)
EstimateEnergyWithDataCtx is the context-aware version of EstimateEnergyWithData.
func (*GrpcClient) Exchange ¶ added in v0.26.0
func (g *GrpcClient) Exchange() ExchangeService
Exchange returns the ExchangeService backed by this client.
func (*GrpcClient) ExchangeByID ¶
func (g *GrpcClient) ExchangeByID(id int64) (*core.Exchange, error)
ExchangeByID returns exchangeDetails
func (*GrpcClient) ExchangeByIDCtx ¶ added in v0.24.3
ExchangeByIDCtx is the context-aware version of ExchangeByID.
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) ExchangeCreateCtx ¶ added in v0.24.3
func (g *GrpcClient) ExchangeCreateCtx( ctx context.Context, from string, tokenID1 string, amountToken1 int64, tokenID2 string, amountToken2 int64, ) (*api.TransactionExtention, error)
ExchangeCreateCtx is the context-aware version of ExchangeCreate.
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) ExchangeInjectCtx ¶ added in v0.24.3
func (g *GrpcClient) ExchangeInjectCtx( ctx context.Context, from string, exchangeID int64, tokenID string, amountToken int64, ) (*api.TransactionExtention, error)
ExchangeInjectCtx is the context-aware version of ExchangeInject.
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) ExchangeListCtx ¶ added in v0.24.3
func (g *GrpcClient) ExchangeListCtx(ctx context.Context, page int64, limit ...int) (*api.ExchangeList, error)
ExchangeListCtx is the context-aware version of ExchangeList.
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) ExchangeTradeCtx ¶ added in v0.24.3
func (g *GrpcClient) ExchangeTradeCtx( ctx context.Context, from string, exchangeID int64, tokenID string, amountToken int64, amountExpected int64, ) (*api.TransactionExtention, error)
ExchangeTradeCtx is the context-aware version of ExchangeTrade.
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) ExchangeWithdrawCtx ¶ added in v0.24.3
func (g *GrpcClient) ExchangeWithdrawCtx( ctx context.Context, from string, exchangeID int64, tokenID string, amountToken int64, ) (*api.TransactionExtention, error)
ExchangeWithdrawCtx is the context-aware version of ExchangeWithdraw.
func (*GrpcClient) FreezeBalance ¶
func (g *GrpcClient) FreezeBalance(from, delegateTo string, resource core.ResourceCode, frozenBalance int64) (*api.TransactionExtention, error)
FreezeBalance from base58 address
func (*GrpcClient) FreezeBalanceCtx ¶ added in v0.24.3
func (g *GrpcClient) FreezeBalanceCtx(ctx context.Context, from, delegateTo string, resource core.ResourceCode, frozenBalance int64) (*api.TransactionExtention, error)
FreezeBalanceCtx is the context-aware version of FreezeBalance.
func (*GrpcClient) FreezeBalanceV2 ¶
func (g *GrpcClient) FreezeBalanceV2(from string, resource core.ResourceCode, frozenBalance int64) (*api.TransactionExtention, error)
FreezeBalanceV2 freezes balance from base58 address.
func (*GrpcClient) FreezeBalanceV2Ctx ¶ added in v0.24.3
func (g *GrpcClient) FreezeBalanceV2Ctx(ctx context.Context, from string, resource core.ResourceCode, frozenBalance int64) (*api.TransactionExtention, error)
FreezeBalanceV2Ctx is the context-aware version of FreezeBalanceV2.
func (*GrpcClient) GetAccount ¶
func (g *GrpcClient) GetAccount(addr string) (*core.Account, error)
GetAccount from BASE58 address
func (*GrpcClient) GetAccountCtx ¶ added in v0.24.3
GetAccountCtx is the context-aware version of GetAccount.
func (*GrpcClient) GetAccountDetailed ¶
func (g *GrpcClient) GetAccountDetailed(addr string) (*account.Account, error)
GetAccountDetailed from BASE58 address
func (*GrpcClient) GetAccountDetailedCtx ¶ added in v0.24.3
func (g *GrpcClient) GetAccountDetailedCtx(ctx context.Context, addr string) (*account.Account, error)
GetAccountDetailedCtx is the context-aware version of GetAccountDetailed.
func (*GrpcClient) GetAccountNet ¶
func (g *GrpcClient) GetAccountNet(addr string) (*api.AccountNetMessage, error)
GetAccountNet return account resources from BASE58 address
func (*GrpcClient) GetAccountNetCtx ¶ added in v0.24.3
func (g *GrpcClient) GetAccountNetCtx(ctx context.Context, addr string) (*api.AccountNetMessage, error)
GetAccountNetCtx is the context-aware version of GetAccountNet.
func (*GrpcClient) GetAccountResource ¶
func (g *GrpcClient) GetAccountResource(addr string) (*api.AccountResourceMessage, error)
GetAccountResource from BASE58 address
func (*GrpcClient) GetAccountResourceCtx ¶ added in v0.24.3
func (g *GrpcClient) GetAccountResourceCtx(ctx context.Context, addr string) (*api.AccountResourceMessage, error)
GetAccountResourceCtx is the context-aware version of GetAccountResource.
func (*GrpcClient) GetAssetIssueByAccount ¶
func (g *GrpcClient) GetAssetIssueByAccount(address string) (*api.AssetIssueList, error)
GetAssetIssueByAccount list asset issued by account
func (*GrpcClient) GetAssetIssueByAccountCtx ¶ added in v0.24.3
func (g *GrpcClient) GetAssetIssueByAccountCtx(ctx context.Context, address string) (*api.AssetIssueList, error)
GetAssetIssueByAccountCtx is the context-aware version of GetAssetIssueByAccount.
func (*GrpcClient) GetAssetIssueByID ¶
func (g *GrpcClient) GetAssetIssueByID(tokenID string) (*core.AssetIssueContract, error)
GetAssetIssueByID list asset issued by ID
func (*GrpcClient) GetAssetIssueByIDCtx ¶ added in v0.24.3
func (g *GrpcClient) GetAssetIssueByIDCtx(ctx context.Context, tokenID string) (*core.AssetIssueContract, error)
GetAssetIssueByIDCtx is the context-aware version of GetAssetIssueByID.
func (*GrpcClient) GetAssetIssueByName ¶
func (g *GrpcClient) GetAssetIssueByName(name string) (*core.AssetIssueContract, error)
GetAssetIssueByName list asset issued by name
func (*GrpcClient) GetAssetIssueByNameCtx ¶ added in v0.24.3
func (g *GrpcClient) GetAssetIssueByNameCtx(ctx context.Context, name string) (*core.AssetIssueContract, error)
GetAssetIssueByNameCtx is the context-aware version of GetAssetIssueByName.
func (*GrpcClient) GetAssetIssueList ¶
func (g *GrpcClient) GetAssetIssueList(page int64, limit ...int) (*api.AssetIssueList, error)
GetAssetIssueList list all TRC10
func (*GrpcClient) GetAssetIssueListCtx ¶ added in v0.24.3
func (g *GrpcClient) GetAssetIssueListCtx(ctx context.Context, page int64, limit ...int) (*api.AssetIssueList, error)
GetAssetIssueListCtx is the context-aware version of GetAssetIssueList.
func (*GrpcClient) GetAvailableUnfreezeCount ¶
func (g *GrpcClient) GetAvailableUnfreezeCount(from string) (*api.GetAvailableUnfreezeCountResponseMessage, error)
GetAvailableUnfreezeCount from base58 address
func (*GrpcClient) GetAvailableUnfreezeCountCtx ¶ added in v0.24.3
func (g *GrpcClient) GetAvailableUnfreezeCountCtx(ctx context.Context, from string) (*api.GetAvailableUnfreezeCountResponseMessage, error)
GetAvailableUnfreezeCountCtx is the context-aware version of GetAvailableUnfreezeCount.
func (*GrpcClient) GetBandwidthPriceHistory ¶ added in v0.24.3
func (g *GrpcClient) GetBandwidthPriceHistory() ([]PriceEntry, error)
GetBandwidthPriceHistory returns parsed bandwidth price history.
func (*GrpcClient) GetBandwidthPriceHistoryCtx ¶ added in v0.24.3
func (g *GrpcClient) GetBandwidthPriceHistoryCtx(ctx context.Context) ([]PriceEntry, error)
GetBandwidthPriceHistoryCtx is the context-aware version of GetBandwidthPriceHistory.
func (*GrpcClient) GetBandwidthPrices ¶
func (g *GrpcClient) GetBandwidthPrices() (*api.PricesResponseMessage, error)
GetBandwidthPrices returns bandwidth prices
func (*GrpcClient) GetBandwidthPricesCtx ¶ added in v0.24.3
func (g *GrpcClient) GetBandwidthPricesCtx(ctx context.Context) (*api.PricesResponseMessage, error)
GetBandwidthPricesCtx is the context-aware version of GetBandwidthPrices.
func (*GrpcClient) GetBlockByID ¶
func (g *GrpcClient) GetBlockByID(id string) (*core.Block, error)
GetBlockByID block from hash
func (*GrpcClient) GetBlockByIDCtx ¶ added in v0.24.3
GetBlockByIDCtx is the context-aware version of GetBlockByID.
func (*GrpcClient) GetBlockByLatestNum ¶
func (g *GrpcClient) GetBlockByLatestNum(num int64) (*api.BlockListExtention, error)
GetBlockByLatestNum return block list till num
func (*GrpcClient) GetBlockByLatestNumCtx ¶ added in v0.24.3
func (g *GrpcClient) GetBlockByLatestNumCtx(ctx context.Context, num int64) (*api.BlockListExtention, error)
GetBlockByLatestNumCtx is the context-aware version of GetBlockByLatestNum.
func (*GrpcClient) GetBlockByLimitNext ¶
func (g *GrpcClient) GetBlockByLimitNext(start, end int64) (*api.BlockListExtention, error)
GetBlockByLimitNext return list of block start/end
func (*GrpcClient) GetBlockByLimitNextCtx ¶ added in v0.24.3
func (g *GrpcClient) GetBlockByLimitNextCtx(ctx context.Context, start, end int64) (*api.BlockListExtention, error)
GetBlockByLimitNextCtx is the context-aware version of GetBlockByLimitNext.
func (*GrpcClient) GetBlockByNum ¶
func (g *GrpcClient) GetBlockByNum(num int64) (*api.BlockExtention, error)
GetBlockByNum block from number
func (*GrpcClient) GetBlockByNumCtx ¶ added in v0.24.3
func (g *GrpcClient) GetBlockByNumCtx(ctx context.Context, num int64) (*api.BlockExtention, error)
GetBlockByNumCtx is the context-aware version of GetBlockByNum.
func (*GrpcClient) GetBlockInfoByNum ¶
func (g *GrpcClient) GetBlockInfoByNum(num int64) (*api.TransactionInfoList, error)
GetBlockInfoByNum block from number
func (*GrpcClient) GetBlockInfoByNumCtx ¶ added in v0.24.3
func (g *GrpcClient) GetBlockInfoByNumCtx(ctx context.Context, num int64) (*api.TransactionInfoList, error)
GetBlockInfoByNumCtx is the context-aware version of GetBlockInfoByNum.
func (*GrpcClient) GetCanDelegatedMaxSize ¶
func (g *GrpcClient) GetCanDelegatedMaxSize(address string, resource int32) (*api.CanDelegatedMaxSizeResponseMessage, error)
GetCanDelegatedMaxSize from BASE58 address
func (*GrpcClient) GetCanDelegatedMaxSizeCtx ¶ added in v0.24.3
func (g *GrpcClient) GetCanDelegatedMaxSizeCtx(ctx context.Context, address string, resource int32) (*api.CanDelegatedMaxSizeResponseMessage, error)
GetCanDelegatedMaxSizeCtx is the context-aware version of GetCanDelegatedMaxSize.
func (*GrpcClient) GetCanWithdrawUnfreezeAmount ¶
func (g *GrpcClient) GetCanWithdrawUnfreezeAmount(from string, timestamp int64) (*api.CanWithdrawUnfreezeAmountResponseMessage, error)
GetCanWithdrawUnfreezeAmount from base58 address
func (*GrpcClient) GetCanWithdrawUnfreezeAmountCtx ¶ added in v0.24.3
func (g *GrpcClient) GetCanWithdrawUnfreezeAmountCtx(ctx context.Context, from string, timestamp int64) (*api.CanWithdrawUnfreezeAmountResponseMessage, error)
GetCanWithdrawUnfreezeAmountCtx is the context-aware version of GetCanWithdrawUnfreezeAmount.
func (*GrpcClient) GetContractABI ¶
func (g *GrpcClient) GetContractABI(contractAddress string) (*core.SmartContract_ABI, error)
GetContractABI returns the ABI of a deployed smart contract.
func (*GrpcClient) GetContractABICtx ¶ added in v0.24.3
func (g *GrpcClient) GetContractABICtx(ctx context.Context, contractAddress string) (*core.SmartContract_ABI, error)
GetContractABICtx is the context-aware version of GetContractABI.
func (*GrpcClient) GetContractABIResolved ¶ added in v0.24.3
func (g *GrpcClient) GetContractABIResolved(contractAddress string) (*core.SmartContract_ABI, error)
GetContractABIResolved returns the ABI for a contract, resolving proxy contracts transparently. It first calls GetContractABI on the given address; if the returned ABI has no entries, or if the ABI looks like a proxy-only ABI (contains an "implementation" function), it attempts to detect a proxy by trying several well-known proxy getter selectors (implementation(), comptrollerImplementation(), getImplementation(), masterCopy()). On success it fetches the ABI from the implementation contract instead.
Only a single level of proxy indirection is resolved; chained proxies (proxy → proxy → implementation) are not followed.
func (*GrpcClient) GetContractABIResolvedCtx ¶ added in v0.24.3
func (g *GrpcClient) GetContractABIResolvedCtx(ctx context.Context, contractAddress string) (*core.SmartContract_ABI, error)
GetContractABIResolvedCtx is the context-aware version of GetContractABIResolved.
func (*GrpcClient) GetDelegatedResources ¶
func (g *GrpcClient) GetDelegatedResources(address string) ([]*api.DelegatedResourceList, error)
GetDelegatedResources from BASE58 address
func (*GrpcClient) GetDelegatedResourcesCtx ¶ added in v0.24.3
func (g *GrpcClient) GetDelegatedResourcesCtx(ctx context.Context, address string) ([]*api.DelegatedResourceList, error)
GetDelegatedResourcesCtx is the context-aware version of GetDelegatedResources.
func (*GrpcClient) GetDelegatedResourcesV2 ¶
func (g *GrpcClient) GetDelegatedResourcesV2(address string) ([]*api.DelegatedResourceList, error)
GetDelegatedResourcesV2 from BASE58 address
func (*GrpcClient) GetDelegatedResourcesV2Ctx ¶ added in v0.24.3
func (g *GrpcClient) GetDelegatedResourcesV2Ctx(ctx context.Context, address string) ([]*api.DelegatedResourceList, error)
GetDelegatedResourcesV2Ctx is the context-aware version of GetDelegatedResourcesV2.
func (*GrpcClient) GetEnergyPriceHistory ¶ added in v0.24.3
func (g *GrpcClient) GetEnergyPriceHistory() ([]PriceEntry, error)
GetEnergyPriceHistory returns parsed energy price history.
func (*GrpcClient) GetEnergyPriceHistoryCtx ¶ added in v0.24.3
func (g *GrpcClient) GetEnergyPriceHistoryCtx(ctx context.Context) ([]PriceEntry, error)
GetEnergyPriceHistoryCtx is the context-aware version of GetEnergyPriceHistory.
func (*GrpcClient) GetEnergyPrices ¶
func (g *GrpcClient) GetEnergyPrices() (*api.PricesResponseMessage, error)
GetEnergyPrices returns energy prices
func (*GrpcClient) GetEnergyPricesCtx ¶ added in v0.24.3
func (g *GrpcClient) GetEnergyPricesCtx(ctx context.Context) (*api.PricesResponseMessage, error)
GetEnergyPricesCtx is the context-aware version of GetEnergyPrices.
func (*GrpcClient) GetMemoFee ¶
func (g *GrpcClient) GetMemoFee() (*api.PricesResponseMessage, error)
GetMemoFee returns memo fee
func (*GrpcClient) GetMemoFeeCtx ¶ added in v0.24.3
func (g *GrpcClient) GetMemoFeeCtx(ctx context.Context) (*api.PricesResponseMessage, error)
GetMemoFeeCtx is the context-aware version of GetMemoFee.
func (*GrpcClient) GetMemoFeeHistory ¶ added in v0.24.3
func (g *GrpcClient) GetMemoFeeHistory() ([]PriceEntry, error)
GetMemoFeeHistory returns parsed memo fee history.
func (*GrpcClient) GetMemoFeeHistoryCtx ¶ added in v0.24.3
func (g *GrpcClient) GetMemoFeeHistoryCtx(ctx context.Context) ([]PriceEntry, error)
GetMemoFeeHistoryCtx is the context-aware version of GetMemoFeeHistory.
func (*GrpcClient) GetNextMaintenanceTime ¶
func (g *GrpcClient) GetNextMaintenanceTime() (*api.NumberMessage, error)
GetNextMaintenanceTime returns the timestamp of the next SR maintenance epoch.
func (*GrpcClient) GetNextMaintenanceTimeCtx ¶ added in v0.24.3
func (g *GrpcClient) GetNextMaintenanceTimeCtx(ctx context.Context) (*api.NumberMessage, error)
GetNextMaintenanceTimeCtx is the context-aware version of GetNextMaintenanceTime.
func (*GrpcClient) GetNodeInfo ¶
func (g *GrpcClient) GetNodeInfo() (*core.NodeInfo, error)
GetNodeInfo returns information about the connected TRON node.
func (*GrpcClient) GetNodeInfoCtx ¶ added in v0.24.3
GetNodeInfoCtx is the context-aware version of GetNodeInfo.
func (*GrpcClient) GetNowBlock ¶
func (g *GrpcClient) GetNowBlock() (*api.BlockExtention, error)
GetNowBlock return TIP block
func (*GrpcClient) GetNowBlockCtx ¶ added in v0.24.3
func (g *GrpcClient) GetNowBlockCtx(ctx context.Context) (*api.BlockExtention, error)
GetNowBlockCtx is the context-aware version of GetNowBlock.
func (*GrpcClient) GetPendingSize ¶ added in v0.25.2
func (g *GrpcClient) GetPendingSize() (*api.NumberMessage, error)
GetPendingSize returns the number of transactions in the pending pool.
func (*GrpcClient) GetPendingSizeCtx ¶ added in v0.25.2
func (g *GrpcClient) GetPendingSizeCtx(ctx context.Context) (*api.NumberMessage, error)
GetPendingSizeCtx is the context-aware version of GetPendingSize.
func (*GrpcClient) GetPendingTransactionsByAddress ¶ added in v0.25.2
func (g *GrpcClient) GetPendingTransactionsByAddress(address string) ([]*core.Transaction, error)
GetPendingTransactionsByAddress returns pending transactions where the given address is the owner (sender) of the contract. It fetches all pending tx IDs and then retrieves each transaction to check the owner address.
func (*GrpcClient) GetPendingTransactionsByAddressCtx ¶ added in v0.25.2
func (g *GrpcClient) GetPendingTransactionsByAddressCtx(ctx context.Context, address string) ([]*core.Transaction, error)
GetPendingTransactionsByAddressCtx is the context-aware version of GetPendingTransactionsByAddress.
func (*GrpcClient) GetReceivedDelegatedResourcesV2 ¶ added in v0.24.2
func (g *GrpcClient) GetReceivedDelegatedResourcesV2(address string) ([]*api.DelegatedResourceList, error)
GetReceivedDelegatedResourcesV2 returns resources delegated to the given BASE58 address by other accounts (Stake 2.0).
func (*GrpcClient) GetReceivedDelegatedResourcesV2Ctx ¶ added in v0.24.3
func (g *GrpcClient) GetReceivedDelegatedResourcesV2Ctx(ctx context.Context, address string) ([]*api.DelegatedResourceList, error)
GetReceivedDelegatedResourcesV2Ctx is the context-aware version of GetReceivedDelegatedResourcesV2.
func (*GrpcClient) GetRewardsInfo ¶
func (g *GrpcClient) GetRewardsInfo(addr string) (int64, error)
GetRewardsInfo from BASE58 address
func (*GrpcClient) GetRewardsInfoCtx ¶ added in v0.24.3
GetRewardsInfoCtx is the context-aware version of GetRewardsInfo.
func (*GrpcClient) GetTransactionByID ¶
func (g *GrpcClient) GetTransactionByID(id string) (*core.Transaction, error)
GetTransactionByID returns transaction details by ID
func (*GrpcClient) GetTransactionByIDCtx ¶ added in v0.24.3
func (g *GrpcClient) GetTransactionByIDCtx(ctx context.Context, id string) (*core.Transaction, error)
GetTransactionByIDCtx is the context-aware version of GetTransactionByID.
func (*GrpcClient) GetTransactionFromPending ¶ added in v0.25.2
func (g *GrpcClient) GetTransactionFromPending(id string) (*core.Transaction, error)
GetTransactionFromPending returns a transaction from the pending pool by ID.
func (*GrpcClient) GetTransactionFromPendingCtx ¶ added in v0.25.2
func (g *GrpcClient) GetTransactionFromPendingCtx(ctx context.Context, id string) (*core.Transaction, error)
GetTransactionFromPendingCtx is the context-aware version of GetTransactionFromPending.
func (*GrpcClient) GetTransactionInfoByID ¶
func (g *GrpcClient) GetTransactionInfoByID(id string) (*core.TransactionInfo, error)
GetTransactionInfoByID returns transaction receipt by ID
func (*GrpcClient) GetTransactionInfoByIDCtx ¶ added in v0.24.3
func (g *GrpcClient) GetTransactionInfoByIDCtx(ctx context.Context, id string) (*core.TransactionInfo, error)
GetTransactionInfoByIDCtx is the context-aware version of GetTransactionInfoByID.
func (*GrpcClient) GetTransactionListFromPending ¶ added in v0.25.2
func (g *GrpcClient) GetTransactionListFromPending() (*api.TransactionIdList, error)
GetTransactionListFromPending returns the list of transaction IDs in the pending pool.
func (*GrpcClient) GetTransactionListFromPendingCtx ¶ added in v0.25.2
func (g *GrpcClient) GetTransactionListFromPendingCtx(ctx context.Context) (*api.TransactionIdList, error)
GetTransactionListFromPendingCtx is the context-aware version of GetTransactionListFromPending.
func (*GrpcClient) GetTransactionSignWeight ¶
func (g *GrpcClient) GetTransactionSignWeight(tx *core.Transaction) (*api.TransactionSignWeight, error)
GetTransactionSignWeight queries transaction sign weight
func (*GrpcClient) GetTransactionSignWeightCtx ¶ added in v0.24.3
func (g *GrpcClient) GetTransactionSignWeightCtx(ctx context.Context, tx *core.Transaction) (*api.TransactionSignWeight, error)
GetTransactionSignWeightCtx is the context-aware version of GetTransactionSignWeight.
func (*GrpcClient) GetWitnessBrokerage ¶
func (g *GrpcClient) GetWitnessBrokerage(witness string) (float64, error)
GetWitnessBrokerage from witness address
func (*GrpcClient) GetWitnessBrokerageCtx ¶ added in v0.24.3
GetWitnessBrokerageCtx is the context-aware version of GetWitnessBrokerage.
func (*GrpcClient) Governance ¶ added in v0.26.0
func (g *GrpcClient) Governance() GovernanceService
Governance returns the GovernanceService backed by this client.
func (*GrpcClient) IsTransactionPending ¶ added in v0.25.2
func (g *GrpcClient) IsTransactionPending(id string) (bool, error)
IsTransactionPending checks whether a transaction is in the pending pool.
func (*GrpcClient) IsTransactionPendingCtx ¶ added in v0.25.2
IsTransactionPendingCtx is the context-aware version of IsTransactionPending.
func (*GrpcClient) ListNodes ¶
func (g *GrpcClient) ListNodes() (*api.NodeList, error)
ListNodes returns the list of nodes connected to the network.
func (*GrpcClient) ListNodesCtx ¶ added in v0.24.3
ListNodesCtx is the context-aware version of ListNodes.
func (*GrpcClient) ListWitnesses ¶
func (g *GrpcClient) ListWitnesses() (*api.WitnessList, error)
ListWitnesses return all witnesses
func (*GrpcClient) ListWitnessesCtx ¶ added in v0.24.3
func (g *GrpcClient) ListWitnessesCtx(ctx context.Context) (*api.WitnessList, error)
ListWitnessesCtx is the context-aware version of ListWitnesses.
func (*GrpcClient) ListWitnessesPaginated ¶ added in v0.24.3
func (g *GrpcClient) ListWitnessesPaginated(page int64, limit ...int) (*api.WitnessList, error)
ListWitnessesPaginated returns a paginated list of current witnesses
func (*GrpcClient) ListWitnessesPaginatedCtx ¶ added in v0.24.3
func (g *GrpcClient) ListWitnessesPaginatedCtx(ctx context.Context, page int64, limit ...int) (*api.WitnessList, error)
ListWitnessesPaginatedCtx is the context-aware version of ListWitnessesPaginated.
func (*GrpcClient) Network ¶ added in v0.26.0
func (g *GrpcClient) Network() NetworkService
Network returns the NetworkService backed by this client.
func (*GrpcClient) ParseTRC20NumericProperty ¶
func (g *GrpcClient) ParseTRC20NumericProperty(data string) (*big.Int, error)
ParseTRC20NumericProperty parses a 64-character hex string into a *big.Int.
func (*GrpcClient) ParseTRC20StringProperty ¶
func (g *GrpcClient) ParseTRC20StringProperty(data string) (string, error)
ParseTRC20StringProperty decodes an ABI-encoded string from hex data.
func (*GrpcClient) ParticipateAssetIssue ¶
func (g *GrpcClient) ParticipateAssetIssue(from, issuerAddress, tokenID string, amount int64) (*api.TransactionExtention, error)
ParticipateAssetIssue TRC10 ICO
func (*GrpcClient) ParticipateAssetIssueCtx ¶ added in v0.24.3
func (g *GrpcClient) ParticipateAssetIssueCtx(ctx context.Context, from, issuerAddress, tokenID string, amount int64) (*api.TransactionExtention, error)
ParticipateAssetIssueCtx is the context-aware version of ParticipateAssetIssue.
func (*GrpcClient) Pending ¶ added in v0.26.0
func (g *GrpcClient) Pending() PendingService
Pending returns the PendingService backed by this client.
func (*GrpcClient) ProposalApprove ¶
func (g *GrpcClient) ProposalApprove(from string, id int64, confirm bool) (*api.TransactionExtention, error)
ProposalApprove change URL info
func (*GrpcClient) ProposalApproveCtx ¶ added in v0.24.3
func (g *GrpcClient) ProposalApproveCtx(ctx context.Context, from string, id int64, confirm bool) (*api.TransactionExtention, error)
ProposalApproveCtx is the context-aware version of ProposalApprove.
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) ProposalCreateCtx ¶ added in v0.24.3
func (g *GrpcClient) ProposalCreateCtx(ctx context.Context, from string, parameters map[int64]int64) (*api.TransactionExtention, error)
ProposalCreateCtx is the context-aware version of ProposalCreate.
func (*GrpcClient) ProposalWithdraw ¶
func (g *GrpcClient) ProposalWithdraw(from string, id int64) (*api.TransactionExtention, error)
ProposalWithdraw withdraws a proposal.
func (*GrpcClient) ProposalWithdrawCtx ¶ added in v0.24.3
func (g *GrpcClient) ProposalWithdrawCtx(ctx context.Context, from string, id int64) (*api.TransactionExtention, error)
ProposalWithdrawCtx is the context-aware version of ProposalWithdraw.
func (*GrpcClient) ProposalsList ¶
func (g *GrpcClient) ProposalsList() (*api.ProposalList, error)
ProposalsList return all network proposals
func (*GrpcClient) ProposalsListCtx ¶ added in v0.24.3
func (g *GrpcClient) ProposalsListCtx(ctx context.Context) (*api.ProposalList, error)
ProposalsListCtx is the context-aware version of ProposalsList.
func (*GrpcClient) Reconnect ¶
func (g *GrpcClient) Reconnect(url string) error
Reconnect closes the current connection and re-establishes it. If url is non-empty, the client address is updated before reconnecting.
func (*GrpcClient) Resource ¶ added in v0.26.0
func (g *GrpcClient) Resource() ResourceService
Resource returns the ResourceService backed by this client.
func (*GrpcClient) SetAPIKey ¶
func (g *GrpcClient) SetAPIKey(apiKey string) error
SetAPIKey configures a TRON-PRO-API-KEY that is sent as gRPC metadata with every request.
func (*GrpcClient) SetContext ¶ added in v0.24.3
func (g *GrpcClient) SetContext(ctx context.Context) error
SetContext sets a base context for all RPC calls. This allows callers to propagate cancellation, deadlines, and tracing metadata. If not set, context.Background() is used.
Note: cancelling the base context will cause all subsequent RPCs on this client to fail immediately. SetContext must not be called concurrently with RPC methods.
func (*GrpcClient) SetTimeout ¶
func (g *GrpcClient) SetTimeout(timeout time.Duration)
SetTimeout updates the timeout used for all subsequent RPC calls.
func (*GrpcClient) Start ¶
func (g *GrpcClient) Start(opts ...grpc.DialOption) error
Start establishes the gRPC connection. If no address was provided, it defaults to grpc.trongrid.io:50051.
func (*GrpcClient) TRC20 ¶ added in v0.26.0
func (g *GrpcClient) TRC20() TRC20Service
TRC20 returns the TRC20Service backed by this client.
func (*GrpcClient) TRC20Approve ¶
func (g *GrpcClient) TRC20Approve(from, to, contract string, amount *big.Int, feeLimit int64, opts ...TRC20Option) (*api.TransactionExtention, error)
TRC20Approve approves a spender to transfer up to amount TRC20 tokens on behalf of from.
func (*GrpcClient) TRC20ApproveCtx ¶ added in v0.24.3
func (g *GrpcClient) TRC20ApproveCtx(ctx context.Context, from, to, contract string, amount *big.Int, feeLimit int64, opts ...TRC20Option) (*api.TransactionExtention, error)
TRC20ApproveCtx is the context-aware version of TRC20Approve.
func (*GrpcClient) TRC20Call ¶
func (g *GrpcClient) TRC20Call(from, contractAddress, data string, constant bool, feeLimit int64) (*api.TransactionExtention, error)
TRC20Call performs a low-level TRC20 contract call with pre-built hex data.
func (*GrpcClient) TRC20CallCtx ¶ added in v0.24.3
func (g *GrpcClient) TRC20CallCtx(ctx context.Context, from, contractAddress, data string, constant bool, feeLimit int64) (*api.TransactionExtention, error)
TRC20CallCtx is the context-aware version of TRC20Call.
func (*GrpcClient) TRC20ContractBalance ¶
func (g *GrpcClient) TRC20ContractBalance(addr, contractAddress string) (*big.Int, error)
TRC20ContractBalance returns the TRC20 token balance of addr for the given contract.
func (*GrpcClient) TRC20ContractBalanceCtx ¶ added in v0.24.3
func (g *GrpcClient) TRC20ContractBalanceCtx(ctx context.Context, addr, contractAddress string) (*big.Int, error)
TRC20ContractBalanceCtx is the context-aware version of TRC20ContractBalance.
func (*GrpcClient) TRC20GetDecimals ¶
func (g *GrpcClient) TRC20GetDecimals(contractAddress string) (*big.Int, error)
TRC20GetDecimals returns the number of decimals for a TRC20 token contract.
func (*GrpcClient) TRC20GetDecimalsCtx ¶ added in v0.24.3
func (g *GrpcClient) TRC20GetDecimalsCtx(ctx context.Context, contractAddress string) (*big.Int, error)
TRC20GetDecimalsCtx is the context-aware version of TRC20GetDecimals.
func (*GrpcClient) TRC20GetName ¶
func (g *GrpcClient) TRC20GetName(contractAddress string) (string, error)
TRC20GetName returns the name of a TRC20 token contract.
func (*GrpcClient) TRC20GetNameCtx ¶ added in v0.24.3
TRC20GetNameCtx is the context-aware version of TRC20GetName.
func (*GrpcClient) TRC20GetSymbol ¶
func (g *GrpcClient) TRC20GetSymbol(contractAddress string) (string, error)
TRC20GetSymbol returns the symbol of a TRC20 token contract.
func (*GrpcClient) TRC20GetSymbolCtx ¶ added in v0.24.3
TRC20GetSymbolCtx is the context-aware version of TRC20GetSymbol.
func (*GrpcClient) TRC20Send ¶
func (g *GrpcClient) TRC20Send(from, to, contract string, amount *big.Int, feeLimit int64, opts ...TRC20Option) (*api.TransactionExtention, error)
TRC20Send transfers TRC20 tokens to the specified address.
func (*GrpcClient) TRC20SendCtx ¶ added in v0.24.3
func (g *GrpcClient) TRC20SendCtx(ctx context.Context, from, to, contract string, amount *big.Int, feeLimit int64, opts ...TRC20Option) (*api.TransactionExtention, error)
TRC20SendCtx is the context-aware version of TRC20Send.
func (*GrpcClient) TRC20TransferFrom ¶
func (g *GrpcClient) TRC20TransferFrom(owner, from, to, contract string, amount *big.Int, feeLimit int64, opts ...TRC20Option) (*api.TransactionExtention, error)
TRC20TransferFrom transfers tokens on behalf of another address (owner signs the tx).
func (*GrpcClient) TRC20TransferFromCtx ¶ added in v0.24.3
func (g *GrpcClient) TRC20TransferFromCtx(ctx context.Context, owner, from, to, contract string, amount *big.Int, feeLimit int64, opts ...TRC20Option) (*api.TransactionExtention, error)
TRC20TransferFromCtx is the context-aware version of TRC20TransferFrom.
func (*GrpcClient) TotalTransaction ¶
func (g *GrpcClient) TotalTransaction() (*api.NumberMessage, error)
TotalTransaction returns the total number of transactions on the network.
func (*GrpcClient) TotalTransactionCtx ¶ added in v0.24.3
func (g *GrpcClient) TotalTransactionCtx(ctx context.Context) (*api.NumberMessage, error)
TotalTransactionCtx is the context-aware version of TotalTransaction.
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) TransferAssetCtx ¶ added in v0.24.3
func (g *GrpcClient) TransferAssetCtx(ctx context.Context, from, toAddress, assetName string, amount int64) (*api.TransactionExtention, error)
TransferAssetCtx is the context-aware version of TransferAsset.
func (*GrpcClient) TransferCtx ¶ added in v0.24.3
func (g *GrpcClient) TransferCtx(ctx context.Context, from, toAddress string, amount int64) (*api.TransactionExtention, error)
TransferCtx is the context-aware version of Transfer.
func (*GrpcClient) Transfers ¶ added in v0.26.0
func (g *GrpcClient) Transfers() TransferService
Transfers returns the TransferService backed by this client.
func (*GrpcClient) TriggerConstantContract ¶
func (g *GrpcClient) TriggerConstantContract(from, contractAddress, method, jsonString string, opts ...ConstantCallOption) (*api.TransactionExtention, error)
TriggerConstantContract executes a read-only smart contract call and returns the result.
func (*GrpcClient) TriggerConstantContractCtx ¶ added in v0.24.3
func (g *GrpcClient) TriggerConstantContractCtx(ctx context.Context, from, contractAddress, method, jsonString string, opts ...ConstantCallOption) (*api.TransactionExtention, error)
TriggerConstantContractCtx is the context-aware version of TriggerConstantContract.
func (*GrpcClient) TriggerConstantContractWithData ¶ added in v0.25.2
func (g *GrpcClient) TriggerConstantContractWithData(from, contractAddress string, data []byte, opts ...ConstantCallOption) (*api.TransactionExtention, error)
TriggerConstantContractWithData calls a constant contract method using pre-packed ABI data, bypassing the JSON string → parse → pack pipeline. This is useful when callers already have packed data from go-ethereum's abi.Pack() or similar tooling.
func (*GrpcClient) TriggerConstantContractWithDataCtx ¶ added in v0.25.2
func (g *GrpcClient) TriggerConstantContractWithDataCtx(ctx context.Context, from, contractAddress string, data []byte, opts ...ConstantCallOption) (*api.TransactionExtention, error)
TriggerConstantContractWithDataCtx is the context-aware version of TriggerConstantContractWithData.
func (*GrpcClient) TriggerContract ¶
func (g *GrpcClient) TriggerContract(from, contractAddress, method, jsonString string, feeLimit, tAmount int64, tTokenID string, tTokenAmount int64) (*api.TransactionExtention, error)
TriggerContract executes a state-changing smart contract call and returns the unsigned transaction.
func (*GrpcClient) TriggerContractCtx ¶ added in v0.24.3
func (g *GrpcClient) TriggerContractCtx(ctx context.Context, from, contractAddress, method, jsonString string, feeLimit, tAmount int64, tTokenID string, tTokenAmount int64) (*api.TransactionExtention, error)
TriggerContractCtx is the context-aware version of TriggerContract.
func (*GrpcClient) TriggerContractWithData ¶ added in v0.25.2
func (g *GrpcClient) TriggerContractWithData(from, contractAddress string, data []byte, feeLimit, tAmount int64, tTokenID string, tTokenAmount int64) (*api.TransactionExtention, error)
TriggerContractWithData triggers a contract method using pre-packed ABI data, bypassing the JSON string → parse → pack pipeline. This is useful when callers already have packed data from go-ethereum's abi.Pack() or similar tooling.
func (*GrpcClient) TriggerContractWithDataCtx ¶ added in v0.25.2
func (g *GrpcClient) TriggerContractWithDataCtx(ctx context.Context, from, contractAddress string, data []byte, feeLimit, tAmount int64, tTokenID string, tTokenAmount int64) (*api.TransactionExtention, error)
TriggerContractWithDataCtx is the context-aware version of TriggerContractWithData.
func (*GrpcClient) UnDelegateResource ¶
func (g *GrpcClient) UnDelegateResource(owner, receiver string, resource core.ResourceCode, delegateBalance int64) (*api.TransactionExtention, error)
UnDelegateResource from BASE58 address
func (*GrpcClient) UnDelegateResourceCtx ¶ added in v0.24.3
func (g *GrpcClient) UnDelegateResourceCtx(ctx context.Context, owner, receiver string, resource core.ResourceCode, delegateBalance int64) (*api.TransactionExtention, error)
UnDelegateResourceCtx is the context-aware version of UnDelegateResource.
func (*GrpcClient) UnfreezeAsset ¶
func (g *GrpcClient) UnfreezeAsset(from string) (*api.TransactionExtention, error)
UnfreezeAsset from owner
func (*GrpcClient) UnfreezeAssetCtx ¶ added in v0.24.3
func (g *GrpcClient) UnfreezeAssetCtx(ctx context.Context, from string) (*api.TransactionExtention, error)
UnfreezeAssetCtx is the context-aware version of UnfreezeAsset.
func (*GrpcClient) UnfreezeBalance ¶
func (g *GrpcClient) UnfreezeBalance(from, delegateTo string, resource core.ResourceCode) (*api.TransactionExtention, error)
UnfreezeBalance from base58 address
func (*GrpcClient) UnfreezeBalanceCtx ¶ added in v0.24.3
func (g *GrpcClient) UnfreezeBalanceCtx(ctx context.Context, from, delegateTo string, resource core.ResourceCode) (*api.TransactionExtention, error)
UnfreezeBalanceCtx is the context-aware version of UnfreezeBalance.
func (*GrpcClient) UnfreezeBalanceV2 ¶
func (g *GrpcClient) UnfreezeBalanceV2(from string, resource core.ResourceCode, unfreezeBalance int64) (*api.TransactionExtention, error)
UnfreezeBalanceV2 unfreezes balance from base58 address.
func (*GrpcClient) UnfreezeBalanceV2Ctx ¶ added in v0.24.3
func (g *GrpcClient) UnfreezeBalanceV2Ctx(ctx context.Context, from string, resource core.ResourceCode, unfreezeBalance int64) (*api.TransactionExtention, error)
UnfreezeBalanceV2Ctx is the context-aware version of UnfreezeBalanceV2.
func (*GrpcClient) UpdateAccount ¶
func (g *GrpcClient) UpdateAccount(from, accountName string) (*api.TransactionExtention, error)
UpdateAccount change account name
func (*GrpcClient) UpdateAccountCtx ¶ added in v0.24.3
func (g *GrpcClient) UpdateAccountCtx(ctx context.Context, from, accountName string) (*api.TransactionExtention, error)
UpdateAccountCtx is the context-aware version of UpdateAccount.
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) UpdateAccountPermissionCtx ¶ added in v0.24.3
func (g *GrpcClient) UpdateAccountPermissionCtx(ctx context.Context, from string, owner, witness map[string]interface{}, actives []map[string]interface{}) (*api.TransactionExtention, error)
UpdateAccountPermissionCtx is the context-aware version of UpdateAccountPermission.
func (*GrpcClient) UpdateAssetIssue ¶
func (g *GrpcClient) UpdateAssetIssue(from, description, urlStr string, newLimit, newPublicLimit int64) (*api.TransactionExtention, error)
UpdateAssetIssue information
func (*GrpcClient) UpdateAssetIssueCtx ¶ added in v0.24.3
func (g *GrpcClient) UpdateAssetIssueCtx(ctx context.Context, from, description, urlStr string, newLimit, newPublicLimit int64) (*api.TransactionExtention, error)
UpdateAssetIssueCtx is the context-aware version of UpdateAssetIssue.
func (*GrpcClient) UpdateBrokerage ¶
func (g *GrpcClient) UpdateBrokerage(from string, commission int32) (*api.TransactionExtention, error)
UpdateBrokerage change SR commission fees
func (*GrpcClient) UpdateBrokerageCtx ¶ added in v0.24.3
func (g *GrpcClient) UpdateBrokerageCtx(ctx context.Context, from string, commission int32) (*api.TransactionExtention, error)
UpdateBrokerageCtx is the context-aware version of UpdateBrokerage.
func (*GrpcClient) UpdateEnergyLimitContract ¶
func (g *GrpcClient) UpdateEnergyLimitContract(from, contractAddress string, value int64) (*api.TransactionExtention, error)
UpdateEnergyLimitContract updates the energy limit of a deployed smart contract.
func (*GrpcClient) UpdateEnergyLimitContractCtx ¶ added in v0.24.3
func (g *GrpcClient) UpdateEnergyLimitContractCtx(ctx context.Context, from, contractAddress string, value int64) (*api.TransactionExtention, error)
UpdateEnergyLimitContractCtx is the context-aware version of UpdateEnergyLimitContract.
func (*GrpcClient) UpdateHash ¶
func (g *GrpcClient) UpdateHash(tx *api.TransactionExtention) error
UpdateHash recalculates the transaction hash after local modifications (e.g. setting fee limit).
func (*GrpcClient) UpdateSettingContract ¶
func (g *GrpcClient) UpdateSettingContract(from, contractAddress string, value int64) (*api.TransactionExtention, error)
UpdateSettingContract changes the user resource consumption ratio of a deployed contract.
func (*GrpcClient) UpdateSettingContractCtx ¶ added in v0.24.3
func (g *GrpcClient) UpdateSettingContractCtx(ctx context.Context, from, contractAddress string, value int64) (*api.TransactionExtention, error)
UpdateSettingContractCtx is the context-aware version of UpdateSettingContract.
func (*GrpcClient) UpdateWitness ¶
func (g *GrpcClient) UpdateWitness(from, urlStr string) (*api.TransactionExtention, error)
UpdateWitness change URL info
func (*GrpcClient) UpdateWitnessCtx ¶ added in v0.24.3
func (g *GrpcClient) UpdateWitnessCtx(ctx context.Context, from, urlStr string) (*api.TransactionExtention, error)
UpdateWitnessCtx is the context-aware version of UpdateWitness.
func (*GrpcClient) VoteWitnessAccount ¶
func (g *GrpcClient) VoteWitnessAccount(from string, witnessMap map[string]int64) (*api.TransactionExtention, error)
VoteWitnessAccount change account vote
func (*GrpcClient) VoteWitnessAccountCtx ¶ added in v0.24.3
func (g *GrpcClient) VoteWitnessAccountCtx(ctx context.Context, from string, witnessMap map[string]int64) (*api.TransactionExtention, error)
VoteWitnessAccountCtx is the context-aware version of VoteWitnessAccount.
func (*GrpcClient) WithdrawBalance ¶
func (g *GrpcClient) WithdrawBalance(from string) (*api.TransactionExtention, error)
WithdrawBalance rewards from account
func (*GrpcClient) WithdrawBalanceCtx ¶ added in v0.24.3
func (g *GrpcClient) WithdrawBalanceCtx(ctx context.Context, from string) (*api.TransactionExtention, error)
WithdrawBalanceCtx is the context-aware version of WithdrawBalance.
func (*GrpcClient) WithdrawExpireUnfreeze ¶
func (g *GrpcClient) WithdrawExpireUnfreeze(from string, timestamp int64) (*api.TransactionExtention, error)
WithdrawExpireUnfreeze from base58 address
func (*GrpcClient) WithdrawExpireUnfreezeCtx ¶ added in v0.24.3
func (g *GrpcClient) WithdrawExpireUnfreezeCtx(ctx context.Context, from string, timestamp int64) (*api.TransactionExtention, error)
WithdrawExpireUnfreezeCtx is the context-aware version of WithdrawExpireUnfreeze.
type NetworkService ¶ added in v0.26.0
type NetworkService interface {
ListNodesCtx(ctx context.Context) (*api.NodeList, error)
GetNextMaintenanceTimeCtx(ctx context.Context) (*api.NumberMessage, error)
TotalTransactionCtx(ctx context.Context) (*api.NumberMessage, error)
GetTransactionByIDCtx(ctx context.Context, id string) (*core.Transaction, error)
GetTransactionInfoByIDCtx(ctx context.Context, id string) (*core.TransactionInfo, error)
BroadcastCtx(ctx context.Context, tx *core.Transaction) (*api.Return, error)
GetNodeInfoCtx(ctx context.Context) (*core.NodeInfo, error)
GetEnergyPricesCtx(ctx context.Context) (*api.PricesResponseMessage, error)
GetBandwidthPricesCtx(ctx context.Context) (*api.PricesResponseMessage, error)
GetMemoFeeCtx(ctx context.Context) (*api.PricesResponseMessage, error)
GetEnergyPriceHistoryCtx(ctx context.Context) ([]PriceEntry, error)
GetBandwidthPriceHistoryCtx(ctx context.Context) ([]PriceEntry, error)
GetMemoFeeHistoryCtx(ctx context.Context) ([]PriceEntry, error)
GetTransactionSignWeightCtx(ctx context.Context, tx *core.Transaction) (*api.TransactionSignWeight, error)
}
NetworkService provides network and transaction query operations.
type PendingService ¶ added in v0.26.0
type PendingService interface {
GetTransactionFromPendingCtx(ctx context.Context, id string) (*core.Transaction, error)
GetTransactionListFromPendingCtx(ctx context.Context) (*api.TransactionIdList, error)
GetPendingSizeCtx(ctx context.Context) (*api.NumberMessage, error)
IsTransactionPendingCtx(ctx context.Context, id string) (bool, error)
GetPendingTransactionsByAddressCtx(ctx context.Context, address string) ([]*core.Transaction, error)
}
PendingService provides pending transaction pool operations.
type PriceEntry ¶ added in v0.24.3
PriceEntry represents a single timestamp:price pair from the TRON price history.
func ParsePrices ¶ added in v0.24.3
func ParsePrices(raw string) ([]PriceEntry, error)
ParsePrices parses the comma-separated "timestamp:price" format returned by GetEnergyPrices, GetBandwidthPrices, and GetMemoFee into structured entries. It does not validate sign — callers should check for negative values if needed.
type ResourceService ¶ added in v0.26.0
type ResourceService interface {
GetAccountResourceCtx(ctx context.Context, addr string) (*api.AccountResourceMessage, error)
GetDelegatedResourcesCtx(ctx context.Context, address string) ([]*api.DelegatedResourceList, error)
GetDelegatedResourcesV2Ctx(ctx context.Context, address string) ([]*api.DelegatedResourceList, error)
GetReceivedDelegatedResourcesV2Ctx(ctx context.Context, address string) ([]*api.DelegatedResourceList, error)
GetCanDelegatedMaxSizeCtx(ctx context.Context, address string, resource int32) (*api.CanDelegatedMaxSizeResponseMessage, error)
DelegateResourceCtx(ctx context.Context, from, to string, resource core.ResourceCode, delegateBalance int64, lock bool, lockPeriod int64) (*api.TransactionExtention, error)
UnDelegateResourceCtx(ctx context.Context, owner, receiver string, resource core.ResourceCode, delegateBalance int64) (*api.TransactionExtention, error)
FreezeBalanceCtx(ctx context.Context, from, delegateTo string, resource core.ResourceCode, frozenBalance int64) (*api.TransactionExtention, error)
FreezeBalanceV2Ctx(ctx context.Context, from string, resource core.ResourceCode, frozenBalance int64) (*api.TransactionExtention, error)
UnfreezeBalanceCtx(ctx context.Context, from, delegateTo string, resource core.ResourceCode) (*api.TransactionExtention, error)
UnfreezeBalanceV2Ctx(ctx context.Context, from string, resource core.ResourceCode, unfreezeBalance int64) (*api.TransactionExtention, error)
GetAvailableUnfreezeCountCtx(ctx context.Context, from string) (*api.GetAvailableUnfreezeCountResponseMessage, error)
GetCanWithdrawUnfreezeAmountCtx(ctx context.Context, from string, timestamp int64) (*api.CanWithdrawUnfreezeAmountResponseMessage, error)
WithdrawExpireUnfreezeCtx(ctx context.Context, from string, timestamp int64) (*api.TransactionExtention, error)
}
ResourceService provides resource and staking operations.
type TRC20Option ¶ added in v0.25.2
type TRC20Option func(*trc20Config)
TRC20Option configures optional behaviour on TRC20 write methods (TRC20Send, TRC20Approve, TRC20TransferFrom).
func WithEstimate ¶ added in v0.25.2
func WithEstimate() TRC20Option
WithEstimate makes the TRC20 method perform a dry-run simulation via TriggerConstantContract instead of building a real transaction. The returned TransactionExtention contains estimated energy usage.
type TRC20Service ¶ added in v0.26.0
type TRC20Service interface {
TRC20CallCtx(ctx context.Context, from, contractAddress, data string, constant bool, feeLimit int64) (*api.TransactionExtention, error)
TRC20GetNameCtx(ctx context.Context, contractAddress string) (string, error)
TRC20GetSymbolCtx(ctx context.Context, contractAddress string) (string, error)
TRC20GetDecimalsCtx(ctx context.Context, contractAddress string) (*big.Int, error)
TRC20ContractBalanceCtx(ctx context.Context, addr, contractAddress string) (*big.Int, error)
TRC20SendCtx(ctx context.Context, from, to, contract string, amount *big.Int, feeLimit int64, opts ...TRC20Option) (*api.TransactionExtention, error)
TRC20TransferFromCtx(ctx context.Context, owner, from, to, contract string, amount *big.Int, feeLimit int64, opts ...TRC20Option) (*api.TransactionExtention, error)
TRC20ApproveCtx(ctx context.Context, from, to, contract string, amount *big.Int, feeLimit int64, opts ...TRC20Option) (*api.TransactionExtention, error)
}
TRC20Service provides TRC20 token operations.
type TransferService ¶ added in v0.26.0
type TransferService interface {
TransferCtx(ctx context.Context, from, toAddress string, amount int64) (*api.TransactionExtention, error)
}
TransferService provides TRX transfer operations.
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package transaction provides transaction signing and submission for TRON.
|
Package transaction provides transaction signing and submission for TRON. |