mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-05-20 22:06:42 +00:00

* Rename show-address to new-address * New proto: ShowAdresses * kaspawallet: added show-addresses command Co-authored-by: Constantine Bitensky <cbitensky1@gmail.com> Co-authored-by: Ori Newman <orinewman1@gmail.com>
28 lines
589 B
Go
28 lines
589 B
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
"github.com/kaspanet/kaspad/cmd/kaspawallet/daemon/client"
|
|
"github.com/kaspanet/kaspad/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
|
|
}
|