mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00
27 lines
579 B
Go
27 lines
579 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"github.com/kaspanet/kaspad/cmd/kaspawallet/daemon/client"
|
|
"github.com/kaspanet/kaspad/cmd/kaspawallet/daemon/pb"
|
|
)
|
|
|
|
func getDaemonVersion(conf *getDaemonVersionConfig) error {
|
|
daemonClient, tearDown, err := client.Connect(conf.DaemonAddress)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
defer tearDown()
|
|
|
|
ctx, cancel := context.WithTimeout(context.Background(), daemonTimeout)
|
|
defer cancel()
|
|
response, err := daemonClient.GetVersion(ctx, &pb.GetVersionRequest{})
|
|
if err != nil {
|
|
return err
|
|
}
|
|
fmt.Println(response.Version)
|
|
|
|
return nil
|
|
}
|