diff --git a/firefly.diff b/firefly.diff index ae40a76865..0be8e1a2e0 100644 --- a/firefly.diff +++ b/firefly.diff @@ -197,7 +197,7 @@ rename packages/desktop/views/dashboard/developer/{index.js => index.ts} (100%) rename packages/desktop/{lib/routers/enums => views/dashboard/drawers/network-config}/network-config-route.enum.ts (86%) rename packages/desktop/{components/menu-buttons/ProposalDetailsButton.svelte => views/dashboard/governance/components/ProposalDetailsMenu.svelte} (55%) - rename packages/desktop/{ => views/dashboard/governance}/components/ProposalQuestion.svelte (59%) + rename packages/desktop/{ => views/dashboard/governance}/components/ProposalQuestion.svelte (58%) rename packages/desktop/views/dashboard/{index.js => index.ts} (77%) rename packages/desktop/views/dashboard/send-flow/{index.js => index.ts} (100%) delete mode 100644 packages/desktop/views/dashboard/send-flow/views/SendFlowTemplate.svelte @@ -205,6 +205,7 @@ delete mode 100644 packages/desktop/views/dashboard/send-flow/views/components/DateTimePickerButton.svelte delete mode 100644 packages/desktop/views/dashboard/send-flow/views/components/TokenAmountTile.svelte delete mode 100644 packages/desktop/views/dashboard/send-flow/views/components/TransactionDetails.svelte + delete mode 100644 packages/desktop/views/dashboard/send-flow/views/components/index.js rename packages/desktop/views/dashboard/send-flow/views/{index.js => index.ts} (100%) delete mode 100644 packages/desktop/views/dashboard/settings/Settings.svelte delete mode 100644 packages/desktop/views/dashboard/settings/views/SettingsNavigator.svelte @@ -242,8 +243,7 @@ rename packages/desktop/views/{index.js => index.ts} (83%) rename packages/desktop/views/login/{index.js => index.ts} (100%) delete mode 100644 packages/desktop/views/login/views/EnterPinView.svelte - delete mode 100644 packages/desktop/views/login/views/index.js - rename packages/{mobile/views/login/views/index.js => desktop/views/login/views/index.ts} (69%) + rename packages/desktop/views/login/views/{index.js => index.ts} (69%) rename packages/desktop/views/onboarding/{index.js => index.ts} (100%) rename packages/desktop/views/onboarding/views/create-from-ledger/{index.js => index.ts} (100%) rename packages/desktop/views/onboarding/views/create-from-ledger/views/{index.js => index.ts} (77%) @@ -589,6 +589,7 @@ delete mode 100644 packages/mobile/views/login/views/EnterPinView.svelte delete mode 100644 packages/mobile/views/login/views/LoadProfileView.svelte delete mode 100644 packages/mobile/views/login/views/SelectProfileView.svelte + delete mode 100644 packages/mobile/views/login/views/index.js delete mode 100644 packages/mobile/views/onboarding/OnboardingRouter.svelte delete mode 100644 packages/mobile/views/onboarding/index.js delete mode 100644 packages/mobile/views/onboarding/views/CongratulationsView.svelte @@ -1103,6 +1104,7 @@ delete mode 100644 packages/shared/lib/core/layer-2/constants/gas-budget.constant.ts delete mode 100644 packages/shared/lib/core/layer-2/constants/gas-multiplier.constant.ts delete mode 100644 packages/shared/lib/core/layer-2/enums/allowance.enum.ts + delete mode 100644 packages/shared/lib/core/layer-2/enums/contract-type.enum.ts delete mode 100644 packages/shared/lib/core/layer-2/enums/destination-network.enum.ts delete mode 100644 packages/shared/lib/core/layer-2/enums/index.ts delete mode 100644 packages/shared/lib/core/layer-2/helpers/encodeAddress.ts @@ -1115,7 +1117,10 @@ delete mode 100644 packages/shared/lib/core/layer-2/interfaces/layer2-parameters.interface.ts delete mode 100644 packages/shared/lib/core/layer-2/interfaces/layer2-profile-balance.interface.ts delete mode 100644 packages/shared/lib/core/layer-2/stores/layer2-balances.store.ts + delete mode 100644 packages/shared/lib/core/layer-2/types/abi.type.ts + delete mode 100644 packages/shared/lib/core/layer-2/types/contract.type.ts delete mode 100644 packages/shared/lib/core/layer-2/types/evm-transaction-data.type.ts + delete mode 100644 packages/shared/lib/core/layer-2/types/index.ts delete mode 100644 packages/shared/lib/core/layer-2/types/layer2-metadata.interface.ts delete mode 100644 packages/shared/lib/core/layer-2/utils/addGasBudget.ts delete mode 100644 packages/shared/lib/core/layer-2/utils/getAbiForContractType.ts @@ -1189,6 +1194,7 @@ delete mode 100644 packages/shared/lib/core/network/enums/explorer-endpoint.enum.ts delete mode 100644 packages/shared/lib/core/network/enums/index.ts delete mode 100644 packages/shared/lib/core/network/interfaces/auth.interface.ts + delete mode 100644 packages/shared/lib/core/network/interfaces/block.interface.ts delete mode 100644 packages/shared/lib/core/network/interfaces/chain-configuration.interface.ts delete mode 100644 packages/shared/lib/core/network/interfaces/chain-status.interface.ts delete mode 100644 packages/shared/lib/core/network/interfaces/chain.interface.ts @@ -1586,10 +1592,10 @@ rename packages/shared/{ => src}/lib/contexts/governance/stores/selected-participation-event-status.store.ts (64%) rename packages/shared/{ => src}/lib/contexts/governance/stores/selected-proposal.store.ts (57%) rename packages/shared/{ => src}/lib/contexts/governance/types/index.ts (100%) - rename packages/shared/{ => src}/lib/contexts/governance/utils/calculateTotalVotesForTrackedParticipations.ts (65%) + rename packages/shared/{ => src}/lib/contexts/governance/utils/calculateTotalVotesForTrackedParticipations.ts (64%) rename packages/shared/{ => src}/lib/contexts/governance/utils/createProposalFromError.ts (52%) rename packages/shared/{ => src}/lib/contexts/governance/utils/getActiveParticipation.ts (82%) - rename packages/shared/{ => src}/lib/contexts/governance/utils/getNumberOfActiveProposals.ts (54%) + rename packages/shared/{ => src}/lib/contexts/governance/utils/getNumberOfActiveProposals.ts (53%) rename packages/shared/{ => src}/lib/contexts/governance/utils/getNumberOfTotalProposals.ts (100%) rename packages/shared/{ => src}/lib/contexts/governance/utils/getNumberOfVotedProposals.ts (92%) rename packages/shared/{ => src}/lib/contexts/governance/utils/getNumberOfVotingProposals.ts (94%) @@ -1837,9 +1843,9 @@ rename packages/shared/{ => src}/lib/core/i18n/utils/getGroupSeparator.ts (83%) rename packages/shared/{ => src}/lib/core/i18n/utils/index.ts (100%) rename packages/shared/{ => src}/lib/core/i18n/utils/replaceCurrencyDecimal.ts (100%) - rename packages/shared/{ => src}/lib/core/layer-2/abis/erc20.abi.ts (100%) + rename packages/shared/{ => src}/lib/core/layer-2/abis/erc20.abi.ts (98%) rename packages/shared/{ => src}/lib/core/layer-2/abis/index.ts (68%) - rename packages/shared/{ => src}/lib/core/layer-2/abis/isc-sandbox.abi.ts (100%) + rename packages/shared/{ => src}/lib/core/layer-2/abis/isc-sandbox.abi.ts (99%) rename packages/shared/{ => src}/lib/core/layer-2/classes/simple-buffer.class.ts (100%) rename packages/shared/{ => src}/lib/core/layer-2/constants/accounts-contract.constant.ts (100%) rename packages/shared/{ => src}/lib/core/layer-2/constants/contract-functions.constant.ts (100%) @@ -1847,13 +1853,12 @@ rename packages/shared/{ => src}/lib/core/layer-2/constants/erc20-tokens-poll-interval.constant.ts (100%) rename packages/shared/{ => src}/lib/core/layer-2/constants/externally-owned-account-type-id.constant.ts (100%) rename packages/shared/{ => src}/lib/core/layer-2/constants/externally-owned-account.constant.ts (100%) - rename packages/shared/{ => src}/lib/core/layer-2/constants/index.ts (66%) + rename packages/shared/{ => src}/lib/core/layer-2/constants/index.ts (78%) rename packages/shared/{ => src}/lib/core/layer-2/constants/isc-magic-contract-address.constant.ts (51%) rename packages/shared/{ => src}/lib/core/layer-2/constants/layer2-tokens-poll-interval.constant.ts (100%) rename packages/shared/{ => src}/lib/core/layer-2/constants/target-contracts.constant.ts (100%) rename packages/shared/{ => src}/lib/core/layer-2/constants/transfer-allowance.constant.ts (100%) rename packages/shared/{ => src}/lib/core/layer-2/enums/abi-type.enum.ts (100%) - rename packages/shared/{ => src}/lib/core/layer-2/enums/contract-type.enum.ts (77%) rename packages/shared/{ => src}/lib/core/layer-2/enums/state-mutability-type.enum.ts (100%) rename packages/shared/{ => src}/lib/core/layer-2/errors/index.ts (100%) rename packages/shared/{ => src}/lib/core/layer-2/errors/layer1-recipient.error.ts (100%) @@ -1869,10 +1874,7 @@ rename packages/shared/{lib/core/token/types/native-token-amount.type.ts => src/lib/core/layer-2/interfaces/native-token-amount.interface.ts} (73%) rename packages/shared/{ => src}/lib/core/layer-2/stores/index.ts (100%) rename packages/shared/{ => src}/lib/core/layer-2/tests/parseLayer2MetadataForTransfer.test.ts (63%) - rename packages/shared/{ => src}/lib/core/layer-2/types/abi.type.ts (100%) - rename packages/shared/{ => src}/lib/core/layer-2/types/contract.type.ts (100%) rename packages/shared/{ => src}/lib/core/layer-2/types/evm-transaction-options.type.ts (100%) - rename packages/shared/{ => src}/lib/core/layer-2/types/index.ts (54%) rename packages/shared/{ => src}/lib/core/layer-2/utils/parseLayer2Metadata.ts (56%) rename packages/shared/{ => src}/lib/core/ledger/classes/index.ts (100%) rename packages/shared/{ => src}/lib/core/ledger/constants/ledger-error-locales.constant.ts (100%) @@ -1921,7 +1923,6 @@ rename packages/shared/{ => src}/lib/core/network/helpers/getNetworkStatusFromNodeInfo.ts (69%) rename packages/shared/{ => src}/lib/core/network/helpers/index.ts (100%) rename packages/shared/{ => src}/lib/core/network/index.ts (100%) - rename packages/shared/{ => src}/lib/core/network/interfaces/block.interface.ts (100%) rename packages/shared/{ => src}/lib/core/network/interfaces/client-options.interface.ts (54%) rename packages/shared/{ => src}/lib/core/network/interfaces/connected-chain.interface.ts (100%) rename packages/shared/{ => src}/lib/core/network/interfaces/evm-addresses.interface.ts (100%) @@ -1931,7 +1932,7 @@ rename packages/shared/{ => src}/lib/core/network/interfaces/node-info-response.interface.ts (62%) rename packages/shared/{ => src}/lib/core/network/interfaces/protocol.interface.ts (62%) rename packages/shared/{ => src}/lib/core/network/types/network-metadata.type.ts (100%) - rename packages/shared/{ => src}/lib/core/network/types/web3-provider.type.ts (100%) + rename packages/shared/{ => src}/lib/core/network/types/web3-provider.type.ts (54%) rename packages/shared/{ => src}/lib/core/network/utils/checkNodeUrlValidity.ts (95%) rename packages/shared/{lib/core/network/utils/getDefaultPersistedNetwork.ts => src/lib/core/network/utils/getDefaultStardustNetwork.ts} (50%) rename packages/shared/{ => src}/lib/core/network/utils/getEvmTransactionOptions.ts (88%) diff --git a/packages/desktop/components/evm-transactions/EvmSmartContractAlert.svelte b/packages/desktop/components/evm-transactions/EvmSmartContractAlert.svelte new file mode 100644 index 0000000000..53e37ea77d --- /dev/null +++ b/packages/desktop/components/evm-transactions/EvmSmartContractAlert.svelte @@ -0,0 +1,50 @@ + + +{#if parsedSmartContract.parsedMethod} + + ({ + key: input.name, + value: String(input.value) ?? localize('general.unknown'), + }))} + /> + +{:else} + +
+ +{/if} diff --git a/packages/desktop/components/evm-transactions/index.ts b/packages/desktop/components/evm-transactions/index.ts index 80ec42f64a..b500a4327a 100644 --- a/packages/desktop/components/evm-transactions/index.ts +++ b/packages/desktop/components/evm-transactions/index.ts @@ -1,2 +1,3 @@ +export { default as EvmSmartContractAlert } from './EvmSmartContractAlert.svelte' export { default as EvmTokenApprovalAlert } from './EvmTokenApprovalAlert.svelte' export { default as EvmTransactionAlert } from './EvmTransactionAlert.svelte' diff --git a/packages/desktop/components/popup/popups/EvmTransactionFromDappPopup.svelte b/packages/desktop/components/popup/popups/EvmTransactionFromDappPopup.svelte index 7fba01cac5..784fd28641 100644 --- a/packages/desktop/components/popup/popups/EvmTransactionFromDappPopup.svelte +++ b/packages/desktop/components/popup/popups/EvmTransactionFromDappPopup.svelte @@ -2,10 +2,10 @@ import { DappVerification, RpcMethod } from '@auxiliary/wallet-connect/enums' import { IConnectedDapp } from '@auxiliary/wallet-connect/interface' import { CallbackParameters } from '@auxiliary/wallet-connect/types' - import { Table } from '@bloomwalletio/ui' + import { EvmTokenApprovalAlert } from '@components' + import { EvmSmartContractAlert } from '@components/evm-transactions' import { IAccountState } from '@core/account' import { getSelectedAccount, selectedAccount } from '@core/account/stores' - import { openUrlInBrowser } from '@core/app' import { handleError } from '@core/error/handlers' import { localize } from '@core/i18n' import { @@ -14,9 +14,11 @@ getHexEncodedTransaction, parseSmartContractDataFromTransactionData, } from '@core/layer-2' + import { ParsedSmartContractType } from '@core/layer-2/enums/parsed-smart-contract-type.enum' import { EvmTransactionData } from '@core/layer-2/types' + import { ParsedSmartContractData } from '@core/layer-2/types/parsed-smart-contract-data.type' import { LedgerAppName } from '@core/ledger' - import { ExplorerEndpoint, IEvmNetwork, getExplorerUrl } from '@core/network' + import { IEvmNetwork } from '@core/network' import { getNftByIdForAccount } from '@core/nfts/stores' import { checkActiveProfileAuth } from '@core/profile/actions' import { getActiveProfileId } from '@core/profile/stores' @@ -27,12 +29,9 @@ import { PopupId, closePopup, modifyPopupState, openPopup } from '@desktop/auxiliary/popup' import { LegacyTransaction } from '@ethereumjs/tx' import { DappInfo, TransactionAssetSection } from '@ui' - import { EvmTransactionAlert, EvmTokenApprovalAlert } from '@components' import { EvmTransactionDetails } from '@views/dashboard/send-flow/views/components' import { onDestroy, onMount } from 'svelte' import PopupTemplate from '../PopupTemplate.svelte' - import { ParsedSmartContractType } from '@core/layer-2/enums/parsed-smart-contract-type.enum' - import { ParsedSmartContractData } from '@core/layer-2/types/parsed-smart-contract-data.type' export let preparedTransaction: EvmTransactionData export let evmNetwork: IEvmNetwork @@ -185,11 +184,6 @@ closePopup({ callOnCancel: true }) } - function onExplorerClick(contractAddress: string): void { - const url = getExplorerUrl(evmNetwork.id, ExplorerEndpoint.Address, contractAddress) - openUrlInBrowser(url) - } - let intervalId: NodeJS.Timeout onMount(async () => { await setGasPrices() @@ -250,33 +244,7 @@ {:else if parsedData?.type === ParsedSmartContractType.SmartContract}
- -
onExplorerClick(String(preparedTransaction.to)), - }, - { key: localize('general.methodName'), value: parsedData.parsedMethod?.name }, - { - key: localize('general.parameters'), - value: parsedData?.parsedMethod?.inputs.reduce((acc, input) => { - acc[input.name] = input.value - return acc - }, {}), - }, - { key: localize('general.data'), value: String(preparedTransaction.data), copyable: true }, - ]} - /> - + {/if} + - + App icon

- - - - - + diff --git a/packages/desktop/public/about.js b/packages/desktop/public/about.js new file mode 100644 index 0000000000..206d65eaa9 --- /dev/null +++ b/packages/desktop/public/about.js @@ -0,0 +1,9 @@ +// https://github.com/electron/electron/issues/2863 +var exports = exports || {} + +window.about.getData().then((aboutData) => { + document.getElementById('title').textContent = aboutData.appName + document.getElementById('app-icon').src = aboutData.iconPath + document.getElementById('app-version').textContent = aboutData.version + document.getElementById('footer').textContent = `Bloom Labs Ltd. ${new Date().getFullYear()}` +}) diff --git a/packages/desktop/public/error.css b/packages/desktop/public/error.css new file mode 100644 index 0000000000..faf6c30129 --- /dev/null +++ b/packages/desktop/public/error.css @@ -0,0 +1,111 @@ +@font-face { + font-family: 'Silka'; + font-style: normal; + font-weight: 500; + font-display: swap; + src: url('./assets/fonts/silka/silka-medium-webfont.woff2') format('woff2'); +} + +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body, +html { + width: 100%; + height: 100%; + user-select: none; + -webkit-user-drag: none; + overflow: hidden; +} + +body { + display: flex; + justify-content: stretch; + color: #ffffff; + background-color: #161926; + font-size: 11px; + font-family: 'Silka'; +} + +a { + color: #b196ef; +} + +hr { + width: 100%; + border: 0; + border-top: 1px solid #212537; + margin: 1.5rem 0; +} + +button { + display: flex; + flex-direction: row; + align-items: center; + justify-content: center; + border: 0px solid rgb(150, 108, 230); + box-sizing: border-box; + cursor: pointer; + border-radius: 3rem; + padding-left: 1.5rem; + padding-right: 1.5rem; + padding-top: 0.5rem; + padding-bottom: 0.5rem; + height: 3rem; + background-color: rgb(150, 108, 230); + width: fit-content; + color: white; + font-family: Silka; + font-size: 16px; +} + +.content { + flex: 1; + display: flex; + margin: 2rem; + display: flex; + flex-direction: column; +} + +#app-icon { + -webkit-user-drag: none; + margin: 1rem 0; +} + +#title { + margin: 1rem 0; +} + +#diagnostics { + margin: 1rem 0; +} + +#details { + margin: 1rem 0; + flex: 1; + overflow-y: auto; + white-space: pre-line; + min-height: 50px; +} + +.help { + color: #c4d1e8; + font-size: 0.8rem; + line-height: 1.5rem; +} + +::-webkit-scrollbar { + width: 8px; +} + +::-webkit-scrollbar-thumb { + background-color: #d8e3f5; + border-radius: 10px; +} + +::-webkit-scrollbar-track { + background-color: transparent; +} diff --git a/packages/desktop/public/error.html b/packages/desktop/public/error.html index 323c4f4cf8..7b67e51363 100644 --- a/packages/desktop/public/error.html +++ b/packages/desktop/public/error.html @@ -1,219 +1,58 @@ - - - - - Bloom Error - - - - -
- App icon -

Unfortunately an error has occurred in Bloom.

-
-

-

-    

-    

-    
-    
- -
- - - - - - + + + + + Bloom Error + + + +
+ App icon +

Unfortunately an error has occurred in Bloom.

+
+

+

+            

+            

+            
+            
+ +
+ + diff --git a/packages/desktop/public/error.js b/packages/desktop/public/error.js new file mode 100644 index 0000000000..d78debfec9 --- /dev/null +++ b/packages/desktop/public/error.js @@ -0,0 +1,65 @@ +// https://github.com/electron/electron/issues/2863 +var exports = exports || {} + +let errorData + +window.error.getData().then((err) => { + errorData = err + document.getElementById('app-icon').src = errorData.iconPath + document.getElementById('version').textContent = `App Version: ${errorData.version}` + document.getElementById('diagnostics').textContent = errorData.diagnostics + document.getElementById('errorType').textContent = `Error Type: ${errorData.errorType}` + document.getElementById('details').textContent = formatError() +}) + +function formatError() { + let formatted = [] + + if (errorData.error) { + if (errorData.error instanceof Error || errorData.error.stack || errorData.error.message) { + if (errorData.error.stack) { + formatted.push(errorData.error.stack) + } else if (errorData.error.message) { + formatted.push(errorData.error.message) + } + } else if (typeof errorData.error == 'string') { + formatted.push(errorData.error) + } else { + formatted.push(JSON.stringify(errorData.error)) + } + } + + return formatted.join('\r\n') +} + +function copy() { + let content = `App Version: ${errorData.version}\r\n\r\n` + content += errorData.diagnostics + '\r\n\r\n' + content += `Error Type: ${errorData.errorType}` + '\r\n\r\n' + content += formatError() + copyToClipboard(content) +} + +function copyToClipboard(input) { + try { + const textArea = document.createElement('textarea') + textArea.value = input + document.body.appendChild(textArea) + + if (navigator.userAgent.match(/ipad|iphone/i)) { + const range = document.createRange() + range.selectNodeContents(textArea) + const selection = window.getSelection() + selection.removeAllRanges() + selection.addRange(range) + textArea.setSelectionRange(0, 999999) + } else { + textArea.select() + } + + document.execCommand('copy') + document.body.removeChild(textArea) + } catch (err) {} +} + +copyButton.addEventListener('click', copy) diff --git a/packages/desktop/public/index.html b/packages/desktop/public/index.html index 7ceaedfe14..bd31dd853c 100644 --- a/packages/desktop/public/index.html +++ b/packages/desktop/public/index.html @@ -7,13 +7,22 @@ http-equiv="Content-Security-Policy" content=" default-src 'self'; - connect-src 'self' https://* wss://*; - frame-src 'self' https://*; + connect-src 'self' https://* wss://relay.walletconnect.com; + img-src 'self' https://tideprotocol.infura-ipfs.io data:; + base-uri 'self'; + form-action 'self'; + frame-src 'self' https://verify.walletconnect.org https://verify.walletconnect.com; + worker-src 'self'; + script-src-elem 'self' 'unsafe-inline'; + script-src-attr 'none'; + style-src-elem 'self' 'unsafe-inline'; + style-src-attr 'self' 'unsafe-inline'; object-src 'none'; - img-src 'self' https: data:; - style-src 'self' 'unsafe-inline'; - media-src 'self' data:; - script-src 'self'; + media-src 'self'; + font-src 'self'; + manifest-src 'self'; + navigate-to 'self'; + upgrade-insecure-requests; " /> diff --git a/packages/desktop/views/dashboard/collectibles/components/CollectionDetails.svelte b/packages/desktop/views/dashboard/collectibles/components/CollectionDetails.svelte index 91324eb7ac..9983cdd2ee 100644 --- a/packages/desktop/views/dashboard/collectibles/components/CollectionDetails.svelte +++ b/packages/desktop/views/dashboard/collectibles/components/CollectionDetails.svelte @@ -5,7 +5,7 @@ export let collectionId: string - $: nfts = $ownedNfts.filter((nft) => nft.collectionId === collectionId) + $: nfts = $ownedNfts.filter((nft) => nft.collectionId === collectionId && !nft.hidden && !nft.isScam) onDestroy(() => { $selectedCollectionId = undefined diff --git a/packages/desktop/views/dashboard/collectibles/components/CollectionsGalleryItem.svelte b/packages/desktop/views/dashboard/collectibles/components/CollectionsGalleryItem.svelte index 734d87613e..c49a2d2d6c 100644 --- a/packages/desktop/views/dashboard/collectibles/components/CollectionsGalleryItem.svelte +++ b/packages/desktop/views/dashboard/collectibles/components/CollectionsGalleryItem.svelte @@ -14,7 +14,7 @@ } $: collection = $persistedCollections[collectionId] - $: nfts = $ownedNfts.filter((nft) => nft.collectionId === collectionId) + $: nfts = $ownedNfts.filter((nft) => nft.collectionId === collectionId && !nft.hidden && !nft.isScam) {#if collection && nfts.length > 0} diff --git a/packages/desktop/views/dashboard/collectibles/views/CollectionsGalleryView.svelte b/packages/desktop/views/dashboard/collectibles/views/CollectionsGalleryView.svelte index 8c56975489..6abe2b9c17 100644 --- a/packages/desktop/views/dashboard/collectibles/views/CollectionsGalleryView.svelte +++ b/packages/desktop/views/dashboard/collectibles/views/CollectionsGalleryView.svelte @@ -11,17 +11,18 @@ let queriedCollectionsIds: string[] = [] - $: collectionsIds = new Set( - $ownedNfts - ?.map((nft) => nft.collectionId) - .filter((collectionId) => collectionId && $persistedCollections[collectionId]) - ) + $: collectionsIds = $ownedNfts?.reduce((set, nft) => { + if (!nft.hidden && !nft.isScam && nft.collectionId && $persistedCollections[nft.collectionId]) { + set.add(nft.collectionId) + } + return set + }, new Set()) $: $collectionsSearchTerm, collectionsIds, setQueriedCollectionsIds() function setQueriedCollectionsIds(): void { queriedCollectionsIds = Array.from(collectionsIds) - .filter((collectionId) => isVisibleCollection($persistedCollections[collectionId])) + ?.filter((collectionId) => isVisibleCollection($persistedCollections[collectionId])) .sort((collectionId1, collectionId2) => $persistedCollections[collectionId1]?.name .toLowerCase() diff --git a/packages/shared/src/lib/core/app/json/configurable-app-parameters.json b/packages/shared/src/lib/core/app/json/configurable-app-parameters.json index 2ba8ab38fd..6fc1f916d0 100644 --- a/packages/shared/src/lib/core/app/json/configurable-app-parameters.json +++ b/packages/shared/src/lib/core/app/json/configurable-app-parameters.json @@ -1,6 +1,6 @@ { "denylists": { - "keywords": ["lottery", "lotto", "raffle", "giveaway", "scam", "won"], + "keywords": ["lottery", "lotto", "raffle", "giveaway", "scam"], "urls": ["iotalottery.com", "iota-lottery.com", "lottery-iota.com", "fly-fire.com"] }, "allowlists": { diff --git a/packages/shared/src/lib/core/layer-2/interfaces/parsed-contract-data.interface.ts b/packages/shared/src/lib/core/layer-2/interfaces/parsed-contract-data.interface.ts index 5ff210bb58..e62a8d4802 100644 --- a/packages/shared/src/lib/core/layer-2/interfaces/parsed-contract-data.interface.ts +++ b/packages/shared/src/lib/core/layer-2/interfaces/parsed-contract-data.interface.ts @@ -30,6 +30,7 @@ export interface IParsedTokenApproval extends Omit(ISC_SANDBOX_ABI, network.provider) - const decodedData = iscMagicDecoder.decodeData(data) + const decodedData = iscMagicDecoder.decodeData(rawData) if (!decodedData) { return undefined } - const rawMethod = data.substring(0, 10) + const rawMethod = rawData.substring(0, 10) const parsedMethod: IParsedMethod = { name: decodedData.name, inputs: Object.values(decodedData.inputs), @@ -79,6 +79,7 @@ function parseSmartContractDataWithIscMagicAbi( tokenId: nativeToken.ID.data, rawAmount, parsedMethod, + rawData, rawMethod, recipientAddress: HEX_PREFIX + agentId?.substring(agentId.length - 40), } @@ -88,11 +89,18 @@ function parseSmartContractDataWithIscMagicAbi( standard: NftStandard.Irc27, nftId, parsedMethod, + rawData, rawMethod, recipientAddress: HEX_PREFIX + agentId?.substring(agentId.length - 40), } } else { - return { type: ParsedSmartContractType.SmartContract, recipientAddress, rawMethod, parsedMethod } + return { + type: ParsedSmartContractType.SmartContract, + recipientAddress, + rawData, + rawMethod, + parsedMethod, + } } } case 'send': { @@ -113,6 +121,7 @@ function parseSmartContractDataWithIscMagicAbi( standard: TokenStandard.Irc30, tokenId: nativeToken.ID.data, rawAmount: BigInt(nativeToken.amount), + rawData, rawMethod, parsedMethod, additionalBaseTokenAmount: baseTokenAmount, @@ -124,6 +133,7 @@ function parseSmartContractDataWithIscMagicAbi( type: ParsedSmartContractType.NftTransfer, standard: NftStandard.Irc27, nftId, + rawData, rawMethod, parsedMethod, additionalBaseTokenAmount: baseTokenAmount, @@ -133,32 +143,33 @@ function parseSmartContractDataWithIscMagicAbi( return { type: ParsedSmartContractType.CoinTransfer, rawAmount: network.denormaliseAmount(baseTokenAmount), + rawData, rawMethod, parsedMethod, recipientAddress, // for now, set it to the magic contract address } } - return { type: ParsedSmartContractType.SmartContract, recipientAddress, rawMethod, parsedMethod } + return { type: ParsedSmartContractType.SmartContract, recipientAddress, rawData, rawMethod, parsedMethod } } default: - return { type: ParsedSmartContractType.SmartContract, recipientAddress, rawMethod, parsedMethod } + return { type: ParsedSmartContractType.SmartContract, recipientAddress, rawData, rawMethod, parsedMethod } } } function parseSmartContractDataWithErc20Abi( network: IEvmNetwork, - data: string, + rawData: string, recipientAddress: string ): ParsedSmartContractData | undefined { const erc20Decoder = new AbiDecoder(ERC20_ABI, network.provider) - const decodedData = erc20Decoder.decodeData(data) + const decodedData = erc20Decoder.decodeData(rawData) if (!decodedData) { return undefined } - const rawMethod = data.substring(0, 10) + const rawMethod = rawData.substring(0, 10) const parsedMethod: IParsedMethod = { name: decodedData.name, inputs: Object.values(decodedData.inputs), @@ -171,6 +182,7 @@ function parseSmartContractDataWithErc20Abi( standard: TokenStandard.Erc20, tokenId: recipientAddress, rawAmount: BigInt(decodedData.inputs._value.value), + rawData, rawMethod, parsedMethod, recipientAddress: decodedData.inputs._to.value, @@ -183,6 +195,7 @@ function parseSmartContractDataWithErc20Abi( tokenId: recipientAddress, spender: decodedData.inputs._spender.value, rawAmount: BigInt(decodedData.inputs._value.value), + rawData, rawMethod, parsedMethod, recipientAddress, @@ -191,6 +204,7 @@ function parseSmartContractDataWithErc20Abi( default: { return { type: ParsedSmartContractType.SmartContract, + rawData, rawMethod, parsedMethod, recipientAddress, @@ -201,17 +215,17 @@ function parseSmartContractDataWithErc20Abi( function parseSmartContractDataWithErc721Abi( network: IEvmNetwork, - data: string, + rawData: string, recipientAddress: string ): ParsedSmartContractData | undefined { const erc721Decoder = new AbiDecoder(ERC721_ABI, network.provider) - const decodedData = erc721Decoder.decodeData(data) + const decodedData = erc721Decoder.decodeData(rawData) if (!decodedData) { return undefined } - const rawMethod = data.substring(0, 10) + const rawMethod = rawData.substring(0, 10) const parsedMethod: IParsedMethod = { name: decodedData.name, inputs: Object.values(decodedData.inputs), @@ -226,6 +240,7 @@ function parseSmartContractDataWithErc721Abi( type: ParsedSmartContractType.NftTransfer, standard: NftStandard.Erc721, nftId: `${recipientAddress}:${inputs.tokenId.value}`, + rawData, rawMethod, parsedMethod, recipientAddress: inputs.to.value, @@ -236,6 +251,7 @@ function parseSmartContractDataWithErc721Abi( return { type: ParsedSmartContractType.SmartContract, recipientAddress, + rawData, rawMethod, parsedMethod, } @@ -275,6 +291,7 @@ function parseSmartContractDataWithMethodRegistry( return { type: ParsedSmartContractType.SmartContract, recipientAddress, + rawData, rawMethod: fourBytePrefix, parsedMethod: { name, inputs }, } @@ -282,6 +299,7 @@ function parseSmartContractDataWithMethodRegistry( return { type: ParsedSmartContractType.SmartContract, recipientAddress, + rawData, rawMethod: fourBytePrefix, } } diff --git a/packages/shared/src/locales/en.json b/packages/shared/src/locales/en.json index 08526d4d52..5476090b93 100644 --- a/packages/shared/src/locales/en.json +++ b/packages/shared/src/locales/en.json @@ -1114,8 +1114,9 @@ }, "smartContractCall": { "title": "Smart contract call to {contractAddress}", - "unableToVerify": "Bloom is unable to verify the smart contract call. Only proceed with apps you trust.", - "viewSmartContract": "View Smart Contract", + "unableToVerify": "Bloom is unable to parse the smart contract data, only proceed with apps you trust.", + "partiallyVerified": "Bloom has partially parsed the smart contract data, proceed with apps you trust.", + "viewSmartContract": "View Contract", "action": "Confirm", "success": "Smart contract call to {recipient}" },