Documentation
¶
Overview ¶
Package trc20 packs TRC-20 (TRON's ERC-20 equivalent) calldata for contract-call transactions on the TRON network. TRC-20 uses the same solidity ABI as ERC-20; the only difference is the address format (base58 with a 0x41 version byte instead of 0x00 hex).
The two helpers in this file (ConvertToBytes / ConvertToHex) are duplicated from signing/tron/utils.go so this package doesn't have to depend on the parent (which itself calls into trc20 for its PackPayloadForTrc20 helper — importing back would create a cycle). Behaviour is identical.
Index ¶
Constants ¶
const ABITRC20 = `` /* 4470-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
func ConvertToBytes ¶
ConvertToBytes base58-decodes a TRON T-address into raw bytes, prefixed with the base58 version byte. Returns nil on decode error.
func ConvertToHex ¶
ConvertToHex takes a base58 T-address and returns its hex form (with the leading 0x41 version byte). Used to build EVM-style calldata parameters where TRC-20 contracts speak in hex-address terms. Returns "" for invalid input; "0" when the decoded bytes are empty (defensive fallback to keep downstream Pack calls from panicking on an empty string).
Types ¶
type CallTrc20In ¶
type CallTrc20In struct {
Address string `json:"address,omitempty"`
Owner string `json:"owner,omitempty"`
Spender string `json:"spender,omitempty"`
From string `json:"from,omitempty"`
To string `json:"to,omitempty"`
Recipient string `json:"recipient,omitempty"`
Amount string `json:"amount,omitempty"`
}
for call contract
type UnpackTrc20 ¶
type UnpackTrc20 struct {
Function string
CallTrc20In
}
for call contract
func UnpackPayloadForTrc20 ¶
func UnpackPayloadForTrc20(payload string) (*UnpackTrc20, error)