tron

package
v1.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2024 License: GPL-3.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BalanceFuncSelector string = "70a08231"
)

Variables

View Source
var (
	Contracts = map[string]ContractInfo{
		"usdt": {
			Address: "TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t",
			Fee:     decimal.NewFromInt(28),
		},
	}
)

Functions

func FromMnemonicSeedAndPassphrase

func FromMnemonicSeedAndPassphrase(mnemonic, passphrase string, index int) (*btcec.PrivateKey, *btcec.PublicKey)

Types

type ContractInfo

type ContractInfo struct {
	Address string
	Fee     decimal.Decimal
}

type RawData

type RawData struct {
	Contract []struct {
		Parameter struct {
			Value struct {
				Data            string `json:"data"`
				Amount          int    `json:"amount"`
				OwnerAddress    string `json:"owner_address"`
				ContractAddress string `json:"contract_address"`
				ToAddress       string `json:"to_address"`
			} `json:"value"`
			TypeURL string `json:"type_url"`
		} `json:"parameter"`
		Type string `json:"type"`
	} `json:"contract"`
	RefBlockBytes string `json:"ref_block_bytes"`
	RefBlockHash  string `json:"ref_block_hash"`
	Expiration    int64  `json:"expiration"`
	Timestamp     int64  `json:"timestamp"`
	FeeLimit      int64  `json:"fee_limit"`
}

type RawTransaction

type RawTransaction struct {
	Visible    bool    `json:"visible"`
	TxID       string  `json:"txID"`
	RawData    RawData `json:"raw_data"`
	RawDataHex string  `json:"raw_data_hex"`
}

type SignedTransaction

type SignedTransaction struct {
	Visible    bool     `json:"visible"`
	TxID       string   `json:"txID"`
	RawData    string   `json:"raw_data"`
	RawDataHex string   `json:"raw_data_hex"`
	Signature  []string `json:"signature,omitempty"`
}

type Trc20

type Trc20 struct {
	FullNodeUrl         string
	SolidityNodeURL     string
	RestFullNodeUrl     string
	RestSolidityNodeURL string

	TronGridNodeurl string
	TronGridApiKey  string

	Denomination      decimal.Decimal
	TRC20Denomination decimal.Decimal
	// contains filtered or unexported fields
}

func New

func New(fullNodeUrl, solidityNodeURL, restFullNodeUrl, restSolidityNodeURL, tronGridNodeurl, tronGridApiKey string, nodeRPS, tronGridRPS int) *Trc20

func (*Trc20) Base58ToHex

func (client *Trc20) Base58ToHex(address string) string

func (*Trc20) GenerateWallet

func (client *Trc20) GenerateWallet() (provider.Wallet, error)

func (*Trc20) GetTRC20Balance

func (client *Trc20) GetTRC20Balance(address string, name string) (decimal.Decimal, error)

func (*Trc20) GetTRC20BalanceWithTronGrid

func (client *Trc20) GetTRC20BalanceWithTronGrid(address string, name string) (decimal.Decimal, error)

func (*Trc20) GetTRXBalance

func (client *Trc20) GetTRXBalance(address string) (decimal.Decimal, error)

func (*Trc20) GetTRXBalanceWithTronGrid

func (client *Trc20) GetTRXBalanceWithTronGrid(address string) (decimal.Decimal, error)

func (*Trc20) SendTRC20

func (client *Trc20) SendTRC20(wallet provider.Wallet, toAddress string, amount decimal.Decimal, name string) (string, error)

func (*Trc20) SendTRX

func (client *Trc20) SendTRX(wallet provider.Wallet, to string, amount decimal.Decimal) (string, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL