Documentation
¶
Index ¶
- Constants
- func ConvertFromHex(hexAddress string) string
- func ConvertToBytes(address string) []byte
- func ConvertToHex(address string) string
- func Int64ToBytes(n int64) []byte
- func NewAccountFromMnemonic(mnemonic, path string) (signing.AccountHandler, error)
- func NewAccountFromPrivateKey(privateKey []byte) (signing.AccountHandler, error)
- func NewAccountFromPrivateKeyHex(privateKey string) (signing.AccountHandler, error)
- func PackPayloadForTrc20(function string, params []byte) (string, error)
- func PublicKey2Address(publicKey []byte) string
- func ValidAddress(address string) bool
- type Account
- func (a *Account) Address() string
- func (a *Account) PrivateKey() []byte
- func (a *Account) PrivateKeyHex() string
- func (a *Account) PublicKey() []byte
- func (a *Account) PublicKeyHex() string
- func (a *Account) SignData(data []byte) ([]byte, error)
- func (a *Account) VerifySignData(data, sig []byte) bool
- type CallTrc20In
- type ContractValue
- type FreeGas
- type Ingredient
- type NativeTx
- type TrxContract
- type TxBuilder
- func (tx *TxBuilder) Build() error
- func (tx *TxBuilder) ConcatSignature(signature string, isDerFormat bool) (string, error)
- func (tx *TxBuilder) GetSigHash() []string
- func (tx *TxBuilder) GetTxHash() string
- func (tx *TxBuilder) GetUnsignedHex() string
- func (tx *TxBuilder) PrintSignerParams(chain string, index string)
- func (tx *TxBuilder) SetSigHash(sigHash []string)
- func (tx *TxBuilder) SetUnsignedHex(unsignedHex string)
- func (tx *TxBuilder) Sign(privateKey []byte) (string, error)
- type TxRaw
- type TxRet
- type UnpackTrc20
Constants ¶
View Source
const ABITRC20 = `` /* 4470-byte string literal not displayed */
Variables ¶
This section is empty.
Functions ¶
func ConvertFromHex ¶
func ConvertToBytes ¶
func ConvertToHex ¶
func Int64ToBytes ¶
func NewAccountFromMnemonic ¶
func NewAccountFromMnemonic(mnemonic, path string) (signing.AccountHandler, error)
func NewAccountFromPrivateKey ¶
func NewAccountFromPrivateKey(privateKey []byte) (signing.AccountHandler, error)
func NewAccountFromPrivateKeyHex ¶
func NewAccountFromPrivateKeyHex(privateKey string) (signing.AccountHandler, error)
func PublicKey2Address ¶
func ValidAddress ¶
Types ¶
type Account ¶
type Account struct {
// contains filtered or unexported fields
}
func (*Account) PrivateKey ¶
func (*Account) PrivateKeyHex ¶
func (*Account) PublicKeyHex ¶
func (*Account) VerifySignData ¶
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 ContractValue ¶
type ContractValue struct {
OwnerAddress string `json:"owner_address,omitempty"`
ToAddress string `json:"to_address,omitempty"`
Data string `json:"data,omitempty"`
ContractAddress string `json:"contract_address,omitempty"`
Amount int64 `json:"amount,omitempty"`
CallValue int64 `json:"call_value,omitempty"`
}
types
type FreeGas ¶
type FreeGas struct {
FreeNetUsed string `json:"freeNetUsed"`
FreeNetLimit string `json:"freeNetLimit"`
}
types
type Ingredient ¶
type Ingredient struct {
TxType string `json:"txType" validate:"required,oneof=0 1 2 3 4 5 6"`
ContractAddress string `json:"contractAddress" validate:"required,trx_addr"`
Sender string `json:"sender" validate:"required,trx_addr"`
Recipient string `json:"recipient,omitempty" validate:"omitempty,trx_addr"`
Amount string `json:"amount,omitempty" validate:"omitempty,bigint_gt0"`
Payload string `json:"payload,omitempty" validate:"omitempty,hex_str"`
FeeLimit string `json:"feeLimit" validate:"required,u64"`
//IsRecipientActivated string `json:"isRecipientActivated,omitempty" validate:"omitempty,bool_str"`
RefBlockHash string `json:"refBlockHash" validate:"required,hex_str"`
RefBlockNumber string `json:"refBlockNumber" validate:"required,u64_gt0"`
RefBlockTimestamp string `json:"refTimestamp" validate:"required,u64_gt0"`
}
types
type NativeTx ¶
type NativeTx struct {
Signature []string `json:"signature,omitempty"`
ID string `json:"txID,omitempty"`
RawData *TxRaw `json:"raw_data,omitempty"`
Ret []TxRet `json:"ret,omitempty"`
}
types
type TrxContract ¶
type TrxContract struct {
Type string `json:"type"`
Parameter struct {
Value ContractValue `json:"value"`
TypeUrl string `json:"type_url"`
} `json:"parameter"`
}
types
type TxBuilder ¶
type TxBuilder struct {
*Ingredient
// contains filtered or unexported fields
}
types
func NewTxBuilder ¶
func NewTxBuilder(ti *Ingredient) *TxBuilder
func (*TxBuilder) ConcatSignature ¶
func (*TxBuilder) GetSigHash ¶
func (*TxBuilder) GetUnsignedHex ¶
func (*TxBuilder) PrintSignerParams ¶
func (*TxBuilder) SetSigHash ¶
func (*TxBuilder) SetUnsignedHex ¶
type TxRaw ¶
type TxRaw struct {
Contracts []*TrxContract `json:"contract"`
RefBlockBytes string `json:"ref_block_bytes,omitempty"`
RefBlockHash string `json:"ref_block_hash,omitempty"`
Timestamp int64 `json:"timestamp"`
Expiration int64 `json:"expiration,omitempty"`
FeeLimit int64 `json:"fee_limit,omitempty"`
}
types
type UnpackTrc20 ¶
type UnpackTrc20 struct {
Function string
CallTrc20In
}
for call contract
func UnpackPayloadForTrc20 ¶
func UnpackPayloadForTrc20(payload string) (*UnpackTrc20, error)
Click to show internal directories.
Click to hide internal directories.