mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-09-14 21:40:11 +00:00
33 lines
700 B
Go
33 lines
700 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/kaspanet/kaspad/cmd/kaspawallet/daemon/client"
|
|
"github.com/kaspanet/kaspad/cmd/kaspawallet/daemon/pb"
|
|
)
|
|
|
|
func showAddress(conf *showAddressConfig) 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.GetReceiveAddress(ctx, &pb.GetReceiveAddressRequest{})
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
fmt.Printf("Address:\n%s\n", response.Address)
|
|
if conf.WithDerivationPath {
|
|
fmt.Printf("Derivation path:\n%s\n", response.DerivationPath)
|
|
}
|
|
|
|
return nil
|
|
}
|