New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@metamask/assets-controllers

Package Overview
Dependencies
Maintainers
10
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@metamask/assets-controllers - npm Package Compare versions

Comparing version 11.0.0 to 11.0.1

7

CHANGELOG.md

@@ -9,2 +9,6 @@ # Changelog

## [11.0.1]
### Changed
- Replace `eth-query` ^2.1.2 with `@metamask/eth-query` ^3.0.1 ([#1546](https://github.com/MetaMask/core/pull/1546))
## [11.0.0]

@@ -214,3 +218,4 @@ ### Added

[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@11.0.0...HEAD
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@11.0.1...HEAD
[11.0.1]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@11.0.0...@metamask/assets-controllers@11.0.1
[11.0.0]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@10.0.0...@metamask/assets-controllers@11.0.0

@@ -217,0 +222,0 @@ [10.0.0]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@9.2.0...@metamask/assets-controllers@10.0.0

2

dist/AccountTrackerController.d.ts
import type { BaseConfig, BaseState } from '@metamask/base-controller';
import { BaseController } from '@metamask/base-controller';
import type { Provider } from '@metamask/eth-query';
import type { PreferencesState } from '@metamask/preferences-controller';
import type { Provider } from 'eth-query';
/**

@@ -6,0 +6,0 @@ * @type AccountInformation

@@ -18,5 +18,5 @@ "use strict";

const controller_utils_1 = require("@metamask/controller-utils");
const eth_query_1 = __importDefault(require("@metamask/eth-query"));
const utils_1 = require("@metamask/utils");
const async_mutex_1 = require("async-mutex");
const eth_query_1 = __importDefault(require("eth-query"));
/**

@@ -23,0 +23,0 @@ * Controller that tracks the network balances for all user accounts.

@@ -92,6 +92,4 @@ "use strict";

}
getNftApi({ contractAddress, tokenId, useProxy, }) {
return useProxy
? `${controller_utils_1.OPENSEA_PROXY_URL}/asset/${contractAddress}/${tokenId}`
: `${controller_utils_1.OPENSEA_API_URL}/asset/${contractAddress}/${tokenId}`;
getNftApi({ contractAddress, tokenId, }) {
return `${controller_utils_1.OPENSEA_PROXY_URL}/asset/${contractAddress}/${tokenId}`;
}

@@ -134,24 +132,8 @@ getNftContractInformationApi({ contractAddress, useProxy, }) {

// Attempt to fetch the data with the proxy
let nftInformation = yield (0, controller_utils_1.fetchWithErrorHandling)({
const nftInformation = yield (0, controller_utils_1.fetchWithErrorHandling)({
url: this.getNftApi({
contractAddress,
tokenId,
useProxy: true,
}),
});
// if an openSeaApiKey is set we should attempt to refetch calling directly to OpenSea
if (!nftInformation && this.openSeaApiKey) {
nftInformation = yield (0, controller_utils_1.fetchWithErrorHandling)({
url: this.getNftApi({
contractAddress,
tokenId,
useProxy: false,
}),
options: {
headers: { 'X-API-KEY': this.openSeaApiKey },
},
// catch 403 errors (in case API key is down we don't want to blow up)
errorCodesToCatch: [403],
});
}
// if we were still unable to fetch the data we return out the default/null of `NftMetadata`

@@ -158,0 +140,0 @@ if (!nftInformation) {

@@ -78,6 +78,4 @@ "use strict";

}
getOwnerNftApi({ address, offset, useProxy, }) {
return useProxy
? `${controller_utils_1.OPENSEA_PROXY_URL}/assets?owner=${address}&offset=${offset}&limit=50`
: `${controller_utils_1.OPENSEA_API_URL}/assets?owner=${address}&offset=${offset}&limit=50`;
getOwnerNftApi({ address, offset, }) {
return `${controller_utils_1.OPENSEA_PROXY_URL}/assets?owner=${address}&offset=${offset}&limit=50`;
}

@@ -89,3 +87,2 @@ getOwnerNfts(address) {

let nfts = [];
const openSeaApiKey = this.getOpenSeaApiKey();
let offset = 0;

@@ -96,18 +93,5 @@ let pagingFinish = false;

nftApiResponse = yield (0, controller_utils_1.fetchWithErrorHandling)({
url: this.getOwnerNftApi({ address, offset, useProxy: true }),
url: this.getOwnerNftApi({ address, offset }),
timeout: 15000,
});
if (openSeaApiKey && !nftApiResponse) {
nftApiResponse = yield (0, controller_utils_1.fetchWithErrorHandling)({
url: this.getOwnerNftApi({
address,
offset,
useProxy: false,
}),
options: { headers: { 'X-API-KEY': openSeaApiKey } },
timeout: 15000,
// catch 403 errors (in case API key is down we don't want to blow up)
errorCodesToCatch: [403],
});
}
if (!nftApiResponse) {

@@ -114,0 +98,0 @@ return nfts;

{
"name": "@metamask/assets-controllers",
"version": "11.0.0",
"version": "11.0.1",
"description": "Controllers which manage interactions involving ERC-20, ERC-721, and ERC-1155 tokens (including NFTs)",

@@ -40,5 +40,6 @@ "keywords": [

"@metamask/contract-metadata": "^2.3.1",
"@metamask/controller-utils": "^4.3.0",
"@metamask/controller-utils": "^4.3.1",
"@metamask/eth-query": "^3.0.1",
"@metamask/metamask-eth-abis": "3.0.0",
"@metamask/network-controller": "^11.0.0",
"@metamask/network-controller": "^12.0.0",
"@metamask/preferences-controller": "^4.2.0",

@@ -50,3 +51,2 @@ "@metamask/rpc-errors": "^5.1.1",

"async-mutex": "^0.2.6",
"eth-query": "^2.1.2",
"ethereumjs-util": "^7.0.10",

@@ -66,3 +66,3 @@ "immer": "^9.0.6",

"jest-environment-jsdom": "^27.5.1",
"nock": "^13.0.7",
"nock": "^13.3.1",
"sinon": "^9.2.4",

@@ -76,3 +76,3 @@ "ts-jest": "^27.1.4",

"@metamask/approval-controller": "^3.5.0",
"@metamask/network-controller": "^11.0.0",
"@metamask/network-controller": "^12.0.0",
"@metamask/preferences-controller": "^4.2.0"

@@ -79,0 +79,0 @@ },

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc