diff --git a/src/app_service/service/shared_urls/dto/url_data.nim b/src/app_service/service/shared_urls/dto/url_data.nim index 72ad1dab21..1bc1e34183 100644 --- a/src/app_service/service/shared_urls/dto/url_data.nim +++ b/src/app_service/service/shared_urls/dto/url_data.nim @@ -137,10 +137,15 @@ proc `$`*(contactUrlDataDto: ContactUrlDataDto): string = jsonObj["publicKey"] = %* contactUrlDataDto.publicKey return $jsonObj +proc `%`*(transactionURLData: TransactionURLDataDto): JsonNode = + return %* [{ + "txType": transactionURLData.txType, + "asset": transactionURLData.asset, + "amount": transactionURLData.amount, + "address": transactionURLData.address, + "chainId": transactionURLData.chainId, + "toAsset": transactionURLData.toAsset, + }] + proc `$`*(transactionURLData: TransactionURLDataDto): string = - var jsonObj = newJObject() - jsonObj["txType"] = %* transactionURLData.txType - jsonObj["asset"] = %* transactionURLData.asset - jsonObj["amount"] = %* transactionURLData.amount - jsonObj["address"] = %* transactionURLData.address - return $jsonObj \ No newline at end of file + return $(%transactionURLData) \ No newline at end of file diff --git a/ui/app/AppLayouts/Wallet/popups/swap/SwapModal.qml b/ui/app/AppLayouts/Wallet/popups/swap/SwapModal.qml index 058d10de47..4a1a132597 100644 --- a/ui/app/AppLayouts/Wallet/popups/swap/SwapModal.qml +++ b/ui/app/AppLayouts/Wallet/popups/swap/SwapModal.qml @@ -151,7 +151,7 @@ StatusDialog { id: shareButton onClicked: { - const url = root.swapAdaptor.getShareTransactionUrl(Constants.SendType.Swap, + const url = root.swapAdaptor.swapStore.getShareTransactionUrl(Constants.SendType.Swap, root.swapInputParamsForm.fromTokensKey, root.swapInputParamsForm.fromTokenAmount, root.swapInputParamsForm.selectedAccountAddress, diff --git a/ui/app/mainui/AppMain.qml b/ui/app/mainui/AppMain.qml index 7ff267ee22..99f4375c6e 100644 --- a/ui/app/mainui/AppMain.qml +++ b/ui/app/mainui/AppMain.qml @@ -43,6 +43,7 @@ import AppLayouts.Chat.stores 1.0 as ChatStores import AppLayouts.Communities.stores 1.0 import AppLayouts.Wallet.stores 1.0 as WalletStores import AppLayouts.Wallet.popups 1.0 as WalletPopups +import AppLayouts.Wallet.popups.swap 1.0 as WalletSwapPopups import mainui.activitycenter.stores 1.0 import mainui.activitycenter.popups 1.0 @@ -386,7 +387,12 @@ Item { console.log("=========== onShowTransactionModal txType:", txType, "asset:", asset, "amount:", amount, "address:", address, "chainId:", chainId, "toAsset:", toAsset) if (txType === Constants.SendType.Swap) { - // TODO_ES implement + d.swapFormData.fromTokensKey = asset + d.swapFormData.toTokenKey = toAsset + d.swapFormData.fromTokenAmount = amount + d.swapFormData.selectedAccountAddress = address + d.swapFormData.selectedNetworkChainId = chainId + Global.openSwapModalRequested(d.swapFormData) return } @@ -400,16 +406,12 @@ Item { case Constants.SendType.ERC1155Transfer: sendModal.preSelectedHoldingType = Constants.TokenType.ERC1155 break - case Constants.SendType.Transfer: - sendModal.preSelectedHoldingType = Constants.TokenType.ERC20 - break - case Constants.SendType.ENSRegister: // TODO_ES test ens + case Constants.SendType.ENSRegister: case Constants.SendType.ENSSetPubKey: case Constants.SendType.ENSRelease: - sendModal.preSelectedHoldingType = Constants.TokenType.ENS - break + case Constants.SendType.Transfer: case Constants.SendType.StickersBuy: - // TOOD_ES handle + sendModal.preSelectedHoldingType = Constants.TokenType.ERC20 break default: break @@ -421,6 +423,10 @@ Item { QtObject { id: d + property WalletSwapPopups.SwapInputParamsForm swapFormData: WalletSwapPopups.SwapInputParamsForm { + selectedAccountAddress: WalletStores.RootStore.selectedAddress + } + property var activityCenterPopupObj: null function openActivityCenterPopup() {