Documentation ¶
Index ¶
- Variables
- type BroadcastResponse
- type CallResponse
- type CallResponseResult
- type Config
- type ContractCallRequest
- type Provider
- func (p *Provider) BroadcastTransaction(ctx context.Context, rawTX []byte, isTest bool) (string, error)
- func (p *Provider) CallContract(ctx context.Context, payload ContractCallRequest, isTest bool) (Transaction, error)
- func (p *Provider) CreateTransaction(ctx context.Context, payload TransactionRequest, isTest bool) (Transaction, error)
- func (p *Provider) GetTransactionReceipt(ctx context.Context, txID string, isTest bool) (*TransactionReceipt, error)
- type Transaction
- type TransactionReceipt
- type TransactionRequest
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrResponse = errors.New("error response") ErrNotFound = errors.New("transaction not found") )
Functions ¶
This section is empty.
Types ¶
type BroadcastResponse ¶
type BroadcastResponse struct { Result bool `json:"result"` Code string `json:"code"` Message string `json:"message"` TransactionHashID string `json:"txid"` }
BroadcastResponse. Examples:
{ "code": "CONTRACT_VALIDATE_ERROR", "txid": "50d52436163be5c38af269bbdee0a7e258e94cfa9cc05f975e543b98c6994f2e", "message": "Contract validate error : account [TDVEJbSyEtk8L4htanm8h5mp2sNutRm5ou] does not exist" } { "code": "DUP_TRANSACTION_ERROR", "txid": "fbb158948b240f88b188c65f5a623b562fe4d7a9a90eecef4495146acf87a484", "message": "Dup transaction." } { "result": true, "txid": "fbb158948b240f88b188c65f5a623b562fe4d7a9a90eecef4495146acf87a484" }
type CallResponse ¶
type CallResponse struct { Result CallResponseResult Transaction Transaction `json:"transaction"` }
CallResponse represents response when calling /wallet/triggersmartcontract.
type CallResponseResult ¶
type Config ¶
type Config struct { MainnetBaseURL string `yaml:"mainnet_url" env:"TRONGRID_MAINNET_URL" env-default:"https://api.trongrid.io" env-description:"Trongrid API base path"` TestnetBaseURL string `` /* 148-byte string literal not displayed */ APIKey string `yaml:"api_key" env:"TRONGRID_API_KEY" env-description:"Trongrid API Key"` }
type ContractCallRequest ¶
type ContractCallRequest struct { OwnerAddress string `json:"owner_address"` ContractAddress string `json:"contract_address"` FunctionSelector string `json:"function_selector"` Parameter string `json:"parameter"` FeeLimit uint64 `json:"fee_limit"` CallValue uint64 `json:"call_value"` Visible bool `json:"visible"` }
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
func (*Provider) BroadcastTransaction ¶
func (p *Provider) BroadcastTransaction(ctx context.Context, rawTX []byte, isTest bool) (string, error)
BroadcastTransaction broadcasts tx and return tx hash id.
func (*Provider) CallContract ¶
func (p *Provider) CallContract( ctx context.Context, payload ContractCallRequest, isTest bool, ) (Transaction, error)
func (*Provider) CreateTransaction ¶
func (p *Provider) CreateTransaction( ctx context.Context, payload TransactionRequest, isTest bool, ) (Transaction, error)
CreateTransaction fcking TRON makes offline tx creation so hard so they basically implemented endpoint for unsigned tx creation
func (*Provider) GetTransactionReceipt ¶
type Transaction ¶
type TransactionReceipt ¶
type TransactionRequest ¶
type TransactionRequest struct { OwnerAddress string `json:"owner_address"` ToAddress string `json:"to_address"` Amount uint64 `json:"amount"` ExtraData string `json:"extra_data"` Visible bool `json:"visible"` }
TransactionRequest transaction request. Address format: 410fe47f49fd91f0edb7fa2b94a3c45d9c2231709c See https://developers.tron.network/reference/createtransaction
Click to show internal directories.
Click to hide internal directories.