UNPKG

@findeth/abi

Version:

A tiny Solidity ABI encoder and decoder

29 lines (28 loc) 1.26 kB
import { Parser } from './types'; /** * Get the parser for the specified type. This will throw if there is no parser for the specified type. * * @param type The type to get a parser for. * @return The parser. */ export declare const getParser: (type: string) => Parser; /** * Check if the specified parser is dynamic, for the provided types. This is primarily used for parsing tuples, where * a tuple can be dynamic based on the types. For other parsers, it will simply use the set `isDynamic` value. * * @param parser The parser to check. * @param type The type to check the parser with. * @return Whether the parser is dynamic. */ export declare const isDynamicParser: (parser: Parser, type: string) => boolean; /** * Pack the provided values in a buffer, encoded with the specified types. If a buffer is specified, the resulting value * will be concatenated with the buffer. * * @param types The types to use for encoding. * @param values The values to encode. * @param [buffer] The buffer to concatenate with. * @return The resulting encoded buffer. */ export declare const pack: (types: string[], values: unknown[], buffer?: Uint8Array) => Uint8Array; export declare const unpack: (types: string[], buffer: Uint8Array) => unknown[];