mirror of
https://github.com/pezkuwichain/pezkuwi-api.git
synced 2026-11-03 15:01:06 +00:00
The pezkuwi-dev build treats any package with a src/ directory as its own: it requires our license header on every file and builds it. These are upstream files that must stay byte-identical to the source embedded in dist/, so they live in upstream-src/ instead, which neither the build nor the root tsconfig picks up.
19 lines
479 B
TypeScript
19 lines
479 B
TypeScript
import {
|
|
decAnyMetadata,
|
|
UnifiedMetadata,
|
|
type HexString,
|
|
unifyMetadata,
|
|
} from "@pezkuwi/bizinikiwi-bindings"
|
|
|
|
export const getMetadata = (
|
|
input: Uint8Array | HexString,
|
|
): UnifiedMetadata<15 | 16> => {
|
|
try {
|
|
const metadata = unifyMetadata(decAnyMetadata(input))
|
|
if (metadata.version <= 14) throw new Error("Wrong metadata version")
|
|
return metadata as UnifiedMetadata<15 | 16>
|
|
} catch (e) {
|
|
throw e || new Error("Unable to decode metadata")
|
|
}
|
|
}
|