2015-05-27 12:08:46 +00:00
|
|
|
// Copyright (c) 2012-2015, The CryptoNote developers, The Bytecoin developers
|
2015-04-06 16:13:07 +00:00
|
|
|
//
|
|
|
|
// This file is part of Bytecoin.
|
|
|
|
//
|
|
|
|
// Bytecoin is free software: you can redistribute it and/or modify
|
|
|
|
// it under the terms of the GNU Lesser General Public License as published by
|
|
|
|
// the Free Software Foundation, either version 3 of the License, or
|
|
|
|
// (at your option) any later version.
|
|
|
|
//
|
|
|
|
// Bytecoin is distributed in the hope that it will be useful,
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
// GNU Lesser General Public License for more details.
|
|
|
|
//
|
|
|
|
// You should have received a copy of the GNU Lesser General Public License
|
|
|
|
// along with Bytecoin. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
#include "WalletSerialization.h"
|
|
|
|
#include "WalletUnconfirmedTransactions.h"
|
|
|
|
#include "IWallet.h"
|
|
|
|
|
|
|
|
#include "cryptonote_core/cryptonote_serialization.h"
|
|
|
|
#include "serialization/ISerializer.h"
|
|
|
|
#include "serialization/SerializationOverloads.h"
|
|
|
|
|
|
|
|
namespace CryptoNote {
|
|
|
|
|
2015-07-15 12:23:00 +00:00
|
|
|
void serialize(UnconfirmedTransferDetails& utd, CryptoNote::ISerializer& serializer) {
|
2015-04-06 16:13:07 +00:00
|
|
|
serializer(utd.tx, "transaction");
|
|
|
|
serializer(utd.amount, "amount");
|
|
|
|
serializer(utd.outsAmount, "outs_amount");
|
|
|
|
uint64_t time = static_cast<uint64_t>(utd.sentTime);
|
|
|
|
serializer(time, "sent_time");
|
|
|
|
utd.sentTime = static_cast<time_t>(time);
|
|
|
|
uint64_t txId = static_cast<uint64_t>(utd.transactionId);
|
|
|
|
serializer(txId, "transaction_id");
|
|
|
|
utd.transactionId = static_cast<size_t>(txId);
|
|
|
|
}
|
|
|
|
|
2015-07-15 12:23:00 +00:00
|
|
|
void serialize(TransactionInfo& txi, CryptoNote::ISerializer& serializer) {
|
2015-04-06 16:13:07 +00:00
|
|
|
uint64_t trId = static_cast<uint64_t>(txi.firstTransferId);
|
|
|
|
serializer(trId, "first_transfer_id");
|
|
|
|
txi.firstTransferId = static_cast<size_t>(trId);
|
|
|
|
|
|
|
|
uint64_t trCount = static_cast<uint64_t>(txi.transferCount);
|
|
|
|
serializer(trCount, "transfer_count");
|
|
|
|
txi.transferCount = static_cast<size_t>(trCount);
|
|
|
|
|
|
|
|
serializer(txi.totalAmount, "total_amount");
|
|
|
|
|
|
|
|
serializer(txi.fee, "fee");
|
|
|
|
serializer(txi.hash, "hash");
|
|
|
|
serializer(txi.isCoinbase, "is_coinbase");
|
|
|
|
serializer(txi.blockHeight, "block_height");
|
|
|
|
serializer(txi.timestamp, "timestamp");
|
|
|
|
serializer(txi.unlockTime, "unlock_time");
|
|
|
|
serializer(txi.extra, "extra");
|
|
|
|
}
|
|
|
|
|
2015-07-15 12:23:00 +00:00
|
|
|
void serialize(Transfer& tr, CryptoNote::ISerializer& serializer) {
|
2015-04-06 16:13:07 +00:00
|
|
|
serializer(tr.address, "address");
|
|
|
|
serializer(tr.amount, "amount");
|
|
|
|
}
|
|
|
|
|
|
|
|
} //namespace CryptoNote
|