@ledgerhq/hw-app-btc
Version:
Ledger Hardware Wallet Bitcoin Application API
16 lines • 588 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.deserializePsbt = deserializePsbt;
const psbtv2_1 = require("@ledgerhq/psbtv2");
/**
* Deserializes a raw PSBT buffer (v0 or v2) into a PsbtV2 instance.
*/
function deserializePsbt(psbtBuffer) {
const psbtVersion = psbtv2_1.PsbtV2.getPsbtVersionNumber(psbtBuffer);
const psbt = psbtVersion === 2 ? new psbtv2_1.PsbtV2() : psbtv2_1.PsbtV2.fromV0(psbtBuffer, true);
if (psbtVersion === 2) {
psbt.deserialize(psbtBuffer);
}
return psbt;
}
//# sourceMappingURL=parsePsbt.js.map