@metamask/assets-controllers 38.3.0 → 39.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.
Files changed (82) hide show
  1. package/CHANGELOG.md +10 -1
  2. package/dist/AccountTrackerController.cjs +4 -3
  3. package/dist/AccountTrackerController.cjs.map +1 -1
  4. package/dist/AccountTrackerController.d.cts +26 -4
  5. package/dist/AccountTrackerController.d.cts.map +1 -1
  6. package/dist/AccountTrackerController.d.mts +26 -4
  7. package/dist/AccountTrackerController.d.mts.map +1 -1
  8. package/dist/AccountTrackerController.mjs +4 -3
  9. package/dist/AccountTrackerController.mjs.map +1 -1
  10. package/dist/CurrencyRateController.cjs +4 -4
  11. package/dist/CurrencyRateController.cjs.map +1 -1
  12. package/dist/CurrencyRateController.d.cts +23 -5
  13. package/dist/CurrencyRateController.d.cts.map +1 -1
  14. package/dist/CurrencyRateController.d.mts +23 -5
  15. package/dist/CurrencyRateController.d.mts.map +1 -1
  16. package/dist/CurrencyRateController.mjs +4 -4
  17. package/dist/CurrencyRateController.mjs.map +1 -1
  18. package/dist/TokenDetectionController.cjs +126 -29
  19. package/dist/TokenDetectionController.cjs.map +1 -1
  20. package/dist/TokenDetectionController.d.cts +25 -17
  21. package/dist/TokenDetectionController.d.cts.map +1 -1
  22. package/dist/TokenDetectionController.d.mts +25 -17
  23. package/dist/TokenDetectionController.d.mts.map +1 -1
  24. package/dist/TokenDetectionController.mjs +125 -27
  25. package/dist/TokenDetectionController.mjs.map +1 -1
  26. package/dist/TokenListController.cjs +18 -17
  27. package/dist/TokenListController.cjs.map +1 -1
  28. package/dist/TokenListController.d.cts +23 -8
  29. package/dist/TokenListController.d.cts.map +1 -1
  30. package/dist/TokenListController.d.mts +23 -8
  31. package/dist/TokenListController.d.mts.map +1 -1
  32. package/dist/TokenListController.mjs +18 -17
  33. package/dist/TokenListController.mjs.map +1 -1
  34. package/dist/TokenRatesController.cjs +4 -4
  35. package/dist/TokenRatesController.cjs.map +1 -1
  36. package/dist/TokenRatesController.d.cts +23 -5
  37. package/dist/TokenRatesController.d.cts.map +1 -1
  38. package/dist/TokenRatesController.d.mts +23 -5
  39. package/dist/TokenRatesController.d.mts.map +1 -1
  40. package/dist/TokenRatesController.mjs +4 -4
  41. package/dist/TokenRatesController.mjs.map +1 -1
  42. package/dist/multi-chain-accounts-service/index.cjs +7 -0
  43. package/dist/multi-chain-accounts-service/index.cjs.map +1 -0
  44. package/dist/multi-chain-accounts-service/index.d.cts +3 -0
  45. package/dist/multi-chain-accounts-service/index.d.cts.map +1 -0
  46. package/dist/multi-chain-accounts-service/index.d.mts +3 -0
  47. package/dist/multi-chain-accounts-service/index.d.mts.map +1 -0
  48. package/dist/multi-chain-accounts-service/index.mjs +2 -0
  49. package/dist/multi-chain-accounts-service/index.mjs.map +1 -0
  50. package/dist/multi-chain-accounts-service/mocks/mock-get-balances.cjs +82 -0
  51. package/dist/multi-chain-accounts-service/mocks/mock-get-balances.cjs.map +1 -0
  52. package/dist/multi-chain-accounts-service/mocks/mock-get-balances.d.cts +4 -0
  53. package/dist/multi-chain-accounts-service/mocks/mock-get-balances.d.cts.map +1 -0
  54. package/dist/multi-chain-accounts-service/mocks/mock-get-balances.d.mts +4 -0
  55. package/dist/multi-chain-accounts-service/mocks/mock-get-balances.d.mts.map +1 -0
  56. package/dist/multi-chain-accounts-service/mocks/mock-get-balances.mjs +78 -0
  57. package/dist/multi-chain-accounts-service/mocks/mock-get-balances.mjs.map +1 -0
  58. package/dist/multi-chain-accounts-service/mocks/mock-get-supported-networks.cjs +10 -0
  59. package/dist/multi-chain-accounts-service/mocks/mock-get-supported-networks.cjs.map +1 -0
  60. package/dist/multi-chain-accounts-service/mocks/mock-get-supported-networks.d.cts +3 -0
  61. package/dist/multi-chain-accounts-service/mocks/mock-get-supported-networks.d.cts.map +1 -0
  62. package/dist/multi-chain-accounts-service/mocks/mock-get-supported-networks.d.mts +3 -0
  63. package/dist/multi-chain-accounts-service/mocks/mock-get-supported-networks.d.mts.map +1 -0
  64. package/dist/multi-chain-accounts-service/mocks/mock-get-supported-networks.mjs +7 -0
  65. package/dist/multi-chain-accounts-service/mocks/mock-get-supported-networks.mjs.map +1 -0
  66. package/dist/multi-chain-accounts-service/multi-chain-accounts.cjs +38 -0
  67. package/dist/multi-chain-accounts-service/multi-chain-accounts.cjs.map +1 -0
  68. package/dist/multi-chain-accounts-service/multi-chain-accounts.d.cts +18 -0
  69. package/dist/multi-chain-accounts-service/multi-chain-accounts.d.cts.map +1 -0
  70. package/dist/multi-chain-accounts-service/multi-chain-accounts.d.mts +18 -0
  71. package/dist/multi-chain-accounts-service/multi-chain-accounts.d.mts.map +1 -0
  72. package/dist/multi-chain-accounts-service/multi-chain-accounts.mjs +33 -0
  73. package/dist/multi-chain-accounts-service/multi-chain-accounts.mjs.map +1 -0
  74. package/dist/multi-chain-accounts-service/types.cjs +3 -0
  75. package/dist/multi-chain-accounts-service/types.cjs.map +1 -0
  76. package/dist/multi-chain-accounts-service/types.d.cts +37 -0
  77. package/dist/multi-chain-accounts-service/types.d.cts.map +1 -0
  78. package/dist/multi-chain-accounts-service/types.d.mts +37 -0
  79. package/dist/multi-chain-accounts-service/types.d.mts.map +1 -0
  80. package/dist/multi-chain-accounts-service/types.mjs +2 -0
  81. package/dist/multi-chain-accounts-service/types.mjs.map +1 -0
  82. package/package.json +6 -6
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mock-get-supported-networks.mjs","sourceRoot":"","sources":["../../../src/multi-chain-accounts-service/mocks/mock-get-supported-networks.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,oCAAoC,GAC/C;IACE,WAAW,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,CAAC;IACzD,cAAc,EAAE;QACd,QAAQ,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC;KAChC;CACF,CAAC","sourcesContent":["import type { GetSupportedNetworksResponse } from '../types';\n\nexport const MOCK_GET_SUPPORTED_NETWORKS_RESPONSE: GetSupportedNetworksResponse =\n {\n fullSupport: [1, 137, 56, 59144, 8453, 10, 42161, 534352],\n partialSupport: {\n balances: [59141, 42220, 43114],\n },\n };\n"]}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchMultiChainBalances = exports.fetchSupportedNetworks = exports.MULTICHAIN_ACCOUNTS_DOMAIN = void 0;
4
+ const controller_utils_1 = require("@metamask/controller-utils");
5
+ exports.MULTICHAIN_ACCOUNTS_DOMAIN = 'https://accounts.api.cx.metamask.io';
6
+ const getBalancesUrl = (address, queryParams) => {
7
+ const url = new URL(`${exports.MULTICHAIN_ACCOUNTS_DOMAIN}/v2/accounts/${address}/balances`);
8
+ if (queryParams?.networks !== undefined) {
9
+ url.searchParams.append('networks', queryParams.networks);
10
+ }
11
+ return url;
12
+ };
13
+ /**
14
+ * Fetches Supported Networks.
15
+ * @returns supported networks (decimal)
16
+ */
17
+ async function fetchSupportedNetworks() {
18
+ const url = new URL(`${exports.MULTICHAIN_ACCOUNTS_DOMAIN}/v1/supportedNetworks`);
19
+ const response = await (0, controller_utils_1.handleFetch)(url);
20
+ return response.fullSupport;
21
+ }
22
+ exports.fetchSupportedNetworks = fetchSupportedNetworks;
23
+ /**
24
+ * Fetches Balances for multiple networks.
25
+ * @param address - address to fetch balances from
26
+ * @param options - params to pass down for a more refined search
27
+ * @param options.networks - the networks (in decimal) that you want to filter by
28
+ * @returns a Balances Response
29
+ */
30
+ async function fetchMultiChainBalances(address, options) {
31
+ const url = getBalancesUrl(address, {
32
+ networks: options?.networks?.join(),
33
+ });
34
+ const response = await (0, controller_utils_1.handleFetch)(url);
35
+ return response;
36
+ }
37
+ exports.fetchMultiChainBalances = fetchMultiChainBalances;
38
+ //# sourceMappingURL=multi-chain-accounts.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multi-chain-accounts.cjs","sourceRoot":"","sources":["../../src/multi-chain-accounts-service/multi-chain-accounts.ts"],"names":[],"mappings":";;;AAAA,iEAAyD;AAQ5C,QAAA,0BAA0B,GAAG,qCAAqC,CAAC;AAEhF,MAAM,cAAc,GAAG,CACrB,OAAe,EACf,WAAoC,EACpC,EAAE;IACF,MAAM,GAAG,GAAG,IAAI,GAAG,CACjB,GAAG,kCAA0B,gBAAgB,OAAO,WAAW,CAChE,CAAC;IAEF,IAAI,WAAW,EAAE,QAAQ,KAAK,SAAS,EAAE;QACvC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;KAC3D;IAED,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF;;;GAGG;AACI,KAAK,UAAU,sBAAsB;IAC1C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,kCAA0B,uBAAuB,CAAC,CAAC;IAC1E,MAAM,QAAQ,GAAiC,MAAM,IAAA,8BAAW,EAAC,GAAG,CAAC,CAAC;IACtE,OAAO,QAAQ,CAAC,WAAW,CAAC;AAC9B,CAAC;AAJD,wDAIC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,uBAAuB,CAC3C,OAAe,EACf,OAAiC;IAEjC,MAAM,GAAG,GAAG,cAAc,CAAC,OAAO,EAAE;QAClC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE;KACpC,CAAC,CAAC;IACH,MAAM,QAAQ,GAAwB,MAAM,IAAA,8BAAW,EAAC,GAAG,CAAC,CAAC;IAC7D,OAAO,QAAQ,CAAC;AAClB,CAAC;AATD,0DASC","sourcesContent":["import { handleFetch } from '@metamask/controller-utils';\n\nimport type {\n GetBalancesQueryParams,\n GetBalancesResponse,\n GetSupportedNetworksResponse,\n} from './types';\n\nexport const MULTICHAIN_ACCOUNTS_DOMAIN = 'https://accounts.api.cx.metamask.io';\n\nconst getBalancesUrl = (\n address: string,\n queryParams?: GetBalancesQueryParams,\n) => {\n const url = new URL(\n `${MULTICHAIN_ACCOUNTS_DOMAIN}/v2/accounts/${address}/balances`,\n );\n\n if (queryParams?.networks !== undefined) {\n url.searchParams.append('networks', queryParams.networks);\n }\n\n return url;\n};\n\n/**\n * Fetches Supported Networks.\n * @returns supported networks (decimal)\n */\nexport async function fetchSupportedNetworks(): Promise<number[]> {\n const url = new URL(`${MULTICHAIN_ACCOUNTS_DOMAIN}/v1/supportedNetworks`);\n const response: GetSupportedNetworksResponse = await handleFetch(url);\n return response.fullSupport;\n}\n\n/**\n * Fetches Balances for multiple networks.\n * @param address - address to fetch balances from\n * @param options - params to pass down for a more refined search\n * @param options.networks - the networks (in decimal) that you want to filter by\n * @returns a Balances Response\n */\nexport async function fetchMultiChainBalances(\n address: string,\n options?: { networks?: number[] },\n) {\n const url = getBalancesUrl(address, {\n networks: options?.networks?.join(),\n });\n const response: GetBalancesResponse = await handleFetch(url);\n return response;\n}\n"]}
@@ -0,0 +1,18 @@
1
+ import type { GetBalancesResponse } from "./types.cjs";
2
+ export declare const MULTICHAIN_ACCOUNTS_DOMAIN = "https://accounts.api.cx.metamask.io";
3
+ /**
4
+ * Fetches Supported Networks.
5
+ * @returns supported networks (decimal)
6
+ */
7
+ export declare function fetchSupportedNetworks(): Promise<number[]>;
8
+ /**
9
+ * Fetches Balances for multiple networks.
10
+ * @param address - address to fetch balances from
11
+ * @param options - params to pass down for a more refined search
12
+ * @param options.networks - the networks (in decimal) that you want to filter by
13
+ * @returns a Balances Response
14
+ */
15
+ export declare function fetchMultiChainBalances(address: string, options?: {
16
+ networks?: number[];
17
+ }): Promise<GetBalancesResponse>;
18
+ //# sourceMappingURL=multi-chain-accounts.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multi-chain-accounts.d.cts","sourceRoot":"","sources":["../../src/multi-chain-accounts-service/multi-chain-accounts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,mBAAmB,EAEpB,oBAAgB;AAEjB,eAAO,MAAM,0BAA0B,wCAAwC,CAAC;AAiBhF;;;GAGG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAIhE;AAED;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,gCAOlC"}
@@ -0,0 +1,18 @@
1
+ import type { GetBalancesResponse } from "./types.mjs";
2
+ export declare const MULTICHAIN_ACCOUNTS_DOMAIN = "https://accounts.api.cx.metamask.io";
3
+ /**
4
+ * Fetches Supported Networks.
5
+ * @returns supported networks (decimal)
6
+ */
7
+ export declare function fetchSupportedNetworks(): Promise<number[]>;
8
+ /**
9
+ * Fetches Balances for multiple networks.
10
+ * @param address - address to fetch balances from
11
+ * @param options - params to pass down for a more refined search
12
+ * @param options.networks - the networks (in decimal) that you want to filter by
13
+ * @returns a Balances Response
14
+ */
15
+ export declare function fetchMultiChainBalances(address: string, options?: {
16
+ networks?: number[];
17
+ }): Promise<GetBalancesResponse>;
18
+ //# sourceMappingURL=multi-chain-accounts.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multi-chain-accounts.d.mts","sourceRoot":"","sources":["../../src/multi-chain-accounts-service/multi-chain-accounts.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAEV,mBAAmB,EAEpB,oBAAgB;AAEjB,eAAO,MAAM,0BAA0B,wCAAwC,CAAC;AAiBhF;;;GAGG;AACH,wBAAsB,sBAAsB,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAIhE;AAED;;;;;;GAMG;AACH,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;IAAE,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAA;CAAE,gCAOlC"}
@@ -0,0 +1,33 @@
1
+ import { handleFetch } from "@metamask/controller-utils";
2
+ export const MULTICHAIN_ACCOUNTS_DOMAIN = 'https://accounts.api.cx.metamask.io';
3
+ const getBalancesUrl = (address, queryParams) => {
4
+ const url = new URL(`${MULTICHAIN_ACCOUNTS_DOMAIN}/v2/accounts/${address}/balances`);
5
+ if (queryParams?.networks !== undefined) {
6
+ url.searchParams.append('networks', queryParams.networks);
7
+ }
8
+ return url;
9
+ };
10
+ /**
11
+ * Fetches Supported Networks.
12
+ * @returns supported networks (decimal)
13
+ */
14
+ export async function fetchSupportedNetworks() {
15
+ const url = new URL(`${MULTICHAIN_ACCOUNTS_DOMAIN}/v1/supportedNetworks`);
16
+ const response = await handleFetch(url);
17
+ return response.fullSupport;
18
+ }
19
+ /**
20
+ * Fetches Balances for multiple networks.
21
+ * @param address - address to fetch balances from
22
+ * @param options - params to pass down for a more refined search
23
+ * @param options.networks - the networks (in decimal) that you want to filter by
24
+ * @returns a Balances Response
25
+ */
26
+ export async function fetchMultiChainBalances(address, options) {
27
+ const url = getBalancesUrl(address, {
28
+ networks: options?.networks?.join(),
29
+ });
30
+ const response = await handleFetch(url);
31
+ return response;
32
+ }
33
+ //# sourceMappingURL=multi-chain-accounts.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"multi-chain-accounts.mjs","sourceRoot":"","sources":["../../src/multi-chain-accounts-service/multi-chain-accounts.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,mCAAmC;AAQzD,MAAM,CAAC,MAAM,0BAA0B,GAAG,qCAAqC,CAAC;AAEhF,MAAM,cAAc,GAAG,CACrB,OAAe,EACf,WAAoC,EACpC,EAAE;IACF,MAAM,GAAG,GAAG,IAAI,GAAG,CACjB,GAAG,0BAA0B,gBAAgB,OAAO,WAAW,CAChE,CAAC;IAEF,IAAI,WAAW,EAAE,QAAQ,KAAK,SAAS,EAAE;QACvC,GAAG,CAAC,YAAY,CAAC,MAAM,CAAC,UAAU,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAC;KAC3D;IAED,OAAO,GAAG,CAAC;AACb,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,KAAK,UAAU,sBAAsB;IAC1C,MAAM,GAAG,GAAG,IAAI,GAAG,CAAC,GAAG,0BAA0B,uBAAuB,CAAC,CAAC;IAC1E,MAAM,QAAQ,GAAiC,MAAM,WAAW,CAAC,GAAG,CAAC,CAAC;IACtE,OAAO,QAAQ,CAAC,WAAW,CAAC;AAC9B,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAC3C,OAAe,EACf,OAAiC;IAEjC,MAAM,GAAG,GAAG,cAAc,CAAC,OAAO,EAAE;QAClC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE;KACpC,CAAC,CAAC;IACH,MAAM,QAAQ,GAAwB,MAAM,WAAW,CAAC,GAAG,CAAC,CAAC;IAC7D,OAAO,QAAQ,CAAC;AAClB,CAAC","sourcesContent":["import { handleFetch } from '@metamask/controller-utils';\n\nimport type {\n GetBalancesQueryParams,\n GetBalancesResponse,\n GetSupportedNetworksResponse,\n} from './types';\n\nexport const MULTICHAIN_ACCOUNTS_DOMAIN = 'https://accounts.api.cx.metamask.io';\n\nconst getBalancesUrl = (\n address: string,\n queryParams?: GetBalancesQueryParams,\n) => {\n const url = new URL(\n `${MULTICHAIN_ACCOUNTS_DOMAIN}/v2/accounts/${address}/balances`,\n );\n\n if (queryParams?.networks !== undefined) {\n url.searchParams.append('networks', queryParams.networks);\n }\n\n return url;\n};\n\n/**\n * Fetches Supported Networks.\n * @returns supported networks (decimal)\n */\nexport async function fetchSupportedNetworks(): Promise<number[]> {\n const url = new URL(`${MULTICHAIN_ACCOUNTS_DOMAIN}/v1/supportedNetworks`);\n const response: GetSupportedNetworksResponse = await handleFetch(url);\n return response.fullSupport;\n}\n\n/**\n * Fetches Balances for multiple networks.\n * @param address - address to fetch balances from\n * @param options - params to pass down for a more refined search\n * @param options.networks - the networks (in decimal) that you want to filter by\n * @returns a Balances Response\n */\nexport async function fetchMultiChainBalances(\n address: string,\n options?: { networks?: number[] },\n) {\n const url = getBalancesUrl(address, {\n networks: options?.networks?.join(),\n });\n const response: GetBalancesResponse = await handleFetch(url);\n return response;\n}\n"]}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.cjs","sourceRoot":"","sources":["../../src/multi-chain-accounts-service/types.ts"],"names":[],"mappings":"","sourcesContent":["export type GetSupportedNetworksResponse = {\n fullSupport: number[];\n partialSupport: {\n balances: number[];\n };\n};\n\nexport type GetBalancesQueryParams = {\n /** Comma-separated network/chain IDs */\n networks?: string;\n /** Whether or not to filter the assets to contain only the tokens existing in the Token API */\n filterSupportedTokens?: boolean;\n /** Specific token addresses to fetch balances for across specified network(s) */\n includeTokenAddresses?: string;\n /** Whether to include balances of the account's staked asset balances */\n includeStakedAssets?: boolean;\n};\n\nexport type GetBalancesResponse = {\n count: number;\n balances: {\n /** Underlying object type. Seems to be always `token` */\n object: string;\n /** Token Type: This is only supplied as `native` to native chain tokens (e.g. - ETH, POL) */\n type?: string;\n /** Timestamp is only provided for `native` chain tokens */\n timestamp?: string;\n address: string;\n symbol: string;\n name: string;\n decimals: number;\n chainId: number;\n /** string representation of the balance in decimal format (decimals adjusted). e.g. - 123.456789 */\n balance: string;\n }[];\n /** networks that failed to process, if no network is processed, returns HTTP 422 */\n unprocessedNetworks: number[];\n};\n"]}
@@ -0,0 +1,37 @@
1
+ export type GetSupportedNetworksResponse = {
2
+ fullSupport: number[];
3
+ partialSupport: {
4
+ balances: number[];
5
+ };
6
+ };
7
+ export type GetBalancesQueryParams = {
8
+ /** Comma-separated network/chain IDs */
9
+ networks?: string;
10
+ /** Whether or not to filter the assets to contain only the tokens existing in the Token API */
11
+ filterSupportedTokens?: boolean;
12
+ /** Specific token addresses to fetch balances for across specified network(s) */
13
+ includeTokenAddresses?: string;
14
+ /** Whether to include balances of the account's staked asset balances */
15
+ includeStakedAssets?: boolean;
16
+ };
17
+ export type GetBalancesResponse = {
18
+ count: number;
19
+ balances: {
20
+ /** Underlying object type. Seems to be always `token` */
21
+ object: string;
22
+ /** Token Type: This is only supplied as `native` to native chain tokens (e.g. - ETH, POL) */
23
+ type?: string;
24
+ /** Timestamp is only provided for `native` chain tokens */
25
+ timestamp?: string;
26
+ address: string;
27
+ symbol: string;
28
+ name: string;
29
+ decimals: number;
30
+ chainId: number;
31
+ /** string representation of the balance in decimal format (decimals adjusted). e.g. - 123.456789 */
32
+ balance: string;
33
+ }[];
34
+ /** networks that failed to process, if no network is processed, returns HTTP 422 */
35
+ unprocessedNetworks: number[];
36
+ };
37
+ //# sourceMappingURL=types.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.cts","sourceRoot":"","sources":["../../src/multi-chain-accounts-service/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,4BAA4B,GAAG;IACzC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,cAAc,EAAE;QACd,QAAQ,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,wCAAwC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+FAA+F;IAC/F,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,iFAAiF;IACjF,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,yEAAyE;IACzE,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE;QACR,yDAAyD;QACzD,MAAM,EAAE,MAAM,CAAC;QACf,6FAA6F;QAC7F,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,2DAA2D;QAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,oGAAoG;QACpG,OAAO,EAAE,MAAM,CAAC;KACjB,EAAE,CAAC;IACJ,qFAAqF;IACrF,mBAAmB,EAAE,MAAM,EAAE,CAAC;CAC/B,CAAC"}
@@ -0,0 +1,37 @@
1
+ export type GetSupportedNetworksResponse = {
2
+ fullSupport: number[];
3
+ partialSupport: {
4
+ balances: number[];
5
+ };
6
+ };
7
+ export type GetBalancesQueryParams = {
8
+ /** Comma-separated network/chain IDs */
9
+ networks?: string;
10
+ /** Whether or not to filter the assets to contain only the tokens existing in the Token API */
11
+ filterSupportedTokens?: boolean;
12
+ /** Specific token addresses to fetch balances for across specified network(s) */
13
+ includeTokenAddresses?: string;
14
+ /** Whether to include balances of the account's staked asset balances */
15
+ includeStakedAssets?: boolean;
16
+ };
17
+ export type GetBalancesResponse = {
18
+ count: number;
19
+ balances: {
20
+ /** Underlying object type. Seems to be always `token` */
21
+ object: string;
22
+ /** Token Type: This is only supplied as `native` to native chain tokens (e.g. - ETH, POL) */
23
+ type?: string;
24
+ /** Timestamp is only provided for `native` chain tokens */
25
+ timestamp?: string;
26
+ address: string;
27
+ symbol: string;
28
+ name: string;
29
+ decimals: number;
30
+ chainId: number;
31
+ /** string representation of the balance in decimal format (decimals adjusted). e.g. - 123.456789 */
32
+ balance: string;
33
+ }[];
34
+ /** networks that failed to process, if no network is processed, returns HTTP 422 */
35
+ unprocessedNetworks: number[];
36
+ };
37
+ //# sourceMappingURL=types.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.mts","sourceRoot":"","sources":["../../src/multi-chain-accounts-service/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,4BAA4B,GAAG;IACzC,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,cAAc,EAAE;QACd,QAAQ,EAAE,MAAM,EAAE,CAAC;KACpB,CAAC;CACH,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,wCAAwC;IACxC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,+FAA+F;IAC/F,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,iFAAiF;IACjF,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,yEAAyE;IACzE,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE;QACR,yDAAyD;QACzD,MAAM,EAAE,MAAM,CAAC;QACf,6FAA6F;QAC7F,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,2DAA2D;QAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE,MAAM,CAAC;QACf,IAAI,EAAE,MAAM,CAAC;QACb,QAAQ,EAAE,MAAM,CAAC;QACjB,OAAO,EAAE,MAAM,CAAC;QAChB,oGAAoG;QACpG,OAAO,EAAE,MAAM,CAAC;KACjB,EAAE,CAAC;IACJ,qFAAqF;IACrF,mBAAmB,EAAE,MAAM,EAAE,CAAC;CAC/B,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.mjs","sourceRoot":"","sources":["../../src/multi-chain-accounts-service/types.ts"],"names":[],"mappings":"","sourcesContent":["export type GetSupportedNetworksResponse = {\n fullSupport: number[];\n partialSupport: {\n balances: number[];\n };\n};\n\nexport type GetBalancesQueryParams = {\n /** Comma-separated network/chain IDs */\n networks?: string;\n /** Whether or not to filter the assets to contain only the tokens existing in the Token API */\n filterSupportedTokens?: boolean;\n /** Specific token addresses to fetch balances for across specified network(s) */\n includeTokenAddresses?: string;\n /** Whether to include balances of the account's staked asset balances */\n includeStakedAssets?: boolean;\n};\n\nexport type GetBalancesResponse = {\n count: number;\n balances: {\n /** Underlying object type. Seems to be always `token` */\n object: string;\n /** Token Type: This is only supplied as `native` to native chain tokens (e.g. - ETH, POL) */\n type?: string;\n /** Timestamp is only provided for `native` chain tokens */\n timestamp?: string;\n address: string;\n symbol: string;\n name: string;\n decimals: number;\n chainId: number;\n /** string representation of the balance in decimal format (decimals adjusted). e.g. - 123.456789 */\n balance: string;\n }[];\n /** networks that failed to process, if no network is processed, returns HTTP 422 */\n unprocessedNetworks: number[];\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask/assets-controllers",
3
- "version": "38.3.0",
3
+ "version": "39.0.0",
4
4
  "description": "Controllers which manage interactions involving ERC-20, ERC-721, and ERC-1155 tokens (including NFTs)",
