tron

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2026 License: LGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package tron provides convenience constructors that bind a GrpcClient to the builder packages (txbuilder, contract, trc20). This avoids boilerplate and gives developers a single entry point to the SDK.

conn := client.NewGrpcClient("grpc.trongrid.io:50051")
conn.Start(grpc.WithTransportCredentials(insecure.NewCredentials()))

t := tron.New(conn)
t.TxBuilder().Transfer(from, to, amount).Send(ctx, signer)
t.Contract(addr).Method("transfer").From(from).Params(json).Send(ctx, signer)
t.TRC20(addr).Transfer(from, to, amount).Send(ctx, signer)

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type SDK

type SDK struct {
	// contains filtered or unexported fields
}

SDK wraps a GrpcClient and provides builder constructors.

func New

func New(conn *client.GrpcClient) *SDK

New creates an SDK instance bound to the given GrpcClient.

func (*SDK) Client

func (s *SDK) Client() *client.GrpcClient

Client returns the underlying GrpcClient.

func (*SDK) Contract

func (s *SDK) Contract(contractAddress string) *contract.ContractCall

Contract returns a contract call builder for the given address.

func (*SDK) TRC20

func (s *SDK) TRC20(contractAddress string) *trc20.Token

TRC20 returns a typed TRC20 token handle for the given contract address.

func (*SDK) TxBuilder

func (s *SDK) TxBuilder(opts ...txbuilder.Option) *txbuilder.Builder

TxBuilder returns a transaction builder for native TRON operations. Options set shared defaults for all transactions (e.g. WithPermissionID).

Jump to

Keyboard shortcuts

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