8
"github.com/fbsobreira/gotron-sdk/pkg/client"9
"google.golang.org/grpc"10
"google.golang.org/grpc/credentials"18
var token = "YOUR_TOKEN"19
var 端点 = "YOUR_ENDPOINT:50051"25
func (a *auth) GetRequestMetadata(ctx 上下文.上下文, uri ...字符串) (map[字符串]字符串, error) {26
return map[string]string{31
func (a *auth) RequireTransportSecurity() bool {37
opts := []grpc.DialOption{38
grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})),39
grpc.WithPerRPCCredentials(&auth{token}),41
conn := client.NewGrpcClient(endpoint)42
if err := conn.Start(opts...); err != nil {45
defer conn.Conn.Close()47
from := "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g" 48
exchangeID := int64(123) 50
amountToken := int64(10000000) 52
fmt.Println("Injecting liquidity into exchange pair...")54
tx, err := conn.ExchangeInject(62
fmt.Printf("Error injecting liquidity: %v\n", err)66
fmt.Println("Liquidity injection transaction created successfully. Transaction details:")67
jsonData, _ := json.MarshalIndent(tx, "", " ")68
fmt.Println(string(jsonData))71
fmt.Println("\nBroadcasting transaction to the TRON network...")72
result, err := conn.Broadcast(tx.Transaction)74
fmt.Printf("Error broadcasting transaction: %v\n", err)78
if !result.GetResult() {79
fmt.Printf("Broadcast failed: %s\n", result.GetMessage())83
fmt.Println("Liquidity injected successfully! Result:")84
resultJSON, _ := json.MarshalIndent(result, "", " ")85
fmt.Println(string(resultJSON))86
fmt.Println("\nNote: When injecting the first token, the second token will be automatically taken in the same ratio as the current exchange balance.")87
fmt.Println("This ensures that the exchange rate remains the same after the injection.")
8
"github.com/fbsobreira/gotron-sdk/pkg/client"9
"google.golang.org/grpc"10
"google.golang.org/grpc/credentials"18
var token = "YOUR_TOKEN"19
var 端点 = "YOUR_ENDPOINT:50051"25
func (a *auth) GetRequestMetadata(ctx 上下文.上下文, uri ...字符串) (map[字符串]字符串, error) {26
return map[string]string{31
func (a *auth) RequireTransportSecurity() bool {37
opts := []grpc.DialOption{38
grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})),39
grpc.WithPerRPCCredentials(&auth{token}),41
conn := client.NewGrpcClient(endpoint)42
if err := conn.Start(opts...); err != nil {45
defer conn.Conn.Close()47
from := "TZ4UXDV5ZhNW7fb2AMSbgfAEZ7hWsnYS2g" 48
exchangeID := int64(123) 50
amountToken := int64(10000000) 52
fmt.Println("Injecting liquidity into exchange pair...")54
tx, err := conn.ExchangeInject(62
fmt.Printf("Error injecting liquidity: %v\n", err)66
fmt.Println("Liquidity injection transaction created successfully. Transaction details:")67
jsonData, _ := json.MarshalIndent(tx, "", " ")68
fmt.Println(string(jsonData))71
fmt.Println("\nBroadcasting transaction to the TRON network...")72
result, err := conn.Broadcast(tx.Transaction)74
fmt.Printf("Error broadcasting transaction: %v\n", err)78
if !result.GetResult() {79
fmt.Printf("Broadcast failed: %s\n", result.GetMessage())83
fmt.Println("Liquidity injected successfully! Result:")84
resultJSON, _ := json.MarshalIndent(result, "", " ")85
fmt.Println(string(resultJSON))86
fmt.Println("\nNote: When injecting the first token, the second token will be automatically taken in the same ratio as the current exchange balance.")87
fmt.Println("This ensures that the exchange rate remains the same after the injection.")