Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

import { getTransferableBitcoinUtxos } from '@subwallet/extension-base/services/balance-service/helpers/balance/bitcoin';
import { _BITCOIN_CHAIN_SLUG, _BITCOIN_NAME, _BITCOIN_TESTNET_NAME } from '@subwallet/extension-base/services/chain-service/constants';
import { _BitcoinApi } from '@subwallet/extension-base/services/chain-service/types';
import { BitcoinFeeInfo, BitcoinFeeRate, GetFeeFunction, TransactionFee } from '@subwallet/extension-base/types';
import { combineBitcoinFee, determineUtxosForSpend, determineUtxosForSpendAll, getId } from '@subwallet/extension-base/utils';
Expand Down Expand Up @@ -100,8 +101,16 @@ export async function getBitcoinTransactionObject ({ bitcoinApi,

return [tx, transferAmount.toString()];
} catch (e) {
const error = e as Error;
// const error = e as Error;

throw new Error(`Failed to get Bitcoin transaction object: ${error.message}`);
throw new Error(`You don’t have enough BTC (${convertChainToSymbol(chain)}) for the transaction. Lower your BTC amount and try again`);
}
}

function convertChainToSymbol (chain: string) {
if (chain === _BITCOIN_CHAIN_SLUG) {
return _BITCOIN_NAME;
} else {
return _BITCOIN_TESTNET_NAME;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -278,5 +278,7 @@ export const _CHAIN_LOGO_MAP_SRC = `https://raw.githubusercontent.com/Koniverse/
export const _ASSET_LOGO_MAP_SRC = `https://raw.githubusercontent.com/Koniverse/SubWallet-Chain/${TARGET_BRANCH}/packages/chain-list/src/data/AssetLogoMap.json`;

export const _BITCOIN_CHAIN_SLUG = 'bitcoin';
export const _BITCOIN_TESTNET_CHAIN_SLUG = 'bitcoinTestnet';
export const _BITCOIN_NAME = 'Bitcoin';
export const _BITCOIN_TESTNET_NAME = 'Bitcoin Testnet';
export const _BEAR_TOKEN = 'aHR0cHM6Ly9xdWFuZ3RydW5nLXNvZnR3YXJlLnZuL2FwaS9tYXN0ZXIvYXBpLXB1YmxpYw=='; // Public for now. Change and hide later.
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ function Component ({ className = '' }: Props): React.ReactElement<Props> {
>
<div className={'chain_import__container'}>
<div className={'chain_import__header_info'}>
{t('Currently support WSS provider for Substrate networks and HTTP provider for EVM network')}
{t('Only HTTP providers for EVM networks are currently supported')}
</div>
<Form
disabled={loading}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ const Component = ({ className, feeDetail, modalId, onSelectOption, selectedOpti

setInvalidForm(true);

return Promise.reject(t('Custom fee should be greater than {{min}} sats/vB', { min: minString }));
return Promise.reject(t('Custom fee too low. Increase fee to at least {{min}} sats/vB and try again', { min: minString }));
}

setInvalidForm(false);
Expand Down Expand Up @@ -349,7 +349,7 @@ const Component = ({ className, feeDetail, modalId, onSelectOption, selectedOpti
disabled={!canSubmitCustom || invalidForm}
onClick={form.submit}
>
Use custom fee
Apply custom fee
</Button>
</div>
)
Expand Down