@thorwallet/xchain-bitcoin
Version:
Custom Bitcoin client and utilities used by XChainJS clients
25 lines • 802 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createTxInfo = void 0;
const tslib_1 = require("tslib");
const Utils = tslib_1.__importStar(require("./utils"));
/**
* Create transaction info.
*
* @param {LedgerTxInfoParams} params The transaction build options.
* @returns {LedgerTxInfo} The transaction info used for ledger sign.
*/
const createTxInfo = (params) => tslib_1.__awaiter(void 0, void 0, void 0, function* () {
try {
const { psbt, utxos } = yield Utils.buildTx(params);
return {
utxos,
newTxHex: psbt.data.globalMap.unsignedTx.toBuffer().toString('hex'),
};
}
catch (e) {
return Promise.reject(e);
}
});
exports.createTxInfo = createTxInfo;
//# sourceMappingURL=ledger.js.map