2021-07-27 07:26:14 -07:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
|
|
|
|
|
|
|
"github.com/davecgh/go-spew/spew"
|
|
|
|
"github.com/gagliardetto/solana-go/rpc"
|
|
|
|
)
|
|
|
|
|
|
|
|
func main() {
|
2021-07-27 08:55:40 -07:00
|
|
|
endpoint := rpc.TestNet_RPC
|
2021-07-27 07:26:14 -07:00
|
|
|
client := rpc.New(endpoint)
|
|
|
|
|
|
|
|
recent, err := client.GetRecentBlockhash(
|
|
|
|
context.TODO(),
|
|
|
|
rpc.CommitmentType("finalized"),
|
|
|
|
)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
|
|
|
|
out, err := client.GetSlotLeaders(
|
|
|
|
context.TODO(),
|
|
|
|
uint64(recent.Context.Slot),
|
|
|
|
10,
|
|
|
|
)
|
|
|
|
if err != nil {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
spew.Dump(out)
|
|
|
|
}
|