utils.d.ts 1.5 KB

1234567891011121314151617181920212223242526272829
  1. import { FullValidationSchema, Schema, ShortValidationSchema, ValidationSchemaInput, ValidInputTypes } from './types.js';
  2. export declare const parseBaseType: <T = string>(type: string) => {
  3. baseType?: T | undefined;
  4. baseTypeSize: number | undefined;
  5. arraySizes: number[];
  6. isArray: boolean;
  7. };
  8. export declare const abiSchemaToJsonSchema: (abis: ShortValidationSchema | FullValidationSchema, level?: string) => Schema;
  9. export declare const ethAbiToJsonSchema: (abis: ValidationSchemaInput) => Schema;
  10. export declare const fetchArrayElement: (data: Array<unknown>, level: number) => unknown;
  11. export declare const transformJsonDataToAbiFormat: (abis: FullValidationSchema, data: ReadonlyArray<unknown> | Record<string, unknown>, transformedData?: Array<unknown>) => Array<unknown>;
  12. /**
  13. * Code points to int
  14. */
  15. export declare const codePointToInt: (codePoint: number) => number;
  16. /**
  17. * Converts value to it's number representation
  18. */
  19. export declare const hexToNumber: (value: string) => bigint | number;
  20. /**
  21. * Converts value to it's hex representation
  22. */
  23. export declare const numberToHex: (value: ValidInputTypes) => string;
  24. /**
  25. * Adds a padding on the left of a string, if value is a integer or bigInt will be converted to a hex string.
  26. */
  27. export declare const padLeft: (value: ValidInputTypes, characterAmount: number, sign?: string) => string;
  28. export declare function uint8ArrayToHexString(uint8Array: Uint8Array): string;
  29. export declare function hexToUint8Array(hex: string): Uint8Array;