Support fetching fees for a transaction directly
Only on a Hub that enabled it, though
This commit is contained in:
+6
-5
@@ -575,15 +575,16 @@ void ContextData::setupBindings(Napi::Env env, Napi::Object exports)
|
||||
auto enum7 = Napi::PropertyDescriptor::Value("IncludeOutputScripts", Napi::Value::From(env, int(Blockchain::IncludeOutputScripts)));
|
||||
auto enum8 = Napi::PropertyDescriptor::Value("IncludeOutputAddresses", Napi::Value::From(env, int(Blockchain::IncludeOutputAddresses)));
|
||||
auto enum9 = Napi::PropertyDescriptor::Value("IncludeOutputScriptHash", Napi::Value::From(env, int(Blockchain::IncludeOutputScriptHash)));
|
||||
auto enum10 = Napi::PropertyDescriptor::Value("InfoLevel", Napi::Value::From(env, int(Log::InfoLevel)));
|
||||
auto enum11 = Napi::PropertyDescriptor::Value("WarningLevel", Napi::Value::From(env, int(Log::WarningLevel)));
|
||||
auto enum12 = Napi::PropertyDescriptor::Value("QuietLevel", Napi::Value::From(env, int(Log::CriticalLevel)));
|
||||
auto enum13 = Napi::PropertyDescriptor::Value("SilentLevel", Napi::Value::From(env, int(Log::FatalLevel)));
|
||||
auto enum10 = Napi::PropertyDescriptor::Value("IncludeTxFees", Napi::Value::From(env, int(Blockchain::IncludeTxFees)));
|
||||
auto enum11 = Napi::PropertyDescriptor::Value("InfoLevel", Napi::Value::From(env, int(Log::InfoLevel)));
|
||||
auto enum12 = Napi::PropertyDescriptor::Value("WarningLevel", Napi::Value::From(env, int(Log::WarningLevel)));
|
||||
auto enum13 = Napi::PropertyDescriptor::Value("QuietLevel", Napi::Value::From(env, int(Log::CriticalLevel)));
|
||||
auto enum14 = Napi::PropertyDescriptor::Value("SilentLevel", Napi::Value::From(env, int(Log::FatalLevel)));
|
||||
|
||||
exports.DefineProperties({m1, m2, m3, m4, m5, m6, m7, m8, m9, m10, m11, m12, m13,
|
||||
p1, p2, p3, p4, p5, p6,
|
||||
enum1, enum2, enum3, enum4, enum5, enum6, enum7, enum8,
|
||||
enum9, enum10, enum11, enum12, enum13,
|
||||
enum9, enum10, enum11, enum12, enum13, enum14,
|
||||
});
|
||||
|
||||
Napi::Object jobEnum = Napi::Object::New(env);
|
||||
|
||||
+3
-1
@@ -1,6 +1,6 @@
|
||||
/*
|
||||
* This file is part of the Flowee project
|
||||
* Copyright (C) 2019 Tom Zander <tom@flowee.org>
|
||||
* Copyright (C) 2019-2021 Tom Zander <tom@flowee.org>
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
@@ -118,6 +118,8 @@ Napi::Object Flowee::populateTransaction(Napi::Env env, const Blockchain::Transa
|
||||
tx.Set("fullTxData", wrap(env, transaction.fullTxData));
|
||||
tx.Set("txid",
|
||||
binaryHash ? wrap(env, transaction.txid) : hashToString(env, transaction.txid));
|
||||
if (transaction.fees != -1)
|
||||
tx.Set("fees", Napi::Number::From(env, transaction.fees));
|
||||
|
||||
Napi::Array inputs = Napi::Array::New(env, transaction.inputs.size());
|
||||
for (size_t i = 0 ; i < transaction.inputs.size(); ++i) {
|
||||
|
||||
@@ -14,7 +14,7 @@ var Flowee = new FloweeServices();
|
||||
|
||||
if (process.argv.length <= 2) {
|
||||
console.log("Fetch transaction\nUsage node transaction.js [txid]");
|
||||
console.log("Example address: b39fa6c39b99683ac8f456721b270786c627ecb246700888315991877024b983\n");
|
||||
console.log("Example txid: 2c0b2784bae08449e651f3718029cb09a12eb00d5c3a6adc326ba31819892880\n");
|
||||
process.exit();
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ function detailTx(txid) {
|
||||
jobs: [{
|
||||
value: txid,
|
||||
type: Flowee.Job.FetchTx,
|
||||
txFilter: [ Flowee.IncludeInputs, Flowee.IncludeOutputs ]
|
||||
txFilter: [ Flowee.IncludeInputs, Flowee.IncludeOutputs , Flowee.IncludeTxFees]
|
||||
}],
|
||||
|
||||
onTxAdded: function(transaction) {
|
||||
@@ -65,6 +65,7 @@ Flowee.connect().then(async function() {
|
||||
console.log(" script: " + output.script);
|
||||
console.log(" }");
|
||||
}
|
||||
console.log(" fees: " + tx.fees);
|
||||
|
||||
const header = result[`block${tx.blockHeight}`];
|
||||
console.log(" block: " + header.height);
|
||||
|
||||
@@ -78,6 +78,7 @@ class Flowee {
|
||||
this.IncludeOutputScripts = this.network.IncludeOutputScripts;
|
||||
this.IncludeOutputAddresses = this.network.IncludeOutputAddresses;
|
||||
this.IncludeOutputScriptHash = this.network.IncludeOutputScriptHash;
|
||||
this.IncludeTxFees = this.network.IncludeTxFees;
|
||||
this.InfoLevel = this.network.InfoLevel;
|
||||
this.WarningLevel = this.network.WarningLevel;
|
||||
this.QuietLevel = this.network.QuietLevel;
|
||||
|
||||
Reference in New Issue
Block a user