{"version":3,"file":"asset-historical-price.mjs","sourceRoot":"","sources":["../../../src/types/handlers/asset-historical-price.ts"],"names":[],"mappings":"","sourcesContent":["import type { CaipAssetType } from '@metamask/utils';\n\n/**\n * The historical price value.\n * The first element in the array is the timestamp, the second is the price.\n */\nexport type HistoricalPriceValue = [number, string];\n\n/**\n * The historical price object.\n * The key is the time period as an ISO 8601 duration or the \"all\" string, the value is an array of historical price values.\n */\nexport type HistoricalPriceIntervals = {\n  [key: string]: HistoricalPriceValue[];\n};\n\n/**\n * The response from the historical price query, containing the historical price about the requested asset pair.\n *\n * @property historicalPrice - The historical price object\n * @property historicalPrice.intervals - The historical price of the asset pair.\n * @property historicalPrice.updateTime - The time at which the historical price has been calculated.\n * @property historicalPrice.expirationTime - The time at which the historical price expires.\n */\nexport type OnAssetHistoricalPriceResponse = {\n  historicalPrice: {\n    intervals: HistoricalPriceIntervals;\n    updateTime: number;\n    expirationTime?: number;\n  };\n} | null;\n\n/**\n * The `onAssetHistoricalPrice` handler arguments.\n *\n * @property from - The CAIP-19 asset type of the asset requested.\n * @property to - The CAIP-19 asset type of the asset converted to.\n */\nexport type OnAssetHistoricalPriceArguments = {\n  from: CaipAssetType;\n  to: CaipAssetType;\n};\n\n/**\n * The `onAssetHistoricalPrice` handler. This is called by MetaMask when querying about the historical price of an asset pair on a specific chain.\n *\n * @returns The historical price of the asset pair. See\n * {@link OnAssetHistoricalPriceResponse}.\n */\nexport type OnAssetHistoricalPriceHandler = (\n  args: OnAssetHistoricalPriceArguments,\n) => Promise<OnAssetHistoricalPriceResponse>;\n"]}