UNPKG

@taquito/local-forging

Version:

Local Tezos operation forging for Taquito.

50 lines (49 loc) 2.31 kB
import { Decoder } from '../decoder'; import { Uint8ArrayConsumer } from '../uint8array-consumer'; import { Encoder } from '../encoder'; export type PrimValue = { prim: string; args?: MichelsonValue[]; annots?: string[]; }; export type BytesValue = { bytes: string; }; export type StringValue = { string: string; }; export type IntValue = { int: string; }; export type MichelsonValue = PrimValue | BytesValue | StringValue | IntValue | (PrimValue | BytesValue | StringValue | IntValue)[]; export declare const isPrim: (value: MichelsonValue) => value is PrimValue; export declare const isBytes: (value: MichelsonValue) => value is BytesValue; export declare const isString: (value: MichelsonValue) => value is StringValue; export declare const isInt: (value: MichelsonValue) => value is IntValue; export declare const scriptEncoder: Encoder<{ code: MichelsonValue; storage: MichelsonValue; }>; export declare const scriptDecoder: Decoder; export declare const valueEncoder: Encoder<MichelsonValue>; export declare const valueDecoder: Decoder; export declare const extractRequiredLen: (value: Uint8ArrayConsumer, bytesLength?: number) => Uint8Array<ArrayBufferLike>; /** * parse bytes into multiple items of an array * @param value Uint8ArrayConsumer class of forged segment to parse * @param bytesLength default 4 bytes for length of variable bytes * @returns array of Uint8Array values for each array item */ export declare const stripLengthPrefixFromBytes: (value: Uint8ArrayConsumer, bytesLength?: number) => Uint8Array[]; export declare const bytesEncoder: Encoder<BytesValue>; export declare const bytesDecoder: Decoder; export declare const stringEncoder: Encoder<StringValue>; export declare const stringDecoder: Decoder; export declare const intEncoder: Encoder<IntValue>; export declare const intDecoder: (value: Uint8ArrayConsumer) => IntValue; export declare const primEncoder: Encoder<PrimValue>; export declare const primDecoder: (value: Uint8ArrayConsumer, preamble: Uint8Array) => Partial<PrimValue>; export declare const primViewDecoder: (value: Uint8ArrayConsumer, result: Partial<PrimValue>) => Partial<PrimValue>; export declare const decodeCombPair: Decoder; export declare const encodeAnnots: Encoder<string[]>; export declare const decodeAnnots: Decoder;