@metamask/assets-controller 3.0.0 → 3.1.1
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 +21 -1
- package/dist/AssetsController-method-action-types.cjs +1 -1
- package/dist/AssetsController-method-action-types.cjs.map +1 -1
- package/dist/AssetsController-method-action-types.d.cts +1 -1
- package/dist/AssetsController-method-action-types.d.mts +1 -1
- package/dist/AssetsController-method-action-types.mjs +1 -1
- package/dist/AssetsController-method-action-types.mjs.map +1 -1
- package/dist/data-sources/RpcDataSource.cjs +37 -35
- package/dist/data-sources/RpcDataSource.cjs.map +1 -1
- package/dist/data-sources/RpcDataSource.d.cts.map +1 -1
- package/dist/data-sources/RpcDataSource.d.mts.map +1 -1
- package/dist/data-sources/RpcDataSource.mjs +37 -35
- package/dist/data-sources/RpcDataSource.mjs.map +1 -1
- package/dist/data-sources/evm-rpc-services/clients/MulticallClient.cjs +3 -6
- package/dist/data-sources/evm-rpc-services/clients/MulticallClient.cjs.map +1 -1
- package/dist/data-sources/evm-rpc-services/clients/MulticallClient.d.cts.map +1 -1
- package/dist/data-sources/evm-rpc-services/clients/MulticallClient.d.mts.map +1 -1
- package/dist/data-sources/evm-rpc-services/clients/MulticallClient.mjs +1 -4
- package/dist/data-sources/evm-rpc-services/clients/MulticallClient.mjs.map +1 -1
- package/dist/data-sources/evm-rpc-services/index.cjs.map +1 -1
- package/dist/data-sources/evm-rpc-services/index.d.cts +1 -1
- package/dist/data-sources/evm-rpc-services/index.d.cts.map +1 -1
- package/dist/data-sources/evm-rpc-services/index.d.mts +1 -1
- package/dist/data-sources/evm-rpc-services/index.d.mts.map +1 -1
- package/dist/data-sources/evm-rpc-services/index.mjs.map +1 -1
- package/dist/data-sources/evm-rpc-services/services/BalanceFetcher.cjs +104 -79
- package/dist/data-sources/evm-rpc-services/services/BalanceFetcher.cjs.map +1 -1
- package/dist/data-sources/evm-rpc-services/services/BalanceFetcher.d.cts +20 -8
- package/dist/data-sources/evm-rpc-services/services/BalanceFetcher.d.cts.map +1 -1
- package/dist/data-sources/evm-rpc-services/services/BalanceFetcher.d.mts +20 -8
- package/dist/data-sources/evm-rpc-services/services/BalanceFetcher.d.mts.map +1 -1
- package/dist/data-sources/evm-rpc-services/services/BalanceFetcher.mjs +102 -77
- package/dist/data-sources/evm-rpc-services/services/BalanceFetcher.mjs.map +1 -1
- package/dist/data-sources/evm-rpc-services/services/TokenDetector.cjs +4 -1
- package/dist/data-sources/evm-rpc-services/services/TokenDetector.cjs.map +1 -1
- package/dist/data-sources/evm-rpc-services/services/TokenDetector.d.cts.map +1 -1
- package/dist/data-sources/evm-rpc-services/services/TokenDetector.d.mts.map +1 -1
- package/dist/data-sources/evm-rpc-services/services/TokenDetector.mjs +4 -1
- package/dist/data-sources/evm-rpc-services/services/TokenDetector.mjs.map +1 -1
- package/dist/data-sources/evm-rpc-services/types/assets.cjs.map +1 -1
- package/dist/data-sources/evm-rpc-services/types/assets.d.cts +2 -2
- package/dist/data-sources/evm-rpc-services/types/assets.d.cts.map +1 -1
- package/dist/data-sources/evm-rpc-services/types/assets.d.mts +2 -2
- package/dist/data-sources/evm-rpc-services/types/assets.d.mts.map +1 -1
- package/dist/data-sources/evm-rpc-services/types/assets.mjs.map +1 -1
- package/dist/data-sources/evm-rpc-services/types/index.cjs.map +1 -1
- package/dist/data-sources/evm-rpc-services/types/index.d.cts +1 -1
- package/dist/data-sources/evm-rpc-services/types/index.d.cts.map +1 -1
- package/dist/data-sources/evm-rpc-services/types/index.d.mts +1 -1
- package/dist/data-sources/evm-rpc-services/types/index.d.mts.map +1 -1
- package/dist/data-sources/evm-rpc-services/types/index.mjs.map +1 -1
- package/dist/data-sources/evm-rpc-services/types/services.cjs.map +1 -1
- package/dist/data-sources/evm-rpc-services/types/services.d.cts +11 -19
- package/dist/data-sources/evm-rpc-services/types/services.d.cts.map +1 -1
- package/dist/data-sources/evm-rpc-services/types/services.d.mts +11 -19
- package/dist/data-sources/evm-rpc-services/types/services.d.mts.map +1 -1
- package/dist/data-sources/evm-rpc-services/types/services.mjs.map +1 -1
- package/dist/utils/constants.cjs +5 -0
- package/dist/utils/constants.cjs.map +1 -0
- package/dist/utils/constants.d.cts +2 -0
- package/dist/utils/constants.d.cts.map +1 -0
- package/dist/utils/constants.d.mts +2 -0
- package/dist/utils/constants.d.mts.map +1 -0
- package/dist/utils/constants.mjs +2 -0
- package/dist/utils/constants.mjs.map +1 -0
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/types/index.ts"],"names":[],"mappings":"","sourcesContent":["// Core types\nexport type {\n AccountId,\n Address,\n AssetType,\n CaipAssetType,\n ChainId,\n} from './core';\n\n// Asset types\nexport type { Asset, AssetBalance } from './assets';\n\n// State types\nexport type {\n AssetsBalanceState,\n TokenChainsCacheEntry,\n TokenListEntry,\n TokenListState,\n} from './state';\n\n// Config types\nexport type { GetProviderFunction, Provider } from './config';\n\n// Multicall types\nexport type { BalanceOfRequest, BalanceOfResponse } from './multicall';\n\n// Service types\nexport type {\n
|
|
1
|
+
{"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/types/index.ts"],"names":[],"mappings":"","sourcesContent":["// Core types\nexport type {\n AccountId,\n Address,\n AssetType,\n CaipAssetType,\n ChainId,\n} from './core';\n\n// Asset types\nexport type { Asset, AssetBalance } from './assets';\n\n// State types\nexport type {\n AssetsBalanceState,\n TokenChainsCacheEntry,\n TokenListEntry,\n TokenListState,\n} from './state';\n\n// Config types\nexport type { GetProviderFunction, Provider } from './config';\n\n// Multicall types\nexport type { BalanceOfRequest, BalanceOfResponse } from './multicall';\n\n// Service types\nexport type {\n AssetFetchEntry,\n BalanceFetchResult,\n TokenDetectionOptions,\n TokenDetectionResult,\n} from './services';\n"]}
|
|
@@ -3,5 +3,5 @@ export type { Asset, AssetBalance } from "./assets.cjs";
|
|
|
3
3
|
export type { AssetsBalanceState, TokenChainsCacheEntry, TokenListEntry, TokenListState, } from "./state.cjs";
|
|
4
4
|
export type { GetProviderFunction, Provider } from "./config.cjs";
|
|
5
5
|
export type { BalanceOfRequest, BalanceOfResponse } from "./multicall.cjs";
|
|
6
|
-
export type {
|
|
6
|
+
export type { AssetFetchEntry, BalanceFetchResult, TokenDetectionOptions, TokenDetectionResult, } from "./services.cjs";
|
|
7
7
|
//# sourceMappingURL=index.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/types/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,SAAS,EACT,OAAO,EACP,SAAS,EACT,aAAa,EACb,OAAO,GACR,mBAAe;AAGhB,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,qBAAiB;AAGpD,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,cAAc,EACd,cAAc,GACf,oBAAgB;AAGjB,YAAY,EAAE,mBAAmB,EAAE,QAAQ,EAAE,qBAAiB;AAG9D,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,wBAAoB;AAGvE,YAAY,EACV,
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/types/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,SAAS,EACT,OAAO,EACP,SAAS,EACT,aAAa,EACb,OAAO,GACR,mBAAe;AAGhB,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,qBAAiB;AAGpD,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,cAAc,EACd,cAAc,GACf,oBAAgB;AAGjB,YAAY,EAAE,mBAAmB,EAAE,QAAQ,EAAE,qBAAiB;AAG9D,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,wBAAoB;AAGvE,YAAY,EACV,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,GACrB,uBAAmB"}
|
|
@@ -3,5 +3,5 @@ export type { Asset, AssetBalance } from "./assets.mjs";
|
|
|
3
3
|
export type { AssetsBalanceState, TokenChainsCacheEntry, TokenListEntry, TokenListState, } from "./state.mjs";
|
|
4
4
|
export type { GetProviderFunction, Provider } from "./config.mjs";
|
|
5
5
|
export type { BalanceOfRequest, BalanceOfResponse } from "./multicall.mjs";
|
|
6
|
-
export type {
|
|
6
|
+
export type { AssetFetchEntry, BalanceFetchResult, TokenDetectionOptions, TokenDetectionResult, } from "./services.mjs";
|
|
7
7
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/types/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,SAAS,EACT,OAAO,EACP,SAAS,EACT,aAAa,EACb,OAAO,GACR,mBAAe;AAGhB,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,qBAAiB;AAGpD,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,cAAc,EACd,cAAc,GACf,oBAAgB;AAGjB,YAAY,EAAE,mBAAmB,EAAE,QAAQ,EAAE,qBAAiB;AAG9D,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,wBAAoB;AAGvE,YAAY,EACV,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/types/index.ts"],"names":[],"mappings":"AACA,YAAY,EACV,SAAS,EACT,OAAO,EACP,SAAS,EACT,aAAa,EACb,OAAO,GACR,mBAAe;AAGhB,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,qBAAiB;AAGpD,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,cAAc,EACd,cAAc,GACf,oBAAgB;AAGjB,YAAY,EAAE,mBAAmB,EAAE,QAAQ,EAAE,qBAAiB;AAG9D,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,wBAAoB;AAGvE,YAAY,EACV,eAAe,EACf,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,GACrB,uBAAmB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/types/index.ts"],"names":[],"mappings":"","sourcesContent":["// Core types\nexport type {\n AccountId,\n Address,\n AssetType,\n CaipAssetType,\n ChainId,\n} from './core';\n\n// Asset types\nexport type { Asset, AssetBalance } from './assets';\n\n// State types\nexport type {\n AssetsBalanceState,\n TokenChainsCacheEntry,\n TokenListEntry,\n TokenListState,\n} from './state';\n\n// Config types\nexport type { GetProviderFunction, Provider } from './config';\n\n// Multicall types\nexport type { BalanceOfRequest, BalanceOfResponse } from './multicall';\n\n// Service types\nexport type {\n
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/types/index.ts"],"names":[],"mappings":"","sourcesContent":["// Core types\nexport type {\n AccountId,\n Address,\n AssetType,\n CaipAssetType,\n ChainId,\n} from './core';\n\n// Asset types\nexport type { Asset, AssetBalance } from './assets';\n\n// State types\nexport type {\n AssetsBalanceState,\n TokenChainsCacheEntry,\n TokenListEntry,\n TokenListState,\n} from './state';\n\n// Config types\nexport type { GetProviderFunction, Provider } from './config';\n\n// Multicall types\nexport type { BalanceOfRequest, BalanceOfResponse } from './multicall';\n\n// Service types\nexport type {\n AssetFetchEntry,\n BalanceFetchResult,\n TokenDetectionOptions,\n TokenDetectionResult,\n} from './services';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.cjs","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/types/services.ts"],"names":[],"mappings":"","sourcesContent":["import type { Asset, AssetBalance } from './assets';\nimport type { AccountId, Address, ChainId } from './core';\n\n/**\n * Token detection result.\n */\nexport type TokenDetectionResult = {\n /** Chain ID */\n chainId: ChainId;\n /** Account ID */\n accountId: AccountId;\n /** Account address used for detection */\n accountAddress: Address;\n /** Newly detected tokens with non-zero balances */\n detectedAssets: Asset[];\n /** Balances for newly detected tokens */\n detectedBalances: AssetBalance[];\n /** Tokens that were checked but had zero balance */\n zeroBalanceAddresses: Address[];\n /** Tokens that failed to be checked */\n failedAddresses: Address[];\n /** Timestamp of detection */\n timestamp: number;\n};\n\n/**\n * Token detection options.\n */\nexport type TokenDetectionOptions = {\n /** Whether token detection is enabled */\n tokenDetectionEnabled?: boolean;\n /** Whether external services (e.g. token list API) are allowed; detection stops when false */\n useExternalService?: boolean;\n /** Maximum number of tokens to check per batch */\n batchSize?: number;\n /** Timeout for detection in milliseconds */\n timeout?: number;\n};\n\n/**\n * Balance fetch result.\n */\nexport type BalanceFetchResult = {\n /** Chain ID */\n chainId: ChainId;\n /** Account ID */\n accountId: AccountId;\n /** Account address */\n accountAddress: Address;\n /** Fetched balances */\n balances: AssetBalance[];\n /** Token addresses that failed to fetch */\n failedAddresses: Address[];\n /** Block number when balances were fetched */\n blockNumber?: number;\n /** Timestamp of fetch */\n timestamp: number;\n};\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"services.cjs","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/types/services.ts"],"names":[],"mappings":"","sourcesContent":["import type { Asset, AssetBalance } from './assets';\nimport type { AccountId, Address, CaipAssetType, ChainId } from './core';\n\n/**\n * Token detection result.\n */\nexport type TokenDetectionResult = {\n /** Chain ID */\n chainId: ChainId;\n /** Account ID */\n accountId: AccountId;\n /** Account address used for detection */\n accountAddress: Address;\n /** Newly detected tokens with non-zero balances */\n detectedAssets: Asset[];\n /** Balances for newly detected tokens */\n detectedBalances: AssetBalance[];\n /** Tokens that were checked but had zero balance */\n zeroBalanceAddresses: Address[];\n /** Tokens that failed to be checked */\n failedAddresses: Address[];\n /** Timestamp of detection */\n timestamp: number;\n};\n\n/**\n * Token detection options.\n */\nexport type TokenDetectionOptions = {\n /** Whether token detection is enabled */\n tokenDetectionEnabled?: boolean;\n /** Whether external services (e.g. token list API) are allowed; detection stops when false */\n useExternalService?: boolean;\n /** Maximum number of tokens to check per batch */\n batchSize?: number;\n /** Timeout for detection in milliseconds */\n timeout?: number;\n};\n\n/**\n * Balance fetch result.\n */\nexport type BalanceFetchResult = {\n /** Chain ID */\n chainId: ChainId;\n /** Account ID */\n accountId: AccountId;\n /** Account address */\n accountAddress: Address;\n /** Fetched balances */\n balances: AssetBalance[];\n /** Token addresses that failed to fetch */\n failedAddresses: Address[];\n /** Block number when balances were fetched */\n blockNumber?: number;\n /** Timestamp of fetch */\n timestamp: number;\n};\n\n/**\n * Entry describing a single asset to fetch a balance for.\n * Bundles the CAIP-19 asset ID with the on-chain address (zero address for\n * native assets even when the chain has a native asset with a non-zero address)\n * and optional metadata\n */\nexport type AssetFetchEntry = {\n /** CAIP-19 asset type identifier */\n assetId: CaipAssetType;\n /** On-chain contract address (zero address for native assets regardless of the chain's native asset address) */\n address: Address;\n /** Token decimals (omit when unknown — balance fetcher returns raw balance for RpcDataSource to resolve). */\n decimals?: number;\n};\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Asset, AssetBalance } from "./assets.cjs";
|
|
2
|
-
import type { AccountId, Address, ChainId } from "./core.cjs";
|
|
2
|
+
import type { AccountId, Address, CaipAssetType, ChainId } from "./core.cjs";
|
|
3
3
|
/**
|
|
4
4
|
* Token detection result.
|
|
5
5
|
*/
|
|
@@ -54,25 +54,17 @@ export type BalanceFetchResult = {
|
|
|
54
54
|
timestamp: number;
|
|
55
55
|
};
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
57
|
+
* Entry describing a single asset to fetch a balance for.
|
|
58
|
+
* Bundles the CAIP-19 asset ID with the on-chain address (zero address for
|
|
59
|
+
* native assets even when the chain has a native asset with a non-zero address)
|
|
60
|
+
* and optional metadata
|
|
58
61
|
*/
|
|
59
|
-
export type
|
|
60
|
-
/**
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
timeout?: number;
|
|
64
|
-
/** Include native token balance */
|
|
65
|
-
includeNative?: boolean;
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* Token info for balance fetching.
|
|
69
|
-
*/
|
|
70
|
-
export type TokenFetchInfo = {
|
|
71
|
-
/** Token contract address */
|
|
62
|
+
export type AssetFetchEntry = {
|
|
63
|
+
/** CAIP-19 asset type identifier */
|
|
64
|
+
assetId: CaipAssetType;
|
|
65
|
+
/** On-chain contract address (zero address for native assets regardless of the chain's native asset address) */
|
|
72
66
|
address: Address;
|
|
73
|
-
/** Token decimals */
|
|
74
|
-
decimals
|
|
75
|
-
/** Token symbol (optional) */
|
|
76
|
-
symbol?: string;
|
|
67
|
+
/** Token decimals (omit when unknown — balance fetcher returns raw balance for RpcDataSource to resolve). */
|
|
68
|
+
decimals?: number;
|
|
77
69
|
};
|
|
78
70
|
//# sourceMappingURL=services.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.d.cts","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/types/services.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,qBAAiB;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,mBAAe;
|
|
1
|
+
{"version":3,"file":"services.d.cts","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/types/services.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,qBAAiB;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,mBAAe;AAEzE;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,eAAe;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB;IACjB,SAAS,EAAE,SAAS,CAAC;IACrB,yCAAyC;IACzC,cAAc,EAAE,OAAO,CAAC;IACxB,mDAAmD;IACnD,cAAc,EAAE,KAAK,EAAE,CAAC;IACxB,yCAAyC;IACzC,gBAAgB,EAAE,YAAY,EAAE,CAAC;IACjC,oDAAoD;IACpD,oBAAoB,EAAE,OAAO,EAAE,CAAC;IAChC,uCAAuC;IACvC,eAAe,EAAE,OAAO,EAAE,CAAC;IAC3B,6BAA6B;IAC7B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,yCAAyC;IACzC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,8FAA8F;IAC9F,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,eAAe;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB;IACjB,SAAS,EAAE,SAAS,CAAC;IACrB,sBAAsB;IACtB,cAAc,EAAE,OAAO,CAAC;IACxB,uBAAuB;IACvB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,2CAA2C;IAC3C,eAAe,EAAE,OAAO,EAAE,CAAC;IAC3B,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,oCAAoC;IACpC,OAAO,EAAE,aAAa,CAAC;IACvB,gHAAgH;IAChH,OAAO,EAAE,OAAO,CAAC;IACjB,6GAA6G;IAC7G,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Asset, AssetBalance } from "./assets.mjs";
|
|
2
|
-
import type { AccountId, Address, ChainId } from "./core.mjs";
|
|
2
|
+
import type { AccountId, Address, CaipAssetType, ChainId } from "./core.mjs";
|
|
3
3
|
/**
|
|
4
4
|
* Token detection result.
|
|
5
5
|
*/
|
|
@@ -54,25 +54,17 @@ export type BalanceFetchResult = {
|
|
|
54
54
|
timestamp: number;
|
|
55
55
|
};
|
|
56
56
|
/**
|
|
57
|
-
*
|
|
57
|
+
* Entry describing a single asset to fetch a balance for.
|
|
58
|
+
* Bundles the CAIP-19 asset ID with the on-chain address (zero address for
|
|
59
|
+
* native assets even when the chain has a native asset with a non-zero address)
|
|
60
|
+
* and optional metadata
|
|
58
61
|
*/
|
|
59
|
-
export type
|
|
60
|
-
/**
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
timeout?: number;
|
|
64
|
-
/** Include native token balance */
|
|
65
|
-
includeNative?: boolean;
|
|
66
|
-
};
|
|
67
|
-
/**
|
|
68
|
-
* Token info for balance fetching.
|
|
69
|
-
*/
|
|
70
|
-
export type TokenFetchInfo = {
|
|
71
|
-
/** Token contract address */
|
|
62
|
+
export type AssetFetchEntry = {
|
|
63
|
+
/** CAIP-19 asset type identifier */
|
|
64
|
+
assetId: CaipAssetType;
|
|
65
|
+
/** On-chain contract address (zero address for native assets regardless of the chain's native asset address) */
|
|
72
66
|
address: Address;
|
|
73
|
-
/** Token decimals */
|
|
74
|
-
decimals
|
|
75
|
-
/** Token symbol (optional) */
|
|
76
|
-
symbol?: string;
|
|
67
|
+
/** Token decimals (omit when unknown — balance fetcher returns raw balance for RpcDataSource to resolve). */
|
|
68
|
+
decimals?: number;
|
|
77
69
|
};
|
|
78
70
|
//# sourceMappingURL=services.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.d.mts","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/types/services.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,qBAAiB;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,OAAO,EAAE,mBAAe;
|
|
1
|
+
{"version":3,"file":"services.d.mts","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/types/services.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,qBAAiB;AACpD,OAAO,KAAK,EAAE,SAAS,EAAE,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,mBAAe;AAEzE;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,eAAe;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB;IACjB,SAAS,EAAE,SAAS,CAAC;IACrB,yCAAyC;IACzC,cAAc,EAAE,OAAO,CAAC;IACxB,mDAAmD;IACnD,cAAc,EAAE,KAAK,EAAE,CAAC;IACxB,yCAAyC;IACzC,gBAAgB,EAAE,YAAY,EAAE,CAAC;IACjC,oDAAoD;IACpD,oBAAoB,EAAE,OAAO,EAAE,CAAC;IAChC,uCAAuC;IACvC,eAAe,EAAE,OAAO,EAAE,CAAC;IAC3B,6BAA6B;IAC7B,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG;IAClC,yCAAyC;IACzC,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,8FAA8F;IAC9F,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,kDAAkD;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF;;GAEG;AACH,MAAM,MAAM,kBAAkB,GAAG;IAC/B,eAAe;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,iBAAiB;IACjB,SAAS,EAAE,SAAS,CAAC;IACrB,sBAAsB;IACtB,cAAc,EAAE,OAAO,CAAC;IACxB,uBAAuB;IACvB,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,2CAA2C;IAC3C,eAAe,EAAE,OAAO,EAAE,CAAC;IAC3B,8CAA8C;IAC9C,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,yBAAyB;IACzB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG;IAC5B,oCAAoC;IACpC,OAAO,EAAE,aAAa,CAAC;IACvB,gHAAgH;IAChH,OAAO,EAAE,OAAO,CAAC;IACjB,6GAA6G;IAC7G,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"services.mjs","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/types/services.ts"],"names":[],"mappings":"","sourcesContent":["import type { Asset, AssetBalance } from './assets';\nimport type { AccountId, Address, ChainId } from './core';\n\n/**\n * Token detection result.\n */\nexport type TokenDetectionResult = {\n /** Chain ID */\n chainId: ChainId;\n /** Account ID */\n accountId: AccountId;\n /** Account address used for detection */\n accountAddress: Address;\n /** Newly detected tokens with non-zero balances */\n detectedAssets: Asset[];\n /** Balances for newly detected tokens */\n detectedBalances: AssetBalance[];\n /** Tokens that were checked but had zero balance */\n zeroBalanceAddresses: Address[];\n /** Tokens that failed to be checked */\n failedAddresses: Address[];\n /** Timestamp of detection */\n timestamp: number;\n};\n\n/**\n * Token detection options.\n */\nexport type TokenDetectionOptions = {\n /** Whether token detection is enabled */\n tokenDetectionEnabled?: boolean;\n /** Whether external services (e.g. token list API) are allowed; detection stops when false */\n useExternalService?: boolean;\n /** Maximum number of tokens to check per batch */\n batchSize?: number;\n /** Timeout for detection in milliseconds */\n timeout?: number;\n};\n\n/**\n * Balance fetch result.\n */\nexport type BalanceFetchResult = {\n /** Chain ID */\n chainId: ChainId;\n /** Account ID */\n accountId: AccountId;\n /** Account address */\n accountAddress: Address;\n /** Fetched balances */\n balances: AssetBalance[];\n /** Token addresses that failed to fetch */\n failedAddresses: Address[];\n /** Block number when balances were fetched */\n blockNumber?: number;\n /** Timestamp of fetch */\n timestamp: number;\n};\n\n/**\n *
|
|
1
|
+
{"version":3,"file":"services.mjs","sourceRoot":"","sources":["../../../../src/data-sources/evm-rpc-services/types/services.ts"],"names":[],"mappings":"","sourcesContent":["import type { Asset, AssetBalance } from './assets';\nimport type { AccountId, Address, CaipAssetType, ChainId } from './core';\n\n/**\n * Token detection result.\n */\nexport type TokenDetectionResult = {\n /** Chain ID */\n chainId: ChainId;\n /** Account ID */\n accountId: AccountId;\n /** Account address used for detection */\n accountAddress: Address;\n /** Newly detected tokens with non-zero balances */\n detectedAssets: Asset[];\n /** Balances for newly detected tokens */\n detectedBalances: AssetBalance[];\n /** Tokens that were checked but had zero balance */\n zeroBalanceAddresses: Address[];\n /** Tokens that failed to be checked */\n failedAddresses: Address[];\n /** Timestamp of detection */\n timestamp: number;\n};\n\n/**\n * Token detection options.\n */\nexport type TokenDetectionOptions = {\n /** Whether token detection is enabled */\n tokenDetectionEnabled?: boolean;\n /** Whether external services (e.g. token list API) are allowed; detection stops when false */\n useExternalService?: boolean;\n /** Maximum number of tokens to check per batch */\n batchSize?: number;\n /** Timeout for detection in milliseconds */\n timeout?: number;\n};\n\n/**\n * Balance fetch result.\n */\nexport type BalanceFetchResult = {\n /** Chain ID */\n chainId: ChainId;\n /** Account ID */\n accountId: AccountId;\n /** Account address */\n accountAddress: Address;\n /** Fetched balances */\n balances: AssetBalance[];\n /** Token addresses that failed to fetch */\n failedAddresses: Address[];\n /** Block number when balances were fetched */\n blockNumber?: number;\n /** Timestamp of fetch */\n timestamp: number;\n};\n\n/**\n * Entry describing a single asset to fetch a balance for.\n * Bundles the CAIP-19 asset ID with the on-chain address (zero address for\n * native assets even when the chain has a native asset with a non-zero address)\n * and optional metadata\n */\nexport type AssetFetchEntry = {\n /** CAIP-19 asset type identifier */\n assetId: CaipAssetType;\n /** On-chain contract address (zero address for native assets regardless of the chain's native asset address) */\n address: Address;\n /** Token decimals (omit when unknown — balance fetcher returns raw balance for RpcDataSource to resolve). */\n decimals?: number;\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.cjs","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GACvB,4CAAqD,CAAC","sourcesContent":["export const ZERO_ADDRESS =\n '0x0000000000000000000000000000000000000000' as const;\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.cts","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,8CAC8B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.mts","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,YAAY,8CAC8B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.mjs","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,YAAY,GACvB,4CAAqD,CAAC","sourcesContent":["export const ZERO_ADDRESS =\n '0x0000000000000000000000000000000000000000' as const;\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/assets-controller",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.1.1",
|
|
4
4
|
"description": "Tracks assets balances/prices and handles token detection across all digital assets",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MetaMask",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"@metamask/client-controller": "^1.0.0",
|
|
58
58
|
"@metamask/controller-utils": "^11.19.0",
|
|
59
59
|
"@metamask/core-backend": "^6.2.0",
|
|
60
|
-
"@metamask/keyring-api": "^21.
|
|
60
|
+
"@metamask/keyring-api": "^21.6.0",
|
|
61
61
|
"@metamask/keyring-controller": "^25.1.0",
|
|
62
62
|
"@metamask/keyring-internal-api": "^10.0.0",
|
|
63
63
|
"@metamask/keyring-snap-client": "^8.2.0",
|
|
@@ -69,7 +69,7 @@
|
|
|
69
69
|
"@metamask/preferences-controller": "^23.0.0",
|
|
70
70
|
"@metamask/snaps-controllers": "^17.2.0",
|
|
71
71
|
"@metamask/snaps-utils": "^11.7.0",
|
|
72
|
-
"@metamask/transaction-controller": "^63.
|
|
72
|
+
"@metamask/transaction-controller": "^63.1.0",
|
|
73
73
|
"@metamask/utils": "^11.9.0",
|
|
74
74
|
"async-mutex": "^0.5.0",
|
|
75
75
|
"bignumber.js": "^9.1.2",
|