@novasamatech/host-api 0.5.0-17 → 0.5.0-18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ import type { Codec } from 'scale-ts';
2
+ export declare const Nullable: <T>(inner: Codec<T>) => Codec<T | null>;
3
+ export declare const Hex: (length?: number) => Codec<`0x${string}`>;
4
+ export declare const GenericErr: Codec<{
5
+ reason: string;
6
+ }>;
7
+ export declare const GenesisHash: Codec<`0x${string}`>;
@@ -0,0 +1,8 @@
1
+ import { fromHex, toHex } from '@polkadot-api/utils';
2
+ import { Bytes, Option, Struct, enhanceCodec, str } from 'scale-ts';
3
+ export const Nullable = (inner) => enhanceCodec(Option(inner), v => v ?? undefined, v => v ?? null);
4
+ export const Hex = (length) => enhanceCodec(Bytes(length), fromHex, v => toHex(v));
5
+ export const GenericErr = Struct({
6
+ reason: str,
7
+ });
8
+ export const GenesisHash = Hex();