diff --git a/Adamant.xcodeproj/project.pbxproj b/Adamant.xcodeproj/project.pbxproj index 8ca9dce71..0f21beb0c 100644 --- a/Adamant.xcodeproj/project.pbxproj +++ b/Adamant.xcodeproj/project.pbxproj @@ -12,6 +12,21 @@ 26A975FF2B7E843E0095C367 /* SelectTextView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26A975FE2B7E843E0095C367 /* SelectTextView.swift */; }; 26A976012B7E852E0095C367 /* ChatSelectTextViewFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 26A976002B7E852E0095C367 /* ChatSelectTextViewFactory.swift */; }; 3A20D93B2AE7F316005475A6 /* AdamantTransactionDetails.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A20D93A2AE7F316005475A6 /* AdamantTransactionDetails.swift */; }; + 3A26D9352C3C1BE2003AD832 /* KlyWalletService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A26D9342C3C1BE2003AD832 /* KlyWalletService.swift */; }; + 3A26D9372C3C1C01003AD832 /* KlyWallet.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A26D9362C3C1C01003AD832 /* KlyWallet.swift */; }; + 3A26D9392C3C1C62003AD832 /* KlyWalletFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A26D9382C3C1C62003AD832 /* KlyWalletFactory.swift */; }; + 3A26D93B2C3C1C97003AD832 /* KlyApiCore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A26D93A2C3C1C97003AD832 /* KlyApiCore.swift */; }; + 3A26D93D2C3C1CC3003AD832 /* KlyNodeApiService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A26D93C2C3C1CC3003AD832 /* KlyNodeApiService.swift */; }; + 3A26D93F2C3C1CED003AD832 /* KlyServiceApiService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A26D93E2C3C1CED003AD832 /* KlyServiceApiService.swift */; }; + 3A26D9412C3C2DC4003AD832 /* KlyWalletService+Send.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A26D9402C3C2DC4003AD832 /* KlyWalletService+Send.swift */; }; + 3A26D9432C3C2E19003AD832 /* KlyWalletService+StatusCheck.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A26D9422C3C2E19003AD832 /* KlyWalletService+StatusCheck.swift */; }; + 3A26D9452C3D336A003AD832 /* KlyWalletService+RichMessageProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A26D9442C3D336A003AD832 /* KlyWalletService+RichMessageProvider.swift */; }; + 3A26D9472C3D37B5003AD832 /* KlyWalletViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A26D9462C3D37B5003AD832 /* KlyWalletViewController.swift */; }; + 3A26D9492C3D3804003AD832 /* KlyTransferViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A26D9482C3D3804003AD832 /* KlyTransferViewController.swift */; }; + 3A26D94B2C3D3838003AD832 /* KlyTransactionsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A26D94A2C3D3838003AD832 /* KlyTransactionsViewController.swift */; }; + 3A26D94D2C3D387B003AD832 /* KlyTransactionDetailsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A26D94C2C3D387B003AD832 /* KlyTransactionDetailsViewController.swift */; }; + 3A26D9502C3D3A5A003AD832 /* KlyWalletService+WalletCore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A26D94F2C3D3A5A003AD832 /* KlyWalletService+WalletCore.swift */; }; + 3A26D9522C3E7F1E003AD832 /* klayr_notificationContent.png in Resources */ = {isa = PBXBuildFile; fileRef = 3A26D9512C3E7F1D003AD832 /* klayr_notificationContent.png */; }; 3A2F55F92AC6F308000A3F26 /* CoinTransaction+CoreDataClass.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A2F55F72AC6F308000A3F26 /* CoinTransaction+CoreDataClass.swift */; }; 3A2F55FA2AC6F308000A3F26 /* CoinTransaction+CoreDataProperties.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A2F55F82AC6F308000A3F26 /* CoinTransaction+CoreDataProperties.swift */; }; 3A2F55FC2AC6F885000A3F26 /* CoinStorage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A2F55FB2AC6F885000A3F26 /* CoinStorage.swift */; }; @@ -29,6 +44,7 @@ 3A9015A52A614A18002A2464 /* EmojiService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A9015A42A614A18002A2464 /* EmojiService.swift */; }; 3A9015A72A614A62002A2464 /* AdamantEmojiService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A9015A62A614A62002A2464 /* AdamantEmojiService.swift */; }; 3A9015A92A615893002A2464 /* ChatMessagesListViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A9015A82A615893002A2464 /* ChatMessagesListViewModel.swift */; }; + 3A9365A92C41332F0073D9A7 /* KLYWalletService+DynamicConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A9365A82C41332F0073D9A7 /* KLYWalletService+DynamicConstants.swift */; }; 3A96E37A2AED27D7001F5A52 /* AdamantPartnerQRService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A96E3792AED27D7001F5A52 /* AdamantPartnerQRService.swift */; }; 3A96E37C2AED27F8001F5A52 /* PartnerQRService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3A96E37B2AED27F8001F5A52 /* PartnerQRService.swift */; }; 3AA2D5F7280EADE3000ED971 /* SocketService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3AA2D5F6280EADE3000ED971 /* SocketService.swift */; }; @@ -81,7 +97,6 @@ 4186B3302941E642006594A3 /* AdmWalletService+DynamicConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4186B32F2941E642006594A3 /* AdmWalletService+DynamicConstants.swift */; }; 4186B332294200B4006594A3 /* BtcWalletService+DynamicConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4186B331294200B4006594A3 /* BtcWalletService+DynamicConstants.swift */; }; 4186B334294200C5006594A3 /* EthWalletService+DynamicConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4186B333294200C5006594A3 /* EthWalletService+DynamicConstants.swift */; }; - 4186B336294200D2006594A3 /* LskWalletService+DynamicConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4186B335294200D2006594A3 /* LskWalletService+DynamicConstants.swift */; }; 4186B338294200E8006594A3 /* DogeWalletService+DynamicConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4186B337294200E8006594A3 /* DogeWalletService+DynamicConstants.swift */; }; 4186B33A294200F4006594A3 /* DashWalletService+DynamicConstants.swift in Sources */ = {isa = PBXBuildFile; fileRef = 4186B339294200F4006594A3 /* DashWalletService+DynamicConstants.swift */; }; 418FDE502A25CA340055E3CD /* ChatMenuManager.swift in Sources */ = {isa = PBXBuildFile; fileRef = 418FDE4F2A25CA340055E3CD /* ChatMenuManager.swift */; }; @@ -126,11 +141,6 @@ 6403F5E622723FDA00D58779 /* DashWalletViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6403F5E522723FDA00D58779 /* DashWalletViewController.swift */; }; 6406D74A21C7F06000196713 /* SearchResultsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = 6406D74821C7F06000196713 /* SearchResultsViewController.xib */; }; 6414C18E217DF43100373FA6 /* String+adamant.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6414C18D217DF43100373FA6 /* String+adamant.swift */; }; - 6416B19D21AD7B92006089AC /* LskWalletFactory.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6416B19C21AD7B92006089AC /* LskWalletFactory.swift */; }; - 6416B19F21AD7CBE006089AC /* LskWalletViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6416B19E21AD7CBE006089AC /* LskWalletViewController.swift */; }; - 6416B1A121AD7D93006089AC /* LskTransferViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6416B1A021AD7D93006089AC /* LskTransferViewController.swift */; }; - 6416B1A321AD7EA1006089AC /* LskTransactionDetailsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6416B1A221AD7EA1006089AC /* LskTransactionDetailsViewController.swift */; }; - 6416B1A721B024B6006089AC /* LskWalletService+Send.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6416B1A621B024B6006089AC /* LskWalletService+Send.swift */; }; 644793C32166314A00FC4CF5 /* OnboardPage.swift in Sources */ = {isa = PBXBuildFile; fileRef = 644793C22166314A00FC4CF5 /* OnboardPage.swift */; }; 6448C291235CA6E100F3F15B /* ERC20WalletService+RichMessageProviderWithStatusCheck.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6449BA64235CA0930033B936 /* ERC20WalletService+RichMessageProviderWithStatusCheck.swift */; }; 6449BA68235CA0930033B936 /* ERC20WalletService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6449BA5E235CA0930033B936 /* ERC20WalletService.swift */; }; @@ -174,8 +184,6 @@ 648DD7A62237DC4000B811FD /* DogeTransferViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 648DD7A52237DC4000B811FD /* DogeTransferViewController.swift */; }; 648DD7A82239147800B811FD /* DogeWalletService+RichMessageProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 648DD7A72239147800B811FD /* DogeWalletService+RichMessageProvider.swift */; }; 648DD7AA2239150E00B811FD /* DogeWalletService+RichMessageProviderWithStatusCheck.swift in Sources */ = {isa = PBXBuildFile; fileRef = 648DD7A92239150E00B811FD /* DogeWalletService+RichMessageProviderWithStatusCheck.swift */; }; - 649D6BE821B95DB7009E727B /* LskWalletService+RichMessageProvider.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D6BE721B95DB7009E727B /* LskWalletService+RichMessageProvider.swift */; }; - 649D6BEA21B9627B009E727B /* LskWalletService+RichMessageProviderWithStatusCheck.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D6BE921B9627B009E727B /* LskWalletService+RichMessageProviderWithStatusCheck.swift */; }; 649D6BEC21BD5A53009E727B /* UISuffixTextField.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D6BEB21BD5A53009E727B /* UISuffixTextField.swift */; }; 649D6BF021BFF481009E727B /* AdamantChatsProvider+search.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D6BEF21BFF481009E727B /* AdamantChatsProvider+search.swift */; }; 649D6BF221C27D5C009E727B /* SearchResultsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 649D6BF121C27D5C009E727B /* SearchResultsViewController.swift */; }; @@ -191,7 +199,6 @@ 64E1C833222EA0F0006C4DA7 /* DogeWalletViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64E1C832222EA0F0006C4DA7 /* DogeWalletViewController.swift */; }; 64EAB37422463E020018D9B2 /* CurrencyInfoService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64EAB37322463E020018D9B2 /* CurrencyInfoService.swift */; }; 64EAB37622463F680018D9B2 /* AdamantCurrencyInfoService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64EAB37522463F680018D9B2 /* AdamantCurrencyInfoService.swift */; }; - 64EE46B220FE0C8D00194DDA /* LskTransactionsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64EE46B120FE0C8D00194DDA /* LskTransactionsViewController.swift */; }; 64F085D920E2D7600006DE68 /* AdmTransactionsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64F085D820E2D7600006DE68 /* AdmTransactionsViewController.swift */; }; 64FA53CD20E1300B006783C9 /* EthTransactionsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64FA53CC20E1300A006783C9 /* EthTransactionsViewController.swift */; }; 64FA53D120E24942006783C9 /* TransactionDetailsViewControllerBase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 64FA53D020E24941006783C9 /* TransactionDetailsViewControllerBase.swift */; }; @@ -311,8 +318,6 @@ 93CC8DC7296F00D6003772BF /* ChatTransactionContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93CC8DC6296F00D6003772BF /* ChatTransactionContainerView.swift */; }; 93CC8DC9296F01DE003772BF /* ChatTransactionContainerView+Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93CC8DC8296F01DE003772BF /* ChatTransactionContainerView+Model.swift */; }; 93CC94C12B17EE73004842AC /* EthApiCore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93CC94C02B17EE73004842AC /* EthApiCore.swift */; }; - 93CCAE752B06CC3600EA5B94 /* LskNodeApiService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93CCAE742B06CC3600EA5B94 /* LskNodeApiService.swift */; }; - 93CCAE772B06D6CC00EA5B94 /* LskServiceApiService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93CCAE762B06D6CC00EA5B94 /* LskServiceApiService.swift */; }; 93CCAE792B06D81D00EA5B94 /* DogeApiService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93CCAE782B06D81D00EA5B94 /* DogeApiService.swift */; }; 93CCAE7B2B06D9B500EA5B94 /* DogeBlocksDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93CCAE7A2B06D9B500EA5B94 /* DogeBlocksDTO.swift */; }; 93CCAE7E2B06DA6C00EA5B94 /* DogeBlockDTO.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93CCAE7D2B06DA6C00EA5B94 /* DogeBlockDTO.swift */; }; @@ -342,7 +347,6 @@ 93FA403629401BFC00D20DB6 /* PopupKit in Frameworks */ = {isa = PBXBuildFile; productRef = 93FA403529401BFC00D20DB6 /* PopupKit */; }; 93FC169B2B0197FD0062B507 /* BtcApiService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93FC169A2B0197FD0062B507 /* BtcApiService.swift */; }; 93FC169D2B019F440062B507 /* EthApiService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93FC169C2B019F440062B507 /* EthApiService.swift */; }; - 93FC169F2B01A3630062B507 /* LskApiCore.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93FC169E2B01A3630062B507 /* LskApiCore.swift */; }; 93FC16A12B01DE120062B507 /* ERC20ApiService.swift in Sources */ = {isa = PBXBuildFile; fileRef = 93FC16A02B01DE120062B507 /* ERC20ApiService.swift */; }; A50A41082822F8CE006BDFE1 /* BtcWalletService.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50A41042822F8CE006BDFE1 /* BtcWalletService.swift */; }; A50A41092822F8CE006BDFE1 /* BtcWalletViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A50A41052822F8CE006BDFE1 /* BtcWalletViewController.swift */; }; @@ -460,8 +464,6 @@ E94008722114EACF00CD2D67 /* WalletAccount.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94008712114EACF00CD2D67 /* WalletAccount.swift */; }; E940087B2114ED0600CD2D67 /* EthWalletService.swift in Sources */ = {isa = PBXBuildFile; fileRef = E940087A2114ED0600CD2D67 /* EthWalletService.swift */; }; E940087D2114EDEE00CD2D67 /* EthWallet.swift in Sources */ = {isa = PBXBuildFile; fileRef = E940087C2114EDEE00CD2D67 /* EthWallet.swift */; }; - E94008832114EE4700CD2D67 /* LskWallet.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94008822114EE4700CD2D67 /* LskWallet.swift */; }; - E94008852114EE7500CD2D67 /* LskWalletService.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94008842114EE7500CD2D67 /* LskWalletService.swift */; }; E94008872114F05B00CD2D67 /* AddressValidationResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = E94008862114F05B00CD2D67 /* AddressValidationResult.swift */; }; E940088B2114F63000CD2D67 /* NSRegularExpression+adamant.swift in Sources */ = {isa = PBXBuildFile; fileRef = E940088A2114F63000CD2D67 /* NSRegularExpression+adamant.swift */; }; E940088F2119A9E800CD2D67 /* BigInt+Decimal.swift in Sources */ = {isa = PBXBuildFile; fileRef = E940088E2119A9E800CD2D67 /* BigInt+Decimal.swift */; }; @@ -661,6 +663,21 @@ 33975C0D891698AA7E74EBCC /* Pods_Adamant.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_Adamant.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 36AB8CE9537B3B873972548B /* Pods_AdmCore.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Pods_AdmCore.framework; sourceTree = BUILT_PRODUCTS_DIR; }; 3A20D93A2AE7F316005475A6 /* AdamantTransactionDetails.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdamantTransactionDetails.swift; sourceTree = ""; }; + 3A26D9342C3C1BE2003AD832 /* KlyWalletService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KlyWalletService.swift; sourceTree = ""; }; + 3A26D9362C3C1C01003AD832 /* KlyWallet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KlyWallet.swift; sourceTree = ""; }; + 3A26D9382C3C1C62003AD832 /* KlyWalletFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KlyWalletFactory.swift; sourceTree = ""; }; + 3A26D93A2C3C1C97003AD832 /* KlyApiCore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KlyApiCore.swift; sourceTree = ""; }; + 3A26D93C2C3C1CC3003AD832 /* KlyNodeApiService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KlyNodeApiService.swift; sourceTree = ""; }; + 3A26D93E2C3C1CED003AD832 /* KlyServiceApiService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KlyServiceApiService.swift; sourceTree = ""; }; + 3A26D9402C3C2DC4003AD832 /* KlyWalletService+Send.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "KlyWalletService+Send.swift"; sourceTree = ""; }; + 3A26D9422C3C2E19003AD832 /* KlyWalletService+StatusCheck.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "KlyWalletService+StatusCheck.swift"; sourceTree = ""; }; + 3A26D9442C3D336A003AD832 /* KlyWalletService+RichMessageProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "KlyWalletService+RichMessageProvider.swift"; sourceTree = ""; }; + 3A26D9462C3D37B5003AD832 /* KlyWalletViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KlyWalletViewController.swift; sourceTree = ""; }; + 3A26D9482C3D3804003AD832 /* KlyTransferViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KlyTransferViewController.swift; sourceTree = ""; }; + 3A26D94A2C3D3838003AD832 /* KlyTransactionsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KlyTransactionsViewController.swift; sourceTree = ""; }; + 3A26D94C2C3D387B003AD832 /* KlyTransactionDetailsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KlyTransactionDetailsViewController.swift; sourceTree = ""; }; + 3A26D94F2C3D3A5A003AD832 /* KlyWalletService+WalletCore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "KlyWalletService+WalletCore.swift"; sourceTree = ""; }; + 3A26D9512C3E7F1D003AD832 /* klayr_notificationContent.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = klayr_notificationContent.png; sourceTree = ""; }; 3A2F55F72AC6F308000A3F26 /* CoinTransaction+CoreDataClass.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CoinTransaction+CoreDataClass.swift"; sourceTree = ""; }; 3A2F55F82AC6F308000A3F26 /* CoinTransaction+CoreDataProperties.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "CoinTransaction+CoreDataProperties.swift"; sourceTree = ""; }; 3A2F55FB2AC6F885000A3F26 /* CoinStorage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CoinStorage.swift; sourceTree = ""; }; @@ -677,6 +694,7 @@ 3A9015A42A614A18002A2464 /* EmojiService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EmojiService.swift; sourceTree = ""; }; 3A9015A62A614A62002A2464 /* AdamantEmojiService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdamantEmojiService.swift; sourceTree = ""; }; 3A9015A82A615893002A2464 /* ChatMessagesListViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatMessagesListViewModel.swift; sourceTree = ""; }; + 3A9365A82C41332F0073D9A7 /* KLYWalletService+DynamicConstants.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "KLYWalletService+DynamicConstants.swift"; sourceTree = ""; }; 3A96E3792AED27D7001F5A52 /* AdamantPartnerQRService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdamantPartnerQRService.swift; sourceTree = ""; }; 3A96E37B2AED27F8001F5A52 /* PartnerQRService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PartnerQRService.swift; sourceTree = ""; }; 3AA2D5F6280EADE3000ED971 /* SocketService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SocketService.swift; sourceTree = ""; }; @@ -726,7 +744,6 @@ 4186B32F2941E642006594A3 /* AdmWalletService+DynamicConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AdmWalletService+DynamicConstants.swift"; sourceTree = ""; }; 4186B331294200B4006594A3 /* BtcWalletService+DynamicConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BtcWalletService+DynamicConstants.swift"; sourceTree = ""; }; 4186B333294200C5006594A3 /* EthWalletService+DynamicConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "EthWalletService+DynamicConstants.swift"; sourceTree = ""; }; - 4186B335294200D2006594A3 /* LskWalletService+DynamicConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "LskWalletService+DynamicConstants.swift"; sourceTree = ""; }; 4186B337294200E8006594A3 /* DogeWalletService+DynamicConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DogeWalletService+DynamicConstants.swift"; sourceTree = ""; }; 4186B339294200F4006594A3 /* DashWalletService+DynamicConstants.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DashWalletService+DynamicConstants.swift"; sourceTree = ""; }; 418FDE4F2A25CA340055E3CD /* ChatMenuManager.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatMenuManager.swift; sourceTree = ""; }; @@ -768,11 +785,6 @@ 6403F5E522723FDA00D58779 /* DashWalletViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DashWalletViewController.swift; sourceTree = ""; }; 6406D74821C7F06000196713 /* SearchResultsViewController.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = SearchResultsViewController.xib; sourceTree = ""; }; 6414C18D217DF43100373FA6 /* String+adamant.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+adamant.swift"; sourceTree = ""; }; - 6416B19C21AD7B92006089AC /* LskWalletFactory.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LskWalletFactory.swift; sourceTree = ""; }; - 6416B19E21AD7CBE006089AC /* LskWalletViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LskWalletViewController.swift; sourceTree = ""; }; - 6416B1A021AD7D93006089AC /* LskTransferViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LskTransferViewController.swift; sourceTree = ""; }; - 6416B1A221AD7EA1006089AC /* LskTransactionDetailsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LskTransactionDetailsViewController.swift; sourceTree = ""; }; - 6416B1A621B024B6006089AC /* LskWalletService+Send.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "LskWalletService+Send.swift"; sourceTree = ""; }; 644793C22166314A00FC4CF5 /* OnboardPage.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OnboardPage.swift; sourceTree = ""; }; 6449BA5E235CA0930033B936 /* ERC20WalletService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ERC20WalletService.swift; sourceTree = ""; }; 6449BA5F235CA0930033B936 /* ERC20TransferViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ERC20TransferViewController.swift; sourceTree = ""; }; @@ -816,8 +828,6 @@ 648DD7A52237DC4000B811FD /* DogeTransferViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DogeTransferViewController.swift; sourceTree = ""; }; 648DD7A72239147800B811FD /* DogeWalletService+RichMessageProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DogeWalletService+RichMessageProvider.swift"; sourceTree = ""; }; 648DD7A92239150E00B811FD /* DogeWalletService+RichMessageProviderWithStatusCheck.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "DogeWalletService+RichMessageProviderWithStatusCheck.swift"; sourceTree = ""; }; - 649D6BE721B95DB7009E727B /* LskWalletService+RichMessageProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "LskWalletService+RichMessageProvider.swift"; sourceTree = ""; }; - 649D6BE921B9627B009E727B /* LskWalletService+RichMessageProviderWithStatusCheck.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "LskWalletService+RichMessageProviderWithStatusCheck.swift"; sourceTree = ""; }; 649D6BEB21BD5A53009E727B /* UISuffixTextField.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UISuffixTextField.swift; sourceTree = ""; }; 649D6BEF21BFF481009E727B /* AdamantChatsProvider+search.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AdamantChatsProvider+search.swift"; sourceTree = ""; }; 649D6BF121C27D5C009E727B /* SearchResultsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchResultsViewController.swift; sourceTree = ""; }; @@ -835,7 +845,6 @@ 64E1C832222EA0F0006C4DA7 /* DogeWalletViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DogeWalletViewController.swift; sourceTree = ""; }; 64EAB37322463E020018D9B2 /* CurrencyInfoService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CurrencyInfoService.swift; sourceTree = ""; }; 64EAB37522463F680018D9B2 /* AdamantCurrencyInfoService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdamantCurrencyInfoService.swift; sourceTree = ""; }; - 64EE46B120FE0C8D00194DDA /* LskTransactionsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LskTransactionsViewController.swift; sourceTree = ""; }; 64F085D820E2D7600006DE68 /* AdmTransactionsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AdmTransactionsViewController.swift; sourceTree = ""; }; 64FA53CC20E1300A006783C9 /* EthTransactionsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EthTransactionsViewController.swift; sourceTree = ""; }; 64FA53D020E24941006783C9 /* TransactionDetailsViewControllerBase.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TransactionDetailsViewControllerBase.swift; sourceTree = ""; }; @@ -951,8 +960,6 @@ 93CC8DC6296F00D6003772BF /* ChatTransactionContainerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ChatTransactionContainerView.swift; sourceTree = ""; }; 93CC8DC8296F01DE003772BF /* ChatTransactionContainerView+Model.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "ChatTransactionContainerView+Model.swift"; sourceTree = ""; }; 93CC94C02B17EE73004842AC /* EthApiCore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EthApiCore.swift; sourceTree = ""; }; - 93CCAE742B06CC3600EA5B94 /* LskNodeApiService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LskNodeApiService.swift; sourceTree = ""; }; - 93CCAE762B06D6CC00EA5B94 /* LskServiceApiService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LskServiceApiService.swift; sourceTree = ""; }; 93CCAE782B06D81D00EA5B94 /* DogeApiService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DogeApiService.swift; sourceTree = ""; }; 93CCAE7A2B06D9B500EA5B94 /* DogeBlocksDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DogeBlocksDTO.swift; sourceTree = ""; }; 93CCAE7D2B06DA6C00EA5B94 /* DogeBlockDTO.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DogeBlockDTO.swift; sourceTree = ""; }; @@ -976,7 +983,6 @@ 93F3914F2962F5D400BFD6AE /* SpinnerView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SpinnerView.swift; sourceTree = ""; }; 93FC169A2B0197FD0062B507 /* BtcApiService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = BtcApiService.swift; sourceTree = ""; }; 93FC169C2B019F440062B507 /* EthApiService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EthApiService.swift; sourceTree = ""; }; - 93FC169E2B01A3630062B507 /* LskApiCore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LskApiCore.swift; sourceTree = ""; }; 93FC16A02B01DE120062B507 /* ERC20ApiService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ERC20ApiService.swift; sourceTree = ""; }; A50A41042822F8CE006BDFE1 /* BtcWalletService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BtcWalletService.swift; sourceTree = ""; }; A50A41052822F8CE006BDFE1 /* BtcWalletViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = BtcWalletViewController.swift; sourceTree = ""; }; @@ -1072,8 +1078,6 @@ E94008712114EACF00CD2D67 /* WalletAccount.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = WalletAccount.swift; sourceTree = ""; }; E940087A2114ED0600CD2D67 /* EthWalletService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EthWalletService.swift; sourceTree = ""; }; E940087C2114EDEE00CD2D67 /* EthWallet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EthWallet.swift; sourceTree = ""; }; - E94008822114EE4700CD2D67 /* LskWallet.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LskWallet.swift; sourceTree = ""; }; - E94008842114EE7500CD2D67 /* LskWalletService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LskWalletService.swift; sourceTree = ""; }; E94008862114F05B00CD2D67 /* AddressValidationResult.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddressValidationResult.swift; sourceTree = ""; }; E940088A2114F63000CD2D67 /* NSRegularExpression+adamant.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "NSRegularExpression+adamant.swift"; sourceTree = ""; }; E940088E2119A9E800CD2D67 /* BigInt+Decimal.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "BigInt+Decimal.swift"; sourceTree = ""; }; @@ -1319,6 +1323,36 @@ path = Models; sourceTree = ""; }; + 3A26D9312C3C1B55003AD832 /* Klayr */ = { + isa = PBXGroup; + children = ( + 3A26D94E2C3D3983003AD832 /* WalletService */, + 3A26D9362C3C1C01003AD832 /* KlyWallet.swift */, + 3A26D9382C3C1C62003AD832 /* KlyWalletFactory.swift */, + 3A9365A82C41332F0073D9A7 /* KLYWalletService+DynamicConstants.swift */, + 3A26D93A2C3C1C97003AD832 /* KlyApiCore.swift */, + 3A26D93C2C3C1CC3003AD832 /* KlyNodeApiService.swift */, + 3A26D93E2C3C1CED003AD832 /* KlyServiceApiService.swift */, + 3A26D9462C3D37B5003AD832 /* KlyWalletViewController.swift */, + 3A26D9482C3D3804003AD832 /* KlyTransferViewController.swift */, + 3A26D94A2C3D3838003AD832 /* KlyTransactionsViewController.swift */, + 3A26D94C2C3D387B003AD832 /* KlyTransactionDetailsViewController.swift */, + ); + path = Klayr; + sourceTree = ""; + }; + 3A26D94E2C3D3983003AD832 /* WalletService */ = { + isa = PBXGroup; + children = ( + 3A26D9342C3C1BE2003AD832 /* KlyWalletService.swift */, + 3A26D94F2C3D3A5A003AD832 /* KlyWalletService+WalletCore.swift */, + 3A26D9402C3C2DC4003AD832 /* KlyWalletService+Send.swift */, + 3A26D9422C3C2E19003AD832 /* KlyWalletService+StatusCheck.swift */, + 3A26D9442C3D336A003AD832 /* KlyWalletService+RichMessageProvider.swift */, + ); + path = WalletService; + sourceTree = ""; + }; 3A41938D2A580C3B006A6B22 /* RichTransactionReactService */ = { isa = PBXGroup; children = ( @@ -2195,7 +2229,7 @@ A50A41022822F8CE006BDFE1 /* Bitcoin */, E94008902119D22400CD2D67 /* Adamant */, E94008792114ECF100CD2D67 /* Ethereum */, - E94008812114EE3900CD2D67 /* Lisk */, + 3A26D9312C3C1B55003AD832 /* Klayr */, 64E1C82B222E958C006C4DA7 /* Doge */, 6403F5DC22723C2800D58779 /* Dash */, 6449BA5D235CA0930033B936 /* ERC20 */, @@ -2236,27 +2270,6 @@ path = Ethereum; sourceTree = ""; }; - E94008812114EE3900CD2D67 /* Lisk */ = { - isa = PBXGroup; - children = ( - E94008822114EE4700CD2D67 /* LskWallet.swift */, - 6416B19C21AD7B92006089AC /* LskWalletFactory.swift */, - E94008842114EE7500CD2D67 /* LskWalletService.swift */, - 93FC169E2B01A3630062B507 /* LskApiCore.swift */, - 93CCAE742B06CC3600EA5B94 /* LskNodeApiService.swift */, - 93CCAE762B06D6CC00EA5B94 /* LskServiceApiService.swift */, - 4186B335294200D2006594A3 /* LskWalletService+DynamicConstants.swift */, - 6416B1A621B024B6006089AC /* LskWalletService+Send.swift */, - 649D6BE721B95DB7009E727B /* LskWalletService+RichMessageProvider.swift */, - 649D6BE921B9627B009E727B /* LskWalletService+RichMessageProviderWithStatusCheck.swift */, - 6416B19E21AD7CBE006089AC /* LskWalletViewController.swift */, - 6416B1A021AD7D93006089AC /* LskTransferViewController.swift */, - 64EE46B120FE0C8D00194DDA /* LskTransactionsViewController.swift */, - 6416B1A221AD7EA1006089AC /* LskTransactionDetailsViewController.swift */, - ); - path = Lisk; - sourceTree = ""; - }; E94008902119D22400CD2D67 /* Adamant */ = { isa = PBXGroup; children = ( @@ -2298,6 +2311,7 @@ E957E105229AF7CA0019732A /* lisk_notificationContent.png */, 412C0ED829124A3400DE2C5E /* dash_notificationContent.png */, 4154413A2923AED000824478 /* bitcoin_notificationContent.png */, + 3A26D9512C3E7F1D003AD832 /* klayr_notificationContent.png */, ); path = WalletImages; sourceTree = ""; @@ -2872,6 +2886,7 @@ 93E123452A6DFECB004DF33B /* Localizable.stringsdict in Resources */, E957E109229AF7CB0019732A /* lisk_notificationContent.png in Resources */, 412C0ED929124A3400DE2C5E /* dash_notificationContent.png in Resources */, + 3A26D9522C3E7F1E003AD832 /* klayr_notificationContent.png in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3006,8 +3021,10 @@ E9960B3621F5154300C840A8 /* DummyAccount+CoreDataProperties.swift in Sources */, 4186B332294200B4006594A3 /* BtcWalletService+DynamicConstants.swift in Sources */, 3AFE7E432B19E4D900718739 /* WalletServiceCompose.swift in Sources */, + 3A26D93D2C3C1CC3003AD832 /* KlyNodeApiService.swift in Sources */, 93A118512993167500E144CC /* ChatMessageBackgroundColor.swift in Sources */, E9CAE8D22018AA7700345E76 /* AdamantApi+Accounts.swift in Sources */, + 3A26D93B2C3C1C97003AD832 /* KlyApiCore.swift in Sources */, 936658A32B0ADE4400BDB2D3 /* CoinsNodesListView+Row.swift in Sources */, 648CE3A6229AD1CD0070A2CC /* DashWalletService+Send.swift in Sources */, E987024920C2B1F700E393F4 /* AdamantChatsProvider+fakeMessages.swift in Sources */, @@ -3062,6 +3079,7 @@ 557AC308287B1365004699D7 /* CheckmarkRowView.swift in Sources */, 9390C5052976B53000270CDF /* ChatDialog.swift in Sources */, 6455E9F321075D8000B2E94C /* AdamantAddressBookService.swift in Sources */, + 3A26D9472C3D37B5003AD832 /* KlyWalletViewController.swift in Sources */, 9324C75E297170600022D7EA /* TransactionStatusService.swift in Sources */, 9304F8BE292F88F900173F18 /* ANSPayload.swift in Sources */, 41CA598C29A0D84F002BFDE4 /* TaskManager.swift in Sources */, @@ -3112,7 +3130,6 @@ 4184F1752A33106200D7B8B9 /* CrashlysticsService.swift in Sources */, 4197B9C92952FAFF004CAF64 /* VisibleWalletsCheckmarkView.swift in Sources */, E9E7CD932002740500DFC4DB /* AdamantAccountService.swift in Sources */, - 6416B19F21AD7CBE006089AC /* LskWalletViewController.swift in Sources */, 41330F7629F1509400CB587C /* AdamantCellAnimation.swift in Sources */, 64FA53CD20E1300B006783C9 /* EthTransactionsViewController.swift in Sources */, 6449BA6A235CA0930033B936 /* ERC20Wallet.swift in Sources */, @@ -3132,6 +3149,7 @@ E983AE2120E655C500497E1A /* AccountHeaderView.swift in Sources */, E971591C2168209800A5F904 /* EthWalletService+RichMessageProviderWithStatusCheck.swift in Sources */, 644EC35220EFA9A300F40C73 /* DelegatesFactory.swift in Sources */, + 3A26D9492C3D3804003AD832 /* KlyTransferViewController.swift in Sources */, E96BBE3121F70F5E009AA738 /* ReadonlyTextView.swift in Sources */, A50A41112822FC35006BDFE1 /* BtcWalletService+RichMessageProviderWithStatusCheck.swift in Sources */, E926E032213EC43B005E536B /* FullscreenAlertView.swift in Sources */, @@ -3165,11 +3183,13 @@ 938F7D692955C9EC001915CA /* ChatViewModel.swift in Sources */, E90A494D204DA932009F6A65 /* LocalAuthentication.swift in Sources */, E96D64C62295C3ED00CA5587 /* Mnemonic+extended.swift in Sources */, + 3A26D9352C3C1BE2003AD832 /* KlyWalletService.swift in Sources */, 41047B70294B5EE10039E956 /* VisibleWalletsViewController.swift in Sources */, 93B28EC82B076E68007F268B /* DashResponseDTO.swift in Sources */, A5BBD811262C657300B5C40C /* ByteBackpacker.swift in Sources */, 648BCA6D213D384F00875EB5 /* AvatarService.swift in Sources */, E95F856F2007B61D0070534A /* GetPublicKeyResponse.swift in Sources */, + 3A26D94B2C3D3838003AD832 /* KlyTransactionsViewController.swift in Sources */, 936658992B0AD32600BDB2D3 /* CoinsNodesListViewModel+ApiServices.swift in Sources */, 644EC34D20EFA60900F40C73 /* AdamantApi+Delegates.swift in Sources */, E940088F2119A9E800CD2D67 /* BigInt+Decimal.swift in Sources */, @@ -3178,7 +3198,6 @@ 9338AE862AEF6A97001D32DF /* APICore.swift in Sources */, 938F7D5D2955C8F9001915CA /* ChatLayoutManager.swift in Sources */, 6403F5DE22723C6800D58779 /* DashMainnet.swift in Sources */, - 649D6BEA21B9627B009E727B /* LskWalletService+RichMessageProviderWithStatusCheck.swift in Sources */, E940088B2114F63000CD2D67 /* NSRegularExpression+adamant.swift in Sources */, 932B34E92974AA4A002A75BA /* ChatPreservationProtocol.swift in Sources */, 3AA388032B67F47600125684 /* RPCResponseModel.swift in Sources */, @@ -3199,6 +3218,7 @@ 93E5D4DB293000BE00439298 /* UnregisteredTransaction.swift in Sources */, 411DB8332A14D01F006AB158 /* ChatKeyboardManager.swift in Sources */, 6449BA68235CA0930033B936 /* ERC20WalletService.swift in Sources */, + 3A9365A92C41332F0073D9A7 /* KLYWalletService+DynamicConstants.swift in Sources */, 93B28ECA2B076E88007F268B /* DashErrorDTO.swift in Sources */, 644793C32166314A00FC4CF5 /* OnboardPage.swift in Sources */, 9345769528FD0C34004E6C7A /* UIViewController+email.swift in Sources */, @@ -3213,7 +3233,6 @@ 93775E462A674FA9009061AC /* Markdown+Adamant.swift in Sources */, 3AA3880E2B6A356900125684 /* RpcRequestModel.swift in Sources */, 93E8EDCD2AF1BD65003E163C /* AdamantApiCore.swift in Sources */, - 6416B1A721B024B6006089AC /* LskWalletService+Send.swift in Sources */, E9942B87203D9E5100C163AF /* EurekaQRRow.swift in Sources */, 3AA50DF32AEBE67C00C58FC8 /* PartnerQRFactory.swift in Sources */, E9AA8C02212C5BF500F9249F /* AdmWalletService+Send.swift in Sources */, @@ -3240,6 +3259,7 @@ E913C8F21FFFA51D001A83F7 /* AppDelegate.swift in Sources */, 648CE3A222999CE70070A2CC /* BTCRawTransaction.swift in Sources */, 648DD79E2236A0B500B811FD /* DogeTransactionsViewController.swift in Sources */, + 3A26D9392C3C1C62003AD832 /* KlyWalletFactory.swift in Sources */, 64B5736F2209B892005DC968 /* BtcTransactionDetailsViewController.swift in Sources */, 938F7D612955C92B001915CA /* ChatDataSourceManager.swift in Sources */, E96D64C82295C44400CA5587 /* Data+utilites.swift in Sources */, @@ -3255,6 +3275,7 @@ 649D6BF021BFF481009E727B /* AdamantChatsProvider+search.swift in Sources */, E908473B219707200095825D /* AccountViewController+StayIn.swift in Sources */, 93C7944C2B077B2700408826 /* DashGetAddressTransactionIds.swift in Sources */, + 3A26D9502C3D3A5A003AD832 /* KlyWalletService+WalletCore.swift in Sources */, E9204B5220C9762400F3B9AB /* MessageStatus.swift in Sources */, 3A770E4C2AE14F130008D98F /* SimpleTransactionDetails+Hashable.swift in Sources */, E908471B2196FE590095825D /* Adamant.xcdatamodeld in Sources */, @@ -3271,7 +3292,6 @@ 9338AE8F2AEF8131001D32DF /* InternalAPIError.swift in Sources */, 41A1994829D325800031AD75 /* SwipeableView.swift in Sources */, 5558A438282AB9390024DDD6 /* NodeStatus.swift in Sources */, - 93FC169F2B01A3630062B507 /* LskApiCore.swift in Sources */, E91947AC20001A9A001362F8 /* ApiService.swift in Sources */, 4164A9D928F17DA700EEF16D /* AdamantChatTransactionService.swift in Sources */, E993302221354BC300CD5200 /* EthWalletFactory.swift in Sources */, @@ -3289,13 +3309,13 @@ E99330262136B0E500CD5200 /* TransferViewControllerBase+QR.swift in Sources */, 93ADC17F2B083D7A00F2DF77 /* NodesAdditionalParamsStorage.swift in Sources */, E9B1AA5B21283E0F00080A2A /* AdmTransferViewController.swift in Sources */, + 3A26D94D2C3D387B003AD832 /* KlyTransactionDetailsViewController.swift in Sources */, 648C697322916192006645F5 /* DashTransactionsViewController.swift in Sources */, 93E8EDCF2AF1CD9F003E163C /* NodeStatusInfo.swift in Sources */, 55E69E172868D7920025D82E /* CheckmarkView.swift in Sources */, 93B28EC02B076667007F268B /* APIResponseModel.swift in Sources */, 9304F8C2292F895C00173F18 /* PushNotificationsTokenService.swift in Sources */, E940086B2114A70600CD2D67 /* LskAccount.swift in Sources */, - 6416B19D21AD7B92006089AC /* LskWalletFactory.swift in Sources */, E9B3D3A1201FA26B0019EB36 /* AdamantAccountsProvider.swift in Sources */, E9FAE5DA203DBFEF008D3A6B /* Comparable+clamped.swift in Sources */, 93A91FD329799298001DB1F8 /* ChatStartPosition.swift in Sources */, @@ -3313,7 +3333,6 @@ E9240BF5215D686500187B09 /* AdmWalletService+RichMessageProvider.swift in Sources */, 648C697122915CB8006645F5 /* BTCRPCServerResponce.swift in Sources */, E9A174B32057EC47003667CD /* BackgroundFetchService.swift in Sources */, - 649D6BE821B95DB7009E727B /* LskWalletService+RichMessageProvider.swift in Sources */, E9E7CDBE2003AEFB00DFC4DB /* CellFactory.swift in Sources */, 9366589D2B0ADBAF00BDB2D3 /* CoinsNodesListView.swift in Sources */, 411743022A39B208008CD98A /* ContributeState.swift in Sources */, @@ -3325,23 +3344,20 @@ E9CAE8D62018AC5300345E76 /* AdamantApi+Transactions.swift in Sources */, E93D7ABE2052CEE1005D19DC /* NotificationsService.swift in Sources */, E940087D2114EDEE00CD2D67 /* EthWallet.swift in Sources */, - 6416B1A121AD7D93006089AC /* LskTransferViewController.swift in Sources */, A5E0422B282AB18B0076CD13 /* BtcUnspentTransactionResponse.swift in Sources */, E972206B201F44CA004F2AAD /* TransfersProvider.swift in Sources */, 3A20D93B2AE7F316005475A6 /* AdamantTransactionDetails.swift in Sources */, 93294B962AAD320B00911109 /* ScreensFactory.swift in Sources */, - 93CCAE772B06D6CC00EA5B94 /* LskServiceApiService.swift in Sources */, 3A9015A72A614A62002A2464 /* AdamantEmojiService.swift in Sources */, 93ADE0722ACA66AF008ED641 /* VibrationSelectionView.swift in Sources */, 648C696F22915A12006645F5 /* DashTransaction.swift in Sources */, 3AF53F8F2B3EE0DA00B30312 /* DogeNodeInfo.swift in Sources */, 3A41939A2A5D554A006A6B22 /* Reaction.swift in Sources */, - 93CCAE752B06CC3600EA5B94 /* LskNodeApiService.swift in Sources */, - 6416B1A321AD7EA1006089AC /* LskTransactionDetailsViewController.swift in Sources */, 6449BA6F235CA0930033B936 /* ERC20WalletService+Send.swift in Sources */, A50A41132822FC35006BDFE1 /* BtcWalletService+Send.swift in Sources */, A5E04229282A998C0076CD13 /* BtcTransactionResponse.swift in Sources */, 4186B334294200C5006594A3 /* EthWalletService+DynamicConstants.swift in Sources */, + 3A26D93F2C3C1CED003AD832 /* KlyServiceApiService.swift in Sources */, 93CCAE802B06E2D100EA5B94 /* ApiServiceError+Extension.swift in Sources */, 644EC34F20EFA77A00F40C73 /* Delegate.swift in Sources */, 64EAB37622463F680018D9B2 /* AdamantCurrencyInfoService.swift in Sources */, @@ -3371,6 +3387,7 @@ E993302021354B1800CD5200 /* AdmWalletFactory.swift in Sources */, E9332B8921F1FA4400D56E72 /* OnboardFactory.swift in Sources */, 938F7D722955CE72001915CA /* ChatFactory.swift in Sources */, + 3A26D9372C3C1C01003AD832 /* KlyWallet.swift in Sources */, 93CCAE792B06D81D00EA5B94 /* DogeApiService.swift in Sources */, 938F7D5F2955C90D001915CA /* ChatInputBarManager.swift in Sources */, E908472D2196FEA80095825D /* CoreDataAccount+CoreDataProperties.swift in Sources */, @@ -3381,8 +3398,8 @@ 64BD2B7720E2820300E2CD36 /* TransactionDetails.swift in Sources */, 3A9015A52A614A18002A2464 /* EmojiService.swift in Sources */, 9322E875297042F000B8357C /* ChatSender.swift in Sources */, - E94008852114EE7500CD2D67 /* LskWalletService.swift in Sources */, E96E86B821679C120061F80A /* EthTransactionDetailsViewController.swift in Sources */, + 3A26D9432C3C2E19003AD832 /* KlyWalletService+StatusCheck.swift in Sources */, 265AA1622B74E6B900CF98B0 /* ChatPreservation.swift in Sources */, 4164A9D728F17D4000EEF16D /* ChatTransactionService.swift in Sources */, E90A4943204C5ED6009F6A65 /* EurekaPassphraseRow.swift in Sources */, @@ -3400,9 +3417,9 @@ 9338AE8D2AEF7E9C001D32DF /* BodyStringEncoding.swift in Sources */, 64C65F4523893C7600DC0425 /* OnboardOverlay.swift in Sources */, 93A18C862AAEACC100D0AB98 /* AdamantWalletFactoryCompose.swift in Sources */, + 3A26D9452C3D336A003AD832 /* KlyWalletService+RichMessageProvider.swift in Sources */, E9484B79227C617E008E10F0 /* BalanceTableViewCell.swift in Sources */, E90847352196FEA80095825D /* MessageTransaction+CoreDataProperties.swift in Sources */, - 4186B336294200D2006594A3 /* LskWalletService+DynamicConstants.swift in Sources */, E9771DA722997F310099AAC7 /* ServerResponseWithTimestamp.swift in Sources */, E9A03FD420DBC824007653A1 /* NodeVersion.swift in Sources */, 648CE3AA229AD1F90070A2CC /* DashWalletService+RichMessageProviderWithStatusCheck.swift in Sources */, @@ -3410,8 +3427,6 @@ 41A1994629D2FCF80031AD75 /* ReplyView.swift in Sources */, E90847342196FEA80095825D /* MessageTransaction+CoreDataClass.swift in Sources */, E9960B3521F5154300C840A8 /* DummyAccount+CoreDataClass.swift in Sources */, - 64EE46B220FE0C8D00194DDA /* LskTransactionsViewController.swift in Sources */, - E94008832114EE4700CD2D67 /* LskWallet.swift in Sources */, 64E1C833222EA0F0006C4DA7 /* DogeWalletViewController.swift in Sources */, E93EB09F20DA3FA4001F9601 /* NodesEditorFactory.swift in Sources */, 93294B8F2AAD2C6B00911109 /* SwiftyOnboard.swift in Sources */, @@ -3433,6 +3448,7 @@ A50A41122822FC35006BDFE1 /* BtcWalletService+RichMessageProvider.swift in Sources */, 3AFE7E412B18D88B00718739 /* WalletService.swift in Sources */, 3A2F55FE2AC6F90E000A3F26 /* AdamantCoinStorageService.swift in Sources */, + 3A26D9412C3C2DC4003AD832 /* KlyWalletService+Send.swift in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; @@ -3758,7 +3774,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 3.6.1; + MARKETING_VERSION = 3.7.0; PRODUCT_BUNDLE_IDENTIFIER = "im.adamant.adamant-messenger-dev"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; @@ -3789,7 +3805,7 @@ "$(inherited)", "@executable_path/Frameworks", ); - MARKETING_VERSION = 3.6.1; + MARKETING_VERSION = 3.7.0; PRODUCT_BUNDLE_IDENTIFIER = "im.adamant.adamant-messenger"; PRODUCT_NAME = "$(TARGET_NAME)"; PROVISIONING_PROFILE_SPECIFIER = ""; diff --git a/Adamant/App/DI/AppAssembly.swift b/Adamant/App/DI/AppAssembly.swift index bbc291bef..b116c8375 100644 --- a/Adamant/App/DI/AppAssembly.swift +++ b/Adamant/App/DI/AppAssembly.swift @@ -151,22 +151,22 @@ struct AppAssembly: Assembly { }.inObjectScope(.container) // MARK: LskNodeApiService - container.register(LskNodeApiService.self) { r in - LskNodeApiService(api: .init( + container.register(KlyNodeApiService.self) { r in + KlyNodeApiService(api: .init( service: .init(), nodesStorage: r.resolve(NodesStorageProtocol.self)!, nodesAdditionalParamsStorage: r.resolve(NodesAdditionalParamsStorageProtocol.self)!, - nodeGroup: .lskNode + nodeGroup: .klyNode )) }.inObjectScope(.container) - // MARK: LskServiceApiService - container.register(LskServiceApiService.self) { r in - LskServiceApiService(api: .init( + // MARK: KlyServiceApiService + container.register(KlyServiceApiService.self) { r in + KlyServiceApiService(api: .init( service: .init(), nodesStorage: r.resolve(NodesStorageProtocol.self)!, nodesAdditionalParamsStorage: r.resolve(NodesAdditionalParamsStorageProtocol.self)!, - nodeGroup: .lskService + nodeGroup: .klyService )) }.inObjectScope(.container) @@ -231,7 +231,7 @@ struct AppAssembly: Assembly { }.inObjectScope(.container) // MARK: LanguageStorageProtocol - container.register(LanguageStorageProtocol.self) { r in + container.register(LanguageStorageProtocol.self) { _ in LanguageStorageService() }.inObjectScope(.container) @@ -333,7 +333,7 @@ struct AppAssembly: Assembly { AdmWalletService(), BtcWalletService(), EthWalletService(), - LskWalletService(), + KlyWalletService(), DogeWalletService(), DashWalletService() ] diff --git a/Adamant/Helpers/NodeGroup+Constants.swift b/Adamant/Helpers/NodeGroup+Constants.swift index 98ccdc67e..bcac6516b 100644 --- a/Adamant/Helpers/NodeGroup+Constants.swift +++ b/Adamant/Helpers/NodeGroup+Constants.swift @@ -17,10 +17,10 @@ public extension NodeGroup { return BtcWalletService.healthCheckParameters.onScreenUpdateInterval case .eth: return EthWalletService.healthCheckParameters.onScreenUpdateInterval - case .lskNode: - return LskWalletService.healthCheckParameters.onScreenUpdateInterval - case .lskService: - return LskWalletService.healthCheckParameters.onScreenServiceUpdateInterval + case .klyNode: + return KlyWalletService.healthCheckParameters.onScreenUpdateInterval + case .klyService: + return KlyWalletService.healthCheckParameters.onScreenServiceUpdateInterval case .doge: return DogeWalletService.healthCheckParameters.onScreenUpdateInterval case .dash: @@ -36,10 +36,10 @@ public extension NodeGroup { return BtcWalletService.healthCheckParameters.crucialUpdateInterval case .eth: return EthWalletService.healthCheckParameters.crucialUpdateInterval - case .lskNode: - return LskWalletService.healthCheckParameters.crucialUpdateInterval - case .lskService: - return LskWalletService.healthCheckParameters.crucialServiceUpdateInterval + case .klyNode: + return KlyWalletService.healthCheckParameters.crucialUpdateInterval + case .klyService: + return KlyWalletService.healthCheckParameters.crucialServiceUpdateInterval case .doge: return DogeWalletService.healthCheckParameters.crucialUpdateInterval case .dash: @@ -55,10 +55,10 @@ public extension NodeGroup { return BtcWalletService.healthCheckParameters.threshold case .eth: return EthWalletService.healthCheckParameters.threshold - case .lskNode: - return LskWalletService.healthCheckParameters.threshold - case .lskService: - return LskWalletService.healthCheckParameters.threshold + case .klyNode: + return KlyWalletService.healthCheckParameters.threshold + case .klyService: + return KlyWalletService.healthCheckParameters.threshold case .doge: return DogeWalletService.healthCheckParameters.threshold case .dash: @@ -74,10 +74,10 @@ public extension NodeGroup { return BtcWalletService.healthCheckParameters.normalUpdateInterval case .eth: return EthWalletService.healthCheckParameters.normalUpdateInterval - case .lskNode: - return LskWalletService.healthCheckParameters.normalUpdateInterval - case .lskService: - return LskWalletService.healthCheckParameters.normalServiceUpdateInterval + case .klyNode: + return KlyWalletService.healthCheckParameters.normalUpdateInterval + case .klyService: + return KlyWalletService.healthCheckParameters.normalServiceUpdateInterval case .doge: return DogeWalletService.healthCheckParameters.normalUpdateInterval case .dash: @@ -94,10 +94,10 @@ public extension NodeGroup { minNodeVersion = BtcWalletService.minNodeVersion case .eth: minNodeVersion = EthWalletService.minNodeVersion - case .lskNode: - minNodeVersion = LskWalletService.minNodeVersion - case .lskService: - minNodeVersion = LskWalletService.minNodeVersion + case .klyNode: + minNodeVersion = KlyWalletService.minNodeVersion + case .klyService: + minNodeVersion = KlyWalletService.minNodeVersion case .doge: minNodeVersion = DogeWalletService.minNodeVersion case .dash: diff --git a/Adamant/Models/NodeWithGroup.swift b/Adamant/Models/NodeWithGroup.swift index 13f3be003..7574cb556 100644 --- a/Adamant/Models/NodeWithGroup.swift +++ b/Adamant/Models/NodeWithGroup.swift @@ -20,10 +20,10 @@ extension NodeGroup { return BtcWalletService.tokenNetworkSymbol case .eth: return EthWalletService.tokenNetworkSymbol - case .lskNode: - return LskWalletService.tokenNetworkSymbol - case .lskService: - return LskWalletService.tokenNetworkSymbol + case .klyNode: + return KlyWalletService.tokenNetworkSymbol + case .klyService: + return KlyWalletService.tokenNetworkSymbol + " " + .adamant.coinsNodesList.serviceNode case .doge: return DogeWalletService.tokenNetworkSymbol @@ -36,7 +36,7 @@ extension NodeGroup { var includeVersionTitle: Bool { switch self { - case .btc, .lskNode, .lskService, .doge, .adm: + case .btc, .klyNode, .klyService, .doge, .adm: return true case .eth, .dash: return false diff --git a/Adamant/Modules/Chat/ViewModel/ChatMessageFactory.swift b/Adamant/Modules/Chat/ViewModel/ChatMessageFactory.swift index cbf4c0cc0..22832f057 100644 --- a/Adamant/Modules/Chat/ViewModel/ChatMessageFactory.swift +++ b/Adamant/Modules/Chat/ViewModel/ChatMessageFactory.swift @@ -254,6 +254,7 @@ private extension ChatMessageFactory { : transaction.senderAddress let coreService = walletServiceCompose.getWallet(by: transfer.type)?.core + let defaultIcon: UIImage = .asset(named: "no-token") ?? .init() return .transaction(.init(value: .init( id: id, @@ -263,9 +264,9 @@ private extension ChatMessageFactory { title: isFromCurrentSender ? .adamant.chat.transactionSent : .adamant.chat.transactionReceived, - icon: coreService?.tokenLogo ?? .init(), + icon: coreService?.tokenLogo ?? defaultIcon, amount: AdamantBalanceFormat.full.format(transfer.amount), - currency: coreService?.tokenSymbol ?? "", + currency: coreService?.tokenSymbol ?? .adamant.transfer.unknownToken, date: transaction.sentDate?.humanizedDateTime(withWeekday: false) ?? "", comment: transfer.comments, backgroundColor: backgroundColor, diff --git a/Adamant/Modules/CoinsNodesList/CoinsNodesListFactory.swift b/Adamant/Modules/CoinsNodesList/CoinsNodesListFactory.swift index 2e230fc37..081c56256 100644 --- a/Adamant/Modules/CoinsNodesList/CoinsNodesListFactory.swift +++ b/Adamant/Modules/CoinsNodesList/CoinsNodesListFactory.swift @@ -50,8 +50,8 @@ private struct CoinsNodesListAssembly: Assembly { apiServices: .init( btc: $0.resolve(BtcApiService.self)!, eth: $0.resolve(EthApiService.self)!, - lskNode: $0.resolve(LskNodeApiService.self)!, - lskService: $0.resolve(LskServiceApiService.self)!, + klyNode: $0.resolve(KlyNodeApiService.self)!, + klyService: $0.resolve(KlyServiceApiService.self)!, doge: $0.resolve(DogeApiService.self)!, dash: $0.resolve(DashApiService.self)!, adm: $0.resolve(ApiService.self)! diff --git a/Adamant/Modules/CoinsNodesList/ViewModel/CoinsNodesListViewModel+ApiServices.swift b/Adamant/Modules/CoinsNodesList/ViewModel/CoinsNodesListViewModel+ApiServices.swift index 53bc5f309..df6da88d3 100644 --- a/Adamant/Modules/CoinsNodesList/ViewModel/CoinsNodesListViewModel+ApiServices.swift +++ b/Adamant/Modules/CoinsNodesList/ViewModel/CoinsNodesListViewModel+ApiServices.swift @@ -12,8 +12,8 @@ extension CoinsNodesListViewModel { struct ApiServices { let btc: WalletApiService let eth: WalletApiService - let lskNode: WalletApiService - let lskService: WalletApiService + let klyNode: WalletApiService + let klyService: WalletApiService let doge: WalletApiService let dash: WalletApiService let adm: WalletApiService @@ -27,10 +27,10 @@ extension CoinsNodesListViewModel.ApiServices { return btc case .eth: return eth - case .lskNode: - return lskNode - case .lskService: - return lskService + case .klyNode: + return klyNode + case .klyService: + return klyService case .doge: return doge case .dash: diff --git a/Adamant/Modules/ScreensFactory/AdamantScreensFactory.swift b/Adamant/Modules/ScreensFactory/AdamantScreensFactory.swift index 0524b81fb..794ca2a6d 100644 --- a/Adamant/Modules/ScreensFactory/AdamantScreensFactory.swift +++ b/Adamant/Modules/ScreensFactory/AdamantScreensFactory.swift @@ -46,7 +46,7 @@ struct AdamantScreensFactory: ScreensFactory { chatSelectTextFactory = .init() walletFactoryCompose = AdamantWalletFactoryCompose( - lskWalletFactory: .init(assembler: assembler), + klyWalletFactory: .init(assembler: assembler), dogeWalletFactory: .init(assembler: assembler), dashWalletFactory: .init(assembler: assembler), btcWalletFactory: .init(assembler: assembler), diff --git a/Adamant/Modules/Wallets/Adamant/AdmWalletService+DynamicConstants.swift b/Adamant/Modules/Wallets/Adamant/AdmWalletService+DynamicConstants.swift index f180c7e52..9cbd3ec83 100644 --- a/Adamant/Modules/Wallets/Adamant/AdmWalletService+DynamicConstants.swift +++ b/Adamant/Modules/Wallets/Adamant/AdmWalletService+DynamicConstants.swift @@ -79,9 +79,9 @@ Node(url: URL(string: "http://184.94.215.92:45555")!), Node(url: URL(string: "https://node1.adamant.business")!, altUrl: URL(string: "http://194.233.75.29:45555")), Node(url: URL(string: "https://node2.blockchain2fa.io")!), Node(url: URL(string: "https://phecda.adm.im")!, altUrl: URL(string: "http://46.250.234.248:36666")), -Node(url: URL(string: "https://tegmine.adm.im")!, altUrl: URL(string: "http://5.104.87.219:36666")), +Node(url: URL(string: "https://tegmine.adm.im")!), Node(url: URL(string: "https://tauri.adm.im")!, altUrl: URL(string: "http://154.26.159.245:36666")), -Node(url: URL(string: "https://dschubba.adm.im")!, altUrl: URL(string: "http://85.239.234.17:36666")), +Node(url: URL(string: "https://dschubba.adm.im")!), ] } diff --git a/Adamant/Modules/Wallets/Bitcoin/BtcTransferViewController.swift b/Adamant/Modules/Wallets/Bitcoin/BtcTransferViewController.swift index aea381b29..34d544ba7 100644 --- a/Adamant/Modules/Wallets/Bitcoin/BtcTransferViewController.swift +++ b/Adamant/Modules/Wallets/Bitcoin/BtcTransferViewController.swift @@ -42,7 +42,8 @@ final class BtcTransferViewController: TransferViewControllerBase { let transaction = try await service.createTransaction( recipient: recipient, amount: amount, - fee: transactionFee + fee: transactionFee, + comment: nil ) if await !doesNotContainSendingTx() { diff --git a/Adamant/Modules/Wallets/Bitcoin/BtcWalletService+DynamicConstants.swift b/Adamant/Modules/Wallets/Bitcoin/BtcWalletService+DynamicConstants.swift index 732eb5bf2..130bc3953 100644 --- a/Adamant/Modules/Wallets/Bitcoin/BtcWalletService+DynamicConstants.swift +++ b/Adamant/Modules/Wallets/Bitcoin/BtcWalletService+DynamicConstants.swift @@ -76,7 +76,7 @@ extension BtcWalletService { static var nodes: [Node] { [ Node(url: URL(string: "https://btcnode1.adamant.im")!, altUrl: URL(string: "http://176.9.38.204:44099")), -Node(url: URL(string: "https://btcnode2.adamant.im")!, altUrl: URL(string: "http://176.9.32.126:44099")), +Node(url: URL(string: "https://btcnode3.adamant.im")!, altUrl: URL(string: "http://195.201.242.108:44099")), ] } diff --git a/Adamant/Modules/Wallets/Bitcoin/BtcWalletService+Send.swift b/Adamant/Modules/Wallets/Bitcoin/BtcWalletService+Send.swift index 2e2278f8d..46f0f0f07 100644 --- a/Adamant/Modules/Wallets/Bitcoin/BtcWalletService+Send.swift +++ b/Adamant/Modules/Wallets/Bitcoin/BtcWalletService+Send.swift @@ -14,7 +14,12 @@ extension BtcWalletService: WalletServiceTwoStepSend { typealias T = BitcoinKit.Transaction // MARK: Create & Send - func createTransaction(recipient: String, amount: Decimal, fee: Decimal) async throws -> BitcoinKit.Transaction { + func createTransaction( + recipient: String, + amount: Decimal, + fee: Decimal, + comment: String? + ) async throws -> BitcoinKit.Transaction { // MARK: 1. Prepare guard let wallet = self.btcWallet else { throw WalletServiceError.notLogged diff --git a/Adamant/Modules/Wallets/DI/AdamantWalletFactoryCompose.swift b/Adamant/Modules/Wallets/DI/AdamantWalletFactoryCompose.swift index 39413fc89..e71b6b3f3 100644 --- a/Adamant/Modules/Wallets/DI/AdamantWalletFactoryCompose.swift +++ b/Adamant/Modules/Wallets/DI/AdamantWalletFactoryCompose.swift @@ -12,7 +12,7 @@ struct AdamantWalletFactoryCompose: WalletFactoryCompose { private let factories: [any WalletFactory] init( - lskWalletFactory: LskWalletFactory, + klyWalletFactory: KlyWalletFactory, dogeWalletFactory: DogeWalletFactory, dashWalletFactory: DashWalletFactory, btcWalletFactory: BtcWalletFactory, @@ -21,7 +21,7 @@ struct AdamantWalletFactoryCompose: WalletFactoryCompose { admWalletFactory: AdmWalletFactory ) { factories = [ - lskWalletFactory, + klyWalletFactory, dogeWalletFactory, dashWalletFactory, btcWalletFactory, diff --git a/Adamant/Modules/Wallets/Dash/DashTransferViewController.swift b/Adamant/Modules/Wallets/Dash/DashTransferViewController.swift index f1605e508..5a1d1e717 100644 --- a/Adamant/Modules/Wallets/Dash/DashTransferViewController.swift +++ b/Adamant/Modules/Wallets/Dash/DashTransferViewController.swift @@ -66,7 +66,8 @@ final class DashTransferViewController: TransferViewControllerBase { let transaction = try await service.createTransaction( recipient: recipient, amount: amount, - fee: transactionFee + fee: transactionFee, + comment: nil ) if await !doesNotContainSendingTx() { diff --git a/Adamant/Modules/Wallets/Dash/DashWalletService+DynamicConstants.swift b/Adamant/Modules/Wallets/Dash/DashWalletService+DynamicConstants.swift index dde5f44e7..0b6668985 100644 --- a/Adamant/Modules/Wallets/Dash/DashWalletService+DynamicConstants.swift +++ b/Adamant/Modules/Wallets/Dash/DashWalletService+DynamicConstants.swift @@ -60,7 +60,7 @@ extension DashWalletService { } var defaultOrdinalLevel: Int? { - 80 + 70 } static var minNodeVersion: String? { diff --git a/Adamant/Modules/Wallets/Dash/DashWalletService+Send.swift b/Adamant/Modules/Wallets/Dash/DashWalletService+Send.swift index e246bb2c8..e2aa6cf8a 100644 --- a/Adamant/Modules/Wallets/Dash/DashWalletService+Send.swift +++ b/Adamant/Modules/Wallets/Dash/DashWalletService+Send.swift @@ -19,7 +19,8 @@ extension DashWalletService: WalletServiceTwoStepSend { return try await createTransaction( recipient: recipient, amount: amount, - fee: transactionFee + fee: transactionFee, + comment: nil ) } @@ -34,14 +35,16 @@ extension DashWalletService: WalletServiceTwoStepSend { return try await createTransaction( recipient: recipient, amount: amount, - fee: transactionFee + fee: transactionFee, + comment: nil ) } func createTransaction( recipient: String, amount: Decimal, - fee: Decimal + fee: Decimal, + comment: String? ) async throws -> BitcoinKit.Transaction { // MARK: 1. Prepare guard let wallet = self.dashWallet else { diff --git a/Adamant/Modules/Wallets/Doge/DogeTransferViewController.swift b/Adamant/Modules/Wallets/Doge/DogeTransferViewController.swift index 02f4188f3..9c49995fb 100644 --- a/Adamant/Modules/Wallets/Doge/DogeTransferViewController.swift +++ b/Adamant/Modules/Wallets/Doge/DogeTransferViewController.swift @@ -43,7 +43,8 @@ final class DogeTransferViewController: TransferViewControllerBase { let transaction = try await service.createTransaction( recipient: recipient, amount: amount, - fee: transactionFee + fee: transactionFee, + comment: nil ) if await !doesNotContainSendingTx() { diff --git a/Adamant/Modules/Wallets/Doge/DogeWalletService+Send.swift b/Adamant/Modules/Wallets/Doge/DogeWalletService+Send.swift index 4dc9955e9..b3e61438f 100644 --- a/Adamant/Modules/Wallets/Doge/DogeWalletService+Send.swift +++ b/Adamant/Modules/Wallets/Doge/DogeWalletService+Send.swift @@ -24,7 +24,8 @@ extension DogeWalletService: WalletServiceTwoStepSend { func createTransaction( recipient: String, amount: Decimal, - fee: Decimal + fee: Decimal, + comment: String? ) async throws -> BitcoinKit.Transaction { // Prepare guard let wallet = self.dogeWallet else { diff --git a/Adamant/Modules/Wallets/ERC20/ERC20TransferViewController.swift b/Adamant/Modules/Wallets/ERC20/ERC20TransferViewController.swift index fb8ee242e..c66d4fe08 100644 --- a/Adamant/Modules/Wallets/ERC20/ERC20TransferViewController.swift +++ b/Adamant/Modules/Wallets/ERC20/ERC20TransferViewController.swift @@ -50,7 +50,8 @@ final class ERC20TransferViewController: TransferViewControllerBase { let transaction = try await service.createTransaction( recipient: recipient, amount: amount, - fee: transactionFee + fee: transactionFee, + comment: nil ) if await !doesNotContainSendingTx( diff --git a/Adamant/Modules/Wallets/ERC20/ERC20WalletService+Send.swift b/Adamant/Modules/Wallets/ERC20/ERC20WalletService+Send.swift index bdd294084..6cef2de23 100644 --- a/Adamant/Modules/Wallets/ERC20/ERC20WalletService+Send.swift +++ b/Adamant/Modules/Wallets/ERC20/ERC20WalletService+Send.swift @@ -19,7 +19,8 @@ extension ERC20WalletService: WalletServiceTwoStepSend { func createTransaction( recipient: String, amount: Decimal, - fee: Decimal + fee: Decimal, + comment: String? ) async throws -> CodableTransaction { guard let ethWallet = ethWallet else { throw WalletServiceError.notLogged diff --git a/Adamant/Modules/Wallets/Ethereum/EthTransferViewController.swift b/Adamant/Modules/Wallets/Ethereum/EthTransferViewController.swift index 86e59ccf8..ef867e9d9 100644 --- a/Adamant/Modules/Wallets/Ethereum/EthTransferViewController.swift +++ b/Adamant/Modules/Wallets/Ethereum/EthTransferViewController.swift @@ -44,7 +44,8 @@ final class EthTransferViewController: TransferViewControllerBase { let transaction = try await service.createTransaction( recipient: recipient, amount: amount, - fee: transactionFee + fee: transactionFee, + comment: nil ) if await !doesNotContainSendingTx( diff --git a/Adamant/Modules/Wallets/Ethereum/EthWalletService+Send.swift b/Adamant/Modules/Wallets/Ethereum/EthWalletService+Send.swift index 440c0168d..ead2c3db4 100644 --- a/Adamant/Modules/Wallets/Ethereum/EthWalletService+Send.swift +++ b/Adamant/Modules/Wallets/Ethereum/EthWalletService+Send.swift @@ -25,7 +25,8 @@ extension EthWalletService: WalletServiceTwoStepSend { func createTransaction( recipient: String, amount: Decimal, - fee: Decimal + fee: Decimal, + comment: String? ) async throws -> CodableTransaction { try await ethApiService.requestWeb3 { [weak self] web3 in guard let self = self else { throw WalletServiceError.internalError(.unknownError) } diff --git a/Adamant/Modules/Wallets/Lisk/LskWalletService+DynamicConstants.swift b/Adamant/Modules/Wallets/Klayr/KLYWalletService+DynamicConstants.swift similarity index 65% rename from Adamant/Modules/Wallets/Lisk/LskWalletService+DynamicConstants.swift rename to Adamant/Modules/Wallets/Klayr/KLYWalletService+DynamicConstants.swift index 32fc5fe7f..b58ec6f05 100644 --- a/Adamant/Modules/Wallets/Lisk/LskWalletService+DynamicConstants.swift +++ b/Adamant/Modules/Wallets/Klayr/KLYWalletService+DynamicConstants.swift @@ -2,12 +2,12 @@ import Foundation import BigInt import CommonKit -extension LskWalletService { +extension KlyWalletService { // MARK: - Constants static let fixedFee: Decimal = 0.00164 - static let currencySymbol = "LSK" + static let currencySymbol = "KLY" static let currencyExponent: Int = -8 - static let qqPrefix: String = "lisk" + static let qqPrefix: String = "klayr" static let healthCheckParameters = CoinHealthCheckParameters( normalUpdateInterval: 270, @@ -40,7 +40,7 @@ extension LskWalletService { } var tokenName: String { - "Lisk" + "Klayr" } var consistencyMaxTime: Double { @@ -60,7 +60,7 @@ extension LskWalletService { } var defaultOrdinalLevel: Int? { - 60 + 50 } static var minNodeVersion: String? { @@ -71,21 +71,19 @@ extension LskWalletService { 8 } - static let explorerAddress = "https://liskscan.com/transaction/" + static let explorerAddress = "https://explorer.klayr.xyz/transaction/" static var nodes: [Node] { [ - Node(url: URL(string: "https://lisknode3.adamant.im")!, altUrl: URL(string: "http://157.90.229.236:44099")), -Node(url: URL(string: "https://lisknode4.adamant.im")!, altUrl: URL(string: "http://78.47.205.206:44099")), -Node(url: URL(string: "https://lisknode5.adamant.im")!, altUrl: URL(string: "http://38.242.243.29:44099")), + Node(url: URL(string: "https://klynode1.adamant.im")!, altUrl: URL(string: "http://195.26.255.137:44099")), +Node(url: URL(string: "https://klynode2.adamant.im")!, altUrl: URL(string: "http://109.176.199.130:44099")), ] } static var serviceNodes: [Node] { [ - Node(url: URL(string: "https://liskservice3.adamant.im")!), -Node(url: URL(string: "https://liskservice4.adamant.im")!), -Node(url: URL(string: "https://liskservice5.adamant.im")!), + Node(url: URL(string: "https://klyservice1.adamant.im")!), +Node(url: URL(string: "https://klyservice2.adamant.im")!), ] } } diff --git a/Adamant/Modules/Wallets/Lisk/LskApiCore.swift b/Adamant/Modules/Wallets/Klayr/KlyApiCore.swift similarity index 93% rename from Adamant/Modules/Wallets/Lisk/LskApiCore.swift rename to Adamant/Modules/Wallets/Klayr/KlyApiCore.swift index b8c7d3d61..769cdc204 100644 --- a/Adamant/Modules/Wallets/Lisk/LskApiCore.swift +++ b/Adamant/Modules/Wallets/Klayr/KlyApiCore.swift @@ -1,16 +1,16 @@ // -// LskApiCore.swift +// KlyApiCore.swift // Adamant // -// Created by Andrew G on 13.11.2023. -// Copyright © 2023 Adamant. All rights reserved. +// Created by Stanislav Jelezoglo on 08.07.2024. +// Copyright © 2024 Adamant. All rights reserved. // import CommonKit import Foundation import LiskKit -class LskApiCore: BlockchainHealthCheckableService { +class KlyApiCore: BlockchainHealthCheckableService { func makeClient(node: CommonKit.Node) -> APIClient { .init(options: .init( nodes: [.init(origin: node.asString())], diff --git a/Adamant/Modules/Wallets/Lisk/LskNodeApiService.swift b/Adamant/Modules/Wallets/Klayr/KlyNodeApiService.swift similarity index 85% rename from Adamant/Modules/Wallets/Lisk/LskNodeApiService.swift rename to Adamant/Modules/Wallets/Klayr/KlyNodeApiService.swift index e76ba7521..885bbd5da 100644 --- a/Adamant/Modules/Wallets/Lisk/LskNodeApiService.swift +++ b/Adamant/Modules/Wallets/Klayr/KlyNodeApiService.swift @@ -1,22 +1,22 @@ // -// LskNodeApiService.swift +// KlyNodeApiService.swift // Adamant // -// Created by Andrew G on 17.11.2023. -// Copyright © 2023 Adamant. All rights reserved. +// Created by Stanislav Jelezoglo on 08.07.2024. +// Copyright © 2024 Adamant. All rights reserved. // import LiskKit import Foundation -final class LskNodeApiService: WalletApiService { - let api: BlockchainHealthCheckWrapper +final class KlyNodeApiService: WalletApiService { + let api: BlockchainHealthCheckWrapper var preferredNodeIds: [UUID] { api.preferredNodeIds } - init(api: BlockchainHealthCheckWrapper) { + init(api: BlockchainHealthCheckWrapper) { self.api = api } @@ -58,7 +58,7 @@ final class LskNodeApiService: WalletApiService { } } -private extension LskNodeApiService { +private extension KlyNodeApiService { func requestClient( body: @escaping @Sendable ( _ client: APIClient, diff --git a/Adamant/Modules/Wallets/Lisk/LskServiceApiService.swift b/Adamant/Modules/Wallets/Klayr/KlyServiceApiService.swift similarity index 84% rename from Adamant/Modules/Wallets/Lisk/LskServiceApiService.swift rename to Adamant/Modules/Wallets/Klayr/KlyServiceApiService.swift index ee0d8363c..b34ded0eb 100644 --- a/Adamant/Modules/Wallets/Lisk/LskServiceApiService.swift +++ b/Adamant/Modules/Wallets/Klayr/KlyServiceApiService.swift @@ -1,16 +1,16 @@ // -// LskServiceApiService.swift +// KlyServiceApiService.swift // Adamant // -// Created by Andrew G on 17.11.2023. -// Copyright © 2023 Adamant. All rights reserved. +// Created by Stanislav Jelezoglo on 08.07.2024. +// Copyright © 2024 Adamant. All rights reserved. // import LiskKit import Foundation import CommonKit -final class LskServiceApiCore: LskApiCore { +final class KlyServiceApiCore: KlyApiCore { override func getStatusInfo( node: CommonKit.Node ) async -> WalletServiceResult { @@ -31,14 +31,14 @@ final class LskServiceApiCore: LskApiCore { } } -final class LskServiceApiService: WalletApiService { - let api: BlockchainHealthCheckWrapper +final class KlyServiceApiService: WalletApiService { + let api: BlockchainHealthCheckWrapper var preferredNodeIds: [UUID] { api.preferredNodeIds } - init(api: BlockchainHealthCheckWrapper) { + init(api: BlockchainHealthCheckWrapper) { self.api = api } @@ -66,7 +66,7 @@ final class LskServiceApiService: WalletApiService { } } -private extension LskServiceApiService { +private extension KlyServiceApiService { func requestClient( body: @escaping @Sendable ( _ client: APIClient, diff --git a/Adamant/Modules/Wallets/Lisk/LskTransactionDetailsViewController.swift b/Adamant/Modules/Wallets/Klayr/KlyTransactionDetailsViewController.swift similarity index 82% rename from Adamant/Modules/Wallets/Lisk/LskTransactionDetailsViewController.swift rename to Adamant/Modules/Wallets/Klayr/KlyTransactionDetailsViewController.swift index 7362f038e..872d8a640 100644 --- a/Adamant/Modules/Wallets/Lisk/LskTransactionDetailsViewController.swift +++ b/Adamant/Modules/Wallets/Klayr/KlyTransactionDetailsViewController.swift @@ -1,19 +1,19 @@ // -// LskTransactionDetailsViewController.swift +// KlyTransactionDetailsViewController.swift // Adamant // -// Created by Anton Boyarkin on 27/11/2018. -// Copyright © 2018 Adamant. All rights reserved. +// Created by Stanislav Jelezoglo on 09.07.2024. +// Copyright © 2024 Adamant. All rights reserved. // import UIKit import CommonKit -final class LskTransactionDetailsViewController: TransactionDetailsViewControllerBase { +final class KlyTransactionDetailsViewController: TransactionDetailsViewControllerBase { // MARK: - Dependencies - weak var service: LskWalletService? { - walletService?.core as? LskWalletService + weak var service: KlyWalletService? { + walletService?.core as? KlyWalletService } // MARK: - Properties @@ -31,7 +31,7 @@ final class LskTransactionDetailsViewController: TransactionDetailsViewControlle // MARK: - Lifecycle override func viewDidLoad() { - currencySymbol = LskWalletService.currencySymbol + currencySymbol = KlyWalletService.currencySymbol super.viewDidLoad() @@ -55,7 +55,7 @@ final class LskTransactionDetailsViewController: TransactionDetailsViewControlle override func explorerUrl(for transaction: TransactionDetails) -> URL? { let id = transaction.txId - return URL(string: "\(LskWalletService.explorerAddress)\(id)") + return URL(string: "\(KlyWalletService.explorerAddress)\(id)") } @MainActor @@ -70,7 +70,7 @@ final class LskTransactionDetailsViewController: TransactionDetailsViewControlle do { var trs = try await service.getTransaction(by: id) - let result = try await service.getFees() + let result = try await service.getCurrentFee() let lastHeight = result.lastHeight trs.updateConfirmations(value: lastHeight) diff --git a/Adamant/Modules/Wallets/Lisk/LskTransactionsViewController.swift b/Adamant/Modules/Wallets/Klayr/KlyTransactionsViewController.swift similarity index 79% rename from Adamant/Modules/Wallets/Lisk/LskTransactionsViewController.swift rename to Adamant/Modules/Wallets/Klayr/KlyTransactionsViewController.swift index b3c3a3107..5106ab376 100644 --- a/Adamant/Modules/Wallets/Lisk/LskTransactionsViewController.swift +++ b/Adamant/Modules/Wallets/Klayr/KlyTransactionsViewController.swift @@ -1,9 +1,9 @@ // -// LskTransactionsViewController +// KlyTransactionsViewController.swift // Adamant // -// Created by Anton Boyarkin on 17/07/2018. -// Copyright © 2018 Adamant. All rights reserved. +// Created by Stanislav Jelezoglo on 09.07.2024. +// Copyright © 2024 Adamant. All rights reserved. // import UIKit @@ -13,11 +13,11 @@ import BigInt import CommonKit import Combine -final class LskTransactionsViewController: TransactionsListViewControllerBase { - - // MARK: - UITableView - - func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) { +final class KlyTransactionsViewController: TransactionsListViewControllerBase { + func tableView( + _ tableView: UITableView, + didSelectRowAt indexPath: IndexPath + ) { tableView.deselectRow(at: indexPath, animated: true) guard let address = walletService.core.wallet?.address, let transaction = transactions[safe: indexPath.row] @@ -44,7 +44,7 @@ extension Transactions.TransactionModel: TransactionDetails { return self.nonce } - var defaultCurrencySymbol: String? { LskWalletService.currencySymbol } + var defaultCurrencySymbol: String? { KlyWalletService.currencySymbol } var txId: String { return id @@ -57,18 +57,21 @@ extension Transactions.TransactionModel: TransactionDetails { var amountValue: Decimal? { let value = BigUInt(self.amount) ?? BigUInt(0) - return value.asDecimal(exponent: LskWalletService.currencyExponent) + return value.asDecimal(exponent: KlyWalletService.currencyExponent) } var feeValue: Decimal? { let value = BigUInt(self.fee) ?? BigUInt(0) - return value.asDecimal(exponent: LskWalletService.currencyExponent) + return value.asDecimal(exponent: KlyWalletService.currencyExponent) } var confirmationsValue: String? { - guard let confirmations = confirmations, let height = height else { return "0" } - if confirmations < height { return "0" } + guard let confirmations = confirmations, + let height = height, + confirmations >= height + else { return "0" } + if confirmations > 0 { return "\(confirmations - height + 1)" } @@ -92,6 +95,10 @@ extension Transactions.TransactionModel: TransactionDetails { if confirmations < height { return .registered } + guard executionStatus != .failed else { + return .failed + } + if confirmations > 0 && height > 0 { let conf = (confirmations - height) + 1 if conf > 1 { @@ -118,7 +125,7 @@ extension Transactions.TransactionModel: TransactionDetails { extension LocalTransaction: TransactionDetails { - var defaultCurrencySymbol: String? { LskWalletService.currencySymbol } + var defaultCurrencySymbol: String? { KlyWalletService.currencySymbol } var txId: String { return id ?? "" @@ -139,13 +146,13 @@ extension LocalTransaction: TransactionDetails { var amountValue: Decimal? { let value = BigUInt(self.amount) - return value.asDecimal(exponent: LskWalletService.currencyExponent) + return value.asDecimal(exponent: KlyWalletService.currencyExponent) } var feeValue: Decimal? { let value = BigUInt(self.fee) - return value.asDecimal(exponent: LskWalletService.currencyExponent) + return value.asDecimal(exponent: KlyWalletService.currencyExponent) } var confirmationsValue: String? { @@ -175,7 +182,7 @@ extension LocalTransaction: TransactionDetails { extension TransactionEntity: TransactionDetails { - var defaultCurrencySymbol: String? { LskWalletService.currencySymbol } + var defaultCurrencySymbol: String? { KlyWalletService.currencySymbol } var txId: String { return id @@ -192,13 +199,13 @@ extension TransactionEntity: TransactionDetails { var amountValue: Decimal? { let value = BigUInt(self.params.amount) - return value.asDecimal(exponent: LskWalletService.currencyExponent) + return value.asDecimal(exponent: KlyWalletService.currencyExponent) } var feeValue: Decimal? { let value = BigUInt(self.fee) - return value.asDecimal(exponent: LskWalletService.currencyExponent) + return value.asDecimal(exponent: KlyWalletService.currencyExponent) } var confirmationsValue: String? { diff --git a/Adamant/Modules/Wallets/Lisk/LskTransferViewController.swift b/Adamant/Modules/Wallets/Klayr/KlyTransferViewController.swift similarity index 78% rename from Adamant/Modules/Wallets/Lisk/LskTransferViewController.swift rename to Adamant/Modules/Wallets/Klayr/KlyTransferViewController.swift index 27f635578..331fd708a 100644 --- a/Adamant/Modules/Wallets/Lisk/LskTransferViewController.swift +++ b/Adamant/Modules/Wallets/Klayr/KlyTransferViewController.swift @@ -1,9 +1,9 @@ // -// LskTransferViewController.swift +// KlyTransferViewController.swift // Adamant // -// Created by Anton Boyarkin on 27/11/2018. -// Copyright © 2018 Adamant. All rights reserved. +// Created by Stanislav Jelezoglo on 09.07.2024. +// Copyright © 2024 Adamant. All rights reserved. // import UIKit @@ -12,11 +12,30 @@ import LiskKit import CommonKit @MainActor -final class LskTransferViewController: TransferViewControllerBase { +final class KlyTransferViewController: TransferViewControllerBase { // MARK: Properties - private let prefix = "lsk" + private let prefix = "kly" + + override var blockchainCommentsEnabled: Bool { + !commentsEnabled + } + + override var transactionFee: Decimal { + let blockchainComment: String = (form.rowBy( + tag: BaseRows.blockchainComments( + coin: walletCore.tokenName + ).tag + ) as? TextAreaRow)?.value ?? .empty + + let baseFee = walletCore.getFee(comment: blockchainComment) + let additionalyFee = walletCore.additionalFee + + return addAdditionalFee + ? baseFee + additionalyFee + : baseFee + } override func checkForAdditionalFee() { Task { @@ -49,7 +68,13 @@ final class LskTransferViewController: TransferViewControllerBase { comments = "" } - guard let service = walletCore as? LskWalletService, + let blockchainComment: String? = (form.rowBy( + tag: BaseRows.blockchainComments( + coin: walletCore.tokenName + ).tag + ) as? TextAreaRow)?.value + + guard let service = walletCore as? KlyWalletService, let recipient = recipientAddress, let amount = amount else { @@ -64,10 +89,14 @@ final class LskTransferViewController: TransferViewControllerBase { let transaction = try await service.createTransaction( recipient: recipient, amount: amount, - fee: transactionFee + fee: transactionFee, + comment: blockchainComment ) - if await !doesNotContainSendingTx(with: String(transaction.nonce)) { + if await !doesNotContainSendingTx( + with: String(transaction.nonce), + senderAddress: transaction.senderAddress + ) { presentSendingError() return } @@ -94,9 +123,7 @@ final class LskTransferViewController: TransferViewControllerBase { throw error } - Task { - await service.update() - } + service.update() dialogService.dismissProgress() dialogService.showSuccess(withMessage: String.adamant.transfer.transferSuccess) @@ -200,9 +227,15 @@ final class LskTransferViewController: TransferViewControllerBase { label.textColor = UIColor.adamant.primary } }.onChange { [weak self] row in - var trimmed = row.value?.components( + defer { + self?.updateToolbar(for: row) + } + + guard let text = row.value else { return } + + var trimmed = text.components( separatedBy: TransferViewControllerBase.invalidCharacters - ).joined() ?? "" + ).joined() if let prefix = self?.prefix, trimmed.starts(with: prefix) { @@ -210,9 +243,12 @@ final class LskTransferViewController: TransferViewControllerBase { trimmed = String(trimmed[i...]) } - row.value = trimmed - row.updateCell() - self?.updateToolbar(for: row) + if text != trimmed { + DispatchQueue.main.async { + row.value = trimmed + row.updateCell() + } + } }.onCellSelection { [weak self] (cell, _) in self?.shareValue(self?.recipientAddress, from: cell) } @@ -221,6 +257,6 @@ final class LskTransferViewController: TransferViewControllerBase { } override func defaultSceneTitle() -> String? { - return String.adamant.sendLsk + String.adamant.sendKly } } diff --git a/Adamant/Modules/Wallets/Klayr/KlyWallet.swift b/Adamant/Modules/Wallets/Klayr/KlyWallet.swift new file mode 100644 index 000000000..939e2255b --- /dev/null +++ b/Adamant/Modules/Wallets/Klayr/KlyWallet.swift @@ -0,0 +1,49 @@ +// +// KlyWallet.swift +// Adamant +// +// Created by Stanislav Jelezoglo on 08.07.2024. +// Copyright © 2024 Adamant. All rights reserved. +// + +import Foundation +import CommonKit +import LiskKit + +final class KlyWallet: WalletAccount { + let legacyAddress: String + let kly32Address: String + let keyPair: KeyPair + var balance: Decimal = 0.0 + var notifications: Int = 0 + var isNewApi: Bool = true + var nonce: UInt64 + var minBalance: Decimal = 0.05 + var minAmount: Decimal = 0 + var isBalanceInitialized: Bool = false + + var address: String { + return isNewApi ? kly32Address : legacyAddress + } + + var binaryAddress: String { + return isNewApi + ? LiskKit.Crypto.getBinaryAddressFromBase32(kly32Address) ?? .empty + : legacyAddress + } + + init( + address: String, + keyPair: KeyPair, + nonce: UInt64, + isNewApi: Bool + ) { + self.legacyAddress = address + self.keyPair = keyPair + self.isNewApi = isNewApi + self.nonce = nonce + self.kly32Address = LiskKit.Crypto.getBase32Address( + from: keyPair.publicKeyString + ) + } +} diff --git a/Adamant/Modules/Wallets/Lisk/LskWalletFactory.swift b/Adamant/Modules/Wallets/Klayr/KlyWalletFactory.swift similarity index 89% rename from Adamant/Modules/Wallets/Lisk/LskWalletFactory.swift rename to Adamant/Modules/Wallets/Klayr/KlyWalletFactory.swift index a950ded07..cb5f85e33 100644 --- a/Adamant/Modules/Wallets/Lisk/LskWalletFactory.swift +++ b/Adamant/Modules/Wallets/Klayr/KlyWalletFactory.swift @@ -1,9 +1,9 @@ // -// LskWalletFactory.swift +// KlyWalletFactory.swift // Adamant // -// Created by Anton Boyarkin on 27/11/2018. -// Copyright © 2018 Adamant. All rights reserved. +// Created by Stanislav Jelezoglo on 08.07.2024. +// Copyright © 2024 Adamant. All rights reserved. // import Swinject @@ -11,14 +11,14 @@ import UIKit import CommonKit import LiskKit -struct LskWalletFactory: WalletFactory { +struct KlyWalletFactory: WalletFactory { typealias Service = WalletService - let typeSymbol: String = LskWalletService.richMessageType + let typeSymbol: String = KlyWalletService.richMessageType let assembler: Assembler func makeWalletVC(service: Service, screensFactory: ScreensFactory) -> WalletViewController { - LskWalletViewController( + KlyWalletViewController( dialogService: assembler.resolve(DialogService.self)!, currencyInfoService: assembler.resolve(CurrencyInfoService.self)!, accountService: assembler.resolve(AccountService.self)!, @@ -29,7 +29,7 @@ struct LskWalletFactory: WalletFactory { } func makeTransferListVC(service: Service, screensFactory: ScreensFactory) -> UIViewController { - LskTransactionsViewController( + KlyTransactionsViewController( walletService: service, dialogService: assembler.resolve(DialogService.self)!, reachabilityMonitor: assembler.resolve(ReachabilityMonitor.self)!, @@ -38,7 +38,7 @@ struct LskWalletFactory: WalletFactory { } func makeTransferVC(service: Service, screensFactory: ScreensFactory) -> TransferViewControllerBase { - LskTransferViewController( + KlyTransferViewController( chatsProvider: assembler.resolve(ChatsProvider.self)!, accountService: assembler.resolve(AccountService.self)!, accountsProvider: assembler.resolve(AccountsProvider.self)!, @@ -82,7 +82,7 @@ struct LskWalletFactory: WalletFactory { } } -private extension LskWalletFactory { +private extension KlyWalletFactory { private func makeTransactionDetailsVC( hash: String, senderId: String?, @@ -117,7 +117,7 @@ private extension LskWalletFactory { confirmationsValue: nil, blockValue: nil, isOutgoing: richTransaction.isOutgoing, - transactionStatus: nil, + transactionStatus: nil, nonceRaw: nil ) @@ -126,8 +126,8 @@ private extension LskWalletFactory { return vc } - func makeTransactionDetailsVC(service: Service) -> LskTransactionDetailsViewController { - LskTransactionDetailsViewController( + func makeTransactionDetailsVC(service: Service) -> KlyTransactionDetailsViewController { + KlyTransactionDetailsViewController( dialogService: assembler.resolve(DialogService.self)!, currencyInfo: assembler.resolve(CurrencyInfoService.self)!, addressBookService: assembler.resolve(AddressBookService.self)!, diff --git a/Adamant/Modules/Wallets/Klayr/KlyWalletViewController.swift b/Adamant/Modules/Wallets/Klayr/KlyWalletViewController.swift new file mode 100644 index 000000000..3a3934c90 --- /dev/null +++ b/Adamant/Modules/Wallets/Klayr/KlyWalletViewController.swift @@ -0,0 +1,34 @@ +// +// KlyWalletViewController.swift +// Adamant +// +// Created by Stanislav Jelezoglo on 09.07.2024. +// Copyright © 2024 Adamant. All rights reserved. +// + +import UIKit +import CommonKit + +extension String.adamant { + static var kly: String { + String.localized("AccountTab.Wallets.kly_wallet", comment: "Account tab: Klayr wallet") + } + + static var sendKly: String { + String.localized("AccountTab.Row.SendKly", comment: "Account tab: 'Send KLY tokens' button") + } +} + +final class KlyWalletViewController: WalletViewControllerBase { + override func sendRowLocalizedLabel() -> NSAttributedString { + return NSAttributedString(string: String.adamant.sendKly) + } + + override func encodeForQr(address: String) -> String? { + return "klayr:\(address)" + } + + override func setTitle() { + walletTitleLabel.text = String.adamant.kly + } +} diff --git a/Adamant/Modules/Wallets/Lisk/LskWalletService+RichMessageProvider.swift b/Adamant/Modules/Wallets/Klayr/WalletService/KlyWalletService+RichMessageProvider.swift similarity index 77% rename from Adamant/Modules/Wallets/Lisk/LskWalletService+RichMessageProvider.swift rename to Adamant/Modules/Wallets/Klayr/WalletService/KlyWalletService+RichMessageProvider.swift index 4bb5f514e..5a341130c 100644 --- a/Adamant/Modules/Wallets/Lisk/LskWalletService+RichMessageProvider.swift +++ b/Adamant/Modules/Wallets/Klayr/WalletService/KlyWalletService+RichMessageProvider.swift @@ -1,18 +1,16 @@ // -// LskWalletService+RichMessageProvider.swift +// KlyWalletService+RichMessageProvider.swift // Adamant // -// Created by Anton Boyarkin on 06/12/2018. -// Copyright © 2018 Adamant. All rights reserved. +// Created by Stanislav Jelezoglo on 09.07.2024. +// Copyright © 2024 Adamant. All rights reserved. // import Foundation -import MessageKit -import UIKit import LiskKit import CommonKit -extension LskWalletService { +extension KlyWalletService { var newPendingInterval: TimeInterval { .init(milliseconds: type(of: self).newPendingInterval) } @@ -44,7 +42,7 @@ extension LskWalletService { guard let raw = transaction.getRichValue(for: RichContentKeys.transfer.amount) else { - return NSAttributedString(string: "⬅️ \(LskWalletService.currencySymbol)") + return NSAttributedString(string: "⬅️ \(KlyWalletService.currencySymbol)") } if let decimal = Decimal(string: raw) { @@ -55,9 +53,9 @@ extension LskWalletService { let string: String if transaction.isOutgoing { - string = "⬅️ \(amount) \(LskWalletService.currencySymbol)" + string = "⬅️ \(amount) \(KlyWalletService.currencySymbol)" } else { - string = "➡️ \(amount) \(LskWalletService.currencySymbol)" + string = "➡️ \(amount) \(KlyWalletService.currencySymbol)" } return NSAttributedString(string: string) diff --git a/Adamant/Modules/Wallets/Lisk/LskWalletService+Send.swift b/Adamant/Modules/Wallets/Klayr/WalletService/KlyWalletService+Send.swift similarity index 68% rename from Adamant/Modules/Wallets/Lisk/LskWalletService+Send.swift rename to Adamant/Modules/Wallets/Klayr/WalletService/KlyWalletService+Send.swift index d2d2f0e40..77631bf2f 100644 --- a/Adamant/Modules/Wallets/Lisk/LskWalletService+Send.swift +++ b/Adamant/Modules/Wallets/Klayr/WalletService/KlyWalletService+Send.swift @@ -1,38 +1,29 @@ // -// LskWalletService+Send.swift +// KlyWalletService+Send.swift // Adamant // -// Created by Anton Boyarkin on 29/11/2018. -// Copyright © 2018 Adamant. All rights reserved. +// Created by Stanislav Jelezoglo on 08.07.2024. +// Copyright © 2024 Adamant. All rights reserved. // import UIKit import LiskKit import CommonKit -extension LocalTransaction: RawTransaction { - var txHash: String? { - return id - } -} - -extension TransactionEntity: RawTransaction { - var txHash: String? { - return id - } -} - -extension LskWalletService: WalletServiceTwoStepSend { +extension KlyWalletService: WalletServiceTwoStepSend { typealias T = TransactionEntity // MARK: Create & Send func createTransaction( recipient: String, amount: Decimal, - fee: Decimal + fee: Decimal, + comment: String? ) async throws -> TransactionEntity { // MARK: 1. Prepare - guard let wallet = lskWallet, let binaryAddress = LiskKit.Crypto.getBinaryAddressFromBase32(recipient) else { + guard let wallet = klyWallet, + let binaryAddress = LiskKit.Crypto.getBinaryAddressFromBase32(recipient) + else { throw WalletServiceError.notLogged } @@ -45,7 +36,8 @@ extension LskWalletService: WalletServiceTwoStepSend { fee: fee, nonce: wallet.nonce, senderPublicKey: wallet.keyPair.publicKeyString, - recipientAddressBinary: binaryAddress + recipientAddressBinary: binaryAddress, + comment: comment ?? .empty ) let signedTransaction = transaction.sign(with: keys, for: Constants.chainID) @@ -53,8 +45,20 @@ extension LskWalletService: WalletServiceTwoStepSend { } func sendTransaction(_ transaction: TransactionEntity) async throws { - _ = try await lskNodeApiService.requestTransactionsApi { api in + _ = try await klyNodeApiService.requestTransactionsApi { api in try await api.submit(transaction: transaction) }.get() } } + +extension LocalTransaction: RawTransaction { + var txHash: String? { + return id + } +} + +extension TransactionEntity: RawTransaction { + var txHash: String? { + return id + } +} diff --git a/Adamant/Modules/Wallets/Lisk/LskWalletService+RichMessageProviderWithStatusCheck.swift b/Adamant/Modules/Wallets/Klayr/WalletService/KlyWalletService+StatusCheck.swift similarity index 69% rename from Adamant/Modules/Wallets/Lisk/LskWalletService+RichMessageProviderWithStatusCheck.swift rename to Adamant/Modules/Wallets/Klayr/WalletService/KlyWalletService+StatusCheck.swift index d315f0fc8..2117e4569 100644 --- a/Adamant/Modules/Wallets/Lisk/LskWalletService+RichMessageProviderWithStatusCheck.swift +++ b/Adamant/Modules/Wallets/Klayr/WalletService/KlyWalletService+StatusCheck.swift @@ -1,16 +1,15 @@ // -// LskWalletService+RichMessageProviderWithStatusCheck.swift +// KlyWalletService+StatusCheck.swift // Adamant // -// Created by Anton Boyarkin on 06/12/2018. -// Copyright © 2018 Adamant. All rights reserved. +// Created by Stanislav Jelezoglo on 08.07.2024. +// Copyright © 2024 Adamant. All rights reserved. // -import Foundation import LiskKit import CommonKit -extension LskWalletService { +extension KlyWalletService { func statusInfoFor(transaction: CoinTransaction) async -> TransactionStatusInfo { let hash: String? @@ -24,34 +23,38 @@ extension LskWalletService { return .init(sentDate: nil, status: .inconsistent(.wrongTxHash)) } - var lskTransaction: Transactions.TransactionModel + var klyTransaction: Transactions.TransactionModel do { - lskTransaction = try await getTransaction(by: hash) + klyTransaction = try await getTransaction(by: hash) } catch { return .init(error: error) } - lskTransaction.updateConfirmations(value: lastHeight) + klyTransaction.updateConfirmations(value: lastHeight) return await .init( - sentDate: lskTransaction.sentDate, + sentDate: klyTransaction.sentDate, status: getStatus( - lskTransaction: lskTransaction, + klyTransaction: klyTransaction, transaction: transaction ) ) } } -private extension LskWalletService { +private extension KlyWalletService { func getStatus( - lskTransaction: Transactions.TransactionModel, + klyTransaction: Transactions.TransactionModel, transaction: CoinTransaction ) async -> TransactionStatus { - guard lskTransaction.blockId != nil else { return .registered } + guard klyTransaction.blockId != nil else { return .registered } - guard let status = lskTransaction.transactionStatus else { + guard klyTransaction.executionStatus != .failed else { + return .failed + } + + guard let status = klyTransaction.transactionStatus else { return .inconsistent(.unknown) } @@ -61,8 +64,8 @@ private extension LskWalletService { // MARK: Check address - var realSenderAddress = lskTransaction.senderAddress - var realRecipientAddress = lskTransaction.recipientAddress + var realSenderAddress = klyTransaction.senderAddress + var realRecipientAddress = klyTransaction.recipientAddress if transaction is RichMessageTransaction { guard let senderAddress = try? await getWalletAddress(byAdamantAddress: transaction.senderAddress) @@ -79,20 +82,20 @@ private extension LskWalletService { realRecipientAddress = recipientAddress } - guard lskTransaction.senderAddress.caseInsensitiveCompare(realSenderAddress) == .orderedSame else { + guard klyTransaction.senderAddress.caseInsensitiveCompare(realSenderAddress) == .orderedSame else { return .inconsistent(.senderCryptoAddressMismatch(tokenSymbol)) } - guard lskTransaction.recipientAddress.caseInsensitiveCompare(realRecipientAddress) == .orderedSame else { + guard klyTransaction.recipientAddress.caseInsensitiveCompare(realRecipientAddress) == .orderedSame else { return .inconsistent(.recipientCryptoAddressMismatch(tokenSymbol)) } if transaction.isOutgoing { - guard lskWallet?.address.caseInsensitiveCompare(lskTransaction.senderAddress) == .orderedSame else { + guard klyWallet?.address.caseInsensitiveCompare(klyTransaction.senderAddress) == .orderedSame else { return .inconsistent(.senderCryptoAddressMismatch(tokenSymbol)) } } else { - guard lskWallet?.address.caseInsensitiveCompare(lskTransaction.recipientAddress) == .orderedSame else { + guard klyWallet?.address.caseInsensitiveCompare(klyTransaction.recipientAddress) == .orderedSame else { return .inconsistent(.recipientCryptoAddressMismatch(tokenSymbol)) } } @@ -100,7 +103,7 @@ private extension LskWalletService { // MARK: Check amount guard isAmountCorrect( transaction: transaction, - lskTransaction: lskTransaction + klyTransaction: klyTransaction ) else { return .inconsistent(.wrongAmount) } return .success @@ -108,7 +111,7 @@ private extension LskWalletService { func isAmountCorrect( transaction: CoinTransaction, - lskTransaction: Transactions.TransactionModel + klyTransaction: Transactions.TransactionModel ) -> Bool { if let transaction = transaction as? RichMessageTransaction, let raw = transaction.getRichValue(for: RichContentKeys.transfer.amount), @@ -116,10 +119,10 @@ private extension LskWalletService { let min = reported - reported*0.005 let max = reported + reported*0.005 - let amount = lskTransaction.amountValue ?? 0 + let amount = klyTransaction.amountValue ?? 0 return amount <= max && amount >= min } - return transaction.amountValue == lskTransaction.amountValue + return transaction.amountValue == klyTransaction.amountValue } } diff --git a/Adamant/Modules/Wallets/Klayr/WalletService/KlyWalletService+WalletCore.swift b/Adamant/Modules/Wallets/Klayr/WalletService/KlyWalletService+WalletCore.swift new file mode 100644 index 000000000..a8854c951 --- /dev/null +++ b/Adamant/Modules/Wallets/Klayr/WalletService/KlyWalletService+WalletCore.swift @@ -0,0 +1,88 @@ +// +// KlyWalletService+WalletCore.swift +// Adamant +// +// Created by Stanislav Jelezoglo on 09.07.2024. +// Copyright © 2024 Adamant. All rights reserved. +// + +import UIKit +import CommonKit +import LiskKit + +extension KlyWalletService { + var wallet: WalletAccount? { + klyWallet + } + + var tokenSymbol: String { + Self.currencySymbol + } + + var tokenLogo: UIImage { + Self.currencyLogo + } + + static var tokenNetworkSymbol: String { + Self.currencySymbol + } + + var tokenContract: String { + .empty + } + + var tokenUnicID: String { + Self.tokenNetworkSymbol + tokenSymbol + } + + var qqPrefix: String { + Self.qqPrefix + } + + var additionalFee: Decimal { + 0.05 + } + + var nodeGroups: [NodeGroup] { + [.klyNode, .klyService] + } + + var transactionFee: Decimal { + transactionFeeRaw.asDecimal(exponent: KlyWalletService.currencyExponent) + } + + var richMessageType: String { + Self.richMessageType + } + + var transactionsPublisher: AnyObservable<[TransactionDetails]> { + $transactions.eraseToAnyPublisher() + } + + var hasMoreOldTransactionsPublisher: AnyObservable { + $hasMoreOldTransactions.eraseToAnyPublisher() + } +} + +extension KlyWalletService: PrivateKeyGenerator { + var rowTitle: String { + tokenName + } + + var rowImage: UIImage? { + .asset(named: "klayr_wallet_row") + } + + func generatePrivateKeyFor(passphrase: String) -> String? { + guard AdamantUtilities.validateAdamantPassphrase(passphrase), + let keypair = try? LiskKit.Crypto.keyPair( + fromPassphrase: passphrase, + salt: salt + ) + else { + return nil + } + + return keypair.privateKeyString + } +} diff --git a/Adamant/Modules/Wallets/Lisk/LskWalletService.swift b/Adamant/Modules/Wallets/Klayr/WalletService/KlyWalletService.swift similarity index 53% rename from Adamant/Modules/Wallets/Lisk/LskWalletService.swift rename to Adamant/Modules/Wallets/Klayr/WalletService/KlyWalletService.swift index c3b9d8a89..82ccbcbca 100644 --- a/Adamant/Modules/Wallets/Lisk/LskWalletService.swift +++ b/Adamant/Modules/Wallets/Klayr/WalletService/KlyWalletService.swift @@ -1,152 +1,178 @@ // -// LskWalletService.swift +// KlyWalletService.swift // Adamant // -// Created by Anokhov Pavel on 03.08.2018. -// Copyright © 2018 Adamant. All rights reserved. +// Created by Stanislav Jelezoglo on 08.07.2024. +// Copyright © 2024 Adamant. All rights reserved. // import Foundation -import UIKit import Swinject -import LiskKit -import web3swift -import Alamofire -import struct BigInt.BigUInt -import Web3Core -import Combine +import UIKit import CommonKit +import Combine +import struct BigInt.BigUInt +import LiskKit -final class LskWalletService: WalletCoreProtocol { - var wallet: WalletAccount? { return lskWallet } - - // MARK: - Notifications - let walletUpdatedNotification = Notification.Name("adamant.lskWallet.walletUpdated") - let serviceEnabledChanged = Notification.Name("adamant.lskWallet.enabledChanged") - let transactionFeeUpdated = Notification.Name("adamant.lskWallet.feeUpdated") - let serviceStateChanged = Notification.Name("adamant.lskWallet.stateChanged") +final class KlyWalletService: WalletCoreProtocol { - // MARK: RichMessageProvider properties - static let richMessageType = "lsk_transaction" + // MARK: Dependencies - // MARK: - Dependencies var apiService: ApiService! - var lskNodeApiService: LskNodeApiService! - var lskServiceApiService: LskServiceApiService! + var klyNodeApiService: KlyNodeApiService! + var klyServiceApiService: KlyServiceApiService! var accountService: AccountService! var dialogService: DialogService! var vibroService: VibroService! var coreDataStack: CoreDataStack! - // MARK: - Constants - var transactionFee: Decimal { - transactionFeeRaw.asDecimal(exponent: LskWalletService.currencyExponent) - } + // MARK: Proprieties + static let richMessageType = "kly_transaction" + static let currencyLogo = UIImage.asset(named: "klayr_wallet") ?? .init() + static let kvsAddress = "kly:address" + static let defaultFee: BigUInt = 141000 + @Atomic var transactionFeeRaw: BigUInt = BigUInt(integerLiteral: 141000) + + @Atomic private var cachedWalletAddress: [String: String] = [:] + @Atomic private var subscriptions = Set() + @Atomic private var balanceObserver: AnyCancellable? + + @Atomic private(set) var klyWallet: KlyWallet? @Atomic private(set) var enabled = true @Atomic private(set) var isWarningGasPrice = false + @Atomic private(set) var state: WalletServiceState = .notInitiated + @Atomic private(set) var lastHeight: UInt64 = .zero + @Atomic private(set) var lastMinFeePerByte: UInt64 = .zero - static let currencyLogo = UIImage.asset(named: "lisk_wallet") ?? .init() - static let kvsAddress = "lsk:address" - static let defaultFee: BigUInt = 141000 + @ObservableValue private(set) var transactions: [TransactionDetails] = [] + @ObservableValue private(set) var hasMoreOldTransactions: Bool = true - @Atomic var lastHeight: UInt64 = .zero + private(set) lazy var coinStorage: CoinStorageService = AdamantCoinStorageService( + coinId: tokenUnicID, + coreDataStack: coreDataStack, + blockchainType: richMessageType + ) - var tokenSymbol: String { - return type(of: self).currencySymbol - } + let salt = "adm" - var tokenLogo: UIImage { - return type(of: self).currencyLogo - } - - static var tokenNetworkSymbol: String { - return "LSK" - } + // MARK: Notifications + + let walletUpdatedNotification = Notification.Name("adamant.klyWallet.walletUpdated") + let serviceEnabledChanged = Notification.Name("adamant.klyWallet.enabledChanged") + let transactionFeeUpdated = Notification.Name("adamant.klyWallet.feeUpdated") + let serviceStateChanged = Notification.Name("adamant.klyWallet.stateChanged") + + // MARK: - - var tokenContract: String { - return "" + func initWallet( + withPassphrase passphrase: String + ) async throws -> WalletAccount { + try await initWallet(passphrase: passphrase) } - var tokenUnicID: String { - Self.tokenNetworkSymbol + tokenSymbol + func setInitiationFailed(reason: String) { + setState(.initiationFailed(reason: reason)) + klyWallet = nil } - var richMessageType: String { - return Self.richMessageType - } - - var qqPrefix: String { - return Self.qqPrefix + func update() { + Task { + await update() + } } - var additionalFee: Decimal { - 0.05 - } - - var nodeGroups: [NodeGroup] { - [.lskNode, .lskService] + func updateStatus(for id: String, status: TransactionStatus?) { + coinStorage.updateStatus(for: id, status: status) } - // MARK: - Properties - let transferAvailable: Bool = true - let netHash = Constants.Nethash.main + func validate(address: String) -> AddressValidationResult { + LiskKit.Crypto.isValidBase32(address: address) + ? .valid + : .invalid(description: nil) + } - @Atomic private(set) var lskWallet: LskWallet? - @Atomic private var cachedWalletAddress: [String: String] = [:] + func getBalance(address: String) async throws -> Decimal { + try await getBalance(for: address) + } - let defaultDispatchQueue = DispatchQueue( - label: "im.adamant.lskWalletService", - qos: .utility, - attributes: [.concurrent] - ) + func getCurrentFee() async throws -> (fee: BigUInt, lastHeight: UInt64, minFeePerByte: UInt64) { + try await getFees(comment: .empty) + } - @Atomic private var subscriptions = Set() - - @ObservableValue private(set) var transactions: [TransactionDetails] = [] - @ObservableValue private(set) var hasMoreOldTransactions: Bool = true - - var transactionsPublisher: AnyObservable<[TransactionDetails]> { - $transactions.eraseToAnyPublisher() + func getFee(comment: String) -> Decimal { + let fee = try? getFee( + minFeePerByte: lastMinFeePerByte, + comment: comment + ).asDecimal(exponent: Self.currencyExponent) + + return fee ?? transactionFee } - var hasMoreOldTransactionsPublisher: AnyObservable { - $hasMoreOldTransactions.eraseToAnyPublisher() + func getWalletAddress(byAdamantAddress address: String) async throws -> String { + try await getKlyWalletAddress(byAdamantAddress: address) } - private(set) lazy var coinStorage: CoinStorageService = AdamantCoinStorageService( - coinId: tokenUnicID, - coreDataStack: coreDataStack, - blockchainType: richMessageType - ) + func getLocalTransactionHistory() -> [TransactionDetails] { + transactions + } - // MARK: - State - @Atomic private (set) var state: WalletServiceState = .notInitiated + func getTransactionsHistory( + offset: Int, + limit: Int + ) async throws -> [TransactionDetails] { + try await getTransactions(offset: UInt(offset), limit: UInt(limit)) + } - private func setState(_ newState: WalletServiceState, silent: Bool = false) { - guard newState != state else { - return - } - - state = newState + func loadTransactions(offset: Int, limit: Int) async throws -> Int { + let trs = try await getTransactionsHistory(offset: offset, limit: limit) - if !silent { - NotificationCenter.default.post( - name: serviceStateChanged, - object: self, - userInfo: [AdamantUserInfoKey.WalletService.walletState: state] - ) + guard trs.count > 0 else { + hasMoreOldTransactions = false + return .zero } - } - // MARK: - Delayed KVS save - @Atomic private var balanceObserver: NSObjectProtocol? + coinStorage.append(trs) + return trs.count + } - init() { - addObservers() + func getTransaction( + by hash: String + ) async throws -> Transactions.TransactionModel { + try await getTransaction(hash: hash) } + func isExist(address: String) async throws -> Bool { + try await isAccountExist(with: address) + } +} + +// MARK: - Dependencies +extension KlyWalletService: SwinjectDependentService { + @MainActor + func injectDependencies(from container: Container) { + accountService = container.resolve(AccountService.self) + apiService = container.resolve(ApiService.self) + dialogService = container.resolve(DialogService.self) + klyServiceApiService = container.resolve(KlyServiceApiService.self) + klyNodeApiService = container.resolve(KlyNodeApiService.self) + vibroService = container.resolve(VibroService.self) + coreDataStack = container.resolve(CoreDataStack.self) + + addTransactionObserver() + } + + func addTransactionObserver() { + coinStorage.transactionsPublisher + .sink { [weak self] transactions in + self?.transactions = transactions + } + .store(in: &subscriptions) + } +} + +private extension KlyWalletService { func addObservers() { NotificationCenter.default .publisher(for: .AdamantAccountService.userLoggedIn, object: nil) @@ -168,7 +194,8 @@ final class LskWalletService: WalletCoreProtocol { .publisher(for: .AdamantAccountService.userLoggedOut, object: nil) .receive(on: OperationQueue.main) .sink { [weak self] _ in - self?.lskWallet = nil + self?.klyWallet = nil + if let balanceObserver = self?.balanceObserver { NotificationCenter.default.removeObserver(balanceObserver) self?.balanceObserver = nil @@ -180,22 +207,8 @@ final class LskWalletService: WalletCoreProtocol { .store(in: &subscriptions) } - func addTransactionObserver() { - coinStorage.transactionsPublisher - .sink { [weak self] transactions in - self?.transactions = transactions - } - .store(in: &subscriptions) - } - - func update() { - Task { - await update() - } - } - func update() async { - guard let wallet = lskWallet else { + guard let wallet = klyWallet else { return } @@ -213,11 +226,12 @@ final class LskWalletService: WalletCoreProtocol { wallet.nonce = nonce } - if let result = try? await getFees() { + if let result = try? await getFees(comment: .empty) { self.lastHeight = result.lastHeight - self.transactionFeeRaw = result.fee > LskWalletService.defaultFee + self.transactionFeeRaw = result.fee > KlyWalletService.defaultFee ? result.fee - : LskWalletService.defaultFee + : KlyWalletService.defaultFee + self.lastMinFeePerByte = result.minFeePerByte } if let balance = try? await getBalance() { @@ -251,34 +265,46 @@ final class LskWalletService: WalletCoreProtocol { setState(.upToDate) } - - // MARK: - Tools - func validate(address: String) -> AddressValidationResult { - return validateAddress(address) - } +} - func validateAddress(_ address: String) -> AddressValidationResult { - return LiskKit.Crypto.isValidBase32(address: address) ? .valid : .invalid(description: nil) - } - - func fromRawLsk(value: BigInt.BigUInt) -> String { - return Utilities.formatToPrecision(value, units: .custom(8), formattingDecimals: 8, decimalSeparator: ".", fallbackToScientific: false) +private extension KlyWalletService { + func getBalance() async throws -> Decimal { + guard let address = klyWallet?.address else { + throw WalletServiceError.notLogged + } + + return try await getBalance(address: address) } - func toRawLsk(value: Double) -> String { - if let formattedAmount = Utilities.parseToBigUInt("\(value)", decimals: 8) { - return "\(formattedAmount)" - } else { - return "--" + func getBalance(for address: String) async throws -> Decimal { + let result = await klyNodeApiService.requestAccountsApi { api in + let balanceRaw = try await api.balance(address: address) + let balance = BigUInt(balanceRaw?.availableBalance ?? "0") ?? .zero + return balance + } + + switch result { + case let .success(balance): + return balance.asDecimal(exponent: KlyWalletService.currencyExponent) + case let .failure(error): + throw error } } - func getFees() async throws -> (fee: BigUInt, lastHeight: UInt64) { - guard let wallet = lskWallet else { + func getNonce(address: String) async throws -> UInt64 { + let nonce = try await klyNodeApiService.requestAccountsApi { api in + try await api.nonce(address: address) + }.get() + + return UInt64(nonce) ?? .zero + } + + func getFees(comment: String) async throws -> (fee: BigUInt, lastHeight: UInt64, minFeePerByte: UInt64) { + guard let wallet = klyWallet else { throw WalletServiceError.notLogged } - let minFeePerByte = try await lskNodeApiService.requestAccountsApi { api in + let minFeePerByte = try await klyNodeApiService.requestAccountsApi { api in try await api.getFees().minFeePerByte }.get() @@ -287,7 +313,8 @@ final class LskWalletService: WalletCoreProtocol { fee: 0.00141, nonce: wallet.nonce, senderPublicKey: wallet.keyPair.publicKeyString, - recipientAddressBinary: wallet.binaryAddress + recipientAddressBinary: wallet.binaryAddress, + comment: comment ).sign( with: wallet.keyPair, for: Constants.chainID @@ -296,39 +323,62 @@ final class LskWalletService: WalletCoreProtocol { let feeValue = tempTransaction.getFee(with: minFeePerByte) let fee = BigUInt(feeValue) - let lastBlock = try await lskNodeApiService.requestAccountsApi { api in + let lastBlock = try await klyNodeApiService.requestAccountsApi { api in try await api.lastBlock() }.get() let height = UInt64(lastBlock.header.height) - return (fee: fee, lastHeight: height) + return (fee: fee, lastHeight: height, minFeePerByte: minFeePerByte) } - func isExist(address: String) async throws -> Bool { - try await lskServiceApiService.requestServiceApi { api in - try await withUnsafeThrowingContinuation { continuation in - api.exist(address: address) { result in - switch result { - case .success(let response): - continuation.resume(returning: response.data.isExists) - case .error(let error): - continuation.resume(throwing: error) - } - } - } - }.get() + func getFee(minFeePerByte: UInt64, comment: String) throws -> BigUInt { + guard let wallet = klyWallet else { + throw WalletServiceError.notLogged + } + + let tempTransaction = TransactionEntity().createTx( + amount: 100000000.0, + fee: 0.00141, + nonce: wallet.nonce, + senderPublicKey: wallet.keyPair.publicKeyString, + recipientAddressBinary: wallet.binaryAddress, + comment: comment + ).sign( + with: wallet.keyPair, + for: Constants.chainID + ) + + let feeValue = tempTransaction.getFee(with: minFeePerByte) + let fee = BigUInt(feeValue) + + return fee + } + + func setState(_ newState: WalletServiceState, silent: Bool = false) { + guard newState != state else { + return + } + + state = newState + + guard !silent else { return } + + NotificationCenter.default.post( + name: serviceStateChanged, + object: self, + userInfo: [AdamantUserInfoKey.WalletService.walletState: state] + ) } } -// MARK: - WalletInitiatedWithPassphrase -extension LskWalletService { - func initWallet(withPassphrase passphrase: String) async throws -> WalletAccount { +// MARK: - Init Wallet +private extension KlyWalletService { + func initWallet(passphrase: String) async throws -> WalletAccount { guard let adamant = accountService.account else { throw WalletServiceError.notLogged } - // MARK: 1. Prepare setState(.notInitiated) if enabled { @@ -336,19 +386,21 @@ extension LskWalletService { NotificationCenter.default.post(name: serviceEnabledChanged, object: self) } - // MARK: 2. Create keys and addresses do { - let keyPair = try LiskKit.Crypto.keyPair(fromPassphrase: passphrase, salt: "adm") + let keyPair = try LiskKit.Crypto.keyPair( + fromPassphrase: passphrase, + salt: salt + ) + let address = LiskKit.Crypto.address(fromPublicKey: keyPair.publicKeyString) - // MARK: 3. Update - let wallet = LskWallet( + let wallet = KlyWallet( address: address, keyPair: keyPair, nonce: .zero, isNewApi: true ) - self.lskWallet = wallet + self.klyWallet = wallet NotificationCenter.default.post( name: walletUpdatedNotification, @@ -356,7 +408,6 @@ extension LskWalletService { userInfo: [AdamantUserInfoKey.WalletService.wallet: wallet] ) } catch { - print("\(error)") throw WalletServiceError.accountNotFound } @@ -365,25 +416,23 @@ extension LskWalletService { NotificationCenter.default.post(name: serviceEnabledChanged, object: self) } - guard let eWallet = self.lskWallet else { + guard let eWallet = self.klyWallet else { throw WalletServiceError.accountNotFound } - // MARK: 4. Save into KVS - let service = self + // Save into KVS + do { let address = try await getWalletAddress(byAdamantAddress: adamant.address) if address != eWallet.address { - service.save(lskAddress: eWallet.address) { result in - service.kvsSaveCompletionRecursion(lskAddress: eWallet.address, result: result) - } + updateKvsAddress(eWallet.address) } - service.setState(.upToDate) + setState(.upToDate) Task { - await service.update() + await update() } return eWallet @@ -392,143 +441,102 @@ extension LskWalletService { case .walletNotInitiated: /// The ADM Wallet is not initialized. Check the balance of the current wallet /// and save the wallet address to kvs when dropshipping ADM - service.setState(.upToDate) + setState(.upToDate) Task { - await service.update() + await update() } - service.save(lskAddress: eWallet.address) { result in - service.kvsSaveCompletionRecursion(lskAddress: eWallet.address, result: result) - } + updateKvsAddress(eWallet.address) return eWallet default: - service.setState(.upToDate) + setState(.upToDate) throw error } } } - func setInitiationFailed(reason: String) { - setState(.initiationFailed(reason: reason)) - lskWallet = nil + func updateKvsAddress(_ address: String) { + Task { + do { + try await save(klyAddress: address) + } catch { + kvsSaveProcessError( + klyAddress: address, + error: error + ) + } + } } /// New accounts doesn't have enought money to save KVS. We need to wait for balance update, and then - retry save - private func kvsSaveCompletionRecursion(lskAddress: String, result: WalletServiceSimpleResult) { - if let observer = balanceObserver { - NotificationCenter.default.removeObserver(observer) - balanceObserver = nil - } - - switch result { - case .success: - break - - case .failure(let error): - switch error { - case .notEnoughMoney: // Possibly new account, we need to wait for dropship - // Register observer - let observer = NotificationCenter.default.addObserver(forName: NSNotification.Name.AdamantAccountService.accountDataUpdated, object: nil, queue: nil) { [weak self] _ in - guard let balance = self?.accountService.account?.balance, balance > AdamantApiService.KvsFee else { - return - } - - self?.save(lskAddress: lskAddress) { result in - self?.kvsSaveCompletionRecursion(lskAddress: lskAddress, result: result) - } - } - - // Save referense to unregister it later - balanceObserver = observer + func kvsSaveProcessError( + klyAddress: String, + error: Error + ) { + guard let error = error as? WalletServiceError, + case .notEnoughMoney = error + else { return } + + balanceObserver?.cancel() + + balanceObserver = NotificationCenter.default.publisher(for: .AdamantAccountService.accountDataUpdated) + .compactMap { [weak self] _ in + self?.accountService.account?.balance + } + .filter { $0 > AdamantApiService.KvsFee } + .sink { [weak self] _ in + guard let self = self else { return } - default: - print("\(error.localizedDescription)") + Task { + try await self.save(klyAddress: klyAddress) + self.balanceObserver?.cancel() + } } - } - } -} - -// MARK: - Dependencies -extension LskWalletService: SwinjectDependentService { - @MainActor - func injectDependencies(from container: Container) { - accountService = container.resolve(AccountService.self) - apiService = container.resolve(ApiService.self) - dialogService = container.resolve(DialogService.self) - lskServiceApiService = container.resolve(LskServiceApiService.self) - lskNodeApiService = container.resolve(LskNodeApiService.self) - vibroService = container.resolve(VibroService.self) - coreDataStack = container.resolve(CoreDataStack.self) - - addTransactionObserver() } -} - -// MARK: - Balances & addresses -extension LskWalletService { - func getBalance() async throws -> Decimal { - guard let address = lskWallet?.address else { + + /// - Parameters: + /// - klyAddress: Klayr address to save into KVS + /// - adamantAddress: Owner of Klayr address + func save(klyAddress: String) async throws { + guard let adamant = accountService.account, + let keypair = accountService.keypair + else { throw WalletServiceError.notLogged } - return try await getBalance(address: address) - } - - func getBalance(address: String) async throws -> Decimal { - let result = await lskNodeApiService.requestAccountsApi { api in - let balanceRaw = try await api.balance(address: address) - let balance = BigUInt(balanceRaw?.availableBalance ?? "0") ?? .zero - return balance + guard adamant.balance >= AdamantApiService.KvsFee else { + throw WalletServiceError.notEnoughMoney } - switch result { - case let .success(balance): - return balance.asDecimal(exponent: LskWalletService.currencyExponent) - case let .failure(error): - throw error - } - } - - func getNonce(address: String) async throws -> UInt64 { - let nonce = try await lskNodeApiService.requestAccountsApi { api in - try await api.nonce(address: address) - }.get() + let result = await apiService.store( + key: KlyWalletService.kvsAddress, + value: klyAddress, + type: .keyValue, + sender: adamant.address, + keypair: keypair + ) - return UInt64(nonce) ?? .zero - } - - func handleAccountSuccess(with balance: String?, completion: @escaping (WalletServiceResult) -> Void) { - let balance = BigUInt(balance ?? "0") ?? BigUInt(0) - completion(.success(balance.asDecimal(exponent: LskWalletService.currencyExponent))) - } - func handleAccountError(with error: APIError, completion: @escaping (WalletServiceResult) -> Void) { - if error == .noNetwork { - completion(.failure(.networkError)) - } else { - completion(.failure(.remoteServiceError(message: error.message))) - } - } - - func getLskAddress(byAdamandAddress address: String, completion: @escaping (ApiServiceResult) -> Void) { - Task { - let result = await apiService.get( - key: LskWalletService.kvsAddress, - sender: address - ) - - completion(result) + guard case .failure(let error) = result else { + return } + + throw WalletServiceError.apiError(error) } - func getWalletAddress(byAdamantAddress address: String) async throws -> String { + func getKlyWalletAddress( + byAdamantAddress address: String + ) async throws -> String { if let address = cachedWalletAddress[address], !address.isEmpty { return address } do { - let result = try await apiService.get(key: LskWalletService.kvsAddress, sender: address).get() + let result = try await apiService.get( + key: KlyWalletService.kvsAddress, + sender: address + ).get() guard let result = result else { throw WalletServiceError.walletNotInitiated @@ -539,77 +547,22 @@ extension LskWalletService { return result } catch _ as ApiServiceError { throw WalletServiceError.remoteServiceError( - message: "LSK Wallet: failed to get address from KVS" - ) - } - } - - func loadTransactions(offset: Int, limit: Int) async throws -> Int { - let trs = try await getTransactionsHistory(offset: offset, limit: limit) - - guard trs.count > 0 else { - hasMoreOldTransactions = false - return .zero - } - - coinStorage.append(trs) - return trs.count - } - - func getTransactionsHistory(offset: Int, limit: Int) async throws -> [TransactionDetails] { - try await getTransactions(offset: UInt(offset), limit: UInt(limit)) - } - - func getLocalTransactionHistory() -> [TransactionDetails] { - transactions - } -} - -// MARK: - KVS -extension LskWalletService { - /// - Parameters: - /// - lskAddress: Lisk address to save into KVS - /// - adamantAddress: Owner of Lisk address - /// - completion: success - private func save(lskAddress: String, completion: @escaping (WalletServiceSimpleResult) -> Void) { - guard let adamant = accountService.account, let keypair = accountService.keypair else { - completion(.failure(error: .notLogged)) - return - } - - guard adamant.balance >= AdamantApiService.KvsFee else { - completion(.failure(error: .notEnoughMoney)) - return - } - - Task { - let result = await apiService.store( - key: LskWalletService.kvsAddress, - value: lskAddress, - type: .keyValue, - sender: adamant.address, - keypair: keypair + message: "KLY Wallet: failed to get address from KVS" ) - - switch result { - case .success: - completion(.success) - - case .failure(let error): - completion(.failure(error: .apiError(error))) - } } } } -// MARK: - Transactions -extension LskWalletService { - func getTransactions(offset: UInt, limit: UInt = 100) async throws -> [Transactions.TransactionModel] { - guard let address = self.lskWallet?.address else { - throw WalletServiceError.internalError(message: "LSK Wallet: not found", error: nil) +private extension KlyWalletService { + func getTransactions( + offset: UInt, + limit: UInt = 100 + ) async throws -> [Transactions.TransactionModel] { + guard let address = self.klyWallet?.address else { + throw WalletServiceError.internalError(message: "KLY Wallet: not found", error: nil) } - return try await lskServiceApiService.requestServiceApi { api, completion in + return try await klyServiceApiService.requestServiceApi { api, completion in api.transactions( ownerAddress: address, senderIdOrRecipientId: address, @@ -621,14 +574,14 @@ extension LskWalletService { }.get() } - func getTransaction(by hash: String) async throws -> Transactions.TransactionModel { + func getTransaction(hash: String) async throws -> Transactions.TransactionModel { guard !hash.isEmpty else { throw ApiServiceError.internalError(message: "No hash", error: nil) } - let ownerAddress = wallet?.address + let ownerAddress = klyWallet?.address - let result = try await lskServiceApiService.requestServiceApi { api, completion in + let result = try await klyServiceApiService.requestServiceApi { api, completion in api.transactions( ownerAddress: ownerAddress, id: hash, @@ -640,31 +593,23 @@ extension LskWalletService { if let transaction = result.first { return transaction - } else { - throw WalletServiceError.remoteServiceError(message: "No transaction") } + + throw WalletServiceError.remoteServiceError(message: "No transaction") } - func updateStatus(for id: String, status: TransactionStatus?) { - coinStorage.updateStatus(for: id, status: status) - } -} - -// MARK: - PrivateKey generator -extension LskWalletService: PrivateKeyGenerator { - var rowTitle: String { - return "Lisk" - } - - var rowImage: UIImage? { - return .asset(named: "lisk_wallet_row") - } - - func generatePrivateKeyFor(passphrase: String) -> String? { - guard AdamantUtilities.validateAdamantPassphrase(passphrase: passphrase), let keypair = try? LiskKit.Crypto.keyPair(fromPassphrase: passphrase, salt: "adm") else { - return nil - } - - return keypair.privateKeyString + func isAccountExist(with address: String) async throws -> Bool { + try await klyServiceApiService.requestServiceApi { api in + try await withUnsafeThrowingContinuation { continuation in + api.exist(address: address) { result in + switch result { + case .success(let response): + continuation.resume(returning: response.data.isExists) + case .error(let error): + continuation.resume(throwing: error) + } + } + } + }.get() } } diff --git a/Adamant/Modules/Wallets/Lisk/LskWallet.swift b/Adamant/Modules/Wallets/Lisk/LskWallet.swift deleted file mode 100644 index 4eb1fe9c5..000000000 --- a/Adamant/Modules/Wallets/Lisk/LskWallet.swift +++ /dev/null @@ -1,41 +0,0 @@ -// -// LskWallet.swift -// Adamant -// -// Created by Anokhov Pavel on 03.08.2018. -// Copyright © 2018 Adamant. All rights reserved. -// - -import Foundation -import LiskKit - -final class LskWallet: WalletAccount { - - var address: String { - return isNewApi ? lisk32Address : legacyAddress - } - - var binaryAddress: String { - return isNewApi ? LiskKit.Crypto.getBinaryAddressFromBase32(lisk32Address) ?? "" : legacyAddress - } - - let legacyAddress: String - let lisk32Address: String - let keyPair: KeyPair - var balance: Decimal = 0.0 - var notifications: Int = 0 - var isNewApi: Bool = true - var nonce: UInt64 - var minBalance: Decimal = 0.05 - var minAmount: Decimal = 0 - var isBalanceInitialized: Bool = false - - init(address: String, keyPair: KeyPair, nonce: UInt64, isNewApi: Bool) { - self.legacyAddress = address - self.keyPair = keyPair - self.lisk32Address = LiskKit.Crypto.getBase32Address(from: keyPair.publicKeyString) - self.isNewApi = isNewApi - self.nonce = nonce - } - -} diff --git a/Adamant/Modules/Wallets/Lisk/LskWalletViewController.swift b/Adamant/Modules/Wallets/Lisk/LskWalletViewController.swift deleted file mode 100644 index af0544723..000000000 --- a/Adamant/Modules/Wallets/Lisk/LskWalletViewController.swift +++ /dev/null @@ -1,34 +0,0 @@ -// -// LskWalletViewController.swift -// Adamant -// -// Created by Anton Boyarkin on 27/11/2018. -// Copyright © 2018 Adamant. All rights reserved. -// - -import UIKit -import CommonKit - -extension String.adamant { - static var lisk: String { - String.localized("AccountTab.Wallets.lisk_wallet", comment: "Account tab: Lisk wallet") - } - - static var sendLsk: String { - String.localized("AccountTab.Row.SendLsk", comment: "Account tab: 'Send LSK tokens' button") - } -} - -final class LskWalletViewController: WalletViewControllerBase { - override func sendRowLocalizedLabel() -> NSAttributedString { - return NSAttributedString(string: String.adamant.sendLsk) - } - - override func encodeForQr(address: String) -> String? { - return "lisk:\(address)" - } - - override func setTitle() { - walletTitleLabel.text = String.adamant.lisk - } -} diff --git a/Adamant/Modules/Wallets/TransferViewControllerBase.swift b/Adamant/Modules/Wallets/TransferViewControllerBase.swift index 6b3fa1496..6c5065f5b 100644 --- a/Adamant/Modules/Wallets/TransferViewControllerBase.swift +++ b/Adamant/Modules/Wallets/TransferViewControllerBase.swift @@ -67,6 +67,9 @@ extension String.adamant { static var useMaxToTransfer: String { String.localized("TransferScene.UseMaxToTransfer", comment: "Tranfser: Confirm using maximum available for transfer tokens as amount to transfer.") } + static var unknownToken: String { + String.localized("Transaction.UnknownTokenTitle", comment: "Transaction: Unknown token") + } } } @@ -98,6 +101,7 @@ class TransferViewControllerBase: FormViewController { case total case comments case sendButton + case blockchainComments(coin: String) var tag: String { switch self { @@ -112,6 +116,7 @@ class TransferViewControllerBase: FormViewController { case .total: return "total" case .comments: return "comments" case .sendButton: return "send" + case .blockchainComments: return "blockchainComments" } } @@ -126,6 +131,11 @@ class TransferViewControllerBase: FormViewController { case .fee: return .localized("TransferScene.Row.TransactionFee", comment: "Transfer: transfer fee") case .total: return .localized("TransferScene.Row.Total", comment: "Transfer: total amount of transaction: money to transfer adding fee") case .comments: return .localized("TransferScene.Row.Comments", comment: "Transfer: transfer comment") + case let .blockchainComments(coin): + return String.localizedStringWithFormat(.localized( + "TransferScene.Row.Blockchain.Comments", + comment: "Transfer: Blockchain transfer comment" + ), coin) case .sendButton: return String.adamant.transfer.send case .increaseFee: return .localized("TransferScene.Row.IncreaseFee", comment: "Transfer: transfer increase fee") } @@ -137,6 +147,7 @@ class TransferViewControllerBase: FormViewController { case recipient case transferInfo case comments + case blockchainComments(coin: String) var tag: String { switch self { @@ -144,6 +155,7 @@ class TransferViewControllerBase: FormViewController { case .recipient: return "rcp" case .transferInfo: return "trsfr" case .comments: return "cmmnt" + case .blockchainComments: return "blockchainComments" } } @@ -153,6 +165,11 @@ class TransferViewControllerBase: FormViewController { case .recipient: return .localized("TransferScene.Section.Recipient", comment: "Transfer: 'Recipient info' section") case .transferInfo: return .localized("TransferScene.Section.TransferInfo", comment: "Transfer: 'Transfer info' section") case .comments: return .localized("TransferScene.Row.Comments", comment: "Transfer: transfer comment") + case let .blockchainComments(coin): + return String.localizedStringWithFormat(.localized( + "TransferScene.Row.Blockchain.Comments", + comment: "Transfer: Blockchain transfer comment" + ), coin) } } } @@ -181,6 +198,8 @@ class TransferViewControllerBase: FormViewController { var rootCoinBalance: Decimal? var isNeedAddFee: Bool { true } var replyToMessageId: String? + var blockchainCommentsEnabled: Bool { false } + var maxBlockchainCommentLenght: Int { 64 } static let invalidCharacters: CharacterSet = { CharacterSet( @@ -342,6 +361,10 @@ class TransferViewControllerBase: FormViewController { form.append(commentsSection()) } + if blockchainCommentsEnabled { + form.append(blockchainCommentsSection()) + } + // MARK: Button section form +++ Section() <<< ButtonRow { @@ -556,6 +579,17 @@ class TransferViewControllerBase: FormViewController { return section } + func blockchainCommentsSection() -> Section { + let commentSection = Sections.blockchainComments(coin: walletCore.tokenName) + let section = Section(commentSection.localized) { + $0.tag = commentSection.tag + } + + section.append(defaultRowFor(baseRow: .blockchainComments(coin: walletCore.tokenName))) + + return section + } + // MARK: - Tools @discardableResult @@ -1164,6 +1198,21 @@ extension TransferViewControllerBase { return row + case .blockchainComments: + let row = TextAreaRow { + $0.tag = BaseRows.blockchainComments(coin: walletCore.tokenName).tag + $0.textAreaHeight = .dynamic(initialTextViewHeight: 44) + $0.useFormatterDuringInput = true + $0.formatter = StringMaxLengthFormatter(maxLength: maxBlockchainCommentLenght) + }.onChange { [weak self] row in + self?.updateToolbar(for: row) + self?.updateFeeCell() + }.cellUpdate { (cell, _) in + cell.textView?.backgroundColor = UIColor.clear + } + + return row + case .sendButton: return ButtonRow { $0.title = BaseRows.sendButton.localized @@ -1233,7 +1282,10 @@ extension TransferViewControllerBase { return !havePending } - func doesNotContainSendingTx(with nonce: String) async -> Bool { + func doesNotContainSendingTx( + with nonce: String, + senderAddress: String + ) async -> Bool { var history = walletCore.getLocalTransactionHistory() if history.isEmpty { @@ -1243,7 +1295,10 @@ extension TransferViewControllerBase { ) ?? [] } - let nonces = history.compactMap { $0.nonceRaw } + let nonces = history.filter { + $0.senderAddress == senderAddress + && $0.transactionStatus != .failed + }.compactMap { $0.nonceRaw } return !nonces.contains(nonce) } diff --git a/Adamant/Modules/Wallets/WalletsService/WalletCoreProtocol.swift b/Adamant/Modules/Wallets/WalletsService/WalletCoreProtocol.swift index c5496b4df..a204a8342 100644 --- a/Adamant/Modules/Wallets/WalletsService/WalletCoreProtocol.swift +++ b/Adamant/Modules/Wallets/WalletsService/WalletCoreProtocol.swift @@ -305,6 +305,7 @@ protocol WalletCoreProtocol: AnyObject { func initWallet(withPassphrase: String) async throws -> WalletAccount func setInitiationFailed(reason: String) func shortDescription(for transaction: RichMessageTransaction) -> NSAttributedString + func getFee(comment: String) -> Decimal // MARK: Send @@ -326,6 +327,7 @@ protocol WalletCoreProtocol: AnyObject { extension WalletCoreProtocol { func isExist(address: String) async throws -> Bool { return true } + func getFee(comment: String) -> Decimal { transactionFee } } extension WalletCoreProtocol { @@ -380,7 +382,8 @@ protocol WalletServiceTwoStepSend: WalletCoreProtocol { func createTransaction( recipient: String, amount: Decimal, - fee: Decimal + fee: Decimal, + comment: String? ) async throws -> T func sendTransaction(_ transaction: T) async throws diff --git a/Adamant/Services/NodesStorage.swift b/Adamant/Services/NodesStorage.swift index 8a7b4089f..f58c484f4 100644 --- a/Adamant/Services/NodesStorage.swift +++ b/Adamant/Services/NodesStorage.swift @@ -122,10 +122,10 @@ private extension NodesStorage { return BtcWalletService.nodes.map { .init(group: .btc, node: $0) } case .eth: return EthWalletService.nodes.map { .init(group: .eth, node: $0) } - case .lskNode: - return LskWalletService.nodes.map { .init(group: .lskNode, node: $0) } - case .lskService: - return LskWalletService.serviceNodes.map { .init(group: .lskService, node: $0) } + case .klyNode: + return KlyWalletService.nodes.map { .init(group: .klyNode, node: $0) } + case .klyService: + return KlyWalletService.serviceNodes.map { .init(group: .klyService, node: $0) } case .doge: return DogeWalletService.nodes.map { .init(group: .doge, node: $0) } case .dash: diff --git a/Adamant/Utilities/AdamantUtilities+extended.swift b/Adamant/Utilities/AdamantUtilities+extended.swift index 993f0a9e5..2610c8123 100644 --- a/Adamant/Utilities/AdamantUtilities+extended.swift +++ b/Adamant/Utilities/AdamantUtilities+extended.swift @@ -79,6 +79,11 @@ extension AdamantUtilities { /// - No -$%èçïäł- caracters /// - 12 words, splitted by a single whitespace /// - a-z + + static func validateAdamantPassphrase(_ passphrase: String) -> Bool { + validateAdamantPassphrase(passphrase: passphrase) + } + static func validateAdamantPassphrase(passphrase: String) -> Bool { guard validate(string: passphrase, with: passphraseRegex) else { return false diff --git a/CommonKit/Sources/CommonKit/AdamantDynamicResources.swift b/CommonKit/Sources/CommonKit/AdamantDynamicResources.swift index 5aebf8810..5b46f2aa1 100644 --- a/CommonKit/Sources/CommonKit/AdamantDynamicResources.swift +++ b/CommonKit/Sources/CommonKit/AdamantDynamicResources.swift @@ -16,9 +16,9 @@ Node(url: URL(string: "http://184.94.215.92:45555")!), Node(url: URL(string: "https://node1.adamant.business")!, altUrl: URL(string: "http://194.233.75.29:45555")), Node(url: URL(string: "https://node2.blockchain2fa.io")!), Node(url: URL(string: "https://phecda.adm.im")!, altUrl: URL(string: "http://46.250.234.248:36666")), -Node(url: URL(string: "https://tegmine.adm.im")!, altUrl: URL(string: "http://5.104.87.219:36666")), +Node(url: URL(string: "https://tegmine.adm.im")!), Node(url: URL(string: "https://tauri.adm.im")!, altUrl: URL(string: "http://154.26.159.245:36666")), -Node(url: URL(string: "https://dschubba.adm.im")!, altUrl: URL(string: "http://85.239.234.17:36666")), +Node(url: URL(string: "https://dschubba.adm.im")!), ] } diff --git a/CommonKit/Sources/CommonKit/Assets/Localization/de.lproj/Localizable.strings b/CommonKit/Sources/CommonKit/Assets/Localization/de.lproj/Localizable.strings index 085ad7956..4088c7870 100644 --- a/CommonKit/Sources/CommonKit/Assets/Localization/de.lproj/Localizable.strings +++ b/CommonKit/Sources/CommonKit/Assets/Localization/de.lproj/Localizable.strings @@ -184,8 +184,8 @@ /* Account tab: 'Send ETH tokens' button */ "AccountTab.Row.SendEth" = "ETH senden"; -/* Account tab: 'Send LSK tokens' button */ -"AccountTab.Row.SendLsk" = "LSK senden"; +/* Account tab: 'Send KLY tokens' button */ +"AccountTab.Row.SendKly" = "KLY senden"; /* Account tab: 'Send BTC tokens' button */ "AccountTab.Row.SendBtc" = "BTC "; @@ -241,8 +241,8 @@ /* Account tab: Ethereum wallet */ "AccountTab.Wallets.ethereum_wallet" = "Ethereum Wallet"; -/* Account tab: Lisk wallet */ -"AccountTab.Wallets.lisk_wallet" = "Lisk Wallet"; +/* Account tab: Klayr wallet */ +"AccountTab.Wallets.kly_wallet" = "Klayr Wallet"; /* Account tab: Bitcoin wallet */ "AccountTab.Wallets.bitcoin_wallet" = "Bitcoin Wallet"; @@ -1126,6 +1126,9 @@ /* Transfer: comment for transfer in chat */ "TransferScene.Row.Comments" = "Bemerkungen"; +/* Transfer: Blockchain comment for transfer in chat */ +"TransferScene.Row.Blockchain.Comments" = "Öffentliche Nachricht in %@ Blockchain"; + /* Transfer: transfer increase fee */ "TransferScene.Row.IncreaseFee" = "Gebühr erhöhen"; @@ -1239,3 +1242,6 @@ /* Include partner url */ "PartnerQR.includePartnerURL" = "Koppeling naar webapp opnemen"; + +/* Transaction: Unknown token */ +"Transaction.UnknownTokenTitle" = "Unbekannt"; diff --git a/CommonKit/Sources/CommonKit/Assets/Localization/en.lproj/Localizable.strings b/CommonKit/Sources/CommonKit/Assets/Localization/en.lproj/Localizable.strings index 95c1d1f23..37bca7fef 100644 --- a/CommonKit/Sources/CommonKit/Assets/Localization/en.lproj/Localizable.strings +++ b/CommonKit/Sources/CommonKit/Assets/Localization/en.lproj/Localizable.strings @@ -181,8 +181,8 @@ /* Account tab: 'Send ETH tokens' button */ "AccountTab.Row.SendEth" = "Send ETH"; -/* Account tab: 'Send LSK tokens' button */ -"AccountTab.Row.SendLsk" = "Send LSK"; +/* Account tab: 'Send KLY tokens' button */ +"AccountTab.Row.SendKly" = "Send KLY"; /* Account tab: 'Send BTC tokens' button */ "AccountTab.Row.SendBtc" = "Send BTC"; @@ -238,8 +238,8 @@ /* Account tab: Ethereum wallet */ "AccountTab.Wallets.ethereum_wallet" = "Ethereum Wallet"; -/* Account tab: Lisk wallet */ -"AccountTab.Wallets.lisk_wallet" = "Lisk Wallet"; +/* Account tab: Klayr wallet */ +"AccountTab.Wallets.kly_wallet" = "Klayr Wallet"; /* Account tab: Bitcoin wallet */ "AccountTab.Wallets.bitcoin_wallet" = "Bitcoin Wallet"; @@ -1099,6 +1099,9 @@ /* Transfer: comment for transfer in chat */ "TransferScene.Row.Comments" = "Comments"; +/* Transfer: Blockchain comment for transfer in chat */ +"TransferScene.Row.Blockchain.Comments" = "Public message in %@ blockchain"; + /* Transfer: transfer increase fee */ "TransferScene.Row.IncreaseFee" = "Increase fee"; @@ -1212,3 +1215,6 @@ /* Include partner url */ "PartnerQR.includePartnerURL" = "Include Web app link"; + +/* Transaction: Unknown token */ +"Transaction.UnknownTokenTitle" = "Unknown"; diff --git a/CommonKit/Sources/CommonKit/Assets/Localization/ru.lproj/Localizable.strings b/CommonKit/Sources/CommonKit/Assets/Localization/ru.lproj/Localizable.strings index b67494f1e..066703b31 100644 --- a/CommonKit/Sources/CommonKit/Assets/Localization/ru.lproj/Localizable.strings +++ b/CommonKit/Sources/CommonKit/Assets/Localization/ru.lproj/Localizable.strings @@ -172,8 +172,8 @@ /* Account tab: 'Send ETH tokens' button */ "AccountTab.Row.SendEth" = "Отправить ETH"; -/* Account tab: 'Send LSK tokens' button */ -"AccountTab.Row.SendLsk" = "Отправить LSK"; +/* Account tab: 'Send KLY tokens' button */ +"AccountTab.Row.SendKly" = "Отправить KLY"; /* Account tab: 'Send BTC tokens' button */ "AccountTab.Row.SendBtc" = "Отправить BTC"; @@ -238,8 +238,8 @@ /* Account tab: Ethereum wallet */ "AccountTab.Wallets.ethereum_wallet" = "Кошелек Ethereum"; -/* Account tab: Lisk wallet */ -"AccountTab.Wallets.lisk_wallet" = "Кошелек Lisk"; +/* Account tab: Klayr wallet */ +"AccountTab.Wallets.kly_wallet" = "Кошелек Klayr"; /* Account tab: Bitcoin wallet */ "AccountTab.Wallets.bitcoin_wallet" = "Кошелек Bitcoin"; @@ -1096,6 +1096,9 @@ /* Transfer: comment for transfer in chat */ "TransferScene.Row.Comments" = "Комментарии"; +/* Transfer: Blockchain comment for transfer in chat */ +"TransferScene.Row.Blockchain.Comments" = "Публичное сообщение в %@ блокчейне"; + /* Transfer: transfer increase fee */ "TransferScene.Row.IncreaseFee" = "Увеличить комиссию"; @@ -1209,3 +1212,6 @@ /* Include partner url */ "PartnerQR.includePartnerURL" = "Добавить ссылку на веб-приложение"; + +/* Transaction: Unknown token */ +"Transaction.UnknownTokenTitle" = "Unknown"; diff --git a/CommonKit/Sources/CommonKit/Assets/Localization/zh.lproj/Localizable.strings b/CommonKit/Sources/CommonKit/Assets/Localization/zh.lproj/Localizable.strings index a164356b3..63fafa539 100644 --- a/CommonKit/Sources/CommonKit/Assets/Localization/zh.lproj/Localizable.strings +++ b/CommonKit/Sources/CommonKit/Assets/Localization/zh.lproj/Localizable.strings @@ -181,8 +181,8 @@ /* Account tab: 'Send ETH tokens' button */ "AccountTab.Row.SendEth" = "发送ETH"; -/* Account tab: 'Send LSK tokens' button */ -"AccountTab.Row.SendLsk" = "发送LSK"; +/* Account tab: 'Send KLY tokens' button */ +"AccountTab.Row.SendKly" = "发送KLY"; /* Account tab: 'Send BTC tokens' button */ "AccountTab.Row.SendBtc" = "发送BTC"; @@ -238,8 +238,8 @@ /* Account tab: Ethereum wallet */ "AccountTab.Wallets.ethereum_wallet" = "以太坊钱包"; -/* Account tab: Lisk wallet */ -"AccountTab.Wallets.lisk_wallet" = "Lisk钱包"; +/* Account tab: Klayr wallet */ +"AccountTab.Wallets.kly_wallet" = "Klayr钱包"; /* Account tab: Bitcoin wallet */ "AccountTab.Wallets.bitcoin_wallet" = "比特币钱包"; @@ -1096,6 +1096,9 @@ /* Transfer: comment for transfer in chat */ "TransferScene.Row.Comments" = "评论"; +/* Transfer: Blockchain comment for transfer in chat */ +"TransferScene.Row.Blockchain.Comments" = "区块链 %@ 中的公开信息"; + /* Transfer: transfer increase fee */ "TransferScene.Row.IncreaseFee" = "增加费用"; @@ -1209,3 +1212,6 @@ /* Include partner url */ "PartnerQR.includePartnerURL" = "包括Web应用程序链接"; + +/* Transaction: Unknown token */ +"Transaction.UnknownTokenTitle" = "未知"; diff --git a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_notification.imageset/Contents.json b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_notification.imageset/Contents.json new file mode 100644 index 000000000..ad8ca4a0a --- /dev/null +++ b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_notification.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "klayr_notification.png" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "klayr_notification@2x.png" + }, + { + "idiom" : "universal", + "scale" : "3x", + "filename" : "klayr_notification@3x.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_notification.imageset/klayr_notification.png b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_notification.imageset/klayr_notification.png new file mode 100644 index 000000000..fb15bc8dc Binary files /dev/null and b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_notification.imageset/klayr_notification.png differ diff --git a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_notification.imageset/klayr_notification@2x.png b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_notification.imageset/klayr_notification@2x.png new file mode 100644 index 000000000..a687ffb16 Binary files /dev/null and b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_notification.imageset/klayr_notification@2x.png differ diff --git a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_notification.imageset/klayr_notification@3x.png b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_notification.imageset/klayr_notification@3x.png new file mode 100644 index 000000000..351eb87db Binary files /dev/null and b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_notification.imageset/klayr_notification@3x.png differ diff --git a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_wallet.imageset/Contents.json b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_wallet.imageset/Contents.json new file mode 100644 index 000000000..d29b8f225 --- /dev/null +++ b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_wallet.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "klayr_wallet.png" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "klayr_wallet@2x.png" + }, + { + "idiom" : "universal", + "scale" : "3x", + "filename" : "klayr_wallet@3x.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_wallet.imageset/klayr_wallet.png b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_wallet.imageset/klayr_wallet.png new file mode 100644 index 000000000..fb15bc8dc Binary files /dev/null and b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_wallet.imageset/klayr_wallet.png differ diff --git a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_wallet.imageset/klayr_wallet@2x.png b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_wallet.imageset/klayr_wallet@2x.png new file mode 100644 index 000000000..a687ffb16 Binary files /dev/null and b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_wallet.imageset/klayr_wallet@2x.png differ diff --git a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_wallet.imageset/klayr_wallet@3x.png b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_wallet.imageset/klayr_wallet@3x.png new file mode 100644 index 000000000..351eb87db Binary files /dev/null and b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_wallet.imageset/klayr_wallet@3x.png differ diff --git a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_wallet_row.imageset/Contents.json b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_wallet_row.imageset/Contents.json new file mode 100644 index 000000000..7fcd1e574 --- /dev/null +++ b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_wallet_row.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "idiom" : "universal", + "scale" : "1x", + "filename" : "klayr_wallet_row.png" + }, + { + "idiom" : "universal", + "scale" : "2x", + "filename" : "klayr_wallet_row@2x.png" + }, + { + "idiom" : "universal", + "scale" : "3x", + "filename" : "klayr_wallet_row@3x.png" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} diff --git a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_wallet_row.imageset/klayr_wallet_row.png b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_wallet_row.imageset/klayr_wallet_row.png new file mode 100644 index 000000000..f65fc841f Binary files /dev/null and b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_wallet_row.imageset/klayr_wallet_row.png differ diff --git a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_wallet_row.imageset/klayr_wallet_row@2x.png b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_wallet_row.imageset/klayr_wallet_row@2x.png new file mode 100644 index 000000000..1f280c79e Binary files /dev/null and b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_wallet_row.imageset/klayr_wallet_row@2x.png differ diff --git a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_wallet_row.imageset/klayr_wallet_row@3x.png b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_wallet_row.imageset/klayr_wallet_row@3x.png new file mode 100644 index 000000000..8e6a9d68d Binary files /dev/null and b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/klayr_wallet_row.imageset/klayr_wallet_row@3x.png differ diff --git a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_notification.imageset/mana_notification.png b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_notification.imageset/mana_notification.png index 70727957c..fbe64f4f3 100644 Binary files a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_notification.imageset/mana_notification.png and b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_notification.imageset/mana_notification.png differ diff --git a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_notification.imageset/mana_notification@2x.png b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_notification.imageset/mana_notification@2x.png index a9c39f9bf..1e3cbb489 100644 Binary files a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_notification.imageset/mana_notification@2x.png and b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_notification.imageset/mana_notification@2x.png differ diff --git a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_notification.imageset/mana_notification@3x.png b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_notification.imageset/mana_notification@3x.png index ef189dde4..472edef83 100644 Binary files a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_notification.imageset/mana_notification@3x.png and b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_notification.imageset/mana_notification@3x.png differ diff --git a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_wallet.imageset/mana_wallet.png b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_wallet.imageset/mana_wallet.png index 70727957c..fbe64f4f3 100644 Binary files a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_wallet.imageset/mana_wallet.png and b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_wallet.imageset/mana_wallet.png differ diff --git a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_wallet.imageset/mana_wallet@2x.png b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_wallet.imageset/mana_wallet@2x.png index a9c39f9bf..1e3cbb489 100644 Binary files a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_wallet.imageset/mana_wallet@2x.png and b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_wallet.imageset/mana_wallet@2x.png differ diff --git a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_wallet.imageset/mana_wallet@3x.png b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_wallet.imageset/mana_wallet@3x.png index ef189dde4..472edef83 100644 Binary files a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_wallet.imageset/mana_wallet@3x.png and b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_wallet.imageset/mana_wallet@3x.png differ diff --git a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_wallet_row.imageset/mana_wallet_row.png b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_wallet_row.imageset/mana_wallet_row.png index 70727957c..fbe64f4f3 100644 Binary files a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_wallet_row.imageset/mana_wallet_row.png and b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_wallet_row.imageset/mana_wallet_row.png differ diff --git a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_wallet_row.imageset/mana_wallet_row@2x.png b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_wallet_row.imageset/mana_wallet_row@2x.png index a9c39f9bf..1e3cbb489 100644 Binary files a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_wallet_row.imageset/mana_wallet_row@2x.png and b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_wallet_row.imageset/mana_wallet_row@2x.png differ diff --git a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_wallet_row.imageset/mana_wallet_row@3x.png b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_wallet_row.imageset/mana_wallet_row@3x.png index ef189dde4..472edef83 100644 Binary files a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_wallet_row.imageset/mana_wallet_row@3x.png and b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/mana_wallet_row.imageset/mana_wallet_row@3x.png differ diff --git a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/no-token.imageset/Contents.json b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/no-token.imageset/Contents.json new file mode 100644 index 000000000..88cbb81ed --- /dev/null +++ b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/no-token.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "no-token.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "no-token@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "no-token@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/no-token.imageset/no-token.png b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/no-token.imageset/no-token.png new file mode 100644 index 000000000..ee0a0b29a Binary files /dev/null and b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/no-token.imageset/no-token.png differ diff --git a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/no-token.imageset/no-token@2x.png b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/no-token.imageset/no-token@2x.png new file mode 100644 index 000000000..72863cedc Binary files /dev/null and b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/no-token.imageset/no-token@2x.png differ diff --git a/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/no-token.imageset/no-token@3x.png b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/no-token.imageset/no-token@3x.png new file mode 100644 index 000000000..014f9a68c Binary files /dev/null and b/CommonKit/Sources/CommonKit/Assets/Shared.xcassets/Wallets/no-token.imageset/no-token@3x.png differ diff --git a/CommonKit/Sources/CommonKit/Helpers/StringMaxLengthFormatter.swift b/CommonKit/Sources/CommonKit/Helpers/StringMaxLengthFormatter.swift new file mode 100644 index 000000000..117ac3e9d --- /dev/null +++ b/CommonKit/Sources/CommonKit/Helpers/StringMaxLengthFormatter.swift @@ -0,0 +1,41 @@ +// +// StringMaxLengthFormatter.swift +// +// +// Created by Stanislav Jelezoglo on 12.07.2024. +// + +import Foundation + +public class StringMaxLengthFormatter: Formatter { + private let maxLength: Int + + public init(maxLength: Int) { + self.maxLength = maxLength + super.init() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + public override func string(for obj: Any?) -> String? { + guard let string = obj as? String else { + return nil + } + + return String(string.prefix(maxLength)) + } + + public override func getObjectValue( + _ obj: AutoreleasingUnsafeMutablePointer?, + for string: String, + errorDescription error: AutoreleasingUnsafeMutablePointer? + ) -> Bool { + if let obj = obj { + obj.pointee = self.string(for: string) as AnyObject? + } + + return true + } +} diff --git a/CommonKit/Sources/CommonKit/Models/NodeGroup+Constants.swift b/CommonKit/Sources/CommonKit/Models/NodeGroup+Constants.swift index 609311d0a..a5113d3f4 100644 --- a/CommonKit/Sources/CommonKit/Models/NodeGroup+Constants.swift +++ b/CommonKit/Sources/CommonKit/Models/NodeGroup+Constants.swift @@ -12,7 +12,7 @@ public extension NodeGroup { switch self { case .adm: return false - case .eth, .lskNode, .lskService, .doge, .dash, .btc: + case .eth, .doge, .dash, .btc, .klyNode, .klyService: return true } } diff --git a/CommonKit/Sources/CommonKit/Models/NodeGroup.swift b/CommonKit/Sources/CommonKit/Models/NodeGroup.swift index d87fb9d80..e76fc8001 100644 --- a/CommonKit/Sources/CommonKit/Models/NodeGroup.swift +++ b/CommonKit/Sources/CommonKit/Models/NodeGroup.swift @@ -8,8 +8,8 @@ public enum NodeGroup: Codable, CaseIterable, Hashable { case btc case eth - case lskNode - case lskService + case klyNode + case klyService case doge case dash case adm diff --git a/CommonKit/Sources/CommonKit/Models/ethereumTokensList.swift b/CommonKit/Sources/CommonKit/Models/ethereumTokensList.swift index 9a066ce24..ba9b9f614 100644 --- a/CommonKit/Sources/CommonKit/Models/ethereumTokensList.swift +++ b/CommonKit/Sources/CommonKit/Models/ethereumTokensList.swift @@ -34,7 +34,7 @@ contractAddress: "0x19062190B1925b5b6689D7073fDfC8c2976EF8Cb", decimals: 16, naturalUnits: 16, - defaultVisibility: true, + defaultVisibility: false, defaultOrdinalLevel: 95, reliabilityGasPricePercent: 10, reliabilityGasLimitPercent: 10, @@ -47,8 +47,8 @@ contractAddress: "0x6b175474e89094c44da98b954eedeac495271d0f", decimals: 18, naturalUnits: 18, - defaultVisibility: true, - defaultOrdinalLevel: 50, + defaultVisibility: false, + defaultOrdinalLevel: 80, reliabilityGasPricePercent: 10, reliabilityGasLimitPercent: 10, defaultGasPriceGwei: 30, @@ -73,7 +73,7 @@ contractAddress: "0xcf0c122c6b73ff809c693db761e7baebe62b6a2e", decimals: 9, naturalUnits: 9, - defaultVisibility: true, + defaultVisibility: false, defaultOrdinalLevel: 100, reliabilityGasPricePercent: 10, reliabilityGasLimitPercent: 10, @@ -86,7 +86,7 @@ contractAddress: "0x720CD16b011b987Da3518fbf38c3071d4F0D1495", decimals: 8, naturalUnits: 8, - defaultVisibility: true, + defaultVisibility: false, defaultOrdinalLevel: 90, reliabilityGasPricePercent: 10, reliabilityGasLimitPercent: 10, @@ -99,7 +99,7 @@ contractAddress: "0xe66747a101bff2dba3697199dcce5b743b454759", decimals: 18, naturalUnits: 18, - defaultVisibility: true, + defaultVisibility: false, defaultOrdinalLevel: 115, reliabilityGasPricePercent: 10, reliabilityGasLimitPercent: 10, @@ -216,7 +216,7 @@ contractAddress: "0x00c83aecc790e8a4453e5dd3b0b4b3680501a7a7", decimals: 18, naturalUnits: 18, - defaultVisibility: true, + defaultVisibility: false, defaultOrdinalLevel: 85, reliabilityGasPricePercent: 10, reliabilityGasLimitPercent: 10, @@ -255,7 +255,7 @@ contractAddress: "0xb64ef51c888972c908cfacf59b47c1afbc0ab8ac", decimals: 8, naturalUnits: 8, - defaultVisibility: true, + defaultVisibility: false, defaultOrdinalLevel: 105, reliabilityGasPricePercent: 10, reliabilityGasLimitPercent: 10, @@ -346,7 +346,7 @@ contractAddress: "0x249cA82617eC3DfB2589c4c17ab7EC9765350a18", decimals: 18, naturalUnits: 18, - defaultVisibility: true, + defaultVisibility: false, defaultOrdinalLevel: 95, reliabilityGasPricePercent: 10, reliabilityGasLimitPercent: 10, @@ -372,7 +372,7 @@ contractAddress: "0xa2cd3d43c775978a96bdbf12d733d5a1ed94fb18", decimals: 18, naturalUnits: 18, - defaultVisibility: true, + defaultVisibility: false, defaultOrdinalLevel: 110, reliabilityGasPricePercent: 10, reliabilityGasLimitPercent: 10, diff --git a/CommonKit/Sources/CommonKit/RichMessageProviders/LskProvider.swift b/CommonKit/Sources/CommonKit/RichMessageProviders/LskProvider.swift index 96f9e7913..8b7843fa9 100644 --- a/CommonKit/Sources/CommonKit/RichMessageProviders/LskProvider.swift +++ b/CommonKit/Sources/CommonKit/RichMessageProviders/LskProvider.swift @@ -8,20 +8,20 @@ import UIKit -public final class LskProvider: TransferBaseProvider { +public final class KlyProvider: TransferBaseProvider { public override class var richMessageType: String { - return "lsk_transaction" + return "kly_transaction" } public override var currencyLogoUrl: URL? { - return Bundle.main.url(forResource: "lsk_notificationContent", withExtension: "png") + return Bundle.main.url(forResource: "klayr_notificationContent", withExtension: "png") } public override var currencySymbol: String { - return "LSK" + return "KLY" } public override var currencyLogoLarge: UIImage { - return .asset(named: "lisk_notification") ?? .init() + return .asset(named: "klayr_notification") ?? .init() } } diff --git a/LiskKit/Sources/API/Service/Service.swift b/LiskKit/Sources/API/Service/Service.swift index 582461ac0..8624f755b 100644 --- a/LiskKit/Sources/API/Service/Service.swift +++ b/LiskKit/Sources/API/Service/Service.swift @@ -106,7 +106,8 @@ extension Service { signature: $0.signature, confirmations: $0.confirmations, isOutgoing: $0.senderId.lowercased() == ownerAddress?.lowercased(), - nonce: $0.nonce + nonce: $0.nonce, + executionStatus: $0.executionStatus ) } completionHandler(.success(response: transaction)) @@ -145,7 +146,8 @@ extension Service { signature: $0.signature, confirmations: $0.confirmations, isOutgoing: $0.senderId.lowercased() == ownerAddress?.lowercased(), - nonce: $0.nonce + nonce: $0.nonce, + executionStatus: $0.executionStatus ) } completionHandler(.success(response: transaction)) diff --git a/LiskKit/Sources/API/Transactions/Models/TransactionModel.swift b/LiskKit/Sources/API/Transactions/Models/TransactionModel.swift index 57e09d20d..4a2d5d4fd 100644 --- a/LiskKit/Sources/API/Transactions/Models/TransactionModel.swift +++ b/LiskKit/Sources/API/Transactions/Models/TransactionModel.swift @@ -54,6 +54,8 @@ extension Transactions { public var isOutgoing: Bool = false public var nonce: String + + public var executionStatus: ExecutionStatus // MARK: - Hashable diff --git a/LiskKit/Sources/API/Transactions/TransactionEntity+Extension.swift b/LiskKit/Sources/API/Transactions/TransactionEntity+Extension.swift index 256f46cee..09b5e728f 100644 --- a/LiskKit/Sources/API/Transactions/TransactionEntity+Extension.swift +++ b/LiskKit/Sources/API/Transactions/TransactionEntity+Extension.swift @@ -29,7 +29,8 @@ public extension TransactionEntity { fee: Decimal, nonce: UInt64, senderPublicKey: String, - recipientAddressBinary: String + recipientAddressBinary: String, + comment: String ) -> TransactionEntity { let amount = Crypto.fixedPoint(amount: amount) let fee = Crypto.fixedPoint(amount: fee) @@ -44,7 +45,7 @@ public extension TransactionEntity { $0.tokenID = Data(Constants.tokenID.allHexBytes()) $0.amount = amount $0.recipientAddressBinary = Data(recipientAddressBinary.allHexBytes()) - $0.data = "" + $0.data = comment } $0.signatures = [] } @@ -88,7 +89,7 @@ private extension TransactionEntity { return "" } - let tagBytes: [UInt8] = Array("LSK_TX_".utf8) + let tagBytes: [UInt8] = Array("KLY_TX_".utf8) let chainBytes: [UInt8] = chainID.allHexBytes() let allBytes = tagBytes + chainBytes diff --git a/LiskKit/Sources/Crypto/Crypto.swift b/LiskKit/Sources/Crypto/Crypto.swift index 2a0361726..3cbbccc7e 100644 --- a/LiskKit/Sources/Crypto/Crypto.swift +++ b/LiskKit/Sources/Crypto/Crypto.swift @@ -42,7 +42,7 @@ public struct Crypto { return "\(identifier)L" } - static let PREFIX_LISK = "lsk" + static let PREFIX_KLY = "kly" static let CHARSET = Array("zxvcpmbn3465o978uyrtkqew2adsjhfg") static let GENERATOR: [UInt] = [0x3b6a57b2, 0x26508e6d, 0x1ea119fa, 0x3d4233dd, 0x2a1462b3] @@ -55,7 +55,7 @@ public struct Crypto { let uint5Address = convertUIntArray(binaryAddress.map { UInt($0) }, 8, 5) let uint5Checksum = createChecksum(uint5Address) let identifier = convertUInt5ToBase32(uint5Address + uint5Checksum) - return "\(PREFIX_LISK)\(identifier)" + return "\(PREFIX_KLY)\(identifier)" } public static func getBase32Address(binaryAddress: String) -> String { @@ -63,13 +63,13 @@ public struct Crypto { let uint5Address = convertUIntArray(binaryAddress.map { UInt($0) }, 8, 5) let uint5Checksum = createChecksum(uint5Address) let identifier = convertUInt5ToBase32(uint5Address + uint5Checksum) - return "\(PREFIX_LISK)\(identifier)" + return "\(PREFIX_KLY)\(identifier)" } public static func getBinaryAddressFromBase32(_ base32Address: String) -> String? { guard isValidBase32(address: base32Address) else { return nil } - let addressArray = Array(base32Address)[PREFIX_LISK.count..<(base32Address.count - 6)] + let addressArray = Array(base32Address)[PREFIX_KLY.count..<(base32Address.count - 6)] let integerSequence = addressArray.compactMap { CHARSET.firstIndex(of: $0) }.map { UInt($0) } guard integerSequence.count == 32 else { return nil } @@ -78,7 +78,7 @@ public struct Crypto { } public static func isValidBase32(address: String) -> Bool { - guard address.prefix(3) == "lsk", address.count == 41 else { return false } + guard address.prefix(3) == PREFIX_KLY, address.count == 41 else { return false } let content = String(address.suffix(38)) let bytes = covertBase32toUInt5(content) diff --git a/NotificationServiceExtension/NotificationService.swift b/NotificationServiceExtension/NotificationService.swift index 1b3178b1c..684af775d 100644 --- a/NotificationServiceExtension/NotificationService.swift +++ b/NotificationServiceExtension/NotificationService.swift @@ -22,7 +22,7 @@ class NotificationService: UNNotificationServiceExtension { private lazy var richMessageProviders: [String: TransferNotificationContentProvider] = { var providers: [String: TransferNotificationContentProvider] = [ EthProvider.richMessageType: EthProvider(), - LskProvider.richMessageType: LskProvider(), + KlyProvider.richMessageType: KlyProvider(), DogeProvider.richMessageType: DogeProvider(), DashProvider.richMessageType: DashProvider(), BtcProvider.richMessageType: BtcProvider() diff --git a/NotificationServiceExtension/WalletImages/klayr_notificationContent.png b/NotificationServiceExtension/WalletImages/klayr_notificationContent.png new file mode 100644 index 000000000..351eb87db Binary files /dev/null and b/NotificationServiceExtension/WalletImages/klayr_notificationContent.png differ diff --git a/NotificationServiceExtension/WalletImages/mana_notificationContent.png b/NotificationServiceExtension/WalletImages/mana_notificationContent.png index ef189dde4..472edef83 100644 Binary files a/NotificationServiceExtension/WalletImages/mana_notificationContent.png and b/NotificationServiceExtension/WalletImages/mana_notificationContent.png differ diff --git a/TransferNotificationContentExtension/NotificationViewController.swift b/TransferNotificationContentExtension/NotificationViewController.swift index 16bcab904..952281d2f 100644 --- a/TransferNotificationContentExtension/NotificationViewController.swift +++ b/TransferNotificationContentExtension/NotificationViewController.swift @@ -26,7 +26,7 @@ class NotificationViewController: UIViewController, UNNotificationContentExtensi private lazy var richMessageProviders: [String: TransferNotificationContentProvider] = { var providers: [String: TransferNotificationContentProvider] = [ EthProvider.richMessageType: EthProvider(), - LskProvider.richMessageType: LskProvider(), + KlyProvider.richMessageType: KlyProvider(), DogeProvider.richMessageType: DogeProvider(), DashProvider.richMessageType: DashProvider(), BtcProvider.richMessageType: BtcProvider()