Get TransactionFee
Introduction
Rate Limit
Tier 4
Tier 3
Tier 2
Tier 1
Tier 0
Request Parameter
Parameters
Mandatory
Format
Exampl
Remark
Request Example
package main
import (
"context"
"crypto/tls"
"log"
// directory of the generated code using the provided proto file
pb "fee-test/feepb"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials"
)
const (
gRPCEndpoint = "grpc.solana-fee.blockrazor.xyz:443" // endpoint address
auth = "your auth" // auth to be verified
testAccount1 = "DH4xmaWDnTzKXehVaPSNy9tMKJxnYL5Mo5U3oTHFtNYJ" // query priority fee and tip of transactions involving a specified account
testAccount2 = "CAPhoEse9xEH95XmdnJjYrZdNCA8xfUWdy3aWymHa1Vj"
)
func main() {
// open gRPC connection to endpoint
conn, err := grpc.Dial(
gRPCEndpoint,
grpc.WithTransportCredentials(credentials.NewTLS(&tls.Config{})),
grpc.WithPerRPCCredentials(&Authentication{auth}),
)
if err != nil {
panic(err)
}
defer conn.Close()
// use the gRPC client
client := pb.NewServerClient(conn)
req := &pb.TransactionFee{
Accounts: []string{}, //do not set accounts
Percentile: 75,
SlotRange: 150,
}
// send gRPC request1
resp, err := client.GetTransactionFee(context.Background(), req)
if err != nil {
panic(err)
}
log.Printf("Response PriorityFee Percentile: %+v", resp.PriorityFee.Percentile)
log.Printf("Response PriorityFee Value: %+v", resp.PriorityFee.Value)
log.Printf("Response Tip Percentile: %+v", resp.Tip.Percentile)
log.Printf("Response Tip Value: %+v", resp.Tip.Value)
req2 := &pb.TransactionFee{
Accounts: []string{testAccount1, testAccount2}, //set specified accounts
Percentile: 75,
SlotRange: 150,
}
// send gRPC request2
resp2, err := client.GetTransactionFee(context.Background(), req2)
if err != nil {
panic(err)
}
log.Printf("Response2 PriorityFee Percentile: %+v", resp2.PriorityFee.Percentile)
log.Printf("Response2 PriorityFee Value: %+v", resp2.PriorityFee.Value)
log.Printf("Response2 Tip Percentile: %+v", resp2.Tip.Percentile)
log.Printf("Response2 Tip Value: %+v", resp2.Tip.Value)
}
type Authentication struct {
auth string
}
func (a *Authentication) GetRequestMetadata(context.Context, ...string) (map[string]string, error) {
return map[string]string{"apiKey": a.auth}, nil
}
func (a *Authentication) RequireTransportSecurity() bool {
return false
}
Proto
Response Example
Last updated