@metamask-previews/assets-controller 2.2.0-preview-62fe3fa64 → 2.2.0-preview-327d86601

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 (40) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/dist/AssetsController-method-action-types.cjs.map +1 -1
  3. package/dist/AssetsController-method-action-types.d.cts +16 -1
  4. package/dist/AssetsController-method-action-types.d.cts.map +1 -1
  5. package/dist/AssetsController-method-action-types.d.mts +16 -1
  6. package/dist/AssetsController-method-action-types.d.mts.map +1 -1
  7. package/dist/AssetsController-method-action-types.mjs.map +1 -1
  8. package/dist/AssetsController.cjs +28 -0
  9. package/dist/AssetsController.cjs.map +1 -1
  10. package/dist/AssetsController.d.cts +15 -1
  11. package/dist/AssetsController.d.cts.map +1 -1
  12. package/dist/AssetsController.d.mts +15 -1
  13. package/dist/AssetsController.d.mts.map +1 -1
  14. package/dist/AssetsController.mjs +29 -1
  15. package/dist/AssetsController.mjs.map +1 -1
  16. package/dist/index.cjs +2 -1
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +3 -3
  19. package/dist/index.d.cts.map +1 -1
  20. package/dist/index.d.mts +3 -3
  21. package/dist/index.d.mts.map +1 -1
  22. package/dist/index.mjs +1 -1
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/utils/formatStateForTransactionPay.cjs +133 -0
  25. package/dist/utils/formatStateForTransactionPay.cjs.map +1 -0
  26. package/dist/utils/formatStateForTransactionPay.d.cts +68 -0
  27. package/dist/utils/formatStateForTransactionPay.d.cts.map +1 -0
  28. package/dist/utils/formatStateForTransactionPay.d.mts +68 -0
  29. package/dist/utils/formatStateForTransactionPay.d.mts.map +1 -0
  30. package/dist/utils/formatStateForTransactionPay.mjs +129 -0
  31. package/dist/utils/formatStateForTransactionPay.mjs.map +1 -0
  32. package/dist/utils/index.cjs +3 -1
  33. package/dist/utils/index.cjs.map +1 -1
  34. package/dist/utils/index.d.cts +2 -0
  35. package/dist/utils/index.d.cts.map +1 -1
  36. package/dist/utils/index.d.mts +2 -0
  37. package/dist/utils/index.d.mts.map +1 -1
  38. package/dist/utils/index.mjs +1 -0
  39. package/dist/utils/index.mjs.map +1 -1
  40. package/package.json +4 -4
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formatStateForTransactionPay.mjs","sourceRoot":"","sources":["../../src/utils/formatStateForTransactionPay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,yBAAyB;AACrD,OAAO,EAAE,WAAW,EAAE,wBAAwB;AAC9C,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,wBAAwB;AAEvE,OAAO,EAAE,4BAA4B,EAAE,2CAAuC;AA8C9E,SAAS,WAAW,CAAC,MAAc;IACjC,MAAM,SAAS,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC9C,OAAO,KAAK,SAAS,EAAE,CAAC;AAC1B,CAAC;AAED,SAAS,oBAAoB,CAAC,OAAqB;IACjD,OAAO,OAAO,OAAO,KAAK,QAAQ,IAAI,OAAO,KAAK,IAAI,IAAI,QAAQ,IAAI,OAAO;QAC3E,CAAC,CAAC,MAAM,CAAE,OAA8B,CAAC,MAAM,CAAC;QAChD,CAAC,CAAC,GAAG,CAAC;AACV,CAAC;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,4BAA4B,CAAC,MAS5C;;IACC,MAAM,EACJ,aAAa,EACb,UAAU,EACV,WAAW,EACX,gBAAgB,EAChB,QAAQ,EACR,sBAAsB,GAAG,EAAE,EAC3B,8BAA8B,GAAG,EAAE,EACnC,yBAAyB,GAC1B,GAAG,MAAM,CAAC;IAEX,MAAM,aAAa,GAAgD,EAAE,CAAC;IACtE,MAAM,iBAAiB,GAAoD,EAAE,CAAC;IAC9E,MAAM,gBAAgB,GAAkC,EAAE,CAAC;IAE3D,KAAK,MAAM,OAAO,IAAI,QAAQ,EAAE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,EAAE,aAAa,CAAC,eAAe;KAC/C,CAAC;AACJ,CAAC","sourcesContent":["import { toChecksumAddress } from '@ethereumjs/util';\nimport { numberToHex } from '@metamask/utils';\nimport { parseCaipAssetType, parseCaipChainId } from '@metamask/utils';\n\nimport { formatExchangeRatesForBridge } from './formatExchangeRatesForBridge';\nimport type { BridgeExchangeRatesFormat } from './formatExchangeRatesForBridge';\nimport type {\n AssetBalance,\n AssetMetadata,\n AssetPrice,\n Caip19AssetId,\n} from '../types';\n\n/** Account with id and address for mapping state to legacy format. */\nexport type AccountForLegacyFormat = { id: string; address: string };\n\n/**\n * Legacy Token shape expected by TokensController / transaction-pay-controller.\n */\nexport type LegacyToken = {\n address: string;\n decimals: number;\n symbol: string;\n name?: string;\n [key: string]: unknown;\n};\n\n/**\n * Legacy state shape that transaction-pay-controller reads from\n * TokenBalancesController, AccountTrackerController, TokensController,\n * TokenRatesController, and CurrencyRateController.\n */\nexport type TransactionPayLegacyFormat = {\n /** TokenBalancesController:getState().tokenBalances */\n tokenBalances: Record<string, Record<string, Record<string, `0x${string}`>>>;\n /** AccountTrackerController:getState().accountsByChainId */\n accountsByChainId: Record<\n string,\n Record<string, { balance: string; stakedBalance?: string }>\n >;\n /** TokensController:getState().allTokens (chainId -> key -> Token[]) */\n allTokens: Record<string, Record<string, LegacyToken[]>>;\n /** TokenRatesController:getState().marketData */\n marketData: BridgeExchangeRatesFormat['marketData'];\n /** CurrencyRateController:getState().currencyRates */\n currencyRates: BridgeExchangeRatesFormat['currencyRates'];\n /** CurrencyRateController:getState().currentCurrency */\n currentCurrency: string;\n};\n\nfunction amountToHex(amount: string): `0x${string}` {\n const hexString = BigInt(amount).toString(16);\n return `0x${hexString}`;\n}\n\nfunction getAmountFromBalance(balance: AssetBalance): string {\n return typeof balance === 'object' && balance !== null && 'amount' in balance\n ? String((balance as { amount: string }).amount)\n : '0';\n}\n\n/**\n * Converts AssetsController state into the legacy format consumed by\n * transaction-pay-controller (TokenBalancesController, AccountTrackerController,\n * TokensController, TokenRatesController, CurrencyRateController shapes).\n *\n * @param params - Conversion parameters.\n * @param params.assetsBalance - Per-account balances by asset ID.\n * @param params.assetsInfo - Metadata by asset ID.\n * @param params.assetsPrice - Prices by asset ID.\n * @param params.selectedCurrency - Current currency code.\n * @param params.accounts - List of accounts (id + address) to map state for.\n * @param params.nativeAssetIdentifiers - Optional CAIP-2 chain ID to native asset ID.\n * @param params.networkConfigurationsByChainId - Optional chain ID to network config (for native symbol).\n * @param params.usdToSelectedCurrencyRate - Optional rate: 1 USD = this many units of selected currency. Required for correct currencyRates when selectedCurrency is not 'usd'; when omitted, conversionRate and usdConversionRate will be equal (incorrect for non-USD).\n * @returns Legacy-compatible state for transaction-pay-controller.\n */\nexport function formatStateForTransactionPay(params: {\n assetsBalance: Record<string, Record<string, AssetBalance>>;\n assetsInfo: Record<string, AssetMetadata>;\n assetsPrice: Record<string, AssetPrice>;\n selectedCurrency: string;\n accounts: AccountForLegacyFormat[];\n nativeAssetIdentifiers?: Record<string, string>;\n networkConfigurationsByChainId?: Record<string, { nativeCurrency?: string }>;\n usdToSelectedCurrencyRate?: number;\n}): TransactionPayLegacyFormat {\n const {\n assetsBalance,\n assetsInfo,\n assetsPrice,\n selectedCurrency,\n accounts,\n nativeAssetIdentifiers = {},\n networkConfigurationsByChainId = {},\n usdToSelectedCurrencyRate,\n } = params;\n\n const tokenBalances: TransactionPayLegacyFormat['tokenBalances'] = {};\n const accountsByChainId: TransactionPayLegacyFormat['accountsByChainId'] = {};\n const allTokensByChain: Record<string, LegacyToken[]> = {};\n\n for (const account of accounts) {\n const accountAddressLower = account.address.toLowerCase();\n const accountBalances = assetsBalance[account.id];\n if (!accountBalances) {\n continue;\n }\n\n for (const [assetId, balance] of Object.entries(accountBalances)) {\n try {\n const parsed = parseCaipAssetType(assetId as Caip19AssetId);\n const chainIdParsed = parseCaipChainId(parsed.chainId);\n if (chainIdParsed.namespace !== 'eip155') {\n continue;\n }\n const chainIdHex = numberToHex(parseInt(chainIdParsed.reference, 10));\n const amount = getAmountFromBalance(balance);\n const balanceHex = amountToHex(amount);\n\n if (parsed.assetNamespace === 'slip44') {\n const nativeAddress =\n '0x0000000000000000000000000000000000000000' as const;\n const checksumAddress = toChecksumAddress(account.address);\n tokenBalances[accountAddressLower] ??= {};\n tokenBalances[accountAddressLower][chainIdHex] ??= {};\n tokenBalances[accountAddressLower][chainIdHex][nativeAddress] =\n balanceHex;\n accountsByChainId[chainIdHex] ??= {};\n accountsByChainId[chainIdHex][checksumAddress] = {\n balance: balanceHex,\n };\n } else if (parsed.assetNamespace === 'erc20') {\n const tokenAddress = toChecksumAddress(String(parsed.assetReference));\n tokenBalances[accountAddressLower] ??= {};\n tokenBalances[accountAddressLower][chainIdHex] ??= {};\n tokenBalances[accountAddressLower][chainIdHex][tokenAddress] =\n balanceHex;\n }\n } catch {\n // Skip malformed asset IDs\n }\n }\n }\n\n for (const [assetId, metadata] of Object.entries(assetsInfo)) {\n try {\n const parsed = parseCaipAssetType(assetId as Caip19AssetId);\n const chainIdParsed = parseCaipChainId(parsed.chainId);\n if (chainIdParsed.namespace !== 'eip155') {\n continue;\n }\n const chainIdHex = numberToHex(parseInt(chainIdParsed.reference, 10));\n const baseMeta =\n metadata && typeof metadata === 'object' && 'decimals' in metadata\n ? (metadata as { decimals: number; symbol: string; name?: string })\n : null;\n if (!baseMeta) {\n continue;\n }\n const address =\n parsed.assetNamespace === 'slip44'\n ? '0x0000000000000000000000000000000000000000'\n : toChecksumAddress(String(parsed.assetReference));\n const token: LegacyToken = {\n address,\n decimals: Number(baseMeta.decimals),\n symbol: baseMeta.symbol ?? '',\n name: baseMeta.name,\n };\n allTokensByChain[chainIdHex] ??= [];\n if (\n !allTokensByChain[chainIdHex].some(\n (existing) =>\n existing.address.toLowerCase() === address.toLowerCase(),\n )\n ) {\n allTokensByChain[chainIdHex].push(token);\n }\n } catch {\n // Skip malformed asset IDs\n }\n }\n\n const allTokens: TransactionPayLegacyFormat['allTokens'] = {};\n for (const [chainId, tokens] of Object.entries(allTokensByChain)) {\n allTokens[chainId] = { '': tokens };\n }\n\n const exchangeRates = formatExchangeRatesForBridge({\n assetsPrice,\n selectedCurrency,\n nativeAssetIdentifiers,\n networkConfigurationsByChainId,\n usdToSelectedCurrencyRate,\n });\n\n return {\n tokenBalances,\n accountsByChainId,\n allTokens,\n marketData: exchangeRates.marketData,\n currencyRates: exchangeRates.currencyRates,\n currentCurrency: exchangeRates.currentCurrency,\n };\n}\n"]}
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.formatExchangeRatesForBridge = exports.normalizeAssetId = void 0;
3
+ exports.formatStateForTransactionPay = exports.formatExchangeRatesForBridge = exports.normalizeAssetId = void 0;
4
4
  var normalizeAssetId_1 = require("./normalizeAssetId.cjs");
5
5
  Object.defineProperty(exports, "normalizeAssetId", { enumerable: true, get: function () { return normalizeAssetId_1.normalizeAssetId; } });
6
6
  var formatExchangeRatesForBridge_1 = require("./formatExchangeRatesForBridge.cjs");
7
7
  Object.defineProperty(exports, "formatExchangeRatesForBridge", { enumerable: true, get: function () { return formatExchangeRatesForBridge_1.formatExchangeRatesForBridge; } });
8
+ var formatStateForTransactionPay_1 = require("./formatStateForTransactionPay.cjs");
9
+ Object.defineProperty(exports, "formatStateForTransactionPay", { enumerable: true, get: function () { return formatStateForTransactionPay_1.formatStateForTransactionPay; } });
8
10
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,2DAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,mFAA8E;AAArE,4IAAA,4BAA4B,OAAA","sourcesContent":["export { normalizeAssetId } from './normalizeAssetId';\nexport { formatExchangeRatesForBridge } from './formatExchangeRatesForBridge';\nexport type {\n BridgeConversionRateEntry,\n BridgeCurrencyRateEntry,\n BridgeExchangeRatesFormat,\n BridgeMarketDataEntry,\n} from './formatExchangeRatesForBridge';\n"]}
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";;;AAAA,2DAAsD;AAA7C,oHAAA,gBAAgB,OAAA;AACzB,mFAA8E;AAArE,4IAAA,4BAA4B,OAAA;AACrC,mFAA8E;AAArE,4IAAA,4BAA4B,OAAA","sourcesContent":["export { normalizeAssetId } from './normalizeAssetId';\nexport { formatExchangeRatesForBridge } from './formatExchangeRatesForBridge';\nexport { formatStateForTransactionPay } from './formatStateForTransactionPay';\nexport type {\n BridgeConversionRateEntry,\n BridgeCurrencyRateEntry,\n BridgeExchangeRatesFormat,\n BridgeMarketDataEntry,\n} from './formatExchangeRatesForBridge';\nexport type {\n AccountForLegacyFormat,\n LegacyToken,\n TransactionPayLegacyFormat,\n} from './formatStateForTransactionPay';\n"]}
@@ -1,4 +1,6 @@
1
1
  export { normalizeAssetId } from "./normalizeAssetId.cjs";
2
2
  export { formatExchangeRatesForBridge } from "./formatExchangeRatesForBridge.cjs";
3
+ export { formatStateForTransactionPay } from "./formatStateForTransactionPay.cjs";
3
4
  export type { BridgeConversionRateEntry, BridgeCurrencyRateEntry, BridgeExchangeRatesFormat, BridgeMarketDataEntry, } from "./formatExchangeRatesForBridge.cjs";
5
+ export type { AccountForLegacyFormat, LegacyToken, TransactionPayLegacyFormat, } from "./formatStateForTransactionPay.cjs";
4
6
  //# sourceMappingURL=index.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,+BAA2B;AACtD,OAAO,EAAE,4BAA4B,EAAE,2CAAuC;AAC9E,YAAY,EACV,yBAAyB,EACzB,uBAAuB,EACvB,yBAAyB,EACzB,qBAAqB,GACtB,2CAAuC"}
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,+BAA2B;AACtD,OAAO,EAAE,4BAA4B,EAAE,2CAAuC;AAC9E,OAAO,EAAE,4BAA4B,EAAE,2CAAuC;AAC9E,YAAY,EACV,yBAAyB,EACzB,uBAAuB,EACvB,yBAAyB,EACzB,qBAAqB,GACtB,2CAAuC;AACxC,YAAY,EACV,sBAAsB,EACtB,WAAW,EACX,0BAA0B,GAC3B,2CAAuC"}
@@ -1,4 +1,6 @@
1
1
  export { normalizeAssetId } from "./normalizeAssetId.mjs";
2
2
  export { formatExchangeRatesForBridge } from "./formatExchangeRatesForBridge.mjs";
3
+ export { formatStateForTransactionPay } from "./formatStateForTransactionPay.mjs";
3
4
  export type { BridgeConversionRateEntry, BridgeCurrencyRateEntry, BridgeExchangeRatesFormat, BridgeMarketDataEntry, } from "./formatExchangeRatesForBridge.mjs";
5
+ export type { AccountForLegacyFormat, LegacyToken, TransactionPayLegacyFormat, } from "./formatStateForTransactionPay.mjs";
4
6
  //# sourceMappingURL=index.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,+BAA2B;AACtD,OAAO,EAAE,4BAA4B,EAAE,2CAAuC;AAC9E,YAAY,EACV,yBAAyB,EACzB,uBAAuB,EACvB,yBAAyB,EACzB,qBAAqB,GACtB,2CAAuC"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,+BAA2B;AACtD,OAAO,EAAE,4BAA4B,EAAE,2CAAuC;AAC9E,OAAO,EAAE,4BAA4B,EAAE,2CAAuC;AAC9E,YAAY,EACV,yBAAyB,EACzB,uBAAuB,EACvB,yBAAyB,EACzB,qBAAqB,GACtB,2CAAuC;AACxC,YAAY,EACV,sBAAsB,EACtB,WAAW,EACX,0BAA0B,GAC3B,2CAAuC"}
@@ -1,3 +1,4 @@
1
1
  export { normalizeAssetId } from "./normalizeAssetId.mjs";
2
2
  export { formatExchangeRatesForBridge } from "./formatExchangeRatesForBridge.mjs";
3
+ export { formatStateForTransactionPay } from "./formatStateForTransactionPay.mjs";
3
4
  //# sourceMappingURL=index.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,+BAA2B;AACtD,OAAO,EAAE,4BAA4B,EAAE,2CAAuC","sourcesContent":["export { normalizeAssetId } from './normalizeAssetId';\nexport { formatExchangeRatesForBridge } from './formatExchangeRatesForBridge';\nexport type {\n BridgeConversionRateEntry,\n BridgeCurrencyRateEntry,\n BridgeExchangeRatesFormat,\n BridgeMarketDataEntry,\n} from './formatExchangeRatesForBridge';\n"]}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,+BAA2B;AACtD,OAAO,EAAE,4BAA4B,EAAE,2CAAuC;AAC9E,OAAO,EAAE,4BAA4B,EAAE,2CAAuC","sourcesContent":["export { normalizeAssetId } from './normalizeAssetId';\nexport { formatExchangeRatesForBridge } from './formatExchangeRatesForBridge';\nexport { formatStateForTransactionPay } from './formatStateForTransactionPay';\nexport type {\n BridgeConversionRateEntry,\n BridgeCurrencyRateEntry,\n BridgeExchangeRatesFormat,\n BridgeMarketDataEntry,\n} from './formatExchangeRatesForBridge';\nexport type {\n AccountForLegacyFormat,\n LegacyToken,\n TransactionPayLegacyFormat,\n} from './formatStateForTransactionPay';\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metamask-previews/assets-controller",
3
- "version": "2.2.0-preview-62fe3fa64",
3
+ "version": "2.2.0-preview-327d86601",
4
4
  "description": "Tracks assets balances/prices and handles token detection across all digital assets",
5
5
  "keywords": [
6
6
  "MetaMask",
@@ -52,7 +52,7 @@
52
52
  "@ethersproject/abi": "^5.7.0",
53
53
  "@ethersproject/providers": "^5.7.0",
54
54
  "@metamask/account-tree-controller": "^4.1.1",
55
- "@metamask/assets-controllers": "^100.0.3",
55
+ "@metamask/assets-controllers": "^100.1.0",
56
56
  "@metamask/base-controller": "^9.0.0",
57
57
  "@metamask/client-controller": "^1.0.0",
58
58
  "@metamask/controller-utils": "^11.19.0",
@@ -63,13 +63,13 @@
63
63
  "@metamask/keyring-snap-client": "^8.2.0",
64
64
  "@metamask/messenger": "^0.3.0",
65
65
  "@metamask/network-controller": "^30.0.0",
66
- "@metamask/network-enablement-controller": "^4.1.2",
66
+ "@metamask/network-enablement-controller": "^4.2.0",
67
67
  "@metamask/permission-controller": "^12.2.0",
68
68
  "@metamask/polling-controller": "^16.0.3",
69
69
  "@metamask/preferences-controller": "^22.1.0",
70
70
  "@metamask/snaps-controllers": "^17.2.0",
71
71
  "@metamask/snaps-utils": "^11.7.0",
72
- "@metamask/transaction-controller": "^62.19.0",
72
+ "@metamask/transaction-controller": "^62.20.0",
73
73
  "@metamask/utils": "^11.9.0",
74
74
  "async-mutex": "^0.5.0",
75
75
  "bignumber.js": "^9.1.2",