diff --git a/BraveCore/build_in_core.sh b/BraveCore/build_in_core.sh index 0bc64cf6047..bb531bf8729 100755 --- a/BraveCore/build_in_core.sh +++ b/BraveCore/build_in_core.sh @@ -106,13 +106,13 @@ mc_framework_args="" if [ "$build_simulator" = 1 ]; then npm run build -- $release_flag --target_os=ios --target_arch=$target_architecture --target_environment=simulator $other_flags - bc_framework_args="-framework $sim_dir/BraveCore.framework -debug-symbols $(pwd)/$sim_dir/BraveCore.dSYM" + bc_framework_args="-framework $sim_dir/BraveCore.framework" mc_framework_args="-framework $sim_dir/MaterialComponents.framework" fi if [ "$build_device" = 1 ]; then npm run build -- $release_flag --target_os=ios --target_arch=arm64 $other_flags - bc_framework_args="$bc_framework_args -framework $device_dir/BraveCore.framework -debug-symbols $(pwd)/$device_dir/BraveCore.dSYM" + bc_framework_args="$bc_framework_args -framework $device_dir/BraveCore.framework" mc_framework_args="$mc_framework_args -framework $device_dir/MaterialComponents.framework" fi diff --git a/Sources/Brave/Extensions/Rewards/BraveLedgerExtensions.swift b/Sources/Brave/Extensions/Rewards/BraveLedgerExtensions.swift index 53737e4308b..9407275337c 100644 --- a/Sources/Brave/Extensions/Rewards/BraveLedgerExtensions.swift +++ b/Sources/Brave/Extensions/Rewards/BraveLedgerExtensions.swift @@ -71,7 +71,6 @@ extension BraveLedger { self.minimumVisitDuration = 8 self.minimumNumberOfVisits = 1 - self.allowVideoContributions = true self.allowUnverifiedPublishers = false self.contributionAmount = Double.greatestFiniteMagnitude diff --git a/Sources/Brave/Frontend/Browser/BrowserViewController.swift b/Sources/Brave/Frontend/Browser/BrowserViewController.swift index c7429838a21..57322a2333a 100644 --- a/Sources/Brave/Frontend/Browser/BrowserViewController.swift +++ b/Sources/Brave/Frontend/Browser/BrowserViewController.swift @@ -279,7 +279,7 @@ public class BrowserViewController: UIViewController { let configuration: BraveRewards.Configuration = .current() - let buildChannel = Ads.BuildChannelInfo().then { + let buildChannel = BraveAds.BuildChannelInfo().then { $0.name = AppConstants.buildChannel.rawValue $0.isRelease = AppConstants.buildChannel == .release } diff --git a/Sources/Brave/Frontend/Browser/BrowserViewController/BVC+Rewards.swift b/Sources/Brave/Frontend/Browser/BrowserViewController/BVC+Rewards.swift index dfd5d3a38aa..9e9c155b6cf 100644 --- a/Sources/Brave/Frontend/Browser/BrowserViewController/BVC+Rewards.swift +++ b/Sources/Brave/Frontend/Browser/BrowserViewController/BVC+Rewards.swift @@ -170,7 +170,6 @@ extension BrowserViewController { ledger.minimumVisitDuration = 8 ledger.minimumNumberOfVisits = 1 ledger.allowUnverifiedPublishers = false - ledger.allowVideoContributions = true ledger.contributionAmount = Double.greatestFiniteMagnitude // Create ledger observer diff --git a/Sources/Brave/Frontend/Browser/New Tab Page/NewTabPageViewController.swift b/Sources/Brave/Frontend/Browser/New Tab Page/NewTabPageViewController.swift index 5f1931f3d00..b438c8ded8a 100644 --- a/Sources/Brave/Frontend/Browser/New Tab Page/NewTabPageViewController.swift +++ b/Sources/Brave/Frontend/Browser/New Tab Page/NewTabPageViewController.swift @@ -428,7 +428,7 @@ class NewTabPageViewController: UIViewController { backgroundView.updateImageXOffset(by: realisticXOffset) } - private func reportSponsoredImageBackgroundEvent(_ event: Ads.NewTabPageAdEventType) { + private func reportSponsoredImageBackgroundEvent(_ event: BraveAds.NewTabPageAdEventType) { guard let backgroundType = background.currentBackground?.type, case .withBrandLogo = backgroundType, let creativeInstanceId = background.currentBackground?.wallpaper.creativeInstanceId diff --git a/Sources/Brave/Frontend/Rewards/BraveRewards.swift b/Sources/Brave/Frontend/Rewards/BraveRewards.swift index b81878f03fa..6db80819b0f 100644 --- a/Sources/Brave/Frontend/Rewards/BraveRewards.swift +++ b/Sources/Brave/Frontend/Rewards/BraveRewards.swift @@ -28,7 +28,7 @@ public class BraveRewards: NSObject { private let configuration: Configuration - init(configuration: Configuration, buildChannel: Ads.BuildChannelInfo?) { + init(configuration: Configuration, buildChannel: BraveAds.BuildChannelInfo?) { self.configuration = configuration if let channel = buildChannel { @@ -306,7 +306,7 @@ extension BraveRewards { var storageURL: URL public var environment: Environment - public var adsBuildChannel: Ads.BuildChannelInfo = .init() + public var adsBuildChannel: BraveAds.BuildChannelInfo = .init() public var isDebug: Bool? public var overridenNumberOfSecondsBetweenReconcile: Int? public var retryInterval: Int? diff --git a/Sources/BraveWallet/Crypto/AssetIconView.swift b/Sources/BraveWallet/Crypto/AssetIconView.swift index 4770a2c0804..be1db298e93 100644 --- a/Sources/BraveWallet/Crypto/AssetIconView.swift +++ b/Sources/BraveWallet/Crypto/AssetIconView.swift @@ -105,6 +105,7 @@ struct AssetIconView_Previews: PreviewProvider { logo: "", isErc20: true, isErc721: false, + isErc1155: false, isNft: false, symbol: "XYO", decimals: 18, diff --git a/Sources/BraveWallet/Crypto/Portfolio/AddCustomAssetView.swift b/Sources/BraveWallet/Crypto/Portfolio/AddCustomAssetView.swift index 7df67bcf88d..21df1d59abf 100644 --- a/Sources/BraveWallet/Crypto/Portfolio/AddCustomAssetView.swift +++ b/Sources/BraveWallet/Crypto/Portfolio/AddCustomAssetView.swift @@ -322,6 +322,7 @@ struct AddCustomAssetView: View { logo: logo, isErc20: network.coin != .sol, isErc721: false, + isErc1155: false, isNft: false, symbol: symbolInput, decimals: Int32(decimalsInput) ?? Int32((networkSelectionStore.networkSelectionInForm?.decimals ?? 18)), @@ -355,6 +356,7 @@ struct AddCustomAssetView: View { logo: "", isErc20: false, isErc721: network.coin != .sol && !tokenIdToHex.isEmpty, + isErc1155: false, isNft: true, symbol: symbolInput, decimals: 0, diff --git a/Sources/BraveWallet/Crypto/Stores/AccountActivityStore.swift b/Sources/BraveWallet/Crypto/Stores/AccountActivityStore.swift index 126c114d232..c502620e922 100644 --- a/Sources/BraveWallet/Crypto/Stores/AccountActivityStore.swift +++ b/Sources/BraveWallet/Crypto/Stores/AccountActivityStore.swift @@ -353,4 +353,7 @@ extension AccountActivityStore: BraveWalletBraveWalletServiceObserver { func onDiscoverAssetsCompleted(_ discoveredAssets: [BraveWallet.BlockchainToken]) { } + + func onResetWallet() { + } } diff --git a/Sources/BraveWallet/Crypto/Stores/AssetDetailStore.swift b/Sources/BraveWallet/Crypto/Stores/AssetDetailStore.swift index d7205997f1d..b448baee91c 100644 --- a/Sources/BraveWallet/Crypto/Stores/AssetDetailStore.swift +++ b/Sources/BraveWallet/Crypto/Stores/AssetDetailStore.swift @@ -330,4 +330,6 @@ extension AssetDetailStore: BraveWalletBraveWalletServiceObserver { func onDiscoverAssetsCompleted(_ discoveredAssets: [BraveWallet.BlockchainToken]) { } + func onResetWallet() { + } } diff --git a/Sources/BraveWallet/Crypto/Stores/PortfolioStore.swift b/Sources/BraveWallet/Crypto/Stores/PortfolioStore.swift index cb2a832f744..4537516ba37 100644 --- a/Sources/BraveWallet/Crypto/Stores/PortfolioStore.swift +++ b/Sources/BraveWallet/Crypto/Stores/PortfolioStore.swift @@ -435,4 +435,7 @@ extension PortfolioStore: BraveWalletBraveWalletServiceObserver { update() } } + + public func onResetWallet() { + } } diff --git a/Sources/BraveWallet/Crypto/Stores/SettingsStore.swift b/Sources/BraveWallet/Crypto/Stores/SettingsStore.swift index 6931db26b82..038a7fd6355 100644 --- a/Sources/BraveWallet/Crypto/Stores/SettingsStore.swift +++ b/Sources/BraveWallet/Crypto/Stores/SettingsStore.swift @@ -201,6 +201,9 @@ extension SettingsStore: BraveWalletBraveWalletServiceObserver { public func onDiscoverAssetsCompleted(_ discoveredAssets: [BraveWallet.BlockchainToken]) { } + + public func onResetWallet() { + } } struct CurrencyCode: Hashable, Identifiable { diff --git a/Sources/BraveWallet/Crypto/Stores/TransactionConfirmationStore.swift b/Sources/BraveWallet/Crypto/Stores/TransactionConfirmationStore.swift index c4fbfccbd50..e3e37c5f5a5 100644 --- a/Sources/BraveWallet/Crypto/Stores/TransactionConfirmationStore.swift +++ b/Sources/BraveWallet/Crypto/Stores/TransactionConfirmationStore.swift @@ -712,4 +712,7 @@ extension TransactionConfirmationStore: BraveWalletBraveWalletServiceObserver { public func onDiscoverAssetsCompleted(_ discoveredAssets: [BraveWallet.BlockchainToken]) { } + + public func onResetWallet() { + } } diff --git a/Sources/BraveWallet/Extensions/BraveWalletSwiftUIExtensions.swift b/Sources/BraveWallet/Extensions/BraveWalletSwiftUIExtensions.swift index d5f2071f783..cdf7f095b03 100644 --- a/Sources/BraveWallet/Extensions/BraveWalletSwiftUIExtensions.swift +++ b/Sources/BraveWallet/Extensions/BraveWalletSwiftUIExtensions.swift @@ -36,6 +36,7 @@ extension BraveWallet.NetworkInfo: Identifiable { logo: nativeTokenLogo ?? "", isErc20: false, isErc721: false, + isErc1155: false, isNft: false, symbol: symbol, decimals: decimals, diff --git a/Sources/BraveWallet/Extensions/RpcServiceExtensions.swift b/Sources/BraveWallet/Extensions/RpcServiceExtensions.swift index a687f78a024..de3995901bb 100644 --- a/Sources/BraveWallet/Extensions/RpcServiceExtensions.swift +++ b/Sources/BraveWallet/Extensions/RpcServiceExtensions.swift @@ -288,7 +288,7 @@ extension BraveWalletJsonRpcService { } metaDataString = metaData } else { - let (metaData, result, errMsg) = await self.solTokenMetadata(token.contractAddress) + let (_, metaData, result, errMsg) = await self.solTokenMetadata(token.chainId, tokenMintAddress: token.contractAddress) if result != .success { Logger.module.debug("Failed to load Solana NFT metadata: \(errMsg)") } @@ -316,7 +316,7 @@ extension BraveWalletJsonRpcService { } metaDataString = metaData } else { - let (metaData, result, errMsg) = await self.solTokenMetadata(token.contractAddress) + let (_, metaData, result, errMsg) = await self.solTokenMetadata(token.chainId, tokenMintAddress: token.contractAddress) if result != .success { Logger.module.debug("Failed to load Solana NFT metadata: \(errMsg)") } diff --git a/Sources/BraveWallet/Preview Content/MockBlockchainRegistry.swift b/Sources/BraveWallet/Preview Content/MockBlockchainRegistry.swift index 1f03c043584..771929f8e9f 100644 --- a/Sources/BraveWallet/Preview Content/MockBlockchainRegistry.swift +++ b/Sources/BraveWallet/Preview Content/MockBlockchainRegistry.swift @@ -12,12 +12,12 @@ import BraveCore /// - note: Do not use this directly, use ``TokenRegistryStore.previewStore`` class MockBlockchainRegistry: BraveWalletBlockchainRegistry { static let testTokens: [BraveWallet.BlockchainToken] = [ - .init(contractAddress: "0x0d8775f648430679a709e98d2b0cb6250d2887ef", name: "Basic Attention Token", logo: "", isErc20: true, isErc721: false, isNft: false, symbol: "BAT", decimals: 18, visible: true, tokenId: "", coingeckoId: "", chainId: "", coin: .eth), - .init(contractAddress: "0xB8c77482e45F1F44dE1745F52C74426C631bDD52", name: "BNB", logo: "", isErc20: true, isErc721: false, isNft: false, symbol: "BNB", decimals: 18, visible: true, tokenId: "", coingeckoId: "", chainId: "", coin: .eth), - .init(contractAddress: "0xdac17f958d2ee523a2206206994597c13d831ec7", name: "Tether USD", logo: "", isErc20: true, isErc721: false, isNft: false, symbol: "USDT", decimals: 6, visible: true, tokenId: "", coingeckoId: "", chainId: "", coin: .eth), - .init(contractAddress: "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85", name: "Ethereum Name Service", logo: "", isErc20: false, isErc721: true, isNft: false, symbol: "ENS", decimals: 1, visible: true, tokenId: "", coingeckoId: "", chainId: "", coin: .eth), - .init(contractAddress: "0xad6d458402f60fd3bd25163575031acdce07538d", name: "DAI Stablecoin", logo: "", isErc20: true, isErc721: false, isNft: false, symbol: "DAI", decimals: 18, visible: false, tokenId: "", coingeckoId: "", chainId: "", coin: .eth), - .init(contractAddress: "0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0", name: "MATIC", logo: "", isErc20: true, isErc721: false, isNft: false, symbol: "MATIC", decimals: 18, visible: true, tokenId: "", coingeckoId: "", chainId: "", coin: .eth) + .init(contractAddress: "0x0d8775f648430679a709e98d2b0cb6250d2887ef", name: "Basic Attention Token", logo: "", isErc20: true, isErc721: false, isErc1155: false, isNft: false, symbol: "BAT", decimals: 18, visible: true, tokenId: "", coingeckoId: "", chainId: "", coin: .eth), + .init(contractAddress: "0xB8c77482e45F1F44dE1745F52C74426C631bDD52", name: "BNB", logo: "", isErc20: true, isErc721: false, isErc1155: false, isNft: false, symbol: "BNB", decimals: 18, visible: true, tokenId: "", coingeckoId: "", chainId: "", coin: .eth), + .init(contractAddress: "0xdac17f958d2ee523a2206206994597c13d831ec7", name: "Tether USD", logo: "", isErc20: true, isErc721: false, isErc1155: false, isNft: false, symbol: "USDT", decimals: 6, visible: true, tokenId: "", coingeckoId: "", chainId: "", coin: .eth), + .init(contractAddress: "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85", name: "Ethereum Name Service", logo: "", isErc20: false, isErc721: true, isErc1155: false, isNft: false, symbol: "ENS", decimals: 1, visible: true, tokenId: "", coingeckoId: "", chainId: "", coin: .eth), + .init(contractAddress: "0xad6d458402f60fd3bd25163575031acdce07538d", name: "DAI Stablecoin", logo: "", isErc20: true, isErc721: false, isErc1155: false, isNft: false, symbol: "DAI", decimals: 18, visible: false, tokenId: "", coingeckoId: "", chainId: "", coin: .eth), + .init(contractAddress: "0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0", name: "MATIC", logo: "", isErc20: true, isErc721: false, isErc1155: false, isNft: false, symbol: "MATIC", decimals: 18, visible: true, tokenId: "", coingeckoId: "", chainId: "", coin: .eth) ] func token(byAddress chainId: String, coin: BraveWallet.CoinType, address: String, completion: @escaping (BraveWallet.BlockchainToken?) -> Void) { diff --git a/Sources/BraveWallet/Preview Content/MockBraveWalletService.swift b/Sources/BraveWallet/Preview Content/MockBraveWalletService.swift index d0c0c6e8ffc..f198606cd1e 100644 --- a/Sources/BraveWallet/Preview Content/MockBraveWalletService.swift +++ b/Sources/BraveWallet/Preview Content/MockBraveWalletService.swift @@ -219,5 +219,11 @@ class MockBraveWalletService: BraveWalletBraveWalletService { func discoverAssetsOnAllSupportedChains() { } + + func nftDiscoveryEnabled(_ completion: @escaping (Bool) -> Void) { + } + + func setNftDiscoveryEnabled(_ enabled: Bool) { + } } #endif diff --git a/Sources/BraveWallet/Preview Content/MockContent.swift b/Sources/BraveWallet/Preview Content/MockContent.swift index 3846e74a430..af60291f7f4 100644 --- a/Sources/BraveWallet/Preview Content/MockContent.swift +++ b/Sources/BraveWallet/Preview Content/MockContent.swift @@ -15,6 +15,7 @@ extension BraveWallet.BlockchainToken { logo: "", isErc20: false, isErc721: false, + isErc1155: false, isNft: false, symbol: "ETH", decimals: 18, @@ -31,6 +32,7 @@ extension BraveWallet.BlockchainToken { logo: "", isErc20: true, isErc721: false, + isErc1155: false, isNft: false, symbol: "DAI", decimals: 18, @@ -47,6 +49,7 @@ extension BraveWallet.BlockchainToken { logo: "", isErc20: true, isErc721: false, + isErc1155: false, isNft: false, symbol: "USDC", decimals: 6, @@ -63,6 +66,7 @@ extension BraveWallet.BlockchainToken { logo: "", isErc20: false, isErc721: false, + isErc1155: false, isNft: false, symbol: "SOL", decimals: 9, @@ -79,6 +83,7 @@ extension BraveWallet.BlockchainToken { logo: "", isErc20: false, isErc721: false, + isErc1155: false, isNft: false, symbol: "SPD", decimals: 6, @@ -95,6 +100,7 @@ extension BraveWallet.BlockchainToken { logo: "", isErc20: false, isErc721: true, + isErc1155: false, isNft: true, symbol: "XENFT", decimals: 0, @@ -111,6 +117,7 @@ extension BraveWallet.BlockchainToken { logo: "", isErc20: false, isErc721: false, + isErc1155: false, isNft: true, symbol: "SOLNFT", decimals: 0, @@ -163,7 +170,8 @@ extension BraveWallet.TransactionInfo { submittedTime: Date(timeIntervalSince1970: 1636399673), confirmedTime: Date(timeIntervalSince1970: 1636402508), originInfo: .init(), - groupId: nil + groupId: nil, + chainId: "" ) } static var previewConfirmedSwap: BraveWallet.TransactionInfo { @@ -200,7 +208,8 @@ extension BraveWallet.TransactionInfo { submittedTime: Date(timeIntervalSince1970: 1636399673), confirmedTime: Date(timeIntervalSince1970: 1636402508), originInfo: .init(), - groupId: nil + groupId: nil, + chainId: "" ) } /// Approved Unlimited DAI @@ -235,7 +244,8 @@ extension BraveWallet.TransactionInfo { submittedTime: Date(timeIntervalSince1970: 1636399673), confirmedTime: Date(timeIntervalSince1970: 1636402508), originInfo: .init(), - groupId: nil + groupId: nil, + chainId: "" ) } /// Solana System Transfer @@ -267,7 +277,8 @@ extension BraveWallet.TransactionInfo { submittedTime: Date(timeIntervalSince1970: 1636399673), confirmedTime: Date(timeIntervalSince1970: 1636402508), originInfo: .init(), - groupId: nil + groupId: nil, + chainId: "" ) } /// Solana Token Transfer @@ -299,7 +310,8 @@ extension BraveWallet.TransactionInfo { submittedTime: Date(timeIntervalSince1970: 1636399673), confirmedTime: Date(timeIntervalSince1970: 1636402508), originInfo: .init(), - groupId: nil + groupId: nil, + chainId: "" ) } static private func _transactionBase64ToData(_ base64String: String) -> [NSNumber] { diff --git a/Sources/BraveWallet/Preview Content/MockJsonRpcService.swift b/Sources/BraveWallet/Preview Content/MockJsonRpcService.swift index eda6cdc6693..ee933e2a9a7 100644 --- a/Sources/BraveWallet/Preview Content/MockJsonRpcService.swift +++ b/Sources/BraveWallet/Preview Content/MockJsonRpcService.swift @@ -147,8 +147,8 @@ class MockJsonRpcService: BraveWalletJsonRpcService { completion("", .internalError, "") } - func solTokenMetadata(_ tokenMintAddress: String, completion: @escaping (String, BraveWallet.SolanaProviderError, String) -> Void) { - completion("", .internalError, "") + func solTokenMetadata(_ chainId: String, tokenMintAddress: String, completion: @escaping (String, String, BraveWallet.SolanaProviderError, String) -> Void) { + completion("", "", .internalError, "") } func erc721Metadata(_ contract: String, tokenId: String, chainId: String, completion: @escaping (String, String, BraveWallet.ProviderError, String) -> Void) { diff --git a/Tests/BraveWalletTests/AccountActivityStoreTests.swift b/Tests/BraveWalletTests/AccountActivityStoreTests.swift index bcf2430fca4..e97e3b3dbbf 100644 --- a/Tests/BraveWalletTests/AccountActivityStoreTests.swift +++ b/Tests/BraveWalletTests/AccountActivityStoreTests.swift @@ -86,15 +86,15 @@ class AccountActivityStoreTests: XCTestCase { """ completion( "", metadata, .success, "") } - rpcService._solTokenMetadata = { _, completion in - completion( - """ + rpcService._solTokenMetadata = { _, _, completion in + let metaData = """ { "image": "sol.mock.image.url", "name": "sol mock nft name", "description": "sol mock nft description" } - """, .success, "") + """ + completion("", metaData, .success, "") } let walletService = BraveWallet.TestBraveWalletService() diff --git a/Tests/BraveWalletTests/BraveWalletExtensionsTests.swift b/Tests/BraveWalletTests/BraveWalletExtensionsTests.swift index fbcd325f17c..5b187af219d 100644 --- a/Tests/BraveWalletTests/BraveWalletExtensionsTests.swift +++ b/Tests/BraveWalletTests/BraveWalletExtensionsTests.swift @@ -5,15 +5,15 @@ import BraveCore class BraveWalletExtensionsTests: XCTestCase { func testIsNativeAsset() { - let ethCoin: BraveWallet.BlockchainToken = .init(contractAddress: "", name: "Eth", logo: "", isErc20: false, isErc721: false, isNft: false, symbol: "Eth", decimals: 18, visible: true, tokenId: "", coingeckoId: "", chainId: "", coin: .eth) - let ethToken: BraveWallet.BlockchainToken = .init(contractAddress: "mock-eth-contract-address", name: "Eth Token", logo: "", isErc20: true, isErc721: false, isNft: false, symbol: "ETHTOKEN", decimals: 18, visible: false, tokenId: "", coingeckoId: "", chainId: "", coin: .eth) + let ethCoin: BraveWallet.BlockchainToken = .init(contractAddress: "", name: "Eth", logo: "", isErc20: false, isErc721: false, isErc1155: false, isNft: false, symbol: "Eth", decimals: 18, visible: true, tokenId: "", coingeckoId: "", chainId: "", coin: .eth) + let ethToken: BraveWallet.BlockchainToken = .init(contractAddress: "mock-eth-contract-address", name: "Eth Token", logo: "", isErc20: true, isErc721: false, isErc1155: false, isNft: false, symbol: "ETHTOKEN", decimals: 18, visible: false, tokenId: "", coingeckoId: "", chainId: "", coin: .eth) let ethNetwork = BraveWallet.NetworkInfo.mockMainnet XCTAssertTrue(ethNetwork.isNativeAsset(ethCoin)) XCTAssertFalse(ethNetwork.isNativeAsset(ethToken)) - let solCoin: BraveWallet.BlockchainToken = .init(contractAddress: "", name: "Sol", logo: "", isErc20: false, isErc721: false, isNft: false, symbol: "SOL", decimals: 9, visible: true, tokenId: "", coingeckoId: "", chainId: "", coin: .sol) - let solToken: BraveWallet.BlockchainToken = .init(contractAddress: "mock-sol-contract-address", name: "Sol Token", logo: "", isErc20: true, isErc721: false, isNft: false, symbol: "SOLTOKEN", decimals: 9, visible: false, tokenId: "", coingeckoId: "", chainId: "", coin: .sol) + let solCoin: BraveWallet.BlockchainToken = .init(contractAddress: "", name: "Sol", logo: "", isErc20: false, isErc721: false, isErc1155: false, isNft: false, symbol: "SOL", decimals: 9, visible: true, tokenId: "", coingeckoId: "", chainId: "", coin: .sol) + let solToken: BraveWallet.BlockchainToken = .init(contractAddress: "mock-sol-contract-address", name: "Sol Token", logo: "", isErc20: true, isErc721: false, isErc1155: false, isNft: false, symbol: "SOLTOKEN", decimals: 9, visible: false, tokenId: "", coingeckoId: "", chainId: "", coin: .sol) let solNetwork = BraveWallet.NetworkInfo.mockSolana XCTAssertTrue(solNetwork.isNativeAsset(solCoin)) diff --git a/Tests/BraveWalletTests/BuyTokenStoreTest.swift b/Tests/BraveWalletTests/BuyTokenStoreTest.swift index a791803f927..d43963b51c9 100644 --- a/Tests/BraveWalletTests/BuyTokenStoreTest.swift +++ b/Tests/BraveWalletTests/BuyTokenStoreTest.swift @@ -15,12 +15,12 @@ class BuyTokenStoreTests: XCTestCase { private func setupServices(selectedNetwork: BraveWallet.NetworkInfo = .mockMainnet) -> (BraveWallet.TestBlockchainRegistry, BraveWallet.TestJsonRpcService, BraveWallet.TestBraveWalletService, BraveWallet.TestAssetRatioService) { let mockTokenList: [BraveWallet.BlockchainToken] = [ - .init(contractAddress: "0x0d8775f648430679a709e98d2b0cb6250d2887ef", name: "Basic Attention Token", logo: "", isErc20: true, isErc721: false, isNft: false, symbol: "BAT", decimals: 18, visible: true, tokenId: "", coingeckoId: "", chainId: BraveWallet.MainnetChainId, coin: .eth), - .init(contractAddress: "0xB8c77482e45F1F44dE1745F52C74426C631bDD52", name: "BNB", logo: "", isErc20: true, isErc721: false, isNft: false, symbol: "BNB", decimals: 18, visible: true, tokenId: "", coingeckoId: "", chainId: "", coin: .eth), - .init(contractAddress: "0xdac17f958d2ee523a2206206994597c13d831ec7", name: "Tether USD", logo: "", isErc20: true, isErc721: false, isNft: false, symbol: "USDT", decimals: 6, visible: true, tokenId: "", coingeckoId: "", chainId: "", coin: .eth), - .init(contractAddress: "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85", name: "Ethereum Name Service", logo: "", isErc20: false, isErc721: true, isNft: false, symbol: "ENS", decimals: 1, visible: true, tokenId: "", coingeckoId: "", chainId: "", coin: .eth), - .init(contractAddress: "0xad6d458402f60fd3bd25163575031acdce07538d", name: "DAI Stablecoin", logo: "", isErc20: true, isErc721: false, isNft: false, symbol: "DAI", decimals: 18, visible: false, tokenId: "", coingeckoId: "", chainId: "", coin: .eth), - .init(contractAddress: "0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0", name: "MATIC", logo: "", isErc20: true, isErc721: false, isNft: false, symbol: "MATIC", decimals: 18, visible: true, tokenId: "", coingeckoId: "", chainId: "", coin: .eth) + .init(contractAddress: "0x0d8775f648430679a709e98d2b0cb6250d2887ef", name: "Basic Attention Token", logo: "", isErc20: true, isErc721: false, isErc1155: false, isNft: false, symbol: "BAT", decimals: 18, visible: true, tokenId: "", coingeckoId: "", chainId: BraveWallet.MainnetChainId, coin: .eth), + .init(contractAddress: "0xB8c77482e45F1F44dE1745F52C74426C631bDD52", name: "BNB", logo: "", isErc20: true, isErc721: false, isErc1155: false, isNft: false, symbol: "BNB", decimals: 18, visible: true, tokenId: "", coingeckoId: "", chainId: "", coin: .eth), + .init(contractAddress: "0xdac17f958d2ee523a2206206994597c13d831ec7", name: "Tether USD", logo: "", isErc20: true, isErc721: false, isErc1155: false, isNft: false, symbol: "USDT", decimals: 6, visible: true, tokenId: "", coingeckoId: "", chainId: "", coin: .eth), + .init(contractAddress: "0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85", name: "Ethereum Name Service", logo: "", isErc20: false, isErc721: true, isErc1155: false, isNft: false, symbol: "ENS", decimals: 1, visible: true, tokenId: "", coingeckoId: "", chainId: "", coin: .eth), + .init(contractAddress: "0xad6d458402f60fd3bd25163575031acdce07538d", name: "DAI Stablecoin", logo: "", isErc20: true, isErc721: false, isErc1155: false, isNft: false, symbol: "DAI", decimals: 18, visible: false, tokenId: "", coingeckoId: "", chainId: "", coin: .eth), + .init(contractAddress: "0x7D1AfA7B718fb893dB30A3aBc0Cfc608AaCfeBB0", name: "MATIC", logo: "", isErc20: true, isErc721: false, isErc1155: false, isNft: false, symbol: "MATIC", decimals: 18, visible: true, tokenId: "", coingeckoId: "", chainId: "", coin: .eth) ] let mockOnRampCurrencies: [BraveWallet.OnRampCurrency] = [ .init(currencyCode: "usd", currencyName: "United States Dollar", providers: [.init(value: 0)]), diff --git a/Tests/BraveWalletTests/PortfolioStoreTests.swift b/Tests/BraveWalletTests/PortfolioStoreTests.swift index e5b5cde0043..63a2a3309af 100644 --- a/Tests/BraveWalletTests/PortfolioStoreTests.swift +++ b/Tests/BraveWalletTests/PortfolioStoreTests.swift @@ -117,15 +117,15 @@ class PortfolioStoreTests: XCTestCase { """ completion("", metadata, .success, "") } - rpcService._solTokenMetadata = { _, completion in - completion( - """ + rpcService._solTokenMetadata = { _, _, completion in + let metaData = """ { "image": "sol.mock.image.url", "name": "sol mock nft name", "description": "sol mock nft description" } - """, .success, "") + """ + completion("", metaData, .success, "") } let walletService = BraveWallet.TestBraveWalletService() walletService._userAssets = { _, coin, completion in diff --git a/Tests/BraveWalletTests/SendTokenStoreTests.swift b/Tests/BraveWalletTests/SendTokenStoreTests.swift index 840f8f21488..36ca964e0de 100644 --- a/Tests/BraveWalletTests/SendTokenStoreTests.swift +++ b/Tests/BraveWalletTests/SendTokenStoreTests.swift @@ -60,15 +60,15 @@ class SendTokenStoreTests: XCTestCase { """ completion("", metadata, .success, "") } - rpcService._solTokenMetadata = { _, completion in - completion( - """ + rpcService._solTokenMetadata = { _, _, completion in + let metaData = """ { "image": "sol.mock.image.url", "name": "sol mock nft name", "description": "sol mock nft description" } - """, .success, "") + """ + completion("", metaData, .success, "") } let walletService = BraveWallet.TestBraveWalletService() walletService._selectedCoin = { $0(selectedCoin) } @@ -284,7 +284,7 @@ class SendTokenStoreTests: XCTestCase { prefilledToken: nil, ipfsApi: TestIpfsAPI() ) - let token: BraveWallet.BlockchainToken = .init(contractAddress: "0x0d8775f648430679a709e98d2b0cb6250d2887ef", name: "Basic Attention Token", logo: "", isErc20: true, isErc721: false, isNft: false, symbol: batSymbol, decimals: 18, visible: true, tokenId: "", coingeckoId: "", chainId: "", coin: .eth) + let token: BraveWallet.BlockchainToken = .init(contractAddress: "0x0d8775f648430679a709e98d2b0cb6250d2887ef", name: "Basic Attention Token", logo: "", isErc20: true, isErc721: false, isErc1155: false, isNft: false, symbol: batSymbol, decimals: 18, visible: true, tokenId: "", coingeckoId: "", chainId: "", coin: .eth) store.selectedSendToken = token let ex = expectation(description: "send-bat-eip1559-transaction") diff --git a/Tests/BraveWalletTests/SwapTokenStoreTests.swift b/Tests/BraveWalletTests/SwapTokenStoreTests.swift index 527fa7b4a5e..ea2786b6494 100644 --- a/Tests/BraveWalletTests/SwapTokenStoreTests.swift +++ b/Tests/BraveWalletTests/SwapTokenStoreTests.swift @@ -40,7 +40,7 @@ class SwapStoreTests: XCTestCase { } func testDefaultSellBuyTokensOnMainnetWithPrefilledToken() { - let batToken: BraveWallet.BlockchainToken = .init(contractAddress: "", name: "Brave BAT", logo: "", isErc20: true, isErc721: false, isNft: false, symbol: "BAT", decimals: 18, visible: false, tokenId: "", coingeckoId: "", chainId: BraveWallet.MainnetChainId, coin: .eth) + let batToken: BraveWallet.BlockchainToken = .init(contractAddress: "", name: "Brave BAT", logo: "", isErc20: true, isErc721: false, isErc1155: false, isNft: false, symbol: "BAT", decimals: 18, visible: false, tokenId: "", coingeckoId: "", chainId: BraveWallet.MainnetChainId, coin: .eth) let solTxManagerProxy = BraveWallet.TestSolanaTxManagerProxy() let store = SwapTokenStore( keyringService: MockKeyringService(), @@ -178,8 +178,8 @@ class SwapStoreTests: XCTestCase { } func testDefaultSellBuyTokensOnEVMWithPrefilledToken() { - let daiToken: BraveWallet.BlockchainToken = .init(contractAddress: "", name: "DAI Stablecoin", logo: "", isErc20: true, isErc721: false, isNft: false, symbol: "DAI", decimals: 18, visible: false, tokenId: "", coingeckoId: "", chainId: BraveWallet.PolygonMainnetChainId, coin: .eth) - let batToken: BraveWallet.BlockchainToken = .init(contractAddress: "0x0d8775f648430679a709e98d2b0cb6250d2887ef", name: "Basic Attention Token", logo: "", isErc20: true, isErc721: false, isNft: false, symbol: "BAT", decimals: 18, visible: true, tokenId: "", coingeckoId: "", chainId: BraveWallet.PolygonMainnetChainId, coin: .eth) + let daiToken: BraveWallet.BlockchainToken = .init(contractAddress: "", name: "DAI Stablecoin", logo: "", isErc20: true, isErc721: false, isErc1155: false, isNft: false, symbol: "DAI", decimals: 18, visible: false, tokenId: "", coingeckoId: "", chainId: BraveWallet.PolygonMainnetChainId, coin: .eth) + let batToken: BraveWallet.BlockchainToken = .init(contractAddress: "0x0d8775f648430679a709e98d2b0cb6250d2887ef", name: "Basic Attention Token", logo: "", isErc20: true, isErc721: false, isErc1155: false, isNft: false, symbol: "BAT", decimals: 18, visible: true, tokenId: "", coingeckoId: "", chainId: BraveWallet.PolygonMainnetChainId, coin: .eth) let rpcService = BraveWallet.TestJsonRpcService() rpcService._addObserver = { _ in } rpcService._network = { $1(.mockPolygon) } diff --git a/Tests/BraveWalletTests/TransactionConfirmationStoreTests.swift b/Tests/BraveWalletTests/TransactionConfirmationStoreTests.swift index af8ef414706..7b539468fad 100644 --- a/Tests/BraveWalletTests/TransactionConfirmationStoreTests.swift +++ b/Tests/BraveWalletTests/TransactionConfirmationStoreTests.swift @@ -419,6 +419,7 @@ private extension BraveWallet.BlockchainToken { logo: "", isErc20: true, isErc721: false, + isErc1155: false, isNft: false, symbol: "DAI", decimals: 18, diff --git a/Tests/BraveWalletTests/TransactionParserTests.swift b/Tests/BraveWalletTests/TransactionParserTests.swift index 25187dfa0b2..19caa8c4055 100644 --- a/Tests/BraveWalletTests/TransactionParserTests.swift +++ b/Tests/BraveWalletTests/TransactionParserTests.swift @@ -83,7 +83,8 @@ class TransactionParserTests: XCTestCase { submittedTime: Date(), confirmedTime: Date(), originInfo: nil, - groupId: nil + groupId: nil, + chainId: BraveWallet.MainnetChainId ) let expectedParsedTransaction = ParsedTransaction( @@ -176,7 +177,8 @@ class TransactionParserTests: XCTestCase { submittedTime: Date(), confirmedTime: Date(), originInfo: nil, - groupId: nil + groupId: nil, + chainId: BraveWallet.MainnetChainId ) let expectedParsedTransaction = ParsedTransaction( @@ -260,7 +262,8 @@ class TransactionParserTests: XCTestCase { submittedTime: Date(), confirmedTime: Date(), originInfo: nil, - groupId: nil + groupId: nil, + chainId: BraveWallet.MainnetChainId ) let expectedParsedTransaction = ParsedTransaction( @@ -348,7 +351,8 @@ class TransactionParserTests: XCTestCase { submittedTime: Date(), confirmedTime: Date(), originInfo: nil, - groupId: nil + groupId: nil, + chainId: BraveWallet.MainnetChainId ) let expectedParsedTransaction = ParsedTransaction( @@ -432,7 +436,8 @@ class TransactionParserTests: XCTestCase { submittedTime: Date(), confirmedTime: Date(), originInfo: nil, - groupId: nil + groupId: nil, + chainId: BraveWallet.MainnetChainId ) let expectedParsedTransaction = ParsedTransaction( @@ -514,7 +519,8 @@ class TransactionParserTests: XCTestCase { submittedTime: Date(), confirmedTime: Date(), originInfo: nil, - groupId: nil + groupId: nil, + chainId: BraveWallet.MainnetChainId ) let expectedParsedTransaction = ParsedTransaction( @@ -600,7 +606,8 @@ class TransactionParserTests: XCTestCase { submittedTime: Date(), confirmedTime: Date(), originInfo: nil, - groupId: nil + groupId: nil, + chainId: BraveWallet.MainnetChainId ) let expectedParsedTransaction = ParsedTransaction( @@ -677,7 +684,8 @@ class TransactionParserTests: XCTestCase { submittedTime: Date(), confirmedTime: Date(), originInfo: nil, - groupId: nil + groupId: nil, + chainId: BraveWallet.MainnetChainId ) let expectedParsedTransaction = ParsedTransaction( transaction: transaction, @@ -766,7 +774,8 @@ class TransactionParserTests: XCTestCase { submittedTime: Date(), confirmedTime: Date(), originInfo: nil, - groupId: nil + groupId: nil, + chainId: BraveWallet.MainnetChainId ) let expectedParsedTransaction = ParsedTransaction( transaction: transaction, @@ -842,7 +851,8 @@ class TransactionParserTests: XCTestCase { submittedTime: Date(), confirmedTime: Date(), originInfo: nil, - groupId: nil + groupId: nil, + chainId: BraveWallet.MainnetChainId ) let expectedParsedTransaction = ParsedTransaction( transaction: transaction, diff --git a/package-lock.json b/package-lock.json index d728b7c2d8c..de3b21fa2fa 100644 --- a/package-lock.json +++ b/package-lock.json @@ -10,7 +10,7 @@ "license": "MPL-2.0", "dependencies": { "@mozilla/readability": "^0.4.2", - "brave-core-ios": "https://github.com/brave/brave-browser/releases/download/v1.50.114/brave-core-ios-1.50.114.tgz", + "brave-core-ios": "https://github.com/brave/brave-browser/releases/download/v1.51.87/brave-core-ios-1.51.87.tgz", "page-metadata-parser": "^1.1.3", "webpack-cli": "^4.8.0" }, @@ -355,9 +355,9 @@ } }, "node_modules/brave-core-ios": { - "version": "1.50.114", - "resolved": "https://github.com/brave/brave-browser/releases/download/v1.50.114/brave-core-ios-1.50.114.tgz", - "integrity": "sha512-D5Qrof5OHUKfRtn81cLgtqHpPOQjY/SFHypXfAIUQm0wRP+1XdnhtkDdMwMB7jZwTf8Qvj/cL/7aac6ZMBarcA==", + "version": "1.51.87", + "resolved": "https://github.com/brave/brave-browser/releases/download/v1.51.87/brave-core-ios-1.51.87.tgz", + "integrity": "sha512-M/GFJoqfjcv+JEYF/hgW4ktNqBW3rDMfMi2TUZZhTnbg7uk1HQiP1ECqqPal3oi5T6YHyV4UNhNSiuY+IQfxsQ==", "license": "ISC" }, "node_modules/browserslist": { @@ -1731,8 +1731,8 @@ } }, "brave-core-ios": { - "version": "https://github.com/brave/brave-browser/releases/download/v1.50.114/brave-core-ios-1.50.114.tgz", - "integrity": "sha512-D5Qrof5OHUKfRtn81cLgtqHpPOQjY/SFHypXfAIUQm0wRP+1XdnhtkDdMwMB7jZwTf8Qvj/cL/7aac6ZMBarcA==" + "version": "https://github.com/brave/brave-browser/releases/download/v1.51.87/brave-core-ios-1.51.87.tgz", + "integrity": "sha512-M/GFJoqfjcv+JEYF/hgW4ktNqBW3rDMfMi2TUZZhTnbg7uk1HQiP1ECqqPal3oi5T6YHyV4UNhNSiuY+IQfxsQ==" }, "browserslist": { "version": "4.17.1", diff --git a/package.json b/package.json index 912d1d5dab5..f10a6cd8566 100644 --- a/package.json +++ b/package.json @@ -11,7 +11,7 @@ }, "license": "MPL-2.0", "dependencies": { - "brave-core-ios": "https://github.com/brave/brave-browser/releases/download/v1.50.114/brave-core-ios-1.50.114.tgz", + "brave-core-ios": "https://github.com/brave/brave-browser/releases/download/v1.51.87/brave-core-ios-1.51.87.tgz", "page-metadata-parser": "^1.1.3", "@mozilla/readability": "^0.4.2", "webpack-cli": "^4.8.0"