UNPKG

@metamask/snaps-utils

Version:
1 lines 1.63 kB
{"version":3,"file":"asset-historical-price.cjs","sourceRoot":"","sources":["../../src/handlers/asset-historical-price.ts"],"names":[],"mappings":";;;AAAA,mDAAqD;AACrD,uDAU+B;AAE/B,sCAAgD;AAEhD;;GAEG;AACU,QAAA,qBAAqB,GAAG,IAAA,0BAAc,EACjD,IAAA,mBAAK,EAAC,CAAC,IAAA,qBAAO,EAAC,KAAK,CAAC,EAAE,4BAAqB,CAAC,CAAC,EAC9C,IAAA,mBAAK,EAAC,IAAA,mBAAK,EAAC,CAAC,IAAA,oBAAM,GAAE,EAAE,IAAA,oBAAM,GAAE,CAAC,CAAC,CAAC,CACnC,CAAC;AAEF;;GAEG;AACU,QAAA,0BAA0B,GAAG,IAAA,sBAAQ,EAChD,IAAA,oBAAM,EAAC;IACL,SAAS,EAAE,6BAAqB;IAChC,UAAU,EAAE,IAAA,oBAAM,GAAE;IACpB,cAAc,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;CACnC,CAAC,CACH,CAAC;AAEF;;GAEG;AACU,QAAA,oCAAoC,GAAG,IAAA,oBAAM,EAAC;IACzD,eAAe,EAAE,kCAA0B;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"]}