mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-05-29 10:16:45 +00:00
28 lines
585 B
Go
28 lines
585 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"github.com/fabbez/topiad/cmd/kaspawallet/daemon/client"
|
|
"github.com/fabbez/topiad/cmd/kaspawallet/daemon/pb"
|
|
)
|
|
|
|
func newAddress(conf *newAddressConfig) 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.NewAddress(ctx, &pb.NewAddressRequest{})
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
fmt.Printf("New address:\n%s\n", response.Address)
|
|
return nil
|
|
}
|