func (w *WalletRPC) SendToAddress(args []string) {
	if len(args) != 3 {
		w.errln("Usage: sendtoaddress <amount> <fromaddress> <toaddress>")
		return
	}

	amount, err := strconv.Atoi(args[0])
	if err != nil {
		w.errf("Error parsing amount: %s", args[0])
	}

	if !address.ValidateAddress(args[1]) {
		w.errf("Invalid address: %s\n", args[1])
		return
	}

	if !address.ValidateAddress(args[2]) {
		w.errf("Invalid address: %s\n", args[2])
		return
	}

	fromAddr := address.Address(args[1])
	toAddr := address.Address(args[2])

	w.printf("Sending %d PHR from %s to %s...\n", amount, fromAddr, toAddr)

	err = w.w.SendToAddress(fromAddr, toAddr, uint64(amount))
	if err != nil {
		w.errf("Error sending: %s\n", err)
		return
	}

	w.printf("Sent %d PHR from %s to %s.\n", amount, fromAddr, toAddr)
}
// SendToAddress sends money to a certain address.
SendToAddress sends money to a certain address.
// SendToAddress sends money to a certain address .
func (w *WalletRPC) SendToAddress(args []string) {
	if len(args) != 3 {
		w.errln("Usage: sendtoaddress <amount> <fromaddress> <toaddress>")
		return
	}
	amount, err := strconv.Atoi(args[0])
	if err != nil {
		w.errf("Error parsing amount: %s", args[0])
	}
	if !address.ValidateAddress(args[1]) {
		w.errf("Invalid address: %s\n", args[1])
		return
	}
	if !address.ValidateAddress(args[2]) {
		w.errf("Invalid address: %s\n", args[2])
		return
	}
	fromAddr := address.Address(args[1])
	toAddr := address.Address(args[2])
	w.printf("Sending %d PHR from %s to %s...\n", amount, fromAddr, toAddr)
	err = w.w.SendToAddress(fromAddr, toAddr, uint64(amount))
	if err != nil {
		w.errf("Error sending: %s\n", err)
		return
	}
	w.printf("Sent %d PHR from %s to %s.\n", amount, fromAddr, toAddr)
}
func ( w * WalletRPC ) SendToAddress ( args [ ] string ) { if len ( args ) != 3 { w . errln ( " " ) return } amount , err := strconv . Atoi ( args [ 0 ] ) if err != nil { w . errf ( " " , args [ 0 ] ) } if ! address . ValidateAddress ( args [ 1 ] ) { w . errf ( " \n " , args [ 1 ] ) return } if ! address . ValidateAddress ( args [ 2 ] ) { w . errf ( " \n " , args [ 2 ] ) return } fromAddr := address . Address ( args [ 1 ] ) toAddr := address . Address ( args [ 2 ] ) w . printf ( " \n " , amount , fromAddr , toAddr ) err = w . w . SendToAddress ( fromAddr , toAddr , uint64 ( amount ) ) if err != nil { w . errf ( " \n " , err ) return } w . printf ( " \n " , amount , fromAddr , toAddr ) }
SendToAddress sends money to a certain address.
SendToAddress sends money to a certain address .