Documentation
¶
Overview ¶
Package account provides TRON account creation, import, and export operations.
Index ¶
- func CreateNewLocalAccount(candidate *Creation) error
- func ExportKeystore(address, path, passphrase string) (string, error)
- func ExportPrivateKey(address, passphrase string) error
- func ImportFromPrivateKey(privateKey, name, passphrase string) (string, error)
- func ImportKeyStore(keyPath, name, passphrase string) (string, error)
- func IsValidPassphrase(pass string) bool
- func New() string
- func RemoveAccount(name string) error
- type Account
- type Creation
- type FrozenResource
- type UnfrozenResource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateNewLocalAccount ¶
CreateNewLocalAccount creates a new account in the local keystore from the given Creation params.
func ExportKeystore ¶
ExportKeystore writes the encrypted keystore JSON for the given address to a file at path.
func ExportPrivateKey ¶
ExportPrivateKey prints the hex-encoded private key for the given address to stdout.
func ImportFromPrivateKey ¶
ImportFromPrivateKey imports an ECDSA private key (hex string) into the local keystore under the given name.
func ImportKeyStore ¶
ImportKeyStore imports an encrypted keystore JSON file into the local account store.
func IsValidPassphrase ¶
IsValidPassphrase is a placeholder that currently always returns true. TODO: implement actual strength validation.
func RemoveAccount ¶
RemoveAccount deletes the named account and its keystore files from the local store.
Types ¶
type Account ¶
type Account struct {
Address string `json:"address"`
Type string `json:"type"`
Name string `json:"name"`
ID string `json:"id"`
Balance int64 `json:"balance"`
Allowance int64 `json:"allowance"`
LastWithdraw int64 `json:"lastWithdraw"`
IsWitness bool `json:"isWitness"`
IsElected bool `json:"isElected"`
Assets map[string]int64 `json:"assetList"`
TronPower int64 `json:"tronPower"`
TronPowerUsed int64 `json:"tronPowerUsed"`
FrozenBalance int64 `json:"frozenBalance"`
FrozenResources []FrozenResource `json:"frozenList"`
FrozenBalanceV2 int64 `json:"frozenBalanceV2"`
FrozenResourcesV2 []FrozenResource `json:"frozenListV2"`
UnfrozenResource []UnfrozenResource `json:"unfrozenList"`
Votes map[string]int64 `json:"voteList"`
BWTotal int64 `json:"bandwidthTotal"`
BWUsed int64 `json:"bandwidthUsed"`
EnergyTotal int64 `json:"energyTotal"`
EnergyUsed int64 `json:"energyUsed"`
Rewards int64 `json:"rewards"`
WithdrawableBalance int64 `json:"withdrawableBalance"`
UnfreezeLeft int64 `json:"countUnfreezeLeft"`
MaxCanDelegateBandwidth int64 `json:"maxCanDelegateBandwidth"`
MaxCanDelegateEnergy int64 `json:"maxCanDelegateEnergy"`
}
Account holds a detailed view of a TRON account including balances, resources, and votes.
type Creation ¶
type Creation struct {
Name string
Passphrase string
Mnemonic string
MnemonicPassphrase string
HdAccountNumber *uint32
HdIndexNumber *uint32
}
Creation holds the parameters needed to create a new local TRON account.
type FrozenResource ¶
type FrozenResource struct {
Type core.ResourceCode
Amount int64
DelegateTo string
Expire int64
}
FrozenResource represents a frozen resource (bandwidth or energy) on a TRON account.
type UnfrozenResource ¶
type UnfrozenResource struct {
Type core.ResourceCode
Amount int64
Expire int64
}
UnfrozenResource represents a pending unfreeze operation on a TRON account.