aboutsummaryrefslogtreecommitdiffstats
path: root/src/ark/offboard.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-09-02 22:25:11 -0700
committerAdam Soltys <[email protected]>2026-09-02 22:25:11 -0700
commit0064b59c3f4543fa709f2b6166174a08d6689506 (patch)
treee34098112f27f93fc32ac89d6aae074896860e0a /src/ark/offboard.js
parentd28b716ae791f924d7dea901b9a9711e44bd7312 (diff)
downloadcoinosv3-0064b59c3f4543fa709f2b6166174a08d6689506.tar.gz
coinosv3-0064b59c3f4543fa709f2b6166174a08d6689506.zip
An offboard's price stops hiding in one number: the miners' cut and the ASP's service charge (base + lifetime ppm) record separately and the history detail shows them on their own lines — settling the mystery of a ~350-sat chain fee inside a ~650-sat total. The community row's member count anchors to last session's settled figure instead of ticking upward through the guestbook replay, and a profile's Pay button reached from search actually reaches Send — the lingering search screen was winning the router
Co-Authored-By: Claude Fable 5 <[email protected]> Claude-Session: https://claude.ai/code/session_01MrkLsNScXe9b6BviUSdmMr
Diffstat (limited to 'src/ark/offboard.js')
-rw-r--r--src/ark/offboard.js14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/ark/offboard.js b/src/ark/offboard.js
index ae6530d..28fd190 100644
--- a/src/ark/offboard.js
+++ b/src/ark/offboard.js
@@ -60,9 +60,13 @@ export const feeRateKwu = (satVkb) => Math.floor(satVkb / 4);
// OffboardFees::calculate — base + ceil(rate * weight) + per-vtxo ppm-by-expiry.
// inputs: [{ amountSat, expiryHeight }]; fees: info.offboardFees.
-export function offboardFee({ spkLen, satVkb, fees, tip, inputs }) {
+// The fee splits into what the MINERS take (this offboard's weight in the
+// shared tx, at the current rate) and what the ASP charges for the service
+// (base fee + the per-coin lifetime ppm, same bracket table as renewals) —
+// kept separate so the wallet can show them apart.
+export function offboardFeeParts({ spkLen, satVkb, fees, tip, inputs }) {
const wu = (fees.fixedAdditionalVb + spkLen) * 4;
- const weightFee = Math.floor((feeRateKwu(satVkb) * wu + 999) / 1000);
+ const chainSat = Math.floor((feeRateKwu(satVkb) * wu + 999) / 1000);
// pver >= 4: sub-satoshi ppm accumulates across vtxos, one round-up at the end
let ppmUnits = 0;
for (const v of inputs) {
@@ -70,7 +74,11 @@ export function offboardFee({ spkLen, satVkb, fees, tip, inputs }) {
const entry = [...fees.ppmExpiryTable].reverse().find((e) => blocks >= e.thresholdBlocks);
if (entry) ppmUnits += v.amountSat * entry.ppm;
}
- return fees.baseFeeSat + weightFee + Math.ceil(ppmUnits / 1_000_000);
+ const serviceSat = fees.baseFeeSat + Math.ceil(ppmUnits / 1_000_000);
+ return { chainSat, serviceSat, totalSat: chainSat + serviceSat };
+}
+export function offboardFee(args) {
+ return offboardFeeParts(args).totalSat;
}
// OffboardRequestAttestation: BIP340 signature over