theseus/bundled-addons/aegis/lib/dgb/psbt/build.js
Local Dev 2e54bf5e5a Ship Theseus 0.3.28 5d15508b (Aegis update card + DevTools in tab sidebar + real favicons)
Setup    5d15508bba929f1f074c052ac933863eadf6eb8e56984ebd5a1af75e80626643
Portable a5d346b97f5a13d85fa3bd301a72075ddb82fe636d7b1a51840ffd5a16d879f4

Bundled since 0.3.27:

32d4b75 - Aegis (bchwallet) gains its own update card in Settings >
General beside Ariadne. Check for updates hits the same signed OTA
endpoint the boot timer uses; Restart to apply appears when a signed
newer version is staged. Uses the existing addons-check-updates + a
new app-restart IPC. New Aegis versions ship without a Theseus release.

32d4b75 (same commit) - DevTools (F12 / Ctrl+Shift+I) opens docked to
the right of the tab (mode: 'right') instead of a detached window.
Matches stock Chrome. Users who prefer detached can drag out via the
DevTools own toolbar.

b71c925 - Search-engine favicons in Settings > Search now use Google's
/s2/favicons service — DuckDuckGo's ip3 source returned 404 for enough
hosts (Brave, Bing, Yandex, etc.) that half the list was falling
through to the emoji placeholder.

Deployed. Verified LIVE 0.3.28.
2026-09-08 18:17:25 +02:00

56 lines
No EOL
1.9 KiB
JavaScript

import { Psbt } from 'bitcoinjs-lib';
import { digibyte } from '../core/index.js';
// Construct an unsigned PSBT from a set of UTXOs and destination outputs.
// Does not add a change output — the caller decides change amount and
// address. Does not compute fees — the caller must have already subtracted
// fee from outputs.
export function buildPsbt(params, network = digibyte) {
const psbt = new Psbt({ network });
const inputs = params.sortBip69 === false ? params.inputs : sortInputs(params.inputs);
const outputs = params.sortBip69 === false ? params.outputs : sortOutputs(params.outputs);
for (const u of inputs) {
psbt.addInput(inputToPsbtInput(u));
}
for (const o of outputs) {
psbt.addOutput({ address: o.address, value: o.value });
}
return psbt;
}
function inputToPsbtInput(u) {
const input = {
hash: u.txid,
index: u.vout,
};
if (u.witness) {
input.witnessUtxo = {
script: Buffer.from(u.witness.scriptHex, 'hex'),
value: u.witness.value,
};
}
if (u.nonWitnessTxHex) {
input.nonWitnessUtxo = Buffer.from(u.nonWitnessTxHex, 'hex');
}
if (u.redeemScriptHex) {
input.redeemScript = Buffer.from(u.redeemScriptHex, 'hex');
}
if (u.tapInternalKeyHex) {
input.tapInternalKey = Buffer.from(u.tapInternalKeyHex, 'hex');
}
return input;
}
// BIP69 lexicographic ordering. Improves privacy by not revealing input
// selection order (which can hint at wallet coin-selection strategy).
function sortInputs(inputs) {
return [...inputs].sort((a, b) => {
const cmp = a.txid.localeCompare(b.txid);
return cmp !== 0 ? cmp : a.vout - b.vout;
});
}
function sortOutputs(outputs) {
return [...outputs].sort((a, b) => {
if (a.value !== b.value)
return a.value - b.value;
return a.address.localeCompare(b.address);
});
}
//# sourceMappingURL=build.js.map