func (w *WalletRPC) Redeem(args []string) {
	if len(args) != 1 {
		w.errln("Usage: redeem <address>")
		return
	}
	if !address.ValidateAddress(args[0]) {
		w.errf("Invalid address: %s\n", args[0])
		return
	}
	addr := address.Address(args[0])
	w.printf("Redeeming premine balance of %s...\n", addr)
	err := w.w.RedeemPremine(addr)
	if err != nil {
		w.errf("Error redeeming premine: %s\n", err)
		return
	}
	w.println("Successfully redeemed premine.")
}
Redeem redeems the premine of an address.
package rpc
import (
	"encoding/hex"
	"github.com/fatih/color"
	"github.com/phoreproject/synapse/wallet"
	"github.com/phoreproject/synapse/wallet/address"
	"google.golang.org/grpc"
	"strconv"
)
type WalletRPC struct {
	w        wallet.Wallet
	ExitChan chan struct{}
	out      color.Color
	errOut   color.Color
}
func NewWalletRPC(relayerConn *grpc.ClientConn, out color.Color, errOut color.Color) *WalletRPC {
	return &WalletRPC{
		w:        wallet.NewWallet(relayerConn),
		ExitChan: make(chan struct{}),
		out:      out,
		errOut:   errOut,
	}
}
func (w *WalletRPC) println(a ...interface{}) {
	_, _ = w.out.Println(a...)
}
func (w *WalletRPC) printf(f string, a ...interface{}) {
	_, _ = w.out.Printf(f, a...)
}
func (w *WalletRPC) errln(a ...interface{}) {
	_, _ = w.errOut.Println(a...)
}
func (w *WalletRPC) errf(f string, a ...interface{}) {
	_, _ = w.errOut.Printf(f, a...)
}
func (w *WalletRPC) WaitForExit() chan struct{} {
	return w.ExitChan
}
func (w *WalletRPC) Exit(args []string) {
	w.println("Exiting wallet...")
	w.ExitChan <- struct{}{}
}
func (w *WalletRPC) GetBalance(args []string) {
	if len(args) != 1 {
		w.errln("Usage: getbalance <address>")
		return
	}
	if !address.ValidateAddress(args[0]) {
		w.errf("Invalid address: %s\n", args[0])
		return
	}
	addr := address.Address(args[0])
	w.printf("Getting balance of %s...\n", addr)
	bal, err := w.w.GetBalance(addr)
	if err != nil {
		w.errf("Error getting balance: %s\n", err)
		return
	}
	w.printf("Balance of %s is %d\n", addr, bal)
}