go_trongrid_api

package module
v0.0.0-...-18d9ed6 Latest Latest
Warning

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

Go to latest
Published: Feb 14, 2023 License: MIT Imports: 13 Imported by: 0

README

go-trongrid-api

Base:https://github.com/fbsobreira/gotron-sdk

成本估算

合约方式
  • 部署子合约:111.1992 TRX+314带宽+397140能量
TRC20转账
  • 激活账户有1.1TRX手续费
  • TRC20转账 345Bandwidth(0.345TRX) 13,045Energy(5.5TRX) 大约:5.85TRX
  • 带宽价格:0.001TRX
  • 能量价格:0.00042TRX

波场账户管理

  • 下载本地钱包工具:http://192.168.10.119/tronctl.zip
  • 创建一个账户:./tronctl keys add examplename 得到TWva2iKq2uVZo51EsuUFtrkjaN5VL4K5PG
  • 水龙头领取矿工费 https://t.me/troncoredevscommunity https://discordapp.com/invite/hqKvyAM
!shasta TWva2iKq2uVZo51EsuUFtrkjaN5VL4K5PG
$ ./tronctl account balance TWva2iKq2uVZo51EsuUFtrkjaN5VL4K5PG -n grpc.shasta.trongrid.io:50051
{
  "address": "TWva2iKq2uVZo51EsuUFtrkjaN5VL4K5PG",
  "allowance": 0,
  "balance": 7911.198038,
  "rewards": 0,
  "type": 0
}
  • 获得TRC20-USDT
  • 查询TRC20-USDT余额:
$ ./tronctl trc20 balance TWva2iKq2uVZo51EsuUFtrkjaN5VL4K5PG TGT6r3rS1tyA77B8LT1gE1pfMFxK9f2XJT -n grpc.shasta.trongrid.io:50051
{
  "balance": "999939898.8 xUSDT"
}
  • 转账TRC20-USDT:从TWva2iKq2uVZo51EsuUFtrkjaN5VL4K5PG转给TY9tyzi6xtt5s3QDfcK5yrcGX2ovHZPzEZ,1.23USDT(TGT6r3rS1tyA77B8LT1gE1pfMFxK9f2XJT)
$  ./tronctl trc20 send TY9tyzi6xtt5s3QDfcK5yrcGX2ovHZPzEZ 1.23 TGT6r3rS1tyA77B8LT1gE1pfMFxK9f2XJT -n grpc.shasta.trongrid.io:50051 -s TWva2iKq2uVZo51EsuUFtrkjaN5VL4K5PG
{
  "blockNumber": 30043699,
  "contractAddress": "TGT6r3rS1tyA77B8LT1gE1pfMFxK9f2XJT",
  "message": "",
  "receipt": {
    "energyFee": 7834960,
    "energyUsage": 0,
    "energyUsageTotal": 27982,
    "fee": 7834960,
    "netFee": 0,
    "netUsage": 345,
    "originEnergyUsage": 0
  },
  "resMessage": "",
  "success": true,
  "txID": "0x622ef0cdcc6528244c49f075ae1be3b47499d5d6d907bad58281c655463a9afc"
}

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ETH2Tron

func ETH2Tron(ethAddr ethcmn.Address) address.Address

func GenTronKey

func GenTronKey() (string, string, string, error)

GenTronKey 生成波场地址信息 返回:地址(Base58),公钥(hex),私钥(hex),error

func JsonPretty

func JsonPretty(v interface{})

func Tron2ETH

func Tron2ETH(addressTron address.Address) ethcmn.Address

func ValidTronAddress

func ValidTronAddress(addr string) bool

ValidTronAddress 校验是否合法的Tron地址(Base58)

Types

type Client

type Client struct {
	*client.GrpcClient
}

func New

func New(nodeAddr string, apiKey string) *Client

func (*Client) SendTRX

func (cli *Client) SendTRX(key string, from, toAddress string, amount int64) (string, error)

func (*Client) SendTx

func (cli *Client) SendTx(signedTx *core.Transaction) error

func (*Client) SignTx

func (cli *Client) SignTx(tx *core.Transaction, key string) (*core.Transaction, error)

func (*Client) TRC20BalanceOf

func (cli *Client) TRC20BalanceOf(addr, contract string) (*big.Int, error)

func (*Client) TRC20Transfer

func (cli *Client) TRC20Transfer(key string, from, to, contract string, amount *big.Int, feeLimit int64) (string, error)

Jump to

Keyboard shortcuts

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