@metamask/snaps-utils
Version:
A collection of utilities for MetaMask Snaps
1 lines • 1.72 kB
Source Map (JSON)
{"version":3,"file":"asset-historical-price.mjs","sourceRoot":"","sources":["../../src/handlers/asset-historical-price.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,4BAA4B;AACrD,OAAO,EACL,KAAK,EACL,OAAO,EACP,QAAQ,EACR,MAAM,EACN,MAAM,EACN,QAAQ,EACR,MAAM,EACN,KAAK,EACL,KAAK,EACN,8BAA8B;AAE/B,OAAO,EAAE,qBAAqB,EAAE,oBAAgB;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,cAAc,CACjD,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,qBAAqB,CAAC,CAAC,EAC9C,KAAK,CAAC,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC,CAAC,CACnC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,QAAQ,CAChD,MAAM,CAAC;IACL,SAAS,EAAE,qBAAqB;IAChC,UAAU,EAAE,MAAM,EAAE;IACpB,cAAc,EAAE,QAAQ,CAAC,MAAM,EAAE,CAAC;CACnC,CAAC,CACH,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAAG,MAAM,CAAC;IACzD,eAAe,EAAE,0BAA0B;CAC5C,CAAC,CAAC","sourcesContent":["import { nonEmptyRecord } from '@metamask/snaps-sdk';\nimport {\n array,\n literal,\n nullable,\n number,\n object,\n optional,\n string,\n tuple,\n union,\n} from '@metamask/superstruct';\n\nimport { ISO8601DurationStruct } from '../time';\n\n/**\n * A struct representing a historical price.\n */\nexport const HistoricalPriceStruct = nonEmptyRecord(\n union([literal('all'), ISO8601DurationStruct]),\n array(tuple([number(), string()])),\n);\n\n/**\n * A struct representing an asset's historical price.\n */\nexport const AssetHistoricalPriceStruct = nullable(\n object({\n intervals: HistoricalPriceStruct,\n updateTime: number(),\n expirationTime: optional(number()),\n }),\n);\n\n/**\n * A struct representing the response of the `onAssetHistoricalPrice` method.\n */\nexport const OnAssetHistoricalPriceResponseStruct = object({\n historicalPrice: AssetHistoricalPriceStruct,\n});\n"]}