TypeError: availableUTXOs.sort is not a function.
Closed this issue · 0 comments
Hey I succesfully created the staking contract but I'm getting this error:
`
Staking Script Data Created.
Input UTXOs: {
txid: "d749c272dcf01ddf837105426816b873f12b9a4eae08edb28b4e73f848c1b1d5",
vout: 1,
status: {
confirmed: true,
block_height: 2874056,
block_hash: "000000000000181db9493eb6d74e2cf109c3057fbaf08645d6b4c73ceb37602e",
block_time: 1724084638,
},
value: 8478840,
}
124 | // src/utils/fee/index.ts
125 | var getStakingTxInputUTXOsAndFees = (network, availableUTXOs, stakingAmount, feeRate, outputs) => {
126 | if (availableUTXOs.length === 0) {
127 | throw new Error("Insufficient funds");
128 | }
129 | availableUTXOs.sort((a, b) => b.value - a.value);
^
TypeError: availableUTXOs.sort is not a function. (In 'availableUTXOs.sort((a, b) => b.value - a.value)', 'availableUTXOs.sort' is undefined)
at getStakingTxInputUTXOsAndFees (/node_modules/@babylonlabs-io/btc-staking-ts/dist/index.cjs:129:18)
at stakingTransaction (/node_modules/@babylonlabs-io/btc-staking-ts/dist/index.cjs:491:34)
at
`