always include hex in wallet transactions. convert to regular transactions.
This commit is contained in:
parent
fe643a37ae
commit
6d994454d5
|
@ -809,12 +809,14 @@ Wallet.prototype.getUnconfirmedBalance = function(options) {
|
||||||
};
|
};
|
||||||
|
|
||||||
// XXX Wallet Transactions
|
// XXX Wallet Transactions
|
||||||
|
// Convert to regular TX
|
||||||
Wallet.prototype.listTransactions =
|
Wallet.prototype.listTransactions =
|
||||||
Wallet.prototype.getTransactions = function(options) {
|
Wallet.prototype.getTransactions = function(options) {
|
||||||
return bitcoindjs.walletListTransactions(options || {});
|
return bitcoindjs.walletListTransactions(options || {}).map(function(tx) {
|
||||||
|
return Transaction.fromHex(tx.hex);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
// XXX Wallet Transactions
|
|
||||||
Wallet.prototype.listReceivedByAddress =
|
Wallet.prototype.listReceivedByAddress =
|
||||||
Wallet.prototype.getReceivedByAddress = function(options) {
|
Wallet.prototype.getReceivedByAddress = function(options) {
|
||||||
return bitcoindjs.walletReceivedByAddress(options || {});
|
return bitcoindjs.walletReceivedByAddress(options || {});
|
||||||
|
@ -825,9 +827,11 @@ Wallet.prototype.getAccounts = function(options) {
|
||||||
return bitcoindjs.walletListAccounts(options || {});
|
return bitcoindjs.walletListAccounts(options || {});
|
||||||
};
|
};
|
||||||
|
|
||||||
// XXX Wallet Transactions
|
// XXX Wallet Transaction
|
||||||
|
// Convert to regular TX
|
||||||
Wallet.prototype.getTransaction = function(options) {
|
Wallet.prototype.getTransaction = function(options) {
|
||||||
return bitcoindjs.walletGetTransaction(options || {});
|
var tx = bitcoindjs.walletGetTransaction(options || {});
|
||||||
|
return tx ? Transaction.fromHex(tx.hex) : tx;
|
||||||
};
|
};
|
||||||
|
|
||||||
Wallet.prototype.backup = function(options) {
|
Wallet.prototype.backup = function(options) {
|
||||||
|
|
|
@ -4136,6 +4136,9 @@ WalletTxToJSON_V8(const CWalletTx& wtx, Local<Object>& entry) {
|
||||||
BOOST_FOREACH(const PAIRTYPE(string,string)& item, wtx.mapValue) {
|
BOOST_FOREACH(const PAIRTYPE(string,string)& item, wtx.mapValue) {
|
||||||
entry->Set(NanNew<String>(item.first), NanNew<String>(item.second));
|
entry->Set(NanNew<String>(item.first), NanNew<String>(item.second));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string strHex = EncodeHexTx(static_cast<CTransaction>(wtx));
|
||||||
|
entry->Set(NanNew<String>("hex"), NanNew<String>(strHex));
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -4176,6 +4179,9 @@ ListTransactions_V8(const CWalletTx& wtx, const string& strAccount,
|
||||||
entry->Set(NanNew<String>("fee"), NanNew<Number>(-nFee));
|
entry->Set(NanNew<String>("fee"), NanNew<Number>(-nFee));
|
||||||
if (fLong) {
|
if (fLong) {
|
||||||
WalletTxToJSON_V8(wtx, entry);
|
WalletTxToJSON_V8(wtx, entry);
|
||||||
|
} else {
|
||||||
|
std::string strHex = EncodeHexTx(static_cast<CTransaction>(wtx));
|
||||||
|
entry->Set(NanNew<String>("hex"), NanNew<String>(strHex));
|
||||||
}
|
}
|
||||||
ret->Set(i, entry);
|
ret->Set(i, entry);
|
||||||
i++;
|
i++;
|
||||||
|
@ -4212,6 +4218,9 @@ ListTransactions_V8(const CWalletTx& wtx, const string& strAccount,
|
||||||
// entry->Set(NanNew<String>("vout"), NanNew<Number>(r.vout));
|
// entry->Set(NanNew<String>("vout"), NanNew<Number>(r.vout));
|
||||||
if (fLong) {
|
if (fLong) {
|
||||||
WalletTxToJSON_V8(wtx, entry);
|
WalletTxToJSON_V8(wtx, entry);
|
||||||
|
} else {
|
||||||
|
std::string strHex = EncodeHexTx(static_cast<CTransaction>(wtx));
|
||||||
|
entry->Set(NanNew<String>("hex"), NanNew<String>(strHex));
|
||||||
}
|
}
|
||||||
ret->Set(i, entry);
|
ret->Set(i, entry);
|
||||||
i++;
|
i++;
|
||||||
|
@ -4449,8 +4458,8 @@ NAN_METHOD(WalletGetTransaction) {
|
||||||
ListTransactions_V8(wtx, "*", 0, false, details, filter, &a_count);
|
ListTransactions_V8(wtx, "*", 0, false, details, filter, &a_count);
|
||||||
entry->Set(NanNew<String>("details"), details);
|
entry->Set(NanNew<String>("details"), details);
|
||||||
|
|
||||||
std::string strHex = EncodeHexTx(static_cast<CTransaction>(wtx));
|
//std::string strHex = EncodeHexTx(static_cast<CTransaction>(wtx));
|
||||||
entry->Set(NanNew<String>("hex"), NanNew<String>(strHex));
|
//entry->Set(NanNew<String>("hex"), NanNew<String>(strHex));
|
||||||
|
|
||||||
NanReturnValue(entry);
|
NanReturnValue(entry);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue