diff --git a/packages/extension/src/providers/bitcoin/libs/utils.ts b/packages/extension/src/providers/bitcoin/libs/utils.ts
index 0c72aee8b..42f61c600 100644
--- a/packages/extension/src/providers/bitcoin/libs/utils.ts
+++ b/packages/extension/src/providers/bitcoin/libs/utils.ts
@@ -1,9 +1,10 @@
-import { BitcoinNetworkInfo } from "../types";
+import { BitcoinNetworkInfo, HaskoinUnspentType } from "../types";
import { address as BTCAddress } from "bitcoinjs-lib";
import { GasPriceTypes } from "@/providers/common/types";
import { fromBase } from "@enkryptcom/utils";
import BigNumber from "bignumber.js";
import { BitcoinNetwork } from "../types/bitcoin-network";
+import { BTCTxInfo } from "../ui/types";
const isAddress = (address: string, network: BitcoinNetworkInfo): boolean => {
try {
@@ -13,6 +14,26 @@ const isAddress = (address: string, network: BitcoinNetworkInfo): boolean => {
return false;
}
};
+
+const getTxInfo = (utxos: HaskoinUnspentType[]): BTCTxInfo => {
+ const txInfo: BTCTxInfo = {
+ inputs: [],
+ outputs: [],
+ };
+ utxos.forEach((u) => {
+ txInfo.inputs.push({
+ hash: u.txid,
+ index: u.index,
+ raw: u.raw,
+ witnessUtxo: {
+ script: u.pkscript,
+ value: u.value,
+ },
+ });
+ });
+ return txInfo;
+};
+
const getGasCostValues = async (
network: BitcoinNetwork,
byteSize: number,
@@ -66,4 +87,4 @@ const getGasCostValues = async (
};
return gasCostValues;
};
-export { isAddress, getGasCostValues };
+export { isAddress, getGasCostValues, getTxInfo };
diff --git a/packages/extension/src/providers/bitcoin/ui/btc-verify-transaction.vue b/packages/extension/src/providers/bitcoin/ui/btc-verify-transaction.vue
index 78f5d2ce1..dfaca4d4c 100644
--- a/packages/extension/src/providers/bitcoin/ui/btc-verify-transaction.vue
+++ b/packages/extension/src/providers/bitcoin/ui/btc-verify-transaction.vue
@@ -148,7 +148,7 @@ import { calculateSizeBasedOnType } from "./libs/tx-size";
import { getGasCostValues } from "../libs/utils";
import { computed } from "@vue/reactivity";
import { toBN } from "web3-utils";
-import { BTCTxInfo } from "./types";
+import { getTxInfo as getBTCTxInfo } from "../libs/utils";
const isProcessing = ref(false);
const isOpenSelectFee = ref(false);
@@ -243,21 +243,7 @@ const updateUTXOs = async () => {
};
const getTxInfo = () => {
- const txInfo: BTCTxInfo = {
- inputs: [],
- outputs: [],
- };
- accountUTXOs.value.forEach((u) => {
- txInfo.inputs.push({
- hash: u.txid,
- index: u.index,
- raw: u.raw,
- witnessUtxo: {
- script: u.pkscript,
- value: u.value,
- },
- });
- });
+ const txInfo = getBTCTxInfo(accountUTXOs.value);
const balance = toBN(TokenBalance.value);
const toAmount = toBN(tx.value.value.toString());
const currentFee = toBN(
diff --git a/packages/extension/src/providers/bitcoin/ui/send-transaction/index.vue b/packages/extension/src/providers/bitcoin/ui/send-transaction/index.vue
index 80182b591..0772a5d98 100644
--- a/packages/extension/src/providers/bitcoin/ui/send-transaction/index.vue
+++ b/packages/extension/src/providers/bitcoin/ui/send-transaction/index.vue
@@ -51,11 +51,10 @@
v-if="isSendToken"
:amount="amount"
:fiat-value="selectedAsset.price"
- :has-enough-balance="hasEnoughBalance"
+ :has-enough-balance="!nativeBalanceAfterTransaction.isNeg()"
@update:input-amount="inputAmount"
@update:input-set-max="setMaxValue"
/>
-