func (w *Wallet) SendToAddress(from address.Address, to address.Address, amount uint64) error {
	key, found := w.Keystore[from]
	if !found {
		return fmt.Errorf("could not find key for address: %s", from)
	}

	st, err := key.keypair.Transfer(0, key.CurrentNonce, to, amount)
	if err != nil {
		return err
	}

	_, err = w.RPCClient.SubmitTransaction(context.Background(), &pb.SubmitTransactionRequest{
		ShardID: 0,
		Transaction: &pb.ShardTransaction{
			TransactionData: st.Serialize(),
		},
	})

	if err != nil {
		return err
	}

	w.Keystore[from].CurrentNonce++

	return nil
}
// SendToAddress sends money to the specified address from the specified address.
SendToAddress sends money to the specified address from the specified address.
// SendToAddress sends money to the specified address from the specified address .
func (w *Wallet) SendToAddress(from address.Address, to address.Address, amount uint64) error {
	key, found := w.Keystore[from]
	if !found {
		return fmt.Errorf("could not find key for address: %s", from)
	}
	st, err := key.keypair.Transfer(0, key.CurrentNonce, to, amount)
	if err != nil {
		return err
	}
	_, err = w.RPCClient.SubmitTransaction(context.Background(), &pb.SubmitTransactionRequest{
		ShardID: 0,
		Transaction: &pb.ShardTransaction{
			TransactionData: st.Serialize(),
		},
	})
	if err != nil {
		return err
	}
	w.Keystore[from].CurrentNonce++
	return nil
}
func ( w * Wallet ) SendToAddress ( from address . Address , to address . Address , amount uint64 ) error { key , found := w . Keystore [ from ] if ! found { return fmt . Errorf ( " " , from ) } st , err := key . keypair . Transfer ( 0 , key . CurrentNonce , to , amount ) if err != nil { return err } _ , err = w . RPCClient . SubmitTransaction ( context . Background ( ) , & pb . SubmitTransactionRequest { ShardID : 0 , Transaction : & pb . ShardTransaction { TransactionData : st . Serialize ( ) , } , } ) if err != nil { return err } w . Keystore [ from ] . CurrentNonce ++ return nil }
SendToAddress sends money to the specified address from the specified address.
SendToAddress sends money to the specified address from the specified address .