Skip to content

Commit 8a41eaa

Browse files
committed
move check, working now
1 parent b6ca677 commit 8a41eaa

File tree

3 files changed

+21
-22
lines changed

3 files changed

+21
-22
lines changed

lib/alkanes/alkanes.js

Lines changed: 10 additions & 10 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/alkanes/alkanes.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/alkanes/alkanes.ts

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -378,21 +378,10 @@ export const createUnwrapBtcPsbt = async ({
378378

379379
const subfrostAddress = await getWrapAddress(provider);
380380

381-
const totalAlkaneAmount = alkaneUtxos.reduce((acc, utxo) => {
382-
const alkane = utxo.alkanes['32:0']
383-
if (alkane) {
384-
return acc + BigInt(alkane.value)
385-
}
386-
return acc
387-
}, 0n)
388-
389381
const psbt = new bitcoin.Psbt({ network: provider.network })
390382
psbt.addOutput({ address: alkanesAddress, value: 546 })
391383
psbt.addOutput({ address: subfrostAddress, value: 546 })
392384

393-
if (totalAlkaneAmount < unwrapAmount) {
394-
throw new OylTransactionError(Error('Insufficient frbtc balance'))
395-
}
396385

397386
const dustOutputIndex = psbt.txOutputs.length - 1
398387

@@ -582,6 +571,16 @@ export const unwrapBtc = async ({
582571
unwrapAmount: bigint
583572
alkaneUtxos: FormattedUtxo[]
584573
}) => {
574+
const totalAlkaneAmount = alkaneUtxos.reduce((acc, utxo) => {
575+
const alkane = utxo.alkanes['32:0']
576+
if (alkane) {
577+
return acc + BigInt(alkane.value)
578+
}
579+
return acc
580+
}, 0n)
581+
if (totalAlkaneAmount < unwrapAmount) {
582+
throw new OylTransactionError(Error('Insufficient frbtc balance'))
583+
}
585584
const { psbt: finalPsbt } = await unwrapBtcNoSigning({
586585
utxos,
587586
account,

0 commit comments

Comments
 (0)