PHP WebShell
Текущая директория: /opt/BitGoJS/modules/babylonlabs-io-btc-staking-ts/src/utils/utxo
Просмотр файла: findInputUTXO.ts
import { Input } from "bitcoinjs-lib/src/transaction";
import { UTXO } from "../../types/UTXO";
import { transactionIdToHash } from "../btc";
export const findInputUTXO = (inputUTXOs: UTXO[], input: Input): UTXO => {
const inputUTXO = inputUTXOs.find(
(u) =>
transactionIdToHash(u.txid).toString("hex") ===
input.hash.toString("hex") && u.vout === input.index,
);
if (!inputUTXO) {
throw new Error(
`Input UTXO not found for txid: ${Buffer.from(input.hash).reverse().toString("hex")} ` +
`and vout: ${input.index}`,
);
}
return inputUTXO;
};
Выполнить команду
Для локальной разработки. Не используйте в интернете!