@metamask/assets-controllers 34.0.0 → 36.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +35 -1
- package/dist/AssetsContractController.js +6 -6
- package/dist/AssetsContractController.mjs +5 -5
- package/dist/NftController.js +3 -3
- package/dist/NftController.mjs +2 -2
- package/dist/NftDetectionController.js +5 -2
- package/dist/NftDetectionController.mjs +4 -1
- package/dist/Standards/ERC20Standard.js +3 -3
- package/dist/Standards/ERC20Standard.mjs +2 -2
- package/dist/Standards/NftStandards/ERC1155/ERC1155Standard.js +3 -3
- package/dist/Standards/NftStandards/ERC1155/ERC1155Standard.mjs +2 -2
- package/dist/Standards/NftStandards/ERC721/ERC721Standard.js +3 -3
- package/dist/Standards/NftStandards/ERC721/ERC721Standard.mjs +2 -2
- package/dist/TokenDetectionController.js +3 -3
- package/dist/TokenDetectionController.mjs +2 -2
- package/dist/TokenListController.js +4 -4
- package/dist/TokenListController.mjs +3 -3
- package/dist/TokenRatesController.js +3 -3
- package/dist/TokenRatesController.mjs +2 -2
- package/dist/TokensController.js +6 -6
- package/dist/TokensController.mjs +5 -5
- package/dist/assetsUtil.js +4 -2
- package/dist/assetsUtil.mjs +3 -1
- package/dist/{chunk-VELPHITE.mjs → chunk-24HGVPDI.mjs} +7 -1
- package/dist/chunk-24HGVPDI.mjs.map +1 -0
- package/dist/{chunk-GHKGU6GK.js → chunk-2J3CVSQ5.js} +5 -5
- package/dist/{chunk-56O7BVZV.mjs → chunk-2YFZGRUL.mjs} +2 -2
- package/dist/{chunk-7OZL6IDY.js → chunk-3QLHZOXA.js} +7 -7
- package/dist/{chunk-LBJTMJFA.js → chunk-4U2L56TY.js} +4 -4
- package/dist/{chunk-47CRHAUE.mjs → chunk-5IMEJ2FS.mjs} +2 -2
- package/dist/{chunk-TWR6P5WG.mjs → chunk-62HDABFM.mjs} +4 -4
- package/dist/chunk-62HDABFM.mjs.map +1 -0
- package/dist/{chunk-JEIAMJGS.mjs → chunk-7H2V5SW4.mjs} +2 -2
- package/dist/{chunk-UYH6NWKB.mjs → chunk-A7VI64MA.mjs} +2 -2
- package/dist/{chunk-JBF4XEGR.js → chunk-B46K3T54.js} +5 -5
- package/dist/{chunk-6PPM4ETZ.js → chunk-DOCJ35CC.js} +3 -3
- package/dist/{chunk-RPQ737HL.js → chunk-DSDI75PJ.js} +4 -4
- package/dist/{chunk-7JWDWDXT.js → chunk-HTIZ4JKG.js} +42 -8
- package/dist/chunk-HTIZ4JKG.js.map +1 -0
- package/dist/{chunk-XSNGD5US.js → chunk-IJS7EZU2.js} +7 -7
- package/dist/{chunk-XSNGD5US.js.map → chunk-IJS7EZU2.js.map} +1 -1
- package/dist/{chunk-GJCTAKK5.mjs → chunk-K6DUHENW.mjs} +2 -2
- package/dist/{chunk-W57QXOHJ.mjs → chunk-OCV7GPA2.mjs} +41 -7
- package/dist/chunk-OCV7GPA2.mjs.map +1 -0
- package/dist/{chunk-X4RMS365.js → chunk-OJLB6FID.js} +3 -3
- package/dist/{chunk-2TSAUGE7.mjs → chunk-PPJTMDXC.mjs} +2 -2
- package/dist/{chunk-NYVA7ZTQ.js → chunk-R4HATJKU.js} +8 -2
- package/dist/chunk-R4HATJKU.js.map +1 -0
- package/dist/{chunk-2IIQTSLV.mjs → chunk-RI6LDZPC.mjs} +67 -3
- package/dist/chunk-RI6LDZPC.mjs.map +1 -0
- package/dist/{chunk-4JLB5OIJ.mjs → chunk-RXBDSHHH.mjs} +5 -5
- package/dist/{chunk-2NQRWANM.js → chunk-TPUVGGNO.js} +11 -11
- package/dist/{chunk-354SINOH.js → chunk-Z6NCPTNT.js} +67 -3
- package/dist/chunk-Z6NCPTNT.js.map +1 -0
- package/dist/{chunk-Y45HQET7.mjs → chunk-ZWZZUFO5.mjs} +3 -3
- package/dist/index.js +13 -13
- package/dist/index.mjs +12 -12
- package/dist/token-service.js +3 -3
- package/dist/token-service.mjs +2 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/AssetsContractController.d.ts.map +1 -1
- package/dist/types/NftController.d.ts +5 -3
- package/dist/types/NftController.d.ts.map +1 -1
- package/dist/types/NftDetectionController.d.ts +35 -1
- package/dist/types/NftDetectionController.d.ts.map +1 -1
- package/dist/types/assetsUtil.d.ts +7 -0
- package/dist/types/assetsUtil.d.ts.map +1 -1
- package/package.json +10 -10
- package/dist/chunk-2IIQTSLV.mjs.map +0 -1
- package/dist/chunk-354SINOH.js.map +0 -1
- package/dist/chunk-7JWDWDXT.js.map +0 -1
- package/dist/chunk-NYVA7ZTQ.js.map +0 -1
- package/dist/chunk-TWR6P5WG.mjs.map +0 -1
- package/dist/chunk-VELPHITE.mjs.map +0 -1
- package/dist/chunk-W57QXOHJ.mjs.map +0 -1
- /package/dist/{chunk-GHKGU6GK.js.map → chunk-2J3CVSQ5.js.map} +0 -0
- /package/dist/{chunk-56O7BVZV.mjs.map → chunk-2YFZGRUL.mjs.map} +0 -0
- /package/dist/{chunk-7OZL6IDY.js.map → chunk-3QLHZOXA.js.map} +0 -0
- /package/dist/{chunk-LBJTMJFA.js.map → chunk-4U2L56TY.js.map} +0 -0
- /package/dist/{chunk-47CRHAUE.mjs.map → chunk-5IMEJ2FS.mjs.map} +0 -0
- /package/dist/{chunk-JEIAMJGS.mjs.map → chunk-7H2V5SW4.mjs.map} +0 -0
- /package/dist/{chunk-UYH6NWKB.mjs.map → chunk-A7VI64MA.mjs.map} +0 -0
- /package/dist/{chunk-JBF4XEGR.js.map → chunk-B46K3T54.js.map} +0 -0
- /package/dist/{chunk-6PPM4ETZ.js.map → chunk-DOCJ35CC.js.map} +0 -0
- /package/dist/{chunk-RPQ737HL.js.map → chunk-DSDI75PJ.js.map} +0 -0
- /package/dist/{chunk-GJCTAKK5.mjs.map → chunk-K6DUHENW.mjs.map} +0 -0
- /package/dist/{chunk-X4RMS365.js.map → chunk-OJLB6FID.js.map} +0 -0
- /package/dist/{chunk-2TSAUGE7.mjs.map → chunk-PPJTMDXC.mjs.map} +0 -0
- /package/dist/{chunk-4JLB5OIJ.mjs.map → chunk-RXBDSHHH.mjs.map} +0 -0
- /package/dist/{chunk-2NQRWANM.js.map → chunk-TPUVGGNO.js.map} +0 -0
- /package/dist/{chunk-Y45HQET7.mjs.map → chunk-ZWZZUFO5.mjs.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,38 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [36.0.0]
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
|
|
14
|
+
- Add optional `topBid` property to the `NftMetadata` type. This property must be of type `TopBid`. ([#4522](https://github.com/MetaMask/core/pull/4522))
|
|
15
|
+
- Add optional `floorAsk` property to the `TokenCollection` type. This property must be of type `FloorAskCollection`. ([#4522](https://github.com/MetaMask/core/pull/4522))
|
|
16
|
+
- Add linea mainnet support to nft detection supported networks ([#4515](https://github.com/MetaMask/core/pull/4515))
|
|
17
|
+
- The `Collection` type is expanded to include the following 'string'-type optional properties: `contractDeployedAt`, `creator`, `ownerCount`, and an optional property `topBid` of the type `TopBid & { sourceDomain?: string; }`. ([#4443](https://github.com/MetaMask/core/pull/4443))
|
|
18
|
+
|
|
19
|
+
### Changed
|
|
20
|
+
|
|
21
|
+
- Fetch NFT collections data from the NFT-API `Get Collections` endpoint when calling the `detectNfts` method of `NftDetectionController`, and the `updateNftMetadata` and `watchNft` methods of `NftController`. ([#4443](https://github.com/MetaMask/core/pull/4443))
|
|
22
|
+
- Bump `@metamask/utils` to `^9.0.0` ([#4516](https://github.com/MetaMask/core/pull/4516))
|
|
23
|
+
- Bump `@metamask/rpc-errors` to `^6.3.1` ([#4516](https://github.com/MetaMask/core/pull/4516))
|
|
24
|
+
|
|
25
|
+
### Fixed
|
|
26
|
+
|
|
27
|
+
- **BREAKING:** The `attributes` property of the `NftMetadata` type must be of type `Attributes[]` ([#4522](https://github.com/MetaMask/core/pull/4522))
|
|
28
|
+
- The `attributes` property was added and typed as `Attributes` on `v28.0.0`.
|
|
29
|
+
|
|
30
|
+
## [35.0.0]
|
|
31
|
+
|
|
32
|
+
### Changed
|
|
33
|
+
|
|
34
|
+
- **BREAKING:** Bump peerDependency `@metamask/network-controller` to `^20.0.0` ([#4508](https://github.com/MetaMask/core/pull/4508))
|
|
35
|
+
- Bump `@metamask/polling-controller` to `^9.0.0` ([#4508](https://github.com/MetaMask/core/pull/4508))
|
|
36
|
+
- Bump `@metamask/accounts-controller` to `^17.2.0` ([#4498](https://github.com/MetaMask/core/pull/4498))
|
|
37
|
+
|
|
38
|
+
### Fixed
|
|
39
|
+
|
|
40
|
+
- Add support for tokenURI encoded images to `NftController` methods `addNft`, `watchNft` and `updateNftMetadata` ([#4482](https://github.com/MetaMask/core/pull/4482))
|
|
41
|
+
|
|
10
42
|
## [34.0.0]
|
|
11
43
|
|
|
12
44
|
### Added
|
|
@@ -981,7 +1013,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
981
1013
|
|
|
982
1014
|
- Use Ethers for AssetsContractController ([#845](https://github.com/MetaMask/core/pull/845))
|
|
983
1015
|
|
|
984
|
-
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@
|
|
1016
|
+
[Unreleased]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@36.0.0...HEAD
|
|
1017
|
+
[36.0.0]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@35.0.0...@metamask/assets-controllers@36.0.0
|
|
1018
|
+
[35.0.0]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@34.0.0...@metamask/assets-controllers@35.0.0
|
|
985
1019
|
[34.0.0]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@33.0.0...@metamask/assets-controllers@34.0.0
|
|
986
1020
|
[33.0.0]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@32.0.0...@metamask/assets-controllers@33.0.0
|
|
987
1021
|
[32.0.0]: https://github.com/MetaMask/core/compare/@metamask/assets-controllers@31.0.0...@metamask/assets-controllers@32.0.0
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
7
|
-
require('./chunk-
|
|
8
|
-
require('./chunk-
|
|
9
|
-
require('./chunk-
|
|
10
|
-
require('./chunk-
|
|
6
|
+
var _chunkIJS7EZU2js = require('./chunk-IJS7EZU2.js');
|
|
7
|
+
require('./chunk-4U2L56TY.js');
|
|
8
|
+
require('./chunk-DOCJ35CC.js');
|
|
9
|
+
require('./chunk-B46K3T54.js');
|
|
10
|
+
require('./chunk-R4HATJKU.js');
|
|
11
11
|
require('./chunk-Z4BLTVTB.js');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
exports.AssetsContractController =
|
|
17
|
+
exports.AssetsContractController = _chunkIJS7EZU2js.AssetsContractController; exports.MISSING_PROVIDER_ERROR = _chunkIJS7EZU2js.MISSING_PROVIDER_ERROR; exports.SINGLE_CALL_BALANCES_ADDRESS_BY_CHAINID = _chunkIJS7EZU2js.SINGLE_CALL_BALANCES_ADDRESS_BY_CHAINID; exports.default = _chunkIJS7EZU2js.AssetsContractController_default;
|
|
18
18
|
//# sourceMappingURL=AssetsContractController.js.map
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
AssetsContractController_default,
|
|
4
4
|
MISSING_PROVIDER_ERROR,
|
|
5
5
|
SINGLE_CALL_BALANCES_ADDRESS_BY_CHAINID
|
|
6
|
-
} from "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
10
|
-
import "./chunk-
|
|
6
|
+
} from "./chunk-62HDABFM.mjs";
|
|
7
|
+
import "./chunk-7H2V5SW4.mjs";
|
|
8
|
+
import "./chunk-2YFZGRUL.mjs";
|
|
9
|
+
import "./chunk-A7VI64MA.mjs";
|
|
10
|
+
import "./chunk-24HGVPDI.mjs";
|
|
11
11
|
import "./chunk-XUI43LEZ.mjs";
|
|
12
12
|
export {
|
|
13
13
|
AssetsContractController,
|
package/dist/NftController.js
CHANGED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkHTIZ4JKGjs = require('./chunk-HTIZ4JKG.js');
|
|
6
6
|
require('./chunk-RGHTNZQ6.js');
|
|
7
|
-
require('./chunk-
|
|
7
|
+
require('./chunk-R4HATJKU.js');
|
|
8
8
|
require('./chunk-Z4BLTVTB.js');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
exports.NftController =
|
|
13
|
+
exports.NftController = _chunkHTIZ4JKGjs.NftController; exports.default = _chunkHTIZ4JKGjs.NftController_default; exports.getDefaultNftControllerState = _chunkHTIZ4JKGjs.getDefaultNftControllerState;
|
|
14
14
|
//# sourceMappingURL=NftController.js.map
|
package/dist/NftController.mjs
CHANGED
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
NftController,
|
|
3
3
|
NftController_default,
|
|
4
4
|
getDefaultNftControllerState
|
|
5
|
-
} from "./chunk-
|
|
5
|
+
} from "./chunk-OCV7GPA2.mjs";
|
|
6
6
|
import "./chunk-CP3HC7AQ.mjs";
|
|
7
|
-
import "./chunk-
|
|
7
|
+
import "./chunk-24HGVPDI.mjs";
|
|
8
8
|
import "./chunk-XUI43LEZ.mjs";
|
|
9
9
|
export {
|
|
10
10
|
NftController,
|
|
@@ -2,12 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
var _chunkZ6NCPTNTjs = require('./chunk-Z6NCPTNT.js');
|
|
6
7
|
require('./chunk-RGHTNZQ6.js');
|
|
8
|
+
require('./chunk-R4HATJKU.js');
|
|
7
9
|
require('./chunk-Z4BLTVTB.js');
|
|
8
10
|
|
|
9
11
|
|
|
10
12
|
|
|
11
13
|
|
|
12
|
-
|
|
14
|
+
|
|
15
|
+
exports.BlockaidResultType = _chunkZ6NCPTNTjs.BlockaidResultType; exports.MAX_GET_COLLECTION_BATCH_SIZE = _chunkZ6NCPTNTjs.MAX_GET_COLLECTION_BATCH_SIZE; exports.NftDetectionController = _chunkZ6NCPTNTjs.NftDetectionController; exports.default = _chunkZ6NCPTNTjs.NftDetectionController_default;
|
|
13
16
|
//# sourceMappingURL=NftDetectionController.js.map
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
BlockaidResultType,
|
|
3
|
+
MAX_GET_COLLECTION_BATCH_SIZE,
|
|
3
4
|
NftDetectionController,
|
|
4
5
|
NftDetectionController_default
|
|
5
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-RI6LDZPC.mjs";
|
|
6
7
|
import "./chunk-CP3HC7AQ.mjs";
|
|
8
|
+
import "./chunk-24HGVPDI.mjs";
|
|
7
9
|
import "./chunk-XUI43LEZ.mjs";
|
|
8
10
|
export {
|
|
9
11
|
BlockaidResultType,
|
|
12
|
+
MAX_GET_COLLECTION_BATCH_SIZE,
|
|
10
13
|
NftDetectionController,
|
|
11
14
|
NftDetectionController_default as default
|
|
12
15
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../chunk-
|
|
3
|
+
var _chunkDOCJ35CCjs = require('../chunk-DOCJ35CC.js');
|
|
4
|
+
require('../chunk-R4HATJKU.js');
|
|
5
5
|
require('../chunk-Z4BLTVTB.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
exports.ERC20Standard =
|
|
8
|
+
exports.ERC20Standard = _chunkDOCJ35CCjs.ERC20Standard;
|
|
9
9
|
//# sourceMappingURL=ERC20Standard.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../../chunk-
|
|
3
|
+
var _chunkB46K3T54js = require('../../../chunk-B46K3T54.js');
|
|
4
|
+
require('../../../chunk-R4HATJKU.js');
|
|
5
5
|
require('../../../chunk-Z4BLTVTB.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
exports.ERC1155Standard =
|
|
8
|
+
exports.ERC1155Standard = _chunkB46K3T54js.ERC1155Standard;
|
|
9
9
|
//# sourceMappingURL=ERC1155Standard.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../../chunk-
|
|
3
|
+
var _chunk4U2L56TYjs = require('../../../chunk-4U2L56TY.js');
|
|
4
|
+
require('../../../chunk-R4HATJKU.js');
|
|
5
5
|
require('../../../chunk-Z4BLTVTB.js');
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
exports.ERC721Standard =
|
|
8
|
+
exports.ERC721Standard = _chunk4U2L56TYjs.ERC721Standard;
|
|
9
9
|
//# sourceMappingURL=ERC721Standard.js.map
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
8
|
-
require('./chunk-
|
|
7
|
+
var _chunk2J3CVSQ5js = require('./chunk-2J3CVSQ5.js');
|
|
8
|
+
require('./chunk-R4HATJKU.js');
|
|
9
9
|
require('./chunk-Z4BLTVTB.js');
|
|
10
10
|
|
|
11
11
|
|
|
@@ -13,5 +13,5 @@ require('./chunk-Z4BLTVTB.js');
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
|
-
exports.STATIC_MAINNET_TOKEN_LIST =
|
|
16
|
+
exports.STATIC_MAINNET_TOKEN_LIST = _chunk2J3CVSQ5js.STATIC_MAINNET_TOKEN_LIST; exports.TokenDetectionController = _chunk2J3CVSQ5js.TokenDetectionController; exports.controllerName = _chunk2J3CVSQ5js.controllerName; exports.default = _chunk2J3CVSQ5js.TokenDetectionController_default; exports.isEqualCaseInsensitive = _chunk2J3CVSQ5js.isEqualCaseInsensitive;
|
|
17
17
|
//# sourceMappingURL=TokenDetectionController.js.map
|
|
@@ -4,8 +4,8 @@ import {
|
|
|
4
4
|
TokenDetectionController_default,
|
|
5
5
|
controllerName,
|
|
6
6
|
isEqualCaseInsensitive
|
|
7
|
-
} from "./chunk-
|
|
8
|
-
import "./chunk-
|
|
7
|
+
} from "./chunk-PPJTMDXC.mjs";
|
|
8
|
+
import "./chunk-24HGVPDI.mjs";
|
|
9
9
|
import "./chunk-XUI43LEZ.mjs";
|
|
10
10
|
export {
|
|
11
11
|
STATIC_MAINNET_TOKEN_LIST,
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('./chunk-
|
|
7
|
-
require('./chunk-
|
|
5
|
+
var _chunk3QLHZOXAjs = require('./chunk-3QLHZOXA.js');
|
|
6
|
+
require('./chunk-OJLB6FID.js');
|
|
7
|
+
require('./chunk-R4HATJKU.js');
|
|
8
8
|
require('./chunk-Z4BLTVTB.js');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
exports.TokenListController =
|
|
13
|
+
exports.TokenListController = _chunk3QLHZOXAjs.TokenListController; exports.default = _chunk3QLHZOXAjs.TokenListController_default; exports.getDefaultTokenListState = _chunk3QLHZOXAjs.getDefaultTokenListState;
|
|
14
14
|
//# sourceMappingURL=TokenListController.js.map
|
|
@@ -2,9 +2,9 @@ import {
|
|
|
2
2
|
TokenListController,
|
|
3
3
|
TokenListController_default,
|
|
4
4
|
getDefaultTokenListState
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-ZWZZUFO5.mjs";
|
|
6
|
+
import "./chunk-5IMEJ2FS.mjs";
|
|
7
|
+
import "./chunk-24HGVPDI.mjs";
|
|
8
8
|
import "./chunk-XUI43LEZ.mjs";
|
|
9
9
|
export {
|
|
10
10
|
TokenListController,
|
|
@@ -3,16 +3,16 @@
|
|
|
3
3
|
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkDSDI75PJjs = require('./chunk-DSDI75PJ.js');
|
|
7
7
|
require('./chunk-V6DNVROD.js');
|
|
8
8
|
require('./chunk-7K6PSEAA.js');
|
|
9
9
|
require('./chunk-ZG5MS2TO.js');
|
|
10
|
-
require('./chunk-
|
|
10
|
+
require('./chunk-R4HATJKU.js');
|
|
11
11
|
require('./chunk-Z4BLTVTB.js');
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
exports.TokenRatesController =
|
|
17
|
+
exports.TokenRatesController = _chunkDSDI75PJjs.TokenRatesController; exports.controllerName = _chunkDSDI75PJjs.controllerName; exports.default = _chunkDSDI75PJjs.TokenRatesController_default; exports.getDefaultTokenRatesControllerState = _chunkDSDI75PJjs.getDefaultTokenRatesControllerState;
|
|
18
18
|
//# sourceMappingURL=TokenRatesController.js.map
|
|
@@ -3,11 +3,11 @@ import {
|
|
|
3
3
|
TokenRatesController_default,
|
|
4
4
|
controllerName,
|
|
5
5
|
getDefaultTokenRatesControllerState
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-K6DUHENW.mjs";
|
|
7
7
|
import "./chunk-XQO3EG4J.mjs";
|
|
8
8
|
import "./chunk-TTH3ES66.mjs";
|
|
9
9
|
import "./chunk-JTXPJ6TK.mjs";
|
|
10
|
-
import "./chunk-
|
|
10
|
+
import "./chunk-24HGVPDI.mjs";
|
|
11
11
|
import "./chunk-XUI43LEZ.mjs";
|
|
12
12
|
export {
|
|
13
13
|
TokenRatesController,
|
package/dist/TokensController.js
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
6
|
-
require('./chunk-
|
|
7
|
-
require('./chunk-
|
|
8
|
-
require('./chunk-
|
|
9
|
-
require('./chunk-
|
|
5
|
+
var _chunkTPUVGGNOjs = require('./chunk-TPUVGGNO.js');
|
|
6
|
+
require('./chunk-DOCJ35CC.js');
|
|
7
|
+
require('./chunk-B46K3T54.js');
|
|
8
|
+
require('./chunk-OJLB6FID.js');
|
|
9
|
+
require('./chunk-R4HATJKU.js');
|
|
10
10
|
require('./chunk-Z4BLTVTB.js');
|
|
11
11
|
|
|
12
12
|
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
exports.TokensController =
|
|
15
|
+
exports.TokensController = _chunkTPUVGGNOjs.TokensController; exports.default = _chunkTPUVGGNOjs.TokensController_default; exports.getDefaultTokensState = _chunkTPUVGGNOjs.getDefaultTokensState;
|
|
16
16
|
//# sourceMappingURL=TokensController.js.map
|
|
@@ -2,11 +2,11 @@ import {
|
|
|
2
2
|
TokensController,
|
|
3
3
|
TokensController_default,
|
|
4
4
|
getDefaultTokensState
|
|
5
|
-
} from "./chunk-
|
|
6
|
-
import "./chunk-
|
|
7
|
-
import "./chunk-
|
|
8
|
-
import "./chunk-
|
|
9
|
-
import "./chunk-
|
|
5
|
+
} from "./chunk-RXBDSHHH.mjs";
|
|
6
|
+
import "./chunk-2YFZGRUL.mjs";
|
|
7
|
+
import "./chunk-A7VI64MA.mjs";
|
|
8
|
+
import "./chunk-5IMEJ2FS.mjs";
|
|
9
|
+
import "./chunk-24HGVPDI.mjs";
|
|
10
10
|
import "./chunk-XUI43LEZ.mjs";
|
|
11
11
|
export {
|
|
12
12
|
TokensController,
|
package/dist/assetsUtil.js
CHANGED
|
@@ -14,7 +14,8 @@
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
var _chunkR4HATJKUjs = require('./chunk-R4HATJKU.js');
|
|
18
19
|
require('./chunk-Z4BLTVTB.js');
|
|
19
20
|
|
|
20
21
|
|
|
@@ -32,5 +33,6 @@ require('./chunk-Z4BLTVTB.js');
|
|
|
32
33
|
|
|
33
34
|
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
|
|
37
|
+
exports.SupportedTokenDetectionNetworks = _chunkR4HATJKUjs.SupportedTokenDetectionNetworks; exports.TOKEN_PRICES_BATCH_SIZE = _chunkR4HATJKUjs.TOKEN_PRICES_BATCH_SIZE; exports.addUrlProtocolPrefix = _chunkR4HATJKUjs.addUrlProtocolPrefix; exports.compareNftMetadata = _chunkR4HATJKUjs.compareNftMetadata; exports.divideIntoBatches = _chunkR4HATJKUjs.divideIntoBatches; exports.ethersBigNumberToBN = _chunkR4HATJKUjs.ethersBigNumberToBN; exports.fetchTokenContractExchangeRates = _chunkR4HATJKUjs.fetchTokenContractExchangeRates; exports.formatAggregatorNames = _chunkR4HATJKUjs.formatAggregatorNames; exports.formatIconUrlWithProxy = _chunkR4HATJKUjs.formatIconUrlWithProxy; exports.getFormattedIpfsUrl = _chunkR4HATJKUjs.getFormattedIpfsUrl; exports.getIpfsCIDv1AndPath = _chunkR4HATJKUjs.getIpfsCIDv1AndPath; exports.hasNewCollectionFields = _chunkR4HATJKUjs.hasNewCollectionFields; exports.isTokenDetectionSupportedForNetwork = _chunkR4HATJKUjs.isTokenDetectionSupportedForNetwork; exports.isTokenListSupportedForNetwork = _chunkR4HATJKUjs.isTokenListSupportedForNetwork; exports.reduceInBatchesSerially = _chunkR4HATJKUjs.reduceInBatchesSerially; exports.removeIpfsProtocolPrefix = _chunkR4HATJKUjs.removeIpfsProtocolPrefix;
|
|
36
38
|
//# sourceMappingURL=assetsUtil.js.map
|
package/dist/assetsUtil.mjs
CHANGED
|
@@ -10,11 +10,12 @@ import {
|
|
|
10
10
|
formatIconUrlWithProxy,
|
|
11
11
|
getFormattedIpfsUrl,
|
|
12
12
|
getIpfsCIDv1AndPath,
|
|
13
|
+
hasNewCollectionFields,
|
|
13
14
|
isTokenDetectionSupportedForNetwork,
|
|
14
15
|
isTokenListSupportedForNetwork,
|
|
15
16
|
reduceInBatchesSerially,
|
|
16
17
|
removeIpfsProtocolPrefix
|
|
17
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-24HGVPDI.mjs";
|
|
18
19
|
import "./chunk-XUI43LEZ.mjs";
|
|
19
20
|
export {
|
|
20
21
|
SupportedTokenDetectionNetworks,
|
|
@@ -28,6 +29,7 @@ export {
|
|
|
28
29
|
formatIconUrlWithProxy,
|
|
29
30
|
getFormattedIpfsUrl,
|
|
30
31
|
getIpfsCIDv1AndPath,
|
|
32
|
+
hasNewCollectionFields,
|
|
31
33
|
isTokenDetectionSupportedForNetwork,
|
|
32
34
|
isTokenListSupportedForNetwork,
|
|
33
35
|
reduceInBatchesSerially,
|
|
@@ -27,6 +27,11 @@ function compareNftMetadata(newNftMetadata, nft) {
|
|
|
27
27
|
}, 0);
|
|
28
28
|
return differentValues > 0;
|
|
29
29
|
}
|
|
30
|
+
function hasNewCollectionFields(newNftMetadata, nft) {
|
|
31
|
+
const keysNewNftMetadata = Object.keys(newNftMetadata.collection ?? {});
|
|
32
|
+
const keysExistingNft = new Set(Object.keys(nft.collection ?? {}));
|
|
33
|
+
return keysNewNftMetadata.some((key) => !keysExistingNft.has(key));
|
|
34
|
+
}
|
|
30
35
|
var aggregatorNameByKey = {
|
|
31
36
|
aave: "Aave",
|
|
32
37
|
bancor: "Bancor",
|
|
@@ -192,6 +197,7 @@ async function fetchTokenContractExchangeRates({
|
|
|
192
197
|
export {
|
|
193
198
|
TOKEN_PRICES_BATCH_SIZE,
|
|
194
199
|
compareNftMetadata,
|
|
200
|
+
hasNewCollectionFields,
|
|
195
201
|
formatAggregatorNames,
|
|
196
202
|
formatIconUrlWithProxy,
|
|
197
203
|
SupportedTokenDetectionNetworks,
|
|
@@ -206,4 +212,4 @@ export {
|
|
|
206
212
|
reduceInBatchesSerially,
|
|
207
213
|
fetchTokenContractExchangeRates
|
|
208
214
|
};
|
|
209
|
-
//# sourceMappingURL=chunk-
|
|
215
|
+
//# sourceMappingURL=chunk-24HGVPDI.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/assetsUtil.ts"],"sourcesContent":["import type { BigNumber } from '@ethersproject/bignumber';\nimport {\n convertHexToDecimal,\n toChecksumHexAddress,\n} from '@metamask/controller-utils';\nimport type { Hex } from '@metamask/utils';\nimport { remove0x } from '@metamask/utils';\nimport BN from 'bn.js';\nimport { CID } from 'multiformats/cid';\n\nimport type { Nft, NftMetadata } from './NftController';\nimport type { AbstractTokenPricesService } from './token-prices-service';\nimport { type ContractExchangeRates } from './TokenRatesController';\n\n/**\n * The maximum number of token addresses that should be sent to the Price API in\n * a single request.\n */\nexport const TOKEN_PRICES_BATCH_SIZE = 30;\n\n/**\n * Compares nft metadata entries to any nft entry.\n * We need this method when comparing a new fetched nft metadata, in case a entry changed to a defined value,\n * there's a need to update the nft in state.\n *\n * @param newNftMetadata - Nft metadata object.\n * @param nft - Nft object to compare with.\n * @returns Whether there are differences.\n */\nexport function compareNftMetadata(newNftMetadata: NftMetadata, nft: Nft) {\n const keys: (keyof NftMetadata)[] = [\n 'image',\n 'backgroundColor',\n 'imagePreview',\n 'imageThumbnail',\n 'imageOriginal',\n 'animation',\n 'animationOriginal',\n 'externalLink',\n 'tokenURI',\n ];\n const differentValues = keys.reduce((value, key) => {\n if (newNftMetadata[key] && newNftMetadata[key] !== nft[key]) {\n return value + 1;\n }\n return value;\n }, 0);\n return differentValues > 0;\n}\n\n/**\n * Checks whether the existing nft object has all the keys of the new incoming nft metadata object\n * @param newNftMetadata - New nft metadata object\n * @param nft - Existing nft object to compare with\n * @returns Whether the existing nft object has all the new keys from the new Nft metadata object\n */\nexport function hasNewCollectionFields(\n newNftMetadata: NftMetadata,\n nft: Nft,\n): boolean {\n const keysNewNftMetadata = Object.keys(newNftMetadata.collection ?? {});\n const keysExistingNft = new Set(Object.keys(nft.collection ?? {}));\n\n return keysNewNftMetadata.some((key) => !keysExistingNft.has(key));\n}\n\nconst aggregatorNameByKey: Record<string, string> = {\n aave: 'Aave',\n bancor: 'Bancor',\n cmc: 'CMC',\n cryptocom: 'Crypto.com',\n coinGecko: 'CoinGecko',\n oneInch: '1inch',\n paraswap: 'Paraswap',\n pmm: 'PMM',\n zapper: 'Zapper',\n zerion: 'Zerion',\n zeroEx: '0x',\n synthetix: 'Synthetix',\n yearn: 'Yearn',\n apeswap: 'ApeSwap',\n binanceDex: 'BinanceDex',\n pancakeTop100: 'PancakeTop100',\n pancakeExtended: 'PancakeExtended',\n balancer: 'Balancer',\n quickswap: 'QuickSwap',\n matcha: 'Matcha',\n pangolinDex: 'PangolinDex',\n pangolinDexStableCoin: 'PangolinDexStableCoin',\n pangolinDexAvaxBridge: 'PangolinDexAvaxBridge',\n traderJoe: 'TraderJoe',\n airswapLight: 'AirswapLight',\n kleros: 'Kleros',\n};\n\n/**\n * Formats aggregator names to presentable format.\n *\n * @param aggregators - List of token list names in camelcase.\n * @returns Formatted aggregator names.\n */\nexport const formatAggregatorNames = (aggregators: string[]) => {\n return aggregators.map(\n (key) =>\n aggregatorNameByKey[key] ||\n `${key[0].toUpperCase()}${key.substring(1, key.length)}`,\n );\n};\n\n/**\n * Format token list assets to use image proxy from Codefi.\n *\n * @param params - Object that contains chainID and tokenAddress.\n * @param params.chainId - ChainID of network in 0x-prefixed hexadecimal format.\n * @param params.tokenAddress - Address of token in mixed or lowercase.\n * @returns Formatted image url\n */\nexport const formatIconUrlWithProxy = ({\n chainId,\n tokenAddress,\n}: {\n chainId: Hex;\n tokenAddress: string;\n}) => {\n const chainIdDecimal = convertHexToDecimal(chainId).toString();\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/restrict-template-expressions\n return `https://static.cx.metamask.io/api/v1/tokenIcons/${chainIdDecimal}/${tokenAddress.toLowerCase()}.png`;\n};\n\n/**\n * Networks where token detection is supported - Values are in hex format\n */\nexport enum SupportedTokenDetectionNetworks {\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n mainnet = '0x1', // decimal: 1\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n bsc = '0x38', // decimal: 56\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n polygon = '0x89', // decimal: 137\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n avax = '0xa86a', // decimal: 43114\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n aurora = '0x4e454152', // decimal: 1313161554\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n linea_goerli = '0xe704', // decimal: 59140\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n linea_mainnet = '0xe708', // decimal: 59144\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n arbitrum = '0xa4b1', // decimal: 42161\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n optimism = '0xa', // decimal: 10\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n base = '0x2105', // decimal: 8453\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n zksync = '0x144', // decimal: 324\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n cronos = '0x19', // decimal: 25\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n celo = '0xa4ec', // decimal: 42220\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n gnosis = '0x64', // decimal: 100\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n fantom = '0xfa', // decimal: 250\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n polygon_zkevm = '0x44d', // decimal: 1101\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n moonbeam = '0x504', // decimal: 1284\n // TODO: Either fix this lint violation or explain why it's necessary to ignore.\n // eslint-disable-next-line @typescript-eslint/naming-convention\n moonriver = '0x505', // decimal: 1285\n}\n\n/**\n * Check if token detection is enabled for certain networks.\n *\n * @param chainId - ChainID of network\n * @returns Whether the current network supports token detection\n */\nexport function isTokenDetectionSupportedForNetwork(chainId: Hex): boolean {\n return Object.values<Hex>(SupportedTokenDetectionNetworks).includes(chainId);\n}\n\n/**\n * Check if token list polling is enabled for a given network.\n * Currently this method is used to support e2e testing for consumers of this package.\n *\n * @param chainId - ChainID of network\n * @returns Whether the current network supports tokenlists\n */\nexport function isTokenListSupportedForNetwork(chainId: Hex): boolean {\n return isTokenDetectionSupportedForNetwork(chainId);\n}\n\n/**\n * Removes IPFS protocol prefix from input string.\n *\n * @param ipfsUrl - An IPFS url (e.g. ipfs://{content id})\n * @returns IPFS content identifier and (possibly) path in a string\n * @throws Will throw if the url passed is not IPFS.\n */\nexport function removeIpfsProtocolPrefix(ipfsUrl: string) {\n if (ipfsUrl.startsWith('ipfs://ipfs/')) {\n return ipfsUrl.replace('ipfs://ipfs/', '');\n } else if (ipfsUrl.startsWith('ipfs://')) {\n return ipfsUrl.replace('ipfs://', '');\n }\n // this method should not be used with non-ipfs urls (i.e. startsWith('ipfs://') === true)\n throw new Error('this method should not be used with non ipfs urls');\n}\n\n/**\n * Extracts content identifier and path from an input string.\n *\n * @param ipfsUrl - An IPFS URL minus the IPFS protocol prefix\n * @returns IFPS content identifier (cid) and sub path as string.\n * @throws Will throw if the url passed is not ipfs.\n */\nexport function getIpfsCIDv1AndPath(ipfsUrl: string): {\n cid: string;\n path?: string;\n} {\n const url = removeIpfsProtocolPrefix(ipfsUrl);\n\n // check if there is a path\n // (CID is everything preceding first forward slash, path is everything after)\n const index = url.indexOf('/');\n const cid = index !== -1 ? url.substring(0, index) : url;\n const path = index !== -1 ? url.substring(index) : undefined;\n\n // We want to ensure that the CID is v1 (https://docs.ipfs.io/concepts/content-addressing/#identifier-formats)\n // because most cid v0s appear to be incompatible with IPFS subdomains\n return {\n cid: CID.parse(cid).toV1().toString(),\n path,\n };\n}\n\n/**\n * Formats URL correctly for use retrieving assets hosted on IPFS.\n *\n * @param ipfsGateway - The users preferred IPFS gateway (full URL or just host).\n * @param ipfsUrl - The IFPS URL pointed at the asset.\n * @param subdomainSupported - Boolean indicating whether the URL should be formatted with subdomains or not.\n * @returns A formatted URL, with the user's preferred IPFS gateway and format (subdomain or not), pointing to an asset hosted on IPFS.\n */\nexport function getFormattedIpfsUrl(\n ipfsGateway: string,\n ipfsUrl: string,\n subdomainSupported: boolean,\n): string {\n const { host, protocol, origin } = new URL(addUrlProtocolPrefix(ipfsGateway));\n if (subdomainSupported) {\n const { cid, path } = getIpfsCIDv1AndPath(ipfsUrl);\n return `${protocol}//${cid}.ipfs.${host}${path ?? ''}`;\n }\n const cidAndPath = removeIpfsProtocolPrefix(ipfsUrl);\n return `${origin}/ipfs/${cidAndPath}`;\n}\n\n/**\n * Adds URL protocol prefix to input URL string if missing.\n *\n * @param urlString - An IPFS URL.\n * @returns A URL with a https:// prepended.\n */\nexport function addUrlProtocolPrefix(urlString: string): string {\n if (!urlString.match(/(^http:\\/\\/)|(^https:\\/\\/)/u)) {\n return `https://${urlString}`;\n }\n return urlString;\n}\n\n/**\n * Converts an Ethers BigNumber to a BN.\n *\n * @param bigNumber - An Ethers BigNumber instance.\n * @returns A BN object.\n */\nexport function ethersBigNumberToBN(bigNumber: BigNumber): BN {\n return new BN(remove0x(bigNumber.toHexString()), 'hex');\n}\n\n/**\n * Partitions a list of values into groups that are at most `batchSize` in\n * length.\n *\n * @param values - The list of values.\n * @param args - The remaining arguments.\n * @param args.batchSize - The desired maximum number of values per batch.\n * @returns The list of batches.\n */\nexport function divideIntoBatches<Value>(\n values: Value[],\n { batchSize }: { batchSize: number },\n): Value[][] {\n const batches = [];\n for (let i = 0; i < values.length; i += batchSize) {\n batches.push(values.slice(i, i + batchSize));\n }\n return batches;\n}\n\n/**\n * Constructs an object from processing batches of the given values\n * sequentially.\n *\n * @param args - The arguments to this function.\n * @param args.values - A list of values to iterate over.\n * @param args.batchSize - The maximum number of values in each batch.\n * @param args.eachBatch - A function to call for each batch. This function is\n * similar to the function that `Array.prototype.reduce` takes, in that it\n * receives the object that is being built, each batch in the list of batches\n * and the index, and should return an updated version of the object.\n * @param args.initialResult - The initial value of the final data structure,\n * i.e., the value that will be fed into the first call of `eachBatch`.\n * @returns The built object.\n */\nexport async function reduceInBatchesSerially<\n Value,\n Result extends Record<PropertyKey, unknown>,\n>({\n values,\n batchSize,\n eachBatch,\n initialResult,\n}: {\n values: Value[];\n batchSize: number;\n eachBatch: (\n workingResult: Partial<Result>,\n batch: Value[],\n index: number,\n ) => Partial<Result> | Promise<Partial<Result>>;\n initialResult: Partial<Result>;\n}): Promise<Result> {\n const batches = divideIntoBatches(values, { batchSize });\n let workingResult = initialResult;\n for (const [index, batch] of batches.entries()) {\n workingResult = await eachBatch(workingResult, batch, index);\n }\n // There's no way around this — we have to assume that in the end, the result\n // matches the intended type.\n const finalResult = workingResult as Result;\n return finalResult;\n}\n\n/**\n * Retrieves token prices for a set of contract addresses in a specific currency and chainId.\n *\n * @param args - The arguments to function.\n * @param args.tokenPricesService - An object in charge of retrieving token prices.\n * @param args.nativeCurrency - The native currency to request price in.\n * @param args.tokenAddresses - The list of contract addresses.\n * @param args.chainId - The chainId of the tokens.\n * @returns The prices for the requested tokens.\n */\nexport async function fetchTokenContractExchangeRates({\n tokenPricesService,\n nativeCurrency,\n tokenAddresses,\n chainId,\n}: {\n tokenPricesService: AbstractTokenPricesService;\n nativeCurrency: string;\n tokenAddresses: Hex[];\n chainId: Hex;\n}): Promise<ContractExchangeRates> {\n const isChainIdSupported =\n tokenPricesService.validateChainIdSupported(chainId);\n const isCurrencySupported =\n tokenPricesService.validateCurrencySupported(nativeCurrency);\n\n if (!isChainIdSupported || !isCurrencySupported) {\n return {};\n }\n\n const tokenPricesByTokenAddress = await reduceInBatchesSerially<\n Hex,\n Awaited<ReturnType<AbstractTokenPricesService['fetchTokenPrices']>>\n >({\n values: [...tokenAddresses].sort(),\n batchSize: TOKEN_PRICES_BATCH_SIZE,\n eachBatch: async (allTokenPricesByTokenAddress, batch) => {\n const tokenPricesByTokenAddressForBatch =\n await tokenPricesService.fetchTokenPrices({\n tokenAddresses: batch,\n chainId,\n currency: nativeCurrency,\n });\n\n return {\n ...allTokenPricesByTokenAddress,\n ...tokenPricesByTokenAddressForBatch,\n };\n },\n initialResult: {},\n });\n\n return Object.entries(tokenPricesByTokenAddress).reduce(\n (obj, [tokenAddress, tokenPrice]) => {\n return {\n ...obj,\n [toChecksumHexAddress(tokenAddress)]: tokenPrice?.price,\n };\n },\n {},\n );\n}\n"],"mappings":";AACA;AAAA,EACE;AAAA,EACA;AAAA,OACK;AAEP,SAAS,gBAAgB;AACzB,OAAO,QAAQ;AACf,SAAS,WAAW;AAUb,IAAM,0BAA0B;AAWhC,SAAS,mBAAmB,gBAA6B,KAAU;AACxE,QAAM,OAA8B;AAAA,IAClC;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACA,QAAM,kBAAkB,KAAK,OAAO,CAAC,OAAO,QAAQ;AAClD,QAAI,eAAe,GAAG,KAAK,eAAe,GAAG,MAAM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;AAC/C,WAAO,CAAC;AAAA,EACV;AAEA,QAAM,4BAA4B,MAAM,wBAGtC;AAAA,IACA,QAAQ,CAAC,GAAG,cAAc,EAAE,KAAK;AAAA,IACjC,WAAW;AAAA,IACX,WAAW,OAAO,8BAA8B,UAAU;AACxD,YAAM,oCACJ,MAAM,mBAAmB,iBAAiB;AAAA,QACxC,gBAAgB;AAAA,QAChB;AAAA,QACA,UAAU;AAAA,MACZ,CAAC;AAEH,aAAO;AAAA,QACL,GAAG;AAAA,QACH,GAAG;AAAA,MACL;AAAA,IACF;AAAA,IACA,eAAe,CAAC;AAAA,EAClB,CAAC;AAED,SAAO,OAAO,QAAQ,yBAAyB,EAAE;AAAA,IAC/C,CAAC,KAAK,CAAC,cAAc,UAAU,MAAM;AACnC,aAAO;AAAA,QACL,GAAG;AAAA,QACH,CAAC,qBAAqB,YAAY,CAAC,GAAG,YAAY;AAAA,MACpD;AAAA,IACF;AAAA,IACA,CAAC;AAAA,EACH;AACF;","names":["SupportedTokenDetectionNetworks"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkR4HATJKUjs = require('./chunk-R4HATJKU.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
@@ -99,7 +99,7 @@ var TokenDetectionController = class extends _pollingcontroller.StaticIntervalPo
|
|
|
99
99
|
_chunkZ4BLTVTBjs.__privateSet.call(void 0, this, _networkClientId, networkClientId);
|
|
100
100
|
const { useTokenDetection: defaultUseTokenDetection } = this.messagingSystem.call("PreferencesController:getState");
|
|
101
101
|
_chunkZ4BLTVTBjs.__privateSet.call(void 0, this, _isDetectionEnabledFromPreferences, defaultUseTokenDetection);
|
|
102
|
-
_chunkZ4BLTVTBjs.__privateSet.call(void 0, this, _isDetectionEnabledForNetwork,
|
|
102
|
+
_chunkZ4BLTVTBjs.__privateSet.call(void 0, this, _isDetectionEnabledForNetwork, _chunkR4HATJKUjs.isTokenDetectionSupportedForNetwork.call(void 0, chainId));
|
|
103
103
|
_chunkZ4BLTVTBjs.__privateSet.call(void 0, this, _getBalancesInSingleCall, getBalancesInSingleCall);
|
|
104
104
|
_chunkZ4BLTVTBjs.__privateSet.call(void 0, this, _trackMetaMetricsEvent, trackMetaMetricsEvent);
|
|
105
105
|
const { isUnlocked } = this.messagingSystem.call(
|
|
@@ -169,7 +169,7 @@ var TokenDetectionController = class extends _pollingcontroller.StaticIntervalPo
|
|
|
169
169
|
const { chainId, networkClientId: selectedNetworkClientId } = _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getCorrectChainIdAndNetworkClientId, getCorrectChainIdAndNetworkClientId_fn).call(this, networkClientId);
|
|
170
170
|
const chainIdAgainstWhichToDetect = chainId;
|
|
171
171
|
const networkClientIdAgainstWhichToDetect = selectedNetworkClientId;
|
|
172
|
-
if (!
|
|
172
|
+
if (!_chunkR4HATJKUjs.isTokenDetectionSupportedForNetwork.call(void 0, chainIdAgainstWhichToDetect)) {
|
|
173
173
|
return;
|
|
174
174
|
}
|
|
175
175
|
if (!_chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _isDetectionEnabledFromPreferences) && chainIdAgainstWhichToDetect !== _controllerutils.ChainId.mainnet) {
|
|
@@ -260,7 +260,7 @@ registerEventListeners_fn = function() {
|
|
|
260
260
|
async ({ selectedNetworkClientId }) => {
|
|
261
261
|
const isNetworkClientIdChanged = _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _networkClientId) !== selectedNetworkClientId;
|
|
262
262
|
const { chainId: newChainId } = _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _getCorrectChainIdAndNetworkClientId, getCorrectChainIdAndNetworkClientId_fn).call(this, selectedNetworkClientId);
|
|
263
|
-
_chunkZ4BLTVTBjs.__privateSet.call(void 0, this, _isDetectionEnabledForNetwork,
|
|
263
|
+
_chunkZ4BLTVTBjs.__privateSet.call(void 0, this, _isDetectionEnabledForNetwork, _chunkR4HATJKUjs.isTokenDetectionSupportedForNetwork.call(void 0, newChainId));
|
|
264
264
|
if (isNetworkClientIdChanged && _chunkZ4BLTVTBjs.__privateGet.call(void 0, this, _isDetectionEnabledForNetwork)) {
|
|
265
265
|
_chunkZ4BLTVTBjs.__privateSet.call(void 0, this, _networkClientId, selectedNetworkClientId);
|
|
266
266
|
await _chunkZ4BLTVTBjs.__privateMethod.call(void 0, this, _restartTokenDetection, restartTokenDetection_fn).call(this, {
|
|
@@ -431,4 +431,4 @@ var TokenDetectionController_default = TokenDetectionController;
|
|
|
431
431
|
|
|
432
432
|
|
|
433
433
|
exports.isEqualCaseInsensitive = isEqualCaseInsensitive; exports.STATIC_MAINNET_TOKEN_LIST = STATIC_MAINNET_TOKEN_LIST; exports.controllerName = controllerName; exports.TokenDetectionController = TokenDetectionController; exports.TokenDetectionController_default = TokenDetectionController_default;
|
|
434
|
-
//# sourceMappingURL=chunk-
|
|
434
|
+
//# sourceMappingURL=chunk-2J3CVSQ5.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ethersBigNumberToBN
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-24HGVPDI.mjs";
|
|
4
4
|
|
|
5
5
|
// src/Standards/ERC20Standard.ts
|
|
6
6
|
import { toUtf8 } from "@ethereumjs/util";
|
|
@@ -112,4 +112,4 @@ var ERC20Standard = class {
|
|
|
112
112
|
export {
|
|
113
113
|
ERC20Standard
|
|
114
114
|
};
|
|
115
|
-
//# sourceMappingURL=chunk-
|
|
115
|
+
//# sourceMappingURL=chunk-2YFZGRUL.mjs.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkOJLB6FIDjs = require('./chunk-OJLB6FID.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkR4HATJKUjs = require('./chunk-R4HATJKU.js');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
@@ -99,7 +99,7 @@ var TokenListController = class extends _pollingcontroller.StaticIntervalPolling
|
|
|
99
99
|
* Start polling for the token list.
|
|
100
100
|
*/
|
|
101
101
|
async start() {
|
|
102
|
-
if (!
|
|
102
|
+
if (!_chunkR4HATJKUjs.isTokenListSupportedForNetwork.call(void 0, this.chainId)) {
|
|
103
103
|
return;
|
|
104
104
|
}
|
|
105
105
|
await this.startPolling();
|
|
@@ -175,7 +175,7 @@ var TokenListController = class extends _pollingcontroller.StaticIntervalPolling
|
|
|
175
175
|
tokenList = { ...cachedTokens };
|
|
176
176
|
} else {
|
|
177
177
|
const tokensFromAPI = await _controllerutils.safelyExecute.call(void 0,
|
|
178
|
-
() =>
|
|
178
|
+
() => _chunkOJLB6FIDjs.fetchTokenListByChainId.call(void 0,
|
|
179
179
|
chainId,
|
|
180
180
|
this.abortController.signal
|
|
181
181
|
)
|
|
@@ -194,8 +194,8 @@ var TokenListController = class extends _pollingcontroller.StaticIntervalPolling
|
|
|
194
194
|
for (const token of tokensFromAPI) {
|
|
195
195
|
const formattedToken = {
|
|
196
196
|
...token,
|
|
197
|
-
aggregators:
|
|
198
|
-
iconUrl:
|
|
197
|
+
aggregators: _chunkR4HATJKUjs.formatAggregatorNames.call(void 0, token.aggregators),
|
|
198
|
+
iconUrl: _chunkR4HATJKUjs.formatIconUrlWithProxy.call(void 0, {
|
|
199
199
|
chainId,
|
|
200
200
|
tokenAddress: token.address
|
|
201
201
|
})
|
|
@@ -288,4 +288,4 @@ var TokenListController_default = TokenListController;
|
|
|
288
288
|
|
|
289
289
|
|
|
290
290
|
exports.getDefaultTokenListState = getDefaultTokenListState; exports.TokenListController = TokenListController; exports.TokenListController_default = TokenListController_default;
|
|
291
|
-
//# sourceMappingURL=chunk-
|
|
291
|
+
//# sourceMappingURL=chunk-3QLHZOXA.js.map
|