updated estimated_tx_network_fee with fork_version bridging

pull/92/head
Paul Shapiro 5 years ago
parent d60bacc128
commit 7d5066b8ac

@ -307,7 +307,7 @@ class MyMoneroCoreBridgeEssentialsClass extends MyMoneroBridgeClass_Base
} }
return ret.retVal; return ret.retVal;
} }
estimated_tx_network_fee(fee_per_kb__string, priority, optl__fee_per_b_string) // this is until we switch the server over to fee per b estimated_tx_network_fee(fee_per_kb__string, priority, optl__fee_per_b_string, optl__fork_version) // this is until we switch the server over to fee per b
{ // TODO update this API to take object rather than arg list { // TODO update this API to take object rather than arg list
const args = const args =
{ {
@ -316,6 +316,11 @@ class MyMoneroCoreBridgeEssentialsClass extends MyMoneroBridgeClass_Base
: (new JSBigInt(fee_per_kb__string)).divide(1024).toString()/*kib -> b*/, : (new JSBigInt(fee_per_kb__string)).divide(1024).toString()/*kib -> b*/,
priority: "" + priority, priority: "" + priority,
}; };
if (typeof optl__fork_version !== 'undefined' && optl__fork_version !== null) {
args.fork_version = "" + optl__fork_version
} else {
// it will default to 0 which means use the latest fork rules
}
const args_str = JSON.stringify(args); const args_str = JSON.stringify(args);
const ret_string = this.Module.estimated_tx_network_fee(args_str); const ret_string = this.Module.estimated_tx_network_fee(args_str);
const ret = JSON.parse(ret_string); const ret = JSON.parse(ret_string);

@ -46,8 +46,8 @@ async function t1()
try { try {
var fee = new mymonero.JSBigInt((await mymonero.monero_utils_promise).estimated_tx_network_fee( var fee = new mymonero.JSBigInt((await mymonero.monero_utils_promise).estimated_tx_network_fee(
"0", 1, "24658" "0", 1, "24658", 10
// fee_per_kb__string, priority, fee_per_b__string // fee_per_kb__string, priority, fee_per_b__string, optl__fork_version
)); ));
console.log("estimated_tx_network_fee", mymonero.monero_amount_format_utils.formatMoneyFull(fee), "XMR") console.log("estimated_tx_network_fee", mymonero.monero_amount_format_utils.formatMoneyFull(fee), "XMR")
} catch (e) { } catch (e) {

Loading…
Cancel
Save