mirror of
https://github.com/aljazceru/ark.git
synced 2025-12-18 04:34:19 +01:00
38 lines
658 B
Go
38 lines
658 B
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"github.com/ark-network/ark/common"
|
|
"github.com/urfave/cli/v2"
|
|
)
|
|
|
|
var receiveCommand = cli.Command{
|
|
Name: "receive",
|
|
Usage: "Print the Ark address associated with your wallet and the connected Ark",
|
|
Action: receiveAction,
|
|
}
|
|
|
|
func receiveAction(ctx *cli.Context) error {
|
|
privateKey, err := privateKeyFromPassword()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
publicKey := privateKey.PubKey()
|
|
|
|
aspPublicKey, err := getServiceProviderPublicKey()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
addr, err := common.EncodeAddress(common.MainNet.Addr, publicKey, aspPublicKey)
|
|
if err != nil {
|
|
return err
|
|
}
|
|
|
|
fmt.Println(addr)
|
|
|
|
return nil
|
|
}
|