5
5
  "keywords": [
6
6
  "MetaMask",
@@ -58,8 +58,8 @@
58
58
  "@metamask/controller-utils": "^11.3.0",
59
59
  "@metamask/eth-query": "^4.0.0",
60
60
  "@metamask/metamask-eth-abis": "^3.1.1",
61
- "@metamask/polling-controller": "^10.0.1",
62
- "@metamask/rpc-errors": "^6.3.1",
61
+ "@metamask/polling-controller": "^11.0.0",
62
+ "@metamask/rpc-errors": "^7.0.0",
63
63
  "@metamask/utils": "^9.1.0",
64
64
  "@types/bn.js": "^5.1.5",
65
65
  "@types/uuid": "^8.3.0",
@@ -78,9 +78,9 @@
78
78
  "@metamask/auto-changelog": "^3.4.4",
79
79
  "@metamask/ethjs-provider-http": "^0.3.0",
80
80
  "@metamask/keyring-api": "^8.1.3",
81
- "@metamask/keyring-controller": "^17.2.2",
82
- "@metamask/network-controller": "^21.0.1",
83
- "@metamask/preferences-controller": "^13.0.3",
81
+ "@metamask/keyring-controller": "^17.3.0",
82
+ "@metamask/network-controller": "^21.1.0",
83
+ "@metamask/preferences-controller": "^13.1.0",
84
84
  "@types/jest": "^27.4.1",
85
85
  "@types/lodash": "^4.14.191",
86
86
  "@types/node": "^16.18.54",