Files
rippled/Wallet.h
JoelKatz e9ae645e3b Transaction Infrastructure Work:
Raw account class (address + public key)
Account State class (account + balance + ledgers valid)
Raw Hanko class
Low-level tranasaction class
Small wallet and key bits
Misc updates to the protocol.
Protocol addition to allow code to wait for replies, but that may not be a good idea.
2011-11-11 14:13:25 -08:00

55 lines
1.1 KiB
C++

#ifndef __WALLET__
#define __WALLET__
#include "keystore.h"
#include "newcoin.pb.h"
#include "Transaction.h"
#include <list>
#include <vector>
class NewcoinAddress;
/*
Keeps track of all the public/private keys you have created
*/
class LocalAccount
{
public:
//CKey mKey;
//std::string mHumanAddress;
uint160 mAddress;
CKey mPublicKey, mPrivateKey;
int64 mAmount;
uint32 mSeqNum;
bool SignRaw(const std::vector<unsigned char> &toSign, std::vector<unsigned char> &signature);
bool CheckSignRaw(const std::vector<unsigned char> &toSign, const std::vector<unsigned char> &signature);
};
class Wallet : public CBasicKeyStore
{
std::list<LocalAccount> mYourAccounts;
TransactionPtr createTransaction(LocalAccount& fromAccount, uint160& destAddr, int64 amount);
bool commitTransaction(TransactionPtr trans);
LocalAccount* consolidateAccountOfSize(int64 amount);
public:
Wallet();
void refreshAccounts();
void load();
int64 getBalance();
// returns some human error str?
std::string sendMoneyToAddress(uint160& destAddress, int64 amount);
// you may need to update your balances
void transactionChanged(TransactionPtr trans);
};
#endif