diff --git a/packages/desktop/components/evm-transactions/EvmDappRequestHeader.svelte b/packages/desktop/components/evm-transactions/EvmDappRequestHeader.svelte new file mode 100644 index 0000000000..f6fdd047ed --- /dev/null +++ b/packages/desktop/components/evm-transactions/EvmDappRequestHeader.svelte @@ -0,0 +1,17 @@ + + +{#if requestInfo.dapp} + + +{/if} diff --git a/packages/desktop/components/evm-transactions/index.ts b/packages/desktop/components/evm-transactions/index.ts index b500a4327a..15f14fa34e 100644 --- a/packages/desktop/components/evm-transactions/index.ts +++ b/packages/desktop/components/evm-transactions/index.ts @@ -1,3 +1,6 @@ +export { default as EvmDappRequestHeader } from './EvmDappRequestHeader.svelte' export { default as EvmSmartContractAlert } from './EvmSmartContractAlert.svelte' export { default as EvmTokenApprovalAlert } from './EvmTokenApprovalAlert.svelte' export { default as EvmTransactionAlert } from './EvmTransactionAlert.svelte' + +export * from './transaction-views' diff --git a/packages/desktop/components/evm-transactions/transaction-views/EvmBaseCoinTransferView.svelte b/packages/desktop/components/evm-transactions/transaction-views/EvmBaseCoinTransferView.svelte new file mode 100644 index 0000000000..74b18cb992 --- /dev/null +++ b/packages/desktop/components/evm-transactions/transaction-views/EvmBaseCoinTransferView.svelte @@ -0,0 +1,40 @@ + + + + + {#if $$slots.dappHeader} + + {/if} + +
+ + +
+
diff --git a/packages/desktop/components/evm-transactions/transaction-views/EvmNftTransferView.svelte b/packages/desktop/components/evm-transactions/transaction-views/EvmNftTransferView.svelte new file mode 100644 index 0000000000..a2ffe237c7 --- /dev/null +++ b/packages/desktop/components/evm-transactions/transaction-views/EvmNftTransferView.svelte @@ -0,0 +1,45 @@ + + + + + {#if $$slots.dappHeader} + + {/if} + +
+ + +
+
diff --git a/packages/desktop/components/evm-transactions/transaction-views/EvmSmartContractView.svelte b/packages/desktop/components/evm-transactions/transaction-views/EvmSmartContractView.svelte new file mode 100644 index 0000000000..1c172eb1a4 --- /dev/null +++ b/packages/desktop/components/evm-transactions/transaction-views/EvmSmartContractView.svelte @@ -0,0 +1,42 @@ + + + + + {#if $$slots.dappHeader} + + {/if} + +
+ + + +
+
diff --git a/packages/desktop/components/evm-transactions/transaction-views/EvmTokenApprovalView.svelte b/packages/desktop/components/evm-transactions/transaction-views/EvmTokenApprovalView.svelte new file mode 100644 index 0000000000..ae55defc14 --- /dev/null +++ b/packages/desktop/components/evm-transactions/transaction-views/EvmTokenApprovalView.svelte @@ -0,0 +1,68 @@ + + + + + {#if $$slots.dappHeader} + + {/if} + +
+ + + + {#if baseCoinTransfer.rawAmount > BigInt(0)} + + + {:else if parsedTokenApproval.rawAmount > tokenBalance} + + + + + + {/if} +
+
diff --git a/packages/desktop/components/evm-transactions/transaction-views/EvmTokenTransferView.svelte b/packages/desktop/components/evm-transactions/transaction-views/EvmTokenTransferView.svelte new file mode 100644 index 0000000000..7fe86e4728 --- /dev/null +++ b/packages/desktop/components/evm-transactions/transaction-views/EvmTokenTransferView.svelte @@ -0,0 +1,47 @@ + + + + + {#if $$slots.dappHeader} + + {/if} + +
+ + +
+
diff --git a/packages/desktop/components/evm-transactions/transaction-views/index.ts b/packages/desktop/components/evm-transactions/transaction-views/index.ts new file mode 100644 index 0000000000..a36aba41c8 --- /dev/null +++ b/packages/desktop/components/evm-transactions/transaction-views/index.ts @@ -0,0 +1,5 @@ +export { default as EvmBaseCoinTransferView } from './EvmBaseCoinTransferView.svelte' +export { default as EvmNftTransferView } from './EvmNftTransferView.svelte' +export { default as EvmSmartContractView } from './EvmSmartContractView.svelte' +export { default as EvmTokenApprovalView } from './EvmTokenApprovalView.svelte' +export { default as EvmTokenTransferView } from './EvmTokenTransferView.svelte' diff --git a/packages/desktop/components/popup/popups/EvmTransactionFromDappPopup.svelte b/packages/desktop/components/popup/popups/EvmTransactionFromDappPopup.svelte index 639772f2c0..69166b766c 100644 --- a/packages/desktop/components/popup/popups/EvmTransactionFromDappPopup.svelte +++ b/packages/desktop/components/popup/popups/EvmTransactionFromDappPopup.svelte @@ -1,8 +1,7 @@ - - - {#if dapp} - - - {/if} - -
- {#if preparedTransaction.value} - - {/if} - {#if parsedData?.type === ParsedSmartContractType.CoinTransfer} - {@const baseCoinTransfer = { - token: getTokenFromSelectedAccountTokens(BASE_TOKEN_ID, evmNetwork.id), - rawAmount: parsedData.rawAmount, - }} - - {:else if parsedData?.type === ParsedSmartContractType.TokenTransfer} - {@const tokenTransfer = { - token: getTokenFromSelectedAccountTokens(parsedData.tokenId, evmNetwork.id), - rawAmount: parsedData.rawAmount, - }} - - {:else if parsedData?.type === ParsedSmartContractType.NftTransfer} - {@const nft = getNftByIdForAccount($selectedAccount?.index, parsedData.nftId)} - - {:else if parsedData?.type === ParsedSmartContractType.TokenApproval} -
- -
- {:else if parsedData?.type === ParsedSmartContractType.SmartContract} -
- -
- {/if} + } + + + +{#if (preparedTransaction.value && !parsedData) || parsedData?.type === ParsedSmartContractType.CoinTransfer} + {@const potentialAdditionalRawAmount = + parsedData?.type === ParsedSmartContractType.CoinTransfer ? parsedData?.rawAmount : BigInt(0)} + {@const recipientAddress = + parsedData?.type === ParsedSmartContractType.CoinTransfer + ? parsedData.recipientAddress + : String(preparedTransaction.to)} + {@const recipient = getSubjectFromAddress(recipientAddress, evmNetwork.id)} + + + + + +{:else if parsedData?.type === ParsedSmartContractType.TokenTransfer} + {@const recipient = getSubjectFromAddress(parsedData.recipientAddress, evmNetwork.id)} + + + + + +{:else if parsedData?.type === ParsedSmartContractType.NftTransfer} + {@const recipient = getSubjectFromAddress(parsedData.recipientAddress, evmNetwork.id)} + + + + + + +{:else if parsedData?.type === ParsedSmartContractType.TokenApproval} + + + + + +{:else if parsedData?.type === ParsedSmartContractType.SmartContract} + + -
-
+ +{/if} diff --git a/packages/desktop/views/dashboard/send-flow/views/components/EvmTransactionDetails.svelte b/packages/desktop/views/dashboard/send-flow/views/components/EvmTransactionDetails.svelte index 7bd5113d8a..b6567cfe3e 100644 --- a/packages/desktop/views/dashboard/send-flow/views/components/EvmTransactionDetails.svelte +++ b/packages/desktop/views/dashboard/send-flow/views/components/EvmTransactionDetails.svelte @@ -1,16 +1,18 @@ -{#if baseCoinTransfer || tokenTransfer || nft || aliasId} +{#if Number(baseCoinTransfer?.rawAmount) > 0 || tokenTransfer || nft || aliasId} {#if tokenTransfer?.token && tokenWithBalance}
diff --git a/packages/shared/src/locales/en.json b/packages/shared/src/locales/en.json index c546045489..c383397a0b 100644 --- a/packages/shared/src/locales/en.json +++ b/packages/shared/src/locales/en.json @@ -1113,10 +1113,12 @@ "hint": "{address} is requesting approval to spend {assetName}", "warning": "You don't own any of the approved tokens. Only approve tokens you trust.", "action": "Approve", + "approveMoreThanBalanceWarning": "This dapp is asking you to approve spending more tokens that you currently own.", + "accept": "I understand and wish to proceed", "success": "Successfully approved" }, "sendTransaction": { - "title": "Send transaction", + "title": "Send {asset} to {recipient}", "action": "Send", "success": "Sent {assetName} to {recipient}" },