From 9c80f907419ff060f5c8d936da04e91ab4c24c98 Mon Sep 17 00:00:00 2001 From: Gamaliel Padillo Date: Wed, 18 Dec 2024 12:53:32 -0800 Subject: [PATCH 1/3] fix: remove etherscan activity for bsc --- packages/extension/src/providers/ethereum/networks/bsc.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/extension/src/providers/ethereum/networks/bsc.ts b/packages/extension/src/providers/ethereum/networks/bsc.ts index 1c39b730f..53a1fb00a 100644 --- a/packages/extension/src/providers/ethereum/networks/bsc.ts +++ b/packages/extension/src/providers/ethereum/networks/bsc.ts @@ -2,8 +2,6 @@ import icon from './icons/bsc.svg'; import { CoingeckoPlatform, NetworkNames } from '@enkryptcom/types'; import { EvmNetwork, EvmNetworkOptions } from '../types/evm-network'; import assetsInfoHandler from '@/providers/ethereum/libs/assets-handlers/assetinfo-mew'; -import { EtherscanActivity } from '../libs/activity-handlers'; -import wrapActivityHandler from '@/libs/activity-state/wrap-activity-handler'; import shNFTHandler from '@/libs/nft-handlers/simplehash'; const bscOptions: EvmNetworkOptions = { @@ -23,7 +21,7 @@ const bscOptions: EvmNetworkOptions = { basePath: "m/44'/714'", NFTHandler: shNFTHandler, assetsInfoHandler, - activityHandler: wrapActivityHandler(EtherscanActivity), + activityHandler: () => Promise.resolve([]), }; const bsc = new EvmNetwork(bscOptions); From 9edd1192c2e370301614b2ca96b77ba1375e15be Mon Sep 17 00:00:00 2001 From: Gamaliel Padillo Date: Thu, 19 Dec 2024 15:52:27 -0800 Subject: [PATCH 2/3] fix: activity not showing in bnb --- .../extension/src/providers/ethereum/networks/arb-nova.ts | 3 ++- packages/extension/src/providers/ethereum/networks/bsc.ts | 4 +++- packages/extension/src/providers/ethereum/networks/holesky.ts | 3 ++- packages/extension/src/providers/ethereum/networks/op-bnb.ts | 3 ++- packages/extension/src/providers/ethereum/networks/palm.ts | 3 ++- 5 files changed, 11 insertions(+), 5 deletions(-) diff --git a/packages/extension/src/providers/ethereum/networks/arb-nova.ts b/packages/extension/src/providers/ethereum/networks/arb-nova.ts index 527404a50..7c299eb0d 100644 --- a/packages/extension/src/providers/ethereum/networks/arb-nova.ts +++ b/packages/extension/src/providers/ethereum/networks/arb-nova.ts @@ -3,6 +3,7 @@ import { CoingeckoPlatform, NetworkNames } from '@enkryptcom/types'; import { EvmNetwork, EvmNetworkOptions } from '../types/evm-network'; import assetsInfoHandler from '@/providers/ethereum/libs/assets-handlers/assetinfo-mew'; import shNFTHandler from '@/libs/nft-handlers/simplehash'; +import wrapActivityHandler from '@/libs/activity-state/wrap-activity-handler'; const arbNovaOptions: EvmNetworkOptions = { name: NetworkNames.ArbitrumNova, @@ -20,7 +21,7 @@ const arbNovaOptions: EvmNetworkOptions = { coingeckoPlatform: CoingeckoPlatform.ArbitrumNova, assetsInfoHandler, NFTHandler: shNFTHandler, - activityHandler: () => Promise.resolve([]), + activityHandler: wrapActivityHandler(() => Promise.resolve([])), }; const arb = new EvmNetwork(arbNovaOptions); diff --git a/packages/extension/src/providers/ethereum/networks/bsc.ts b/packages/extension/src/providers/ethereum/networks/bsc.ts index 53a1fb00a..7eaebd53c 100644 --- a/packages/extension/src/providers/ethereum/networks/bsc.ts +++ b/packages/extension/src/providers/ethereum/networks/bsc.ts @@ -2,6 +2,8 @@ import icon from './icons/bsc.svg'; import { CoingeckoPlatform, NetworkNames } from '@enkryptcom/types'; import { EvmNetwork, EvmNetworkOptions } from '../types/evm-network'; import assetsInfoHandler from '@/providers/ethereum/libs/assets-handlers/assetinfo-mew'; +import { EtherscanActivity } from '../libs/activity-handlers'; +import wrapActivityHandler from '@/libs/activity-state/wrap-activity-handler'; import shNFTHandler from '@/libs/nft-handlers/simplehash'; const bscOptions: EvmNetworkOptions = { @@ -21,7 +23,7 @@ const bscOptions: EvmNetworkOptions = { basePath: "m/44'/714'", NFTHandler: shNFTHandler, assetsInfoHandler, - activityHandler: () => Promise.resolve([]), + activityHandler: wrapActivityHandler(() => Promise.resolve([])), }; const bsc = new EvmNetwork(bscOptions); diff --git a/packages/extension/src/providers/ethereum/networks/holesky.ts b/packages/extension/src/providers/ethereum/networks/holesky.ts index f15cb90cd..cf5eac096 100644 --- a/packages/extension/src/providers/ethereum/networks/holesky.ts +++ b/packages/extension/src/providers/ethereum/networks/holesky.ts @@ -1,6 +1,7 @@ import icon from './icons/eth.svg'; import { NetworkNames } from '@enkryptcom/types'; import { EvmNetwork, EvmNetworkOptions } from '../types/evm-network'; +import wrapActivityHandler from '@/libs/activity-state/wrap-activity-handler'; const holeskyOptions: EvmNetworkOptions = { name: NetworkNames.Holesky, @@ -14,7 +15,7 @@ const holeskyOptions: EvmNetworkOptions = { currencyNameLong: 'Holesky', node: 'wss://nodes.mewapi.io/ws/holesky', icon, - activityHandler: () => Promise.resolve([]), + activityHandler: wrapActivityHandler(() => Promise.resolve([])), }; const holesky = new EvmNetwork(holeskyOptions); diff --git a/packages/extension/src/providers/ethereum/networks/op-bnb.ts b/packages/extension/src/providers/ethereum/networks/op-bnb.ts index 330ad7a63..a76288bac 100644 --- a/packages/extension/src/providers/ethereum/networks/op-bnb.ts +++ b/packages/extension/src/providers/ethereum/networks/op-bnb.ts @@ -3,6 +3,7 @@ import { CoingeckoPlatform, NetworkNames } from '@enkryptcom/types'; import { EvmNetwork, EvmNetworkOptions } from '../types/evm-network'; import assetsInfoHandler from '@/providers/ethereum/libs/assets-handlers/assetinfo-mew'; import shNFTHandler from '@/libs/nft-handlers/simplehash'; +import wrapActivityHandler from '@/libs/activity-state/wrap-activity-handler'; const opBnbOptions: EvmNetworkOptions = { name: NetworkNames.OpBNB, @@ -20,7 +21,7 @@ const opBnbOptions: EvmNetworkOptions = { coingeckoPlatform: CoingeckoPlatform.OpBNB, assetsInfoHandler, NFTHandler: shNFTHandler, - activityHandler: () => Promise.resolve([]), + activityHandler: wrapActivityHandler(() => Promise.resolve([])), }; const op = new EvmNetwork(opBnbOptions); diff --git a/packages/extension/src/providers/ethereum/networks/palm.ts b/packages/extension/src/providers/ethereum/networks/palm.ts index 9b3e66fcf..12f2d37c7 100644 --- a/packages/extension/src/providers/ethereum/networks/palm.ts +++ b/packages/extension/src/providers/ethereum/networks/palm.ts @@ -2,6 +2,7 @@ import icon from './icons/palm.svg'; import { NetworkNames } from '@enkryptcom/types'; import { EvmNetwork, EvmNetworkOptions } from '../types/evm-network'; import shNFTHandler from '@/libs/nft-handlers/simplehash'; +import wrapActivityHandler from '@/libs/activity-state/wrap-activity-handler'; // Palm network has an API but it seems broken (DNS won't resolve) // @see https://palm.chainlens.com/api/swagger-ui/index.html @@ -20,7 +21,7 @@ const palmNetworkOptions: EvmNetworkOptions = { icon, coingeckoID: 'palm-ai', NFTHandler: shNFTHandler, - activityHandler: () => Promise.resolve([]), + activityHandler: wrapActivityHandler(() => Promise.resolve([])), }; const palmNetwork = new EvmNetwork(palmNetworkOptions); From 9002ec630b6ab359212606a933dd33a9fad06786 Mon Sep 17 00:00:00 2001 From: Gamaliel Padillo Date: Thu, 19 Dec 2024 16:05:06 -0800 Subject: [PATCH 3/3] fix: show balance error --- .../ethereum/ui/send-transaction/index.vue | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/extension/src/providers/ethereum/ui/send-transaction/index.vue b/packages/extension/src/providers/ethereum/ui/send-transaction/index.vue index 4fd40a1f8..7f870d95f 100644 --- a/packages/extension/src/providers/ethereum/ui/send-transaction/index.vue +++ b/packages/extension/src/providers/ethereum/ui/send-transaction/index.vue @@ -225,6 +225,18 @@ const hasEnoughBalance = computed(() => { return false; } + // check if user has enough balance for fees + if ( + toBN( + toBase( + gasCostValues.value[selectedFee.value].nativeValue, + props.network.decimals, + ), + ).gt(toBN(nativeBalance.value)) + ) { + return false; + } + return toBN(selectedAsset.value.balance ?? '0').gte( toBN(toBase(sendAmount.value ?? '0', selectedAsset.value.decimals!)), ); @@ -562,8 +574,8 @@ const isInputsValid = computed(() => { if (!isSendToken.value && !selectedNft.value.id) { return false; } - const sendAmountBigNumber = new BigNumber(sendAmount.value) - if (sendAmountBigNumber.isNaN()) return false + const sendAmountBigNumber = new BigNumber(sendAmount.value); + if (sendAmountBigNumber.isNaN()) return false; if (sendAmountBigNumber.gt(assetMaxValue.value)) return false; if (gasCostValues.value.REGULAR.nativeValue === '0') return false; if (!isNumericPositive(sendAmount.value)) return false;