UNPKG

@tezwell/michelson-sdk

Version:

Michelson SDK is a framework for generating Michelson values and types from Javascript.

127 lines (126 loc) 6.01 kB
import type { MichelsonJSON, MichelsonMicheline, PairsOfKeys, IType, PrimType } from './typings'; export declare class Michelson_Type implements IType { #private; private type; private innerTypes; constructor(type: PrimType, ...innerTypes: IType[]); /** * @description Set field annotation * @link https://tezos.gitlab.io/active/michelson.html#field-and-constructor-annotations * @param {string} annotation field annotation */ setAnnotation(annotation: string): this; /** * @description Generate the Micheline representation of the type * @returns {MichelsonMicheline} Micheline representation */ toMicheline(): MichelsonMicheline; /** * @description Generate the JSON representation of the type * @returns {MichelsonMicheline} JSON representation */ toJSON(): MichelsonJSON; /** * @description Resolve type instance to a primitive * @return {MichelsonJSON} Michelson JSON format */ [Symbol.toPrimitive](): MichelsonJSON; } export declare class Michelson_Type_With_Param implements IType { #private; private type; constructor(type: PrimType, ...params: number[]); /** * @description Set field annotation * @link https://tezos.gitlab.io/active/michelson.html#field-and-constructor-annotations * @param {string} annotation field annotation */ setAnnotation(annotation: string): this; /** * @description Generate the Micheline representation of the type * @returns {MichelsonMicheline} Micheline representation */ toMicheline(): MichelsonMicheline; /** * @description Generate the JSON representation of the type * @returns {MichelsonMicheline} JSON representation */ toJSON(): MichelsonJSON; /** * @description Resolve type instance to a primitive * @return {MichelsonJSON} Michelson JSON format */ [Symbol.toPrimitive](): MichelsonJSON; } export interface IRecordVariant extends IType { fields: Record<string, IType>; layout: PairsOfKeys<string>; } export declare const buildRecordVariantType: (fields: Record<string, IType>, layout: PairsOfKeys<string>, container: (leftType: IType, rightType: IType) => IType) => IRecordVariant; export declare const TNat: () => Michelson_Type; export declare const TInt: () => Michelson_Type; export declare const TMutez: () => Michelson_Type; export declare const TString: () => Michelson_Type; export declare const TBool: () => Michelson_Type; export declare const TAddress: () => Michelson_Type; export declare const TTimestamp: () => Michelson_Type; export declare const TChain_id: () => Michelson_Type; export declare const TBytes: () => Michelson_Type; export declare const TBls12_381_fr: () => Michelson_Type; export declare const TBls12_381_g1: () => Michelson_Type; export declare const TBls12_381_g2: () => Michelson_Type; export declare const TKey: () => Michelson_Type; export declare const TKey_hash: () => Michelson_Type; export declare const TSignature: () => Michelson_Type; export declare const TUnit: () => Michelson_Type; export declare const TOperation: () => Michelson_Type; export declare const TNever: () => Michelson_Type; export declare const TList: (innerType: IType) => Michelson_Type; export declare const TSet: (innerType: IType) => Michelson_Type; export declare const TOption: (innerType: IType) => Michelson_Type; export declare const TPair: (leftType: IType, rightType: IType) => Michelson_Type; export declare const TOr: (leftType: IType, rightType: IType) => Michelson_Type; export declare const TMap: (keyType: IType, valueType: IType) => Michelson_Type; export declare const TBig_map: (keyType: IType, valueType: IType) => Michelson_Type; export declare const TLambda: (inType: IType, outType: IType) => Michelson_Type; export declare const TTicket: (innerType: IType) => Michelson_Type; export declare const TContract: (innerType: IType) => Michelson_Type; export declare const TSapling_state: (memoSize: number) => Michelson_Type_With_Param; export declare const TSapling_transaction: (memoSize: number) => Michelson_Type_With_Param; export declare const TRecord: (fields: Record<string, IType>, layout?: PairsOfKeys<string> | undefined) => IRecordVariant; export declare const TVariant: (fields: Record<string, IType>, layout?: PairsOfKeys<string> | undefined) => IRecordVariant; declare const Types: { TUnit: () => Michelson_Type; TNat: () => Michelson_Type; TInt: () => Michelson_Type; TMutez: () => Michelson_Type; TString: () => Michelson_Type; TBool: () => Michelson_Type; TBytes: () => Michelson_Type; TAddress: () => Michelson_Type; TTimestamp: () => Michelson_Type; TChain_id: () => Michelson_Type; TBls12_381_fr: () => Michelson_Type; TBls12_381_g1: () => Michelson_Type; TBls12_381_g2: () => Michelson_Type; TKey: () => Michelson_Type; TKey_hash: () => Michelson_Type; TSignature: () => Michelson_Type; TOperation: () => Michelson_Type; TNever: () => Michelson_Type; TList: (innerType: IType) => Michelson_Type; TSet: (innerType: IType) => Michelson_Type; TOption: (innerType: IType) => Michelson_Type; TPair: (leftType: IType, rightType: IType) => Michelson_Type; TOr: (leftType: IType, rightType: IType) => Michelson_Type; TMap: (keyType: IType, valueType: IType) => Michelson_Type; TBig_map: (keyType: IType, valueType: IType) => Michelson_Type; TLambda: (inType: IType, outType: IType) => Michelson_Type; TTicket: (innerType: IType) => Michelson_Type; TContract: (innerType: IType) => Michelson_Type; TSapling_state: (memoSize: number) => Michelson_Type_With_Param; TSapling_transaction: (memoSize: number) => Michelson_Type_With_Param; TRecord: (fields: Record<string, IType>, layout?: PairsOfKeys<string> | undefined) => IRecordVariant; TVariant: (fields: Record<string, IType>, layout?: PairsOfKeys<string> | undefined) => IRecordVariant; }; export default Types;