{"version":3,"file":"get-hasher-from-block.mjs","sources":["../../../src/utils/get-hasher-from-block.ts"],"sourcesContent":["import { Blake2256, Keccak256 } from \"@polkadot-api/substrate-bindings\"\nimport { getFromShittyHeader } from \"./fromShittyHeader\"\nimport { ShittyHeader } from \"@/types\"\n\nconst hashers = [Blake2256, Keccak256]\nconst fns = hashers.map(getFromShittyHeader)\nconst noHasher = (_: Uint8Array): Uint8Array => {\n  throw new Error(\"Hasher not supported\")\n}\n\nexport const getHasherFromBlock =\n  (shitHeader: ShittyHeader) =>\n  (hash: string): ((data: Uint8Array) => Uint8Array) =>\n    hashers[fns.findIndex((fn) => fn(shitHeader).hash === hash)] || noHasher\n"],"names":[],"mappings":";;;AAIA,MAAM,OAAA,GAAU,CAAC,SAAA,EAAW,SAAS,CAAA;AACrC,MAAM,GAAA,GAAM,OAAA,CAAQ,GAAA,CAAI,mBAAmB,CAAA;AAC3C,MAAM,QAAA,GAAW,CAAC,CAAA,KAA8B;AAC9C,EAAA,MAAM,IAAI,MAAM,sBAAsB,CAAA;AACxC,CAAA;AAEO,MAAM,qBACX,CAAC,UAAA,KACD,CAAC,IAAA,KACC,QAAQ,GAAA,CAAI,SAAA,CAAU,CAAC,EAAA,KAAO,GAAG,UAAU,CAAA,CAAE,IAAA,KAAS,IAAI,CAAC,CAAA,IAAK;;;;"}