UNPKG

@taquito/michelson-encoder

Version:

converts michelson data and types into convenient JS/TS objects

54 lines (53 loc) 1.82 kB
import { MichelsonV1Expression, MichelsonV1ExpressionExtended, ScriptResponse } from '@taquito/rpc'; import { Semantic } from '../tokens/token'; export declare class ViewSchema { readonly viewName: string; readonly viewArgsType: MichelsonV1ExpressionExtended; readonly viewReturnType: MichelsonV1ExpressionExtended; readonly instructions: MichelsonV1ExpressionExtended[]; private rootArgsType; private rootReturnType; /** * * @description Create an instance of ViewSchema for each view in a script * * @param val contract script obtained from the RPC * @returns array of ViewSchema or empty array if there is no view in the contract * @throws {@link InvalidScriptError} */ static fromRPCResponse(val: { script: ScriptResponse; }): ViewSchema[]; /** * @throws {@link InvalidScriptError} */ constructor(viewArgs: MichelsonV1Expression[] | undefined); /** * * @description Transform the view parameter into Michelson * * @param args parameter of the view in js format * @returns parameter of the view in Michelson * @throws {@link ParameterEncodingError} */ encodeViewArgs(args: any): any; /** * * @description Transform the view result from Michelson to readable data * * @param val result of the view in JSON Michelson * @param semantics optional semantics to override the default decoding behavior * @returns result of the view in a readable format */ decodeViewResult(val: any, semantics?: Semantic): any; /** * * @description Return the signature of the view parameter */ extractArgsSchema(): any; /** * * @description Return the format of the view result */ extractResultSchema(): any; }