diff --git a/android/java/org/chromium/chrome/browser/crypto_wallet/util/AsyncUtils.java b/android/java/org/chromium/chrome/browser/crypto_wallet/util/AsyncUtils.java index 1e50cd7c4059..07116be2fb5c 100644 --- a/android/java/org/chromium/chrome/browser/crypto_wallet/util/AsyncUtils.java +++ b/android/java/org/chromium/chrome/browser/crypto_wallet/util/AsyncUtils.java @@ -423,7 +423,8 @@ public GetNftErc721MetadataContext(Runnable responseCompleteCallback) { } @Override - public void call(String tokenUrl, String erc721Metadata, Integer errorCode, String errorMessage) { + public void call( + String tokenUrl, String erc721Metadata, Integer errorCode, String errorMessage) { this.tokenMetadata = erc721Metadata; this.errorCode = errorCode; this.errorMessage = errorMessage; diff --git a/components/brave_wallet/browser/brave_wallet_auto_pin_service.cc b/components/brave_wallet/browser/brave_wallet_auto_pin_service.cc index 1217a041d13c..5e5dd6f371b2 100644 --- a/components/brave_wallet/browser/brave_wallet_auto_pin_service.cc +++ b/components/brave_wallet/browser/brave_wallet_auto_pin_service.cc @@ -87,10 +87,7 @@ void BraveWalletAutoPinService::OnTokenListResolved( continue; } - auto it = known_tokens.find(current_token_path.value()); - if (it != known_tokens.end()) { - known_tokens.erase(it); - } + known_tokens.erase(current_token_path.value()); mojom::TokenPinStatusPtr status = brave_wallet_pin_service_->GetTokenStatus(absl::nullopt, token); diff --git a/components/brave_wallet/browser/brave_wallet_pin_service.cc b/components/brave_wallet/browser/brave_wallet_pin_service.cc index a767587ccca1..443afc5e46ea 100644 --- a/components/brave_wallet/browser/brave_wallet_pin_service.cc +++ b/components/brave_wallet/browser/brave_wallet_pin_service.cc @@ -33,6 +33,11 @@ const char kAssetUrlListKey[] = "cids"; namespace { const char kNftPart[] = "nft"; +/** + * Service name used in prefs for local pinning service. + * Use absl::nullopt in methods to perform operations on + * the local pinning service. + */ const char kLocalService[] = "local"; absl::optional StringToStatus( diff --git a/components/brave_wallet/browser/brave_wallet_pin_service.h b/components/brave_wallet/browser/brave_wallet_pin_service.h index 461b695c5f6d..6d87692a8add 100644 --- a/components/brave_wallet/browser/brave_wallet_pin_service.h +++ b/components/brave_wallet/browser/brave_wallet_pin_service.h @@ -27,6 +27,10 @@ namespace brave_wallet { +/** + * At the moment only local pinning is supported so use absl::nullopt + * for optional service argument. + */ class BraveWalletPinService : public KeyedService, public brave_wallet::mojom::WalletPinService, public ipfs::IpfsServiceObserver { diff --git a/components/brave_wallet/browser/brave_wallet_service.cc b/components/brave_wallet/browser/brave_wallet_service.cc index 82ec48511315..6c71f9907542 100644 --- a/components/brave_wallet/browser/brave_wallet_service.cc +++ b/components/brave_wallet/browser/brave_wallet_service.cc @@ -1450,7 +1450,8 @@ void BraveWalletService::DiscoverAssetsOnAllSupportedChains() { addresses[mojom::CoinType::SOL] = std::move(sol_account_addresses); // Discover assets owned by the SOL and ETH addresses on all supported chains - asset_discovery_manager_->DiscoverAssetsOnAllSupportedChainsRefresh(addresses); + asset_discovery_manager_->DiscoverAssetsOnAllSupportedChainsRefresh( + addresses); } void BraveWalletService::CancelAllSuggestedTokenCallbacks() { diff --git a/components/brave_wallet/common/brave_wallet.mojom b/components/brave_wallet/common/brave_wallet.mojom index 9ab969ca61f6..a9bfd0925027 100644 --- a/components/brave_wallet/common/brave_wallet.mojom +++ b/components/brave_wallet/common/brave_wallet.mojom @@ -266,6 +266,9 @@ interface BraveWalletPinServiceObserver { }; // Low-level interface for token pinning. +// String service argument is used to select on which pinning +// service operation should be performed. +// At the moment we have only local pinning, so use null. interface WalletPinService { AddObserver(pending_remote observer); @@ -279,13 +282,14 @@ interface WalletPinService { // Returns overview for provided token. GetTokenStatus(BlockchainToken token) => (TokenPinOverview? status, PinError? error); - // Checks whether token in pinned correctly. + // Checks whether token is pinned correctly. Validate(BlockchainToken token, string? service) => (bool result, PinError? error); // Returns whether IPFS localnode is currently running. IsLocalNodeRunning() => (bool result); // Returns whether token is supported for pinning. + // Note: You should manually check token metadata url to have ipfs:// url. IsTokenSupported(BlockchainToken token) => (bool result); };