@taqueria/plugin-contract-types 0.3.0 → 0.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/Readme.md CHANGED
@@ -1,14 +1,62 @@
1
- This plugin will generate typescript types for a contract.
1
+ This plugin provides a `taq generate types` command which will generate and export TypeScript types from compiled Michelson smart contracts. These generated types then work with your IDE and Taquito, providing type safety and an improved code authoring experience
2
2
 
3
- In the simple case, it reads the `artifacts` folder for any `*.tz` Michelson files and will generate a types file with the matching filename for each.
3
+ Benefits of using generated types:
4
+ - Static types used to call smart contract methods are checked at compile time, improving code reliability
5
+ - Generated types enable auto-completion and syntax highlighting in your IDE
6
+ - Developing apps with Taquito is faster and more reliable
7
+ - The VS Code Extension provides tooltip hints for parameter types used to call a smart contract method
8
+ - Calling smart contract methods with types is done directly, removing the need for utility methods
9
+ - Simplifies your code and improves readability
4
10
 
5
11
  ## Requirements
6
12
 
7
- This is using a unmerged taquito PR:
13
+ - Node JS v16 or later
14
+ - Taquito v11.2 or later (optional)
8
15
 
9
- - https://github.com/ecadlabs/taquito/pull/1343
10
- - `npm i @taquito/taquito@11.1.0-6bfb6c08--1343 --registry https://npm.preview.tezostaquito.io/`
16
+ ## Installation
11
17
 
18
+ To install the Contract Types plugin on a Taqueria project, navigate to the project folder and run:
19
+ ```shell
20
+ taq install @taqueria/plugin-contract-types
21
+ ```
22
+
23
+ ## Configuration
24
+
25
+ This plugin will look for Michelson files according to the `artifactsDir` configured in `./.taq/config.json`. By default, this value is `/artifacts` but can be changed as needed
26
+
27
+ ## Usage
28
+
29
+ The plugin provides a single command to Taqueria: `taq generate types`
30
+
31
+ This will look for `.tz` files in the `/artifacts` directory and will generate a series of related `.ts` files in the `/types` directory. These files export type definitions for each method which can then be used by Taquito and your IDE
32
+
33
+ ### The `generate types` Command
34
+
35
+ #### Syntax
36
+ ```shell
37
+ taq generate types [typeOutputDir]
38
+ ```
39
+
40
+ #### Parameters
41
+
42
+ | parameter | required | description |
43
+ |:-------------:|:-----------|----------------------------------------------------|
44
+ | typeOutputDir | no | The output directory for the `.ts` files generated |
45
+
46
+ #### CLI Aliases
47
+
48
+ The following aliases are interchangable with `generate types`
49
+ - `gen`
50
+ - `gentypes`
51
+
52
+ #### Options
53
+
54
+ The `generate types` command will accept the following optional parameters:
55
+
56
+ | flag | name | description |
57
+ |:-----:|:--------------|----------------------------------------------|
58
+ | -t | typeAliasMode | Use type aliases in the generated types |
59
+
12
60
  ## Examples
13
61
 
14
62
  ### Example Usage (based on an nft auction contract from open minter sdk)
@@ -60,7 +108,6 @@ export const exampleContractMethods1 = async () => {
60
108
  };
61
109
  ```
62
110
 
63
-
64
111
  ### Example typegen task
65
112
 
66
113
  ```console
package/index.js CHANGED
@@ -283,8 +283,12 @@ const $b95e97a0bb3bf047$var$visitType = (node, options)=>{
283
283
  typescriptType: `string`
284
284
  };
285
285
  // chest
286
- if (node.prim === 'chest') throw new Error('Not Implemented: chest');
287
- if (node.prim === 'chest_key') throw new Error('Not Implemented: chest_key');
286
+ if (node.prim === 'chest' || node.prim === 'chest_key') return {
287
+ kind: `value`,
288
+ raw: node,
289
+ value: node.prim,
290
+ typescriptType: `string`
291
+ };
288
292
  // never
289
293
  if (node.prim === `never`) return {
290
294
  kind: `never`,
@@ -595,6 +599,8 @@ const $38088c948e5b4cf5$export$adc4e820bbd3332 = (contractScript, contractName,
595
599
  };
596
600
  const parameterResult = contractParameter && $b95e97a0bb3bf047$export$5c00959a6ba200c1(contractParameter);
597
601
  const methods = parameterResult?.methods ?? [];
602
+ // If there's only one entrypoint, then we call it "default"
603
+ if (methods.length === 1) methods[0].name = `default`;
598
604
  const schemaOutput = $4e7cd4eb63db9934$export$eb0413f5ee90780(methods, storage);
599
605
  const typescriptCode = $8fdd19ff0013f28e$export$d355209543d39bc0(storage, methods, contractName, contract, protocol, typeAliasData, typeUtilsData);
600
606
  return {
@@ -633,6 +639,8 @@ type MapKey = Array<any> | object | string | boolean | number;
633
639
  export type MMap<K extends MapKey, V> = Omit<MichelsonMap<K, V>, 'get'> & { get: (key: K) => V };
634
640
  export type BigMap<K extends MapKey, V> = Omit<MichelsonMap<K, V>, 'get'> & { get: (key: K) => Promise<V> };
635
641
 
642
+ export type chest = string & { __type: 'chest' };
643
+ export type chest_key = string & { __type: 'chest_key' };
636
644
 
637
645
  const createStringTypeTas = <T extends string>() => {
638
646
  return (value: string): T => value as T;
@@ -671,6 +679,8 @@ export const tas = {
671
679
  address: createStringTypeTas<address>(),
672
680
  bytes: createStringTypeTas<bytes>(),
673
681
  contract: createStringTypeTas<contract>(),
682
+ chest: createStringTypeTas<chest>(),
683
+ chest_key: createStringTypeTas<chest_key>(),
674
684
  timestamp: (value: string | Date): timestamp => new Date(value).toISOString() as timestamp,
675
685
 
676
686
  int: createBigNumberTypeTas<int>(),
@@ -852,7 +862,6 @@ const $3beaa6d78a95a243$var$generateContractTypesAll = async (parsedArgs)=>{
852
862
  return await Promise.all(files.map($3beaa6d78a95a243$var$generateContractTypes(parsedArgs)));
853
863
  };
854
864
  const $3beaa6d78a95a243$export$3350b7b754d5c00c = (parsedArgs)=>{
855
- debugger;
856
865
  parsedArgs.typescriptDir = parsedArgs.typescriptDir || 'types';
857
866
  console.log('generateTypes', {
858
867
  typescriptDir: parsedArgs.typescriptDir
package/index.js.map CHANGED
@@ -1 +1 @@
1
- {"mappings":";;;;;;;;;;AAAA;ACAA;;ACAA;;;ACAO,MAAM,yCAAqB,GAAG,CAAC,IAAY,GAAK,IAAI,CACtD,OAAO,kBAAkB,GAAG,CAAC,CAC7B,KAAK,CAAC,GAAG,CAAC,CACV,MAAM,CAAC,CAAA,CAAC,GAAI,CAAC;IAAA,CAAC,CACd,GAAG,CAAC,CAAA,CAAC,GAAI,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IAAA,CAAC,CAC7C,IAAI,CAAC,EAAE,CAAC;AAAC;;;ACLd;AC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AC,IAAU,GAAM,CAAA;QAC3B,KAAK,EAAE,gBAAgB;QACvB,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,KAAK;QACd,KAAK,EAAE;YACH,2BAAI,CAAC,MAAM,CAAC;gBACR,IAAI,EAAE,gBAAgB;gBACtB,OAAO,EAAE,gCAAgC;gBACzC,WAAW,EAAE,uDAAuD;gBACpE,WAAW,EAAE;oBACT,oCAAa,CAAC,MAAM,CAAC;wBACjB,WAAW,EAAE,eAAe;wBAC5B,WAAW,EAAE,mDAAmD;wBAChE,YAAY,EAAE,OAAO;qBACxB,CAAC;iBACL;gBACD,OAAO,EAAE;oBACL,6BAAM,CAAC,MAAM,CAAC;wBACV,SAAS,EAAE,GAAG;wBACd,IAAI,EAAE,eAAe;wBACrB,OAAO,EAAE;4BAAC,MAAM;4BAAE,QAAQ;yBAAC;wBAC3B,WAAW,EAAE,8CAA8C;qBAC9D,CAAC;iBACL;gBACD,OAAO,EAAE;oBAAC,WAAW;oBAAE,UAAU;iBAAC;gBAClC,OAAO,EAAE,OAAO;aACnB,CAAC;SACL;QACD,KAAK,EAAE,yCAAK,CAAC,aAAa;KAC7B,CAAA;AAAC,EAAE,OAAO,CAAC,IAAI,CAAC","sources":["taqueria-plugin-contract-types/index.ts","taqueria-plugin-contract-types/tasks.ts","taqueria-plugin-contract-types/src/cli-process.ts","taqueria-plugin-contract-types/src/generator/contract-name.ts","taqueria-plugin-contract-types/src/generator/process.ts","taqueria-plugin-contract-types/src/generator/common.ts","taqueria-plugin-contract-types/src/generator/contract-parser.ts","taqueria-plugin-contract-types/src/generator/schema-output.ts","taqueria-plugin-contract-types/src/generator/typescript-output.ts","taqueria-plugin-contract-types/src/type-aliases-file-content.ts","taqueria-plugin-contract-types/src/type-utils-file-content.ts"],"sourcesContent":["import {Plugin, Task, Option, PositionalArg} from '@taqueria/node-sdk'\nimport type { i18n} from '@taqueria/node-sdk/types'\nimport {tasks} from './tasks'\n\nPlugin.create((i18n: i18n) => ({\n alias: \"contract-types\",\n schema: \"1.0\",\n version: \"0.1\",\n tasks: [\n Task.create({\n task: \"generate types\",\n command: \"generate types [typescriptDir]\",\n description: \"Generate types for a contract to be used with taquito\",\n positionals: [\n PositionalArg.create({\n placeholder: \"typescriptDir\",\n description: \"The output directory for the generated type files\",\n defaultValue: \"types\",\n })\n ],\n options: [\n Option.create({\n shortFlag: \"t\",\n flag: \"typeAliasMode\",\n choices: ['file', 'simple'],\n description: \"The type aliases used in the generated types\"\n }),\n ],\n aliases: [\"gen types\", \"gentypes\"],\n handler: \"proxy\"\n }),\n ],\n proxy: tasks.generateTypes,\n}), process.argv)","import { SanitizedArgs, PluginResponse, Failure, LikeAPromise } from \"@taqueria/node-sdk/types\";\nimport glob from 'fast-glob'\nimport { join } from 'path'\nimport { generateContractTypesProcessContractFiles } from \"./src/cli-process\";\n\ntype PluginOpts = {\n // TODO: Document these\n typescriptDir: string,\n typeAliasMode?: 'local' | 'file' | 'library' | 'simple',\n};\ntype Opts = SanitizedArgs & Record<string, unknown>;\n\nconst getContractAbspath = (contractFilename: string, parsedArgs: Opts) => \n join(parsedArgs.artifactsDir, /\\.tz$/.test(contractFilename) ? contractFilename : `${contractFilename}.tz`)\n\n\nconst generateContractTypes = (parsedArgs: Opts & PluginOpts) => async (contractFilename: string) : Promise<string> => {\n const contractAbspath = getContractAbspath(contractFilename, parsedArgs);\n await generateContractTypesProcessContractFiles({\n inputTzContractDirectory: parsedArgs.artifactsDir,\n inputFiles: [contractAbspath],\n outputTypescriptDirectory: parsedArgs.typescriptDir,\n format: 'tz',\n typeAliasMode: parsedArgs.typeAliasMode ?? 'file',\n });\n\n return `${contractFilename}: Types generated`;\n}\n\nconst generateContractTypesAll = async (parsedArgs: Opts & PluginOpts) : Promise<string[]> => {\n const files = await glob(\"**/*.tz\", {cwd: parsedArgs.artifactsDir});\n return await Promise.all(files.map(generateContractTypes(parsedArgs)));\n}\n\nexport const generateTypes = <T>(parsedArgs: Opts): LikeAPromise<PluginResponse, Failure<T>> => {\n debugger\n parsedArgs.typescriptDir = parsedArgs.typescriptDir || 'types';\n\n console.log('generateTypes', { \n typescriptDir: parsedArgs.typescriptDir\n });\n\n const argsTyped = parsedArgs as Opts & PluginOpts;\n\n const p = argsTyped.contract\n ? generateContractTypes(argsTyped) (argsTyped.contract as string)\n : generateContractTypesAll(argsTyped)\n\n return p.then(data => {\n console.log(\n (Array.isArray(data))\n ? data.join(\"\\n\")\n : data\n )\n })\n}\n\nexport const tasks = {\n generateTypes,\n} ","import fsRaw from 'fs';\nimport path from 'path';\nimport { promisify } from 'util';\nimport { normalizeContractName } from './generator/contract-name';\nimport { generateContractTypesFromMichelsonCode } from './generator/process';\nimport { TypeAliasData, TypeUtilsData } from './generator/typescript-output';\nimport { typeAliasesFileContent } from './type-aliases-file-content';\nimport { typeUtilsFileContent } from './type-utils-file-content';\n\nconst fs = {\n mkdir: promisify(fsRaw.mkdir),\n copyFile: promisify(fsRaw.copyFile),\n readdir: promisify(fsRaw.readdir),\n readFile: promisify(fsRaw.readFile),\n writeFile: promisify(fsRaw.writeFile),\n stat: promisify(fsRaw.stat),\n exists: fsRaw.existsSync,\n};\n\nconst getAllFiles = async (rootPath: string, filter: (fullPath: string) => boolean): Promise<string[]> => {\n const allFiles = [] as string[];\n\n const getAllFilesRecursive = async (dirPath: string) => {\n let files = await fs.readdir(dirPath, { withFileTypes: true });\n\n for (const f of files) {\n const subPath = path.resolve(dirPath, f.name);\n\n if (f.isDirectory()) {\n await getAllFilesRecursive(subPath);\n continue;\n }\n\n if (!filter(subPath)) {\n continue;\n }\n\n allFiles.push(subPath);\n }\n }\n\n await getAllFilesRecursive(rootPath);\n return allFiles;\n}\n\nexport const generateContractTypesProcessContractFiles = async ({\n inputTzContractDirectory,\n inputFiles,\n outputTypescriptDirectory,\n format,\n typeAliasMode,\n}: {\n inputTzContractDirectory: string;\n inputFiles?: string[];\n outputTypescriptDirectory: string;\n format: 'tz' | 'json',\n typeAliasMode: 'local' | 'file' | 'library' | 'simple',\n}): Promise<void> => {\n\n console.log(`Generating Types: ${path.resolve(inputTzContractDirectory)} => ${path.resolve(outputTypescriptDirectory)}`);\n\n const ext = '.' + format;\n const filesAll = await getAllFiles(inputTzContractDirectory, x => x.endsWith(ext));\n const files = inputFiles ? filesAll.filter(f => inputFiles.some(inputFile => f.endsWith(inputFile))) : filesAll;\n\n console.log(`Contracts Found: ${[``, ...files].join(`\\n\\t- `)}`);\n\n const typeAliasImportPath = `@taquito/contract-type-generator`;\n\n const typeAliasData: TypeAliasData = typeAliasMode === 'local' ? { mode: typeAliasMode, fileContent: typeAliasesFileContent }\n : typeAliasMode === 'file' ? { mode: typeAliasMode, importPath: `./type-aliases` }\n : typeAliasMode === 'library' ? { mode: typeAliasMode, importPath: typeAliasImportPath }\n : { mode: 'simple' };\n\n if (typeAliasMode === 'file') {\n // Copy the type alias file\n await fs.mkdir(outputTypescriptDirectory, { recursive: true });\n await fs.writeFile(path.join(outputTypescriptDirectory, './type-aliases.ts'), typeAliasesFileContent);\n }\n\n // Copy the type utils file\n const typeUtilsData: TypeUtilsData = { importPath: `./type-utils` };\n await fs.mkdir(outputTypescriptDirectory, { recursive: true });\n await fs.writeFile(path.join(outputTypescriptDirectory, './type-utils.ts'), typeUtilsFileContent);\n\n for (const fullPath of files) {\n const fileRelativePath = fullPath.replace(path.resolve(inputTzContractDirectory), '');\n const fileName = fileRelativePath.replace(ext, '');\n const inputFilePath = path.join(inputTzContractDirectory, fileRelativePath);\n const typesOutputFilePath = path.join(outputTypescriptDirectory, fileRelativePath.replace(ext, `.types.ts`));\n const codeContentOutputFilePath = path.join(outputTypescriptDirectory, fileRelativePath.replace(ext, `.code.ts`));\n const schemaContentOutputFilePath = path.join(outputTypescriptDirectory, fileRelativePath.replace(ext, `.schema.json`));\n console.log(`Processing ${fileRelativePath}...`);\n\n try {\n const contractTypeName = normalizeContractName(fileName);\n\n const michelsonCode = await fs.readFile(inputFilePath, { encoding: `utf8` });\n\n const {\n schemaOutput,\n typescriptCodeOutput: { typesFileContent, contractCodeFileContent }\n } = generateContractTypesFromMichelsonCode(michelsonCode, contractTypeName, format, typeAliasData, typeUtilsData);\n\n // Write output (ensure dir exists)\n await fs.mkdir(path.dirname(typesOutputFilePath), { recursive: true });\n await fs.writeFile(typesOutputFilePath, typesFileContent);\n await fs.writeFile(codeContentOutputFilePath, contractCodeFileContent);\n\n const debugSchema = false;\n if(debugSchema){\n await fs.writeFile(schemaContentOutputFilePath, JSON.stringify(schemaOutput, null, 2));\n }\n } catch (err: unknown) {\n console.error(`❌ Could not process ${fileRelativePath}`, { err });\n }\n }\n};","export const normalizeContractName = (text: string) => text\n .replace(/[^A-Za-z0-9]/g, '_')\n .split(\"_\")\n .filter(x => x)\n .map(x => x[0].toUpperCase() + x.substring(1))\n .join('');\n","import * as M from '@taquito/michel-codec';\nimport { GenerateApiError } from './common';\nimport { parseContractStorage, parseContractParameter } from './contract-parser';\nimport { SchemaOutput, toSchema } from './schema-output';\nimport { TypescriptCodeOutput, toTypescriptCode, TypeAliasData, TypeUtilsData } from './typescript-output';\n\nconst parseContractWithMinimalProtocolLevel = (contractScript: string, format: 'tz' | 'json', contractLevelIndex: number): { contract: M.MichelsonContract, protocol: { name: string, key: string } } => {\n const contractLevels = [\n { name: 'PsDELPH1', key: M.Protocol.PsDELPH1 },\n { name: 'PtEdo2Zk', key: M.Protocol.PtEdo2Zk },\n { name: 'PsFLorena', key: M.Protocol.PsFLorena },\n ];\n\n const protocol = contractLevels[contractLevelIndex];\n if (!protocol) {\n throw new GenerateApiError(`Could not parse contract script`, contractScript);\n }\n\n const p = new M.Parser({ protocol: protocol.key });\n\n try {\n const contract = (format === 'tz' ? p.parseScript(contractScript) : p.parseJSON(JSON.parse(contractScript))) as M.MichelsonContract;\n if (contract) {\n return {\n contract,\n protocol,\n };\n }\n } catch {\n // Ignore parse errors\n }\n\n // Try again with next level\n return parseContractWithMinimalProtocolLevel(contractScript, format, contractLevelIndex + 1);\n};\n\nexport const generateContractTypesFromMichelsonCode = (contractScript: string, contractName: string, format: 'tz' | 'json', typeAliasData: TypeAliasData, typeUtilsData: TypeUtilsData): {\n schemaOutput: SchemaOutput;\n typescriptCodeOutput: TypescriptCodeOutput;\n parsedContract: M.MichelsonContract;\n minimalProtocol: string;\n} => {\n\n const p = new M.Parser({ protocol: M.Protocol.PsFLorena });\n\n const { contract, protocol } = parseContractWithMinimalProtocolLevel(contractScript, format, 0);\n\n const contractStorage = contract.find(x => x.prim === `storage`) as undefined | M.MichelsonContractStorage;\n const contractParameter = contract.find(x => x.prim === `parameter`) as undefined | M.MichelsonContractParameter;\n\n const storageResult = contractStorage && parseContractStorage(contractStorage);\n const storage = storageResult ?? { storage: { kind: `object`, raw: { prim: `never` } as M.MichelsonType, fields: [] } };\n\n const parameterResult = contractParameter && parseContractParameter(contractParameter);\n const methods = parameterResult?.methods ?? [];\n const schemaOutput = toSchema(methods, storage);\n\n const typescriptCode = toTypescriptCode(storage, methods, contractName, contract, protocol, typeAliasData, typeUtilsData);\n\n return {\n schemaOutput,\n typescriptCodeOutput: typescriptCode,\n parsedContract: contract,\n minimalProtocol: protocol.key,\n };\n};\n","\nexport class GenerateApiError implements Error {\n name = `GenerateApiError`;\n constructor(public message: string, readonly data: unknown) {\n console.error(`❌ GenerateApiError: ${message}`, data);\n }\n}\n\nexport const assertExhaustive = (value: never, message: string): void => {\n console.error(message, { value });\n};\n\nexport const reduceFlatMap = <T>(out: T[], x: T[]): T[] => {\n out.push(...x);\n return out;\n}\n\n// const reduceFlatMapTest = () => {\n// const items = [['a'], ['b']];\n// const itemsFlat = items.reduce(reduceFlatMap);\n// };\n","import * as M from '@taquito/michel-codec';\nimport { assertExhaustive, GenerateApiError, reduceFlatMap } from './common';\n\nexport type TypedStorage = {\n storage: TypedType;\n};\nexport type TypedParameter = {\n methods: TypedMethod[];\n};\nexport type TypedMethod = {\n name: string;\n args: TypedVar[];\n};\nexport type TypedVar = {\n name?: string;\n type: TypedType;\n};\nexport type TypedType = {\n raw: M.MichelsonType;\n optional?: boolean;\n} & (\n {\n kind: 'unit';\n } | {\n kind: 'never';\n } | {\n kind: 'unknown';\n } | {\n kind: 'value';\n value: string;\n typescriptType: 'string' | 'boolean' | 'number' | 'Date';\n } | {\n kind: 'union';\n union: TypedVar[];\n } | {\n kind: 'object';\n fields: TypedVar[];\n } | {\n kind: 'array';\n array: { item: TypedType };\n } | {\n kind: 'map';\n map: { key: TypedType, value: TypedType, isBigMap: boolean };\n }\n );\n\nconst toDebugSource = (node: M.MichelsonType) => {\n return JSON.stringify(node);\n};\n\nexport const parseContractStorage = (storage: M.MichelsonContractStorage): TypedStorage => {\n const fields = storage.args\n .map(x => visitVar(x))\n .reduce(reduceFlatMap, []);\n\n if(fields.length === 1 && !fields[0].name){\n return {\n storage: fields[0].type\n };\n }\n\n return {\n storage: {\n kind: `object` as const,\n raw: storage as unknown as M.MichelsonType,\n fields,\n },\n };\n};\n\nexport const parseContractParameter = (parameter: M.MichelsonContractParameter): TypedParameter => {\n return {\n methods: parameter.args\n .map(x => visitContractParameterEndpoint(x as MMethod))\n .reduce(reduceFlatMap, []),\n };\n};\n\n\ntype MMethod = M.MichelsonTypeOr<[M.MichelsonType, M.MichelsonType]>;\nconst visitContractParameterEndpoint = (node: MMethod): TypedMethod[] => {\n\n // console.log('visitContractParameterEndpoint', { node });\n\n // Sub endpoints (i.e. admin endpoints that are imported)\n if (node.prim === `or`) {\n return node.args.map(x => visitContractParameterEndpoint(x as MMethod)).reduce(reduceFlatMap, []);\n }\n\n // Sub endpoints as a list with a single or (i.e. admin endpoints that are imported)\n if (node.prim === `list` && node.args.length as number === 1 && (node.args[0] as MMethod)?.prim === `or`) {\n return node.args.map(x => visitContractParameterEndpoint(x as MMethod)).reduce(reduceFlatMap, []);\n }\n\n const nameRaw = node.annots?.[0];\n const name = nameRaw?.startsWith('%') ? nameRaw.substr(1) : null;\n\n if (!name) {\n console.warn(`Unknown method: ${node.prim as string}`, { node, args: node.args });\n return [];\n }\n\n const nodeType = visitType(node, { ignorePairName: node.prim === 'pair' });\n\n // Method args are usually objects\n if (nodeType.kind === 'object') {\n return [{ name, args: nodeType.fields }];\n }\n\n // Simple methods can have a single unnamed argument\n return [{\n name,\n args: [{ type: nodeType }],\n }];\n};\n\n// type PrimOf<T extends M.MichelsonType> = T extends { prim: infer U } ? U : never;\n// type WithPrim<T extends M.MichelsonType, P extends PrimOf<T>> = T extends { prim: P } ? T : never;\n// const isPrimType = <TPrim extends PrimOf<M.MichelsonType>>(node: undefined | null | M.MichelsonType, prim: TPrim): node is WithPrim<M.MichelsonType, TPrim> => {\n// return (node && 'prim' in node && node.prim === prim) || false;\n// };\n\ntype MVarArgs = M.MichelsonType;\nconst visitVar = (node: MVarArgs): TypedVar[] => {\n const name = `annots` in node && node.annots?.length === 1 ? node.annots[0].substr(1) : undefined;\n const type = visitType(node);\n\n return [{\n name,\n type,\n }];\n};\n\ntype MType = M.MichelsonType;\nconst visitType = (node: MType, options?: { ignorePairName?: boolean }): TypedType => {\n // console.log('visitType', { node });\n // const debug_source = toDebugSource(node);\n\n // if (typeof node === `string`) {\n // return { kind: `value`, raw: node, value: node, typescriptType: `string` };\n // }\n\n if (!(`prim` in node)) {\n // Unknown\n console.error(`visitType no prim`, { node });\n return { kind: `unknown`, raw: node };\n }\n\n // Union\n if (node.prim === `or`) {\n const unionVars = node.args.map(x => visitVar(x)).reduce(reduceFlatMap, []).map(x => x);\n\n // Flatten with child unions\n const union = unionVars.map(x => !x.name && x.type.kind === 'union' ? x.type.union : [x]).reduce(reduceFlatMap, []);\n // const union = unionVars.map(x=>x.type);\n\n // const union = unionVars.map(x => x.type);\n\n // Flatten with child unions\n\n // const rightSide = union[1];\n // if (rightSide.kind === `union`) {\n // union.pop();\n // union.push(...rightSide.union);\n // }\n\n if (union.some(x => !x)) {\n throw new GenerateApiError(`or: Some fields are null`, { node });\n }\n return {\n kind: `union`,\n raw: node,\n union,\n };\n }\n\n // Intersect\n if (node.prim === `pair`) {\n const fields = node.args.map(x => visitVar(x)).reduce(reduceFlatMap, []);\n if (fields.some(x => !x)) {\n throw new GenerateApiError(`pair: Some fields are null`, { node, args: node.args, fields });\n }\n // Disabled Check: Apparently pairs can have more than 2 items\n // if (fields.length !== 2) {\n // throw new GenerateApiError(`pair: Expected 2 items`, { node, length: fields.length, fields });\n // }\n\n // Flatten with unnamed child pairs\n const fieldsFlat = fields.map(x => (!x.name || options?.ignorePairName) && x.type.kind === 'object' ? x.type.fields : [x]).reduce(reduceFlatMap, []);\n\n return {\n kind: `object`,\n raw: node,\n fields: fieldsFlat,\n };\n }\n\n // list\n if (node.prim === `list`\n || node.prim === `set`\n ) {\n if (node.args.length !== 1) {\n throw new GenerateApiError(`list does not have 1 arg`, { node, args: node.args });\n }\n\n const arrayItem = visitType(node.args[0]);\n if (!arrayItem) {\n throw new GenerateApiError(`arrayItem are null`, { node, args: node.args, arrayItem });\n }\n return {\n kind: `array`,\n raw: node,\n array: { item: arrayItem },\n };\n }\n\n // map\n if (node.prim === `map`\n || node.prim === `big_map`\n ) {\n if (node.args.length !== 2) {\n throw new GenerateApiError(`map does not have 2 args`, { node, args: node.args });\n }\n\n const mapKey = visitType(node.args[0]);\n const mapValue = visitType(node.args[1]);\n if (!mapKey || !mapValue) {\n throw new GenerateApiError(`map is missing key or value`, { node, args: node.args, mapKey, mapValue });\n }\n return {\n kind: `map`,\n raw: node,\n map: {\n key: mapKey,\n value: mapValue,\n isBigMap: node.prim === `big_map`,\n },\n };\n }\n\n // option\n if (node.prim === `option`) {\n return {\n ...visitType(node.args[0]),\n optional: true,\n };\n }\n\n // boolean\n if (node.prim === `bool`) {\n return {\n kind: `value`,\n raw: node,\n value: node.prim,\n typescriptType: `boolean`,\n };\n }\n\n // numbers\n if (node.prim === `nat`\n || node.prim === `int`\n || node.prim === `mutez`\n ) {\n return {\n kind: `value`,\n raw: node,\n value: node.prim,\n typescriptType: `number`,\n };\n }\n\n // Date\n if (node.prim === `timestamp`\n\n ) {\n return {\n kind: `value`,\n raw: node,\n value: node.prim,\n typescriptType: `Date`,\n };\n }\n\n // strings\n if (node.prim === `address`\n || node.prim === `key`\n || node.prim === `key_hash`\n || node.prim === `chain_id`\n || node.prim === `string`\n || node.prim === `signature`\n || node.prim === `ticket`\n || node.prim === `bls12_381_fr`\n || node.prim === `bls12_381_g1`\n || node.prim === `bls12_381_g2`\n || node.prim === `sapling_state`\n || node.prim === `sapling_transaction`\n || node.prim === `contract`\n ) {\n return {\n kind: `value`,\n raw: node,\n value: node.prim,\n typescriptType: `string`,\n };\n }\n\n\n // void\n if (node.prim === `unit`) {\n return {\n kind: `unit`,\n raw: node,\n };\n }\n\n // bytes?\n if (node.prim === `bytes`) {\n return {\n kind: `value`,\n raw: node,\n value: node.prim,\n typescriptType: `string`,\n };\n }\n\n // misc?\n if (node.prim === `lambda`\n || node.prim === `operation`\n ) {\n return {\n kind: `value`,\n raw: node,\n value: node.prim,\n typescriptType: `string`,\n };\n }\n\n // chest\n if(node.prim === 'chest'){\n throw new Error('Not Implemented: chest');\n }\n if(node.prim === 'chest_key'){\n throw new Error('Not Implemented: chest_key');\n }\n\n // never\n if (node.prim === `never`\n ) {\n return {\n kind: `never`,\n raw: node,\n };\n }\n\n\n // Unknown\n assertExhaustive(node, `Unknown type`);\n throw new GenerateApiError(`Unknown type`, { node });\n};\n","import { GenerateApiError } from './common';\nimport { TypedMethod, TypedVar, TypedType, TypedStorage } from './contract-parser';\n\ntype SchemaObjectType = { [name: string]: SchemaType };\ntype SchemaType = string | SchemaType[] | SchemaObjectType;\ntype SchemaMethods = {\n [name: string]: {\n params: SchemaType;\n };\n};\nexport type SchemaOutput = {\n methods: SchemaMethods;\n storage: SchemaType;\n};\n\nexport const toSchema = (methods: TypedMethod[], storage: TypedStorage): SchemaOutput => {\n\n const getSchemaObjectType = (vars: TypedVar[]) => {\n // console.log('getSchemaObjectType', { vars });\n\n if (vars.some(x => !x)) {\n throw new GenerateApiError(`getSchemaObjectType has null vars`, { vars });\n }\n\n return vars.reduce((out, x, i) => {\n out[x.name ?? i] = getSchemaType(x.type);\n return out;\n }, {} as SchemaObjectType);\n };\n\n const getSchemaType = (t: TypedType): SchemaType => {\n // console.log('getSchemaType', { t });\n\n return (t.kind === `value` && t.value ? t.value : null)\n ?? (t.kind === `array` && t.array ? [getSchemaType(t.array.item)] : null)\n ?? (t.kind === `map` && t.map ? [`map`, getSchemaType(t.map.key), getSchemaType(t.map.value)] : null)\n ?? (t.kind === `object` && t.fields ? getSchemaObjectType(t.fields) : null)\n ?? (t.kind === `unit` ? `unit` : null)\n ?? (t.kind === `never` ? `never` : null)\n ?? `${t.raw as unknown as string}`;\n };\n\n const schemaMethods = methods.reduce((out, x) => {\n // console.log('schemaMethods', { x });\n\n out[x.name] = {\n params: x.args.length === 1 && !x.args[0].name ? getSchemaType(x.args[0].type) : getSchemaObjectType(x.args ?? []),\n };\n return out;\n }, {} as SchemaMethods);\n\n const schemaStorage = getSchemaType(storage.storage);\n\n return {\n methods: schemaMethods,\n storage: schemaStorage,\n };\n};\n","import { assertExhaustive, GenerateApiError, reduceFlatMap } from './common';\nimport { TypedStorage, TypedMethod, TypedType, TypedVar } from './contract-parser';\n\nexport type TypescriptCodeOutput = {\n typesFileContent: string;\n contractCodeFileContent: string;\n storage: string;\n methods: string;\n methodsObject: string;\n};\n\nexport type TypeAliasData = {\n mode: 'local',\n fileContent?: string,\n} | {\n mode: 'file' | 'library',\n importPath?: string,\n} | {\n mode: 'simple',\n};\nexport type TypeUtilsData = {\n importPath: string,\n};\n\nexport const toTypescriptCode = (storage: TypedStorage, methods: TypedMethod[], contractName: string, parsedContract: unknown, protocol: { name: string, key: string }, typeAliasData: TypeAliasData, typeUtilsData: TypeUtilsData): TypescriptCodeOutput => {\n type TypeAlias = { aliasType: string, simpleTypeDefinition: string, simpleTypeImports?: { name: string, isDefault?: boolean, from: string }[] };\n const usedStrictTypes = [] as TypeAlias[];\n const addTypeAlias = (strictType: TypeAlias) => {\n if (!usedStrictTypes.some(x => x.aliasType === strictType.aliasType)) {\n usedStrictTypes.push(strictType);\n }\n };\n\n // Not really tabs :)\n const tabs = (indent: number) => Array(indent).fill(` `).join(``);\n const toIndentedItems = (indent: number, delimeters: { afterItem?: string, beforeItem?: string }, items: string[]) => {\n return `\n${tabs(indent + 1)}${items.join(`${delimeters.afterItem ?? ``}\n${tabs(indent + 1)}${delimeters.beforeItem ?? ``}`)}\n${tabs(indent)}`;\n };\n\n const typeToCode = (t: TypedType, indent: number): string => {\n if (t.kind === `value`) {\n // return `${t.typescriptType}`;\n\n const prim = `prim` in t.raw ? t.raw.prim : `unknown`;\n\n // Strict mode\n if (t.typescriptType === `boolean`\n || t.typescriptType === `string` && prim === `string`\n ) {\n return `${t.typescriptType}`;\n }\n\n if (t.typescriptType === 'number') {\n const simpleBaseType = `string | BigNumber | number`;\n const typeAlias: TypeAlias = { aliasType: prim, simpleTypeDefinition: `type ${prim} = ${simpleBaseType};`, simpleTypeImports: [{ name: 'BigNumber', isDefault: true, from: 'bignumber.js' }] };\n addTypeAlias(typeAlias);\n\n return typeAlias.aliasType;\n }\n\n const simpleBaseType = t.typescriptType === 'Date' ? 'Date | string' : t.typescriptType;\n const typeAlias: TypeAlias = { aliasType: prim, simpleTypeDefinition: `type ${prim} = ${simpleBaseType};` };\n addTypeAlias(typeAlias);\n\n return typeAlias.aliasType;\n }\n if (t.kind === `array`) {\n return `Array<${typeToCode(t.array.item, indent)}>`;\n }\n if (t.kind === `map`) {\n\n const typeAlias: TypeAlias = t.map.isBigMap\n ? { aliasType: `BigMap`, simpleTypeDefinition: 'type BigMap<K, T> = MichelsonMap<K, T>;', simpleTypeImports: [{ name: 'MichelsonMap', from: '@taquito/taquito' }] }\n : { aliasType: `MMap`, simpleTypeDefinition: 'type MMap<K, T> = MichelsonMap<K, T>;', simpleTypeImports: [{ name: 'MichelsonMap', from: '@taquito/taquito' }] };\n addTypeAlias(typeAlias);\n\n return `${typeAlias.aliasType}<${typeToCode(t.map.key, indent)}, ${typeToCode(t.map.value, indent)}>`;\n }\n if (t.kind === `object`) {\n return `{${toIndentedItems(indent, {},\n t.fields.map((a, i) => varToCode(a, i, indent + 1) + `;`),\n )}}`;\n }\n if (t.kind === `union`) {\n\n const getUnionItem = (a: TypedVar, i: number) => {\n const itemCode = `${varToCode(a, i, indent + 1)}`;\n\n // Keep on single line if already on single line\n if (!itemCode.includes(`\\n`)) {\n return `{ ${itemCode} }`;\n }\n\n // Indent if multi-line (and remake with extra indent)\n return `{${toIndentedItems(indent + 1, {}, [`${varToCode(a, i, indent + 2)}`])}}`;\n };\n\n return `(${toIndentedItems(indent, { beforeItem: `| ` },\n t.union.map(getUnionItem),\n )})`;\n }\n if (t.kind === `unit`) {\n const typeAlias: TypeAlias = { aliasType: `unit`, simpleTypeDefinition: `type unit = (true | undefined);`, };\n addTypeAlias(typeAlias);\n return typeAlias.aliasType;\n }\n if (t.kind === `never`) {\n return `never`;\n }\n if (t.kind === `unknown`) {\n return `unknown`;\n }\n\n assertExhaustive(t, `Unknown type`);\n throw new GenerateApiError(`Unknown type node`, { t });\n };\n\n const varToCode = (t: TypedVar, i: number, indent: number, numberVarNamePrefix = ''): string => {\n return `${t.name ?? `${numberVarNamePrefix}${i}`}${t.type.optional ? `?` : ``}: ${typeToCode(t.type, indent)}`;\n };\n\n const argsToCode = (args: TypedVar[], indent: number, asObject: boolean): string => {\n if (args.length === 1) {\n if (args[0].type.kind === `unit`) { return ``; }\n return `${args[0].name ?? `param`}: ${typeToCode(args[0].type, indent + 1)}`;\n }\n\n const result = `${toIndentedItems(indent, {},\n args.filter(x => x.name || x.type.kind !== `unit`).map((a, i) => varToCode(a, i, indent + 1, asObject ? '' : '_') + `,`),\n )}`;\n\n if(asObject){\n return `params: {${result}}`;\n }\n\n return result;\n };\n\n const methodsToCode = (indent: number) => {\n const methodFields = methods.map(x => {\n const methodCode = `${x.name}: (${argsToCode(x.args, indent + 1, false)}) => Promise<void>;`;\n return methodCode;\n });\n\n const methodsTypeCode = `type Methods = {${toIndentedItems(indent, {}, methodFields)}};`;\n return methodsTypeCode;\n };\n const methodsObjectToCode = (indent: number) => {\n const methodFields = methods.map(x => {\n const methodCode = `${x.name}: (${argsToCode(x.args, indent + 1, true)}) => Promise<void>;`;\n return methodCode;\n });\n\n const methodsTypeCode = `type MethodsObject = {${toIndentedItems(indent, {}, methodFields)}};`;\n return methodsTypeCode;\n };\n\n const storageToCode = (indent: number) => {\n const storageTypeCode = `type Storage = ${typeToCode(storage.storage, indent)};`;\n return storageTypeCode;\n };\n\n const methodsCode = methodsToCode(0);\n const methodsObjectCode = methodsObjectToCode(0);\n const storageCode = storageToCode(0);\n\n // Simple type aliases\n const simpleTypeMappingImportsAll = new Map(usedStrictTypes.map(x => x.simpleTypeImports ?? []).reduce(reduceFlatMap, []).map(x => [`${x?.from}:${x?.name}:${x?.isDefault}`, x]));\n const simpleTypeMappingImportsFrom = [...simpleTypeMappingImportsAll.values()].reduce((out, x) => {\n const entry = out[x.from] ?? (out[x.from] = { names: [] });\n if (x.isDefault) {\n entry.default = x.name;\n } else {\n entry.names.push(x.name);\n }\n entry.names.sort((a, b) => a.localeCompare(b));\n return out;\n }, {} as { [from: string]: { names: string[], default?: string } });\n\n const simpleTypeMappingImportsText = Object.keys(simpleTypeMappingImportsFrom)\n .map(k => {\n const entry = simpleTypeMappingImportsFrom[k];\n const items = [entry.default, entry.names.length ? `{ ${entry.names.join(', ')} }` : ''].filter(x => x);\n return `import ${items.join(', ')} from '${k}';\\n`;\n })\n .join('');\n\n const simpleTypeMapping = usedStrictTypes\n .sort((a, b) => a.aliasType.localeCompare(b.aliasType))\n .map(x => x.simpleTypeDefinition).join(`\\n`);\n\n const typeUtilsDefinitions =\n `import { ContractAbstractionFromContractType, WalletContractAbstractionFromContractType } from '${typeUtilsData.importPath}';`;\n\n const typeAliasesDefinitions =\n typeAliasData.mode === 'simple' ? `${simpleTypeMappingImportsText}${simpleTypeMapping}`\n : typeAliasData.mode === 'local' ? typeAliasData.fileContent\n : `import { ${usedStrictTypes.map(x => x.aliasType).join(`, `)} } from '${typeAliasData.importPath}';`;\n\n const contractTypeName = `${contractName}ContractType`;\n const walletTypeName = `${contractName}WalletType`;\n const codeName = `${contractName}Code`;\n\n const typesFileContent = `\n${typeUtilsDefinitions}\n${typeAliasesDefinitions}\n\n${storageCode}\n\n${methodsCode}\n\n${methodsObjectCode}\n\ntype contractTypes = { methods: Methods, methodsObject: MethodsObject, storage: Storage, code: { __type: '${codeName}', protocol: string, code: object[] } };\nexport type ${contractTypeName} = ContractAbstractionFromContractType<contractTypes>;\nexport type ${walletTypeName} = WalletContractAbstractionFromContractType<contractTypes>;\n`;\n\n const contractCodeFileContent = `\nexport const ${codeName}: { __type: '${codeName}', protocol: string, code: object[] } = {\n __type: '${codeName}',\n protocol: '${protocol.key}',\n code: JSON.parse(\\`${JSON.stringify(parsedContract)}\\`)\n};\n`;\n return {\n typesFileContent,\n contractCodeFileContent,\n storage: storageCode,\n methods: methodsCode,\n methodsObject: methodsObjectCode,\n };\n\n};\n\n\n","// This is required for copying the type aliases to a local file\nexport const typeAliasesFileContent = `\nimport { BigNumber } from 'bignumber.js';\nimport { MichelsonMap } from '@taquito/taquito';\n\nexport type unit = (true | undefined) & { __type: 'unit' };\n\nexport type address = string & { __type: 'address' };\nexport type bytes = string & { __type: 'bytes' };\nexport type contract = string & { __type: 'contract' };\nexport type operation = string & { __type: 'operation' };\nexport type key = string & { __type: 'key' };\nexport type key_hash = string & { __type: 'key_hash' };\nexport type signature = string & { __type: 'signature' };\nexport type ticket = string & { __type: 'ticket' };\n\nexport type timestamp = string & { __type: 'timestamp' };\n\nexport type int = BigNumber & { __type: 'int' };\nexport type nat = BigNumber & { __type: 'nat' };\n\nexport type mutez = BigNumber & { __type: 'mutez' };\nexport type tez = BigNumber & { __type: 'tez' };\n\ntype MapKey = Array<any> | object | string | boolean | number;\nexport type MMap<K extends MapKey, V> = Omit<MichelsonMap<K, V>, 'get'> & { get: (key: K) => V };\nexport type BigMap<K extends MapKey, V> = Omit<MichelsonMap<K, V>, 'get'> & { get: (key: K) => Promise<V> };\n\n\nconst createStringTypeTas = <T extends string>() => {\n return (value: string): T => value as T;\n};\n\nconst createBigNumberTypeTas = <T extends BigNumber>() => {\n return (value: number | BigNumber | string): T => new BigNumber(value) as T;\n};\n\ntype asMapParamOf<K, V> = K extends string ? { [key: string]: V } | Array<{ key: K, value: V }>\n : K extends number ? { [key: number]: V } | Array<{ key: K, value: V }>\n : Array<{ key: K, value: V }>;\n\nfunction asMap<K extends MapKey, V>(value: asMapParamOf<K, V>): MMap<K, V> {\n const m = new MichelsonMap<K, V>();\n if (Array.isArray(value)) {\n const vArray = value as Array<{ key: K, value: V }>;\n vArray.forEach(x => m.set(x.key, x.value));\n } else {\n const vObject = value as { [key: string]: V };\n Object.keys(vObject).forEach(key => m.set(key as unknown as K, vObject[key]));\n }\n return m as MMap<K, V>;\n}\nconst asBigMap = <K extends MapKey, V>(value: asMapParamOf<K, V>) => asMap(value) as unknown as BigMap<K, V>;\n\nfunction add<T extends BigNumber>(a: T, b: T): T {\n return a.plus(b) as T;\n}\nfunction subtract<T extends BigNumber>(a: T, b: T): T {\n return a.minus(b) as T;\n}\n\n/** tas: Tezos 'as' casting for strict types */\nexport const tas = {\n address: createStringTypeTas<address>(),\n bytes: createStringTypeTas<bytes>(),\n contract: createStringTypeTas<contract>(),\n timestamp: (value: string | Date): timestamp => new Date(value).toISOString() as timestamp,\n\n int: createBigNumberTypeTas<int>(),\n nat: createBigNumberTypeTas<nat>(),\n mutez: createBigNumberTypeTas<mutez>(),\n tez: createBigNumberTypeTas<tez>(),\n\n map: asMap,\n bigMap: asBigMap,\n\n // Operations\n add,\n subtract,\n\n // To number\n number: (value: string | BigNumber) => Number(value + ''),\n};\n`;","// This is required for copying the type utils to a local file\nexport const typeUtilsFileContent = `\nimport { ContractAbstraction, ContractMethod, ContractMethodObject, ContractProvider, Wallet } from '@taquito/taquito';\n\ntype BaseContractType = { methods: unknown, methodsObject: unknown, storage: unknown };\n\ntype ContractMethodsOf<T extends ContractProvider | Wallet, TContract extends BaseContractType> = {\n[M in keyof TContract['methods']]:\nTContract['methods'][M] extends (...args: infer A) => unknown\n? (...args: A) => ContractMethod<T>\n: never\n};\ntype ContractMethodsObjectsOf<T extends ContractProvider | Wallet, TContract extends BaseContractType> = {\n[M in keyof TContract['methodsObject']]:\nTContract['methodsObject'][M] extends (...args: infer A) => unknown\n? (...args: A) => ContractMethodObject<T>\n: never\n};\ntype ContractStorageOf<TContract extends BaseContractType> = TContract['storage'];\n\nexport type ContractAbstractionFromContractType<TContract extends BaseContractType> = \n ContractAbstraction<ContractProvider, \n ContractMethodsOf<ContractProvider, TContract>,\n ContractMethodsObjectsOf<ContractProvider, TContract>,\n {},\n {},\n ContractStorageOf<TContract>\n >;\n\nexport type WalletContractAbstractionFromContractType<TContract extends BaseContractType> = \n ContractAbstraction<Wallet, \n ContractMethodsOf<Wallet, TContract>,\n ContractMethodsObjectsOf<Wallet, TContract>,\n {},\n {},\n ContractStorageOf<TContract>\n >;\n`;"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../"}
1
+ {"mappings":";;;;;;;;;;AAAA;ACAA;;ACAA;;;ACAO,MAAM,yCAAqB,GAAG,CAAC,IAAY,GAAK,IAAI,CACtD,OAAO,kBAAkB,GAAG,CAAC,CAC7B,KAAK,CAAC,GAAG,CAAC,CACV,MAAM,CAAC,CAAA,CAAC,GAAI,CAAC;IAAA,CAAC,CACd,GAAG,CAAC,CAAA,CAAC,GAAI,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC;IAAA,CAAC,CAC7C,IAAI,CAAC,EAAE,CAAC;AAAC;;;ACLd;ACCO,MAAM,yCAAgB;IAEzB,YAAmB,OAAe,EAAW,IAAa,CAAE;aAAzC,OAAe,GAAf,OAAe;aAAW,IAAa,GAAb,IAAa;aAD1D,IAAI,GAAG,CAAC,gBAAgB,CAAC;QAErB,OAAO,CAAC,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C,IAAU,GAAM,CAAA;QAC3B,KAAK,EAAE,gBAAgB;QACvB,MAAM,EAAE,KAAK;QACb,OAAO,EAAE,KAAK;QACd,KAAK,EAAE;YACH,2BAAI,CAAC,MAAM,CAAC;gBACR,IAAI,EAAE,gBAAgB;gBACtB,OAAO,EAAE,gCAAgC;gBACzC,WAAW,EAAE,uDAAuD;gBACpE,WAAW,EAAE;oBACT,oCAAa,CAAC,MAAM,CAAC;wBACjB,WAAW,EAAE,eAAe;wBAC5B,WAAW,EAAE,mDAAmD;wBAChE,YAAY,EAAE,OAAO;qBACxB,CAAC;iBACL;gBACD,OAAO,EAAE;oBACL,6BAAM,CAAC,MAAM,CAAC;wBACV,SAAS,EAAE,GAAG;wBACd,IAAI,EAAE,eAAe;wBACrB,OAAO,EAAE;4BAAC,MAAM;4BAAE,QAAQ;yBAAC;wBAC3B,WAAW,EAAE,8CAA8C;qBAC9D,CAAC;iBACL;gBACD,OAAO,EAAE;oBAAC,WAAW;oBAAE,UAAU;iBAAC;gBAClC,OAAO,EAAE,OAAO;aACnB,CAAC;SACL;QACD,KAAK,EAAE,yCAAK,CAAC,aAAa;KAC7B,CAAA;AAAC,EAAE,OAAO,CAAC,IAAI,CAAC","sources":["taqueria-plugin-contract-types/index.ts","taqueria-plugin-contract-types/tasks.ts","taqueria-plugin-contract-types/src/cli-process.ts","taqueria-plugin-contract-types/src/generator/contract-name.ts","taqueria-plugin-contract-types/src/generator/process.ts","taqueria-plugin-contract-types/src/generator/common.ts","taqueria-plugin-contract-types/src/generator/contract-parser.ts","taqueria-plugin-contract-types/src/generator/schema-output.ts","taqueria-plugin-contract-types/src/generator/typescript-output.ts","taqueria-plugin-contract-types/src/type-aliases-file-content.ts","taqueria-plugin-contract-types/src/type-utils-file-content.ts"],"sourcesContent":["import {Plugin, Task, Option, PositionalArg} from '@taqueria/node-sdk'\nimport type { i18n} from '@taqueria/node-sdk/types'\nimport {tasks} from './tasks'\n\nPlugin.create((i18n: i18n) => ({\n alias: \"contract-types\",\n schema: \"1.0\",\n version: \"0.1\",\n tasks: [\n Task.create({\n task: \"generate types\",\n command: \"generate types [typescriptDir]\",\n description: \"Generate types for a contract to be used with taquito\",\n positionals: [\n PositionalArg.create({\n placeholder: \"typescriptDir\",\n description: \"The output directory for the generated type files\",\n defaultValue: \"types\",\n })\n ],\n options: [\n Option.create({\n shortFlag: \"t\",\n flag: \"typeAliasMode\",\n choices: ['file', 'simple'],\n description: \"The type aliases used in the generated types\"\n }),\n ],\n aliases: [\"gen types\", \"gentypes\"],\n handler: \"proxy\"\n }),\n ],\n proxy: tasks.generateTypes,\n}), process.argv)","import { SanitizedArgs, PluginResponse, Failure, LikeAPromise } from \"@taqueria/node-sdk/types\";\nimport glob from 'fast-glob'\nimport { join } from 'path'\nimport { generateContractTypesProcessContractFiles } from \"./src/cli-process\";\n\ntype PluginOpts = {\n // TODO: Document these\n typescriptDir: string,\n typeAliasMode?: 'local' | 'file' | 'library' | 'simple',\n};\ntype Opts = SanitizedArgs & Record<string, unknown>;\n\nconst getContractAbspath = (contractFilename: string, parsedArgs: Opts) => \n join(parsedArgs.artifactsDir, /\\.tz$/.test(contractFilename) ? contractFilename : `${contractFilename}.tz`)\n\n\nconst generateContractTypes = (parsedArgs: Opts & PluginOpts) => async (contractFilename: string) : Promise<string> => {\n const contractAbspath = getContractAbspath(contractFilename, parsedArgs);\n await generateContractTypesProcessContractFiles({\n inputTzContractDirectory: parsedArgs.artifactsDir,\n inputFiles: [contractAbspath],\n outputTypescriptDirectory: parsedArgs.typescriptDir,\n format: 'tz',\n typeAliasMode: parsedArgs.typeAliasMode ?? 'file',\n });\n\n return `${contractFilename}: Types generated`;\n}\n\nconst generateContractTypesAll = async (parsedArgs: Opts & PluginOpts) : Promise<string[]> => {\n const files = await glob(\"**/*.tz\", {cwd: parsedArgs.artifactsDir});\n return await Promise.all(files.map(generateContractTypes(parsedArgs)));\n}\n\nexport const generateTypes = <T>(parsedArgs: Opts): LikeAPromise<PluginResponse, Failure<T>> => {\n parsedArgs.typescriptDir = parsedArgs.typescriptDir || 'types';\n\n console.log('generateTypes', { \n typescriptDir: parsedArgs.typescriptDir\n });\n\n const argsTyped = parsedArgs as Opts & PluginOpts;\n\n const p = argsTyped.contract\n ? generateContractTypes(argsTyped) (argsTyped.contract as string)\n : generateContractTypesAll(argsTyped)\n\n return p.then(data => {\n console.log(\n (Array.isArray(data))\n ? data.join(\"\\n\")\n : data\n )\n })\n}\n\nexport const tasks = {\n generateTypes,\n} ","import fsRaw from 'fs';\nimport path from 'path';\nimport { promisify } from 'util';\nimport { normalizeContractName } from './generator/contract-name';\nimport { generateContractTypesFromMichelsonCode } from './generator/process';\nimport { TypeAliasData, TypeUtilsData } from './generator/typescript-output';\nimport { typeAliasesFileContent } from './type-aliases-file-content';\nimport { typeUtilsFileContent } from './type-utils-file-content';\n\nconst fs = {\n mkdir: promisify(fsRaw.mkdir),\n copyFile: promisify(fsRaw.copyFile),\n readdir: promisify(fsRaw.readdir),\n readFile: promisify(fsRaw.readFile),\n writeFile: promisify(fsRaw.writeFile),\n stat: promisify(fsRaw.stat),\n exists: fsRaw.existsSync,\n};\n\nconst getAllFiles = async (rootPath: string, filter: (fullPath: string) => boolean): Promise<string[]> => {\n const allFiles = [] as string[];\n\n const getAllFilesRecursive = async (dirPath: string) => {\n let files = await fs.readdir(dirPath, { withFileTypes: true });\n\n for (const f of files) {\n const subPath = path.resolve(dirPath, f.name);\n\n if (f.isDirectory()) {\n await getAllFilesRecursive(subPath);\n continue;\n }\n\n if (!filter(subPath)) {\n continue;\n }\n\n allFiles.push(subPath);\n }\n }\n\n await getAllFilesRecursive(rootPath);\n return allFiles;\n}\n\nexport const generateContractTypesProcessContractFiles = async ({\n inputTzContractDirectory,\n inputFiles,\n outputTypescriptDirectory,\n format,\n typeAliasMode,\n}: {\n inputTzContractDirectory: string;\n inputFiles?: string[];\n outputTypescriptDirectory: string;\n format: 'tz' | 'json',\n typeAliasMode: 'local' | 'file' | 'library' | 'simple',\n}): Promise<void> => {\n\n console.log(`Generating Types: ${path.resolve(inputTzContractDirectory)} => ${path.resolve(outputTypescriptDirectory)}`);\n\n const ext = '.' + format;\n const filesAll = await getAllFiles(inputTzContractDirectory, x => x.endsWith(ext));\n const files = inputFiles ? filesAll.filter(f => inputFiles.some(inputFile => f.endsWith(inputFile))) : filesAll;\n\n console.log(`Contracts Found: ${[``, ...files].join(`\\n\\t- `)}`);\n\n const typeAliasImportPath = `@taquito/contract-type-generator`;\n\n const typeAliasData: TypeAliasData = typeAliasMode === 'local' ? { mode: typeAliasMode, fileContent: typeAliasesFileContent }\n : typeAliasMode === 'file' ? { mode: typeAliasMode, importPath: `./type-aliases` }\n : typeAliasMode === 'library' ? { mode: typeAliasMode, importPath: typeAliasImportPath }\n : { mode: 'simple' };\n\n if (typeAliasMode === 'file') {\n // Copy the type alias file\n await fs.mkdir(outputTypescriptDirectory, { recursive: true });\n await fs.writeFile(path.join(outputTypescriptDirectory, './type-aliases.ts'), typeAliasesFileContent);\n }\n\n // Copy the type utils file\n const typeUtilsData: TypeUtilsData = { importPath: `./type-utils` };\n await fs.mkdir(outputTypescriptDirectory, { recursive: true });\n await fs.writeFile(path.join(outputTypescriptDirectory, './type-utils.ts'), typeUtilsFileContent);\n\n for (const fullPath of files) {\n const fileRelativePath = fullPath.replace(path.resolve(inputTzContractDirectory), '');\n const fileName = fileRelativePath.replace(ext, '');\n const inputFilePath = path.join(inputTzContractDirectory, fileRelativePath);\n const typesOutputFilePath = path.join(outputTypescriptDirectory, fileRelativePath.replace(ext, `.types.ts`));\n const codeContentOutputFilePath = path.join(outputTypescriptDirectory, fileRelativePath.replace(ext, `.code.ts`));\n const schemaContentOutputFilePath = path.join(outputTypescriptDirectory, fileRelativePath.replace(ext, `.schema.json`));\n console.log(`Processing ${fileRelativePath}...`);\n\n try {\n const contractTypeName = normalizeContractName(fileName);\n\n const michelsonCode = await fs.readFile(inputFilePath, { encoding: `utf8` });\n\n const {\n schemaOutput,\n typescriptCodeOutput: { typesFileContent, contractCodeFileContent }\n } = generateContractTypesFromMichelsonCode(michelsonCode, contractTypeName, format, typeAliasData, typeUtilsData);\n\n // Write output (ensure dir exists)\n await fs.mkdir(path.dirname(typesOutputFilePath), { recursive: true });\n await fs.writeFile(typesOutputFilePath, typesFileContent);\n await fs.writeFile(codeContentOutputFilePath, contractCodeFileContent);\n\n const debugSchema = false;\n if(debugSchema){\n await fs.writeFile(schemaContentOutputFilePath, JSON.stringify(schemaOutput, null, 2));\n }\n } catch (err: unknown) {\n console.error(`❌ Could not process ${fileRelativePath}`, { err });\n }\n }\n};","export const normalizeContractName = (text: string) => text\n .replace(/[^A-Za-z0-9]/g, '_')\n .split(\"_\")\n .filter(x => x)\n .map(x => x[0].toUpperCase() + x.substring(1))\n .join('');\n","import * as M from '@taquito/michel-codec';\nimport { GenerateApiError } from './common';\nimport { parseContractStorage, parseContractParameter } from './contract-parser';\nimport { SchemaOutput, toSchema } from './schema-output';\nimport { TypescriptCodeOutput, toTypescriptCode, TypeAliasData, TypeUtilsData } from './typescript-output';\n\nconst parseContractWithMinimalProtocolLevel = (contractScript: string, format: 'tz' | 'json', contractLevelIndex: number): { contract: M.MichelsonContract, protocol: { name: string, key: string } } => {\n const contractLevels = [\n { name: 'PsDELPH1', key: M.Protocol.PsDELPH1 },\n { name: 'PtEdo2Zk', key: M.Protocol.PtEdo2Zk },\n { name: 'PsFLorena', key: M.Protocol.PsFLorena },\n ];\n\n const protocol = contractLevels[contractLevelIndex];\n if (!protocol) {\n throw new GenerateApiError(`Could not parse contract script`, contractScript);\n }\n\n const p = new M.Parser({ protocol: protocol.key });\n\n try {\n const contract = (format === 'tz' ? p.parseScript(contractScript) : p.parseJSON(JSON.parse(contractScript))) as M.MichelsonContract;\n if (contract) {\n return {\n contract,\n protocol,\n };\n }\n } catch {\n // Ignore parse errors\n }\n\n // Try again with next level\n return parseContractWithMinimalProtocolLevel(contractScript, format, contractLevelIndex + 1);\n};\n\nexport const generateContractTypesFromMichelsonCode = (contractScript: string, contractName: string, format: 'tz' | 'json', typeAliasData: TypeAliasData, typeUtilsData: TypeUtilsData): {\n schemaOutput: SchemaOutput;\n typescriptCodeOutput: TypescriptCodeOutput;\n parsedContract: M.MichelsonContract;\n minimalProtocol: string;\n} => {\n\n const p = new M.Parser({ protocol: M.Protocol.PsFLorena });\n\n const { contract, protocol } = parseContractWithMinimalProtocolLevel(contractScript, format, 0);\n\n const contractStorage = contract.find(x => x.prim === `storage`) as undefined | M.MichelsonContractStorage;\n const contractParameter = contract.find(x => x.prim === `parameter`) as undefined | M.MichelsonContractParameter;\n\n const storageResult = contractStorage && parseContractStorage(contractStorage);\n const storage = storageResult ?? { storage: { kind: `object`, raw: { prim: `never` } as M.MichelsonType, fields: [] } };\n\n const parameterResult = contractParameter && parseContractParameter(contractParameter);\n const methods = parameterResult?.methods ?? [];\n\n // If there's only one entrypoint, then we call it \"default\"\n if (methods.length === 1) methods[0].name = `default`\n\n const schemaOutput = toSchema(methods, storage);\n\n const typescriptCode = toTypescriptCode(storage, methods, contractName, contract, protocol, typeAliasData, typeUtilsData);\n\n return {\n schemaOutput,\n typescriptCodeOutput: typescriptCode,\n parsedContract: contract,\n minimalProtocol: protocol.key,\n };\n};\n","\nexport class GenerateApiError implements Error {\n name = `GenerateApiError`;\n constructor(public message: string, readonly data: unknown) {\n console.error(`❌ GenerateApiError: ${message}`, data);\n }\n}\n\nexport const assertExhaustive = (value: never, message: string): void => {\n console.error(message, { value });\n};\n\nexport const reduceFlatMap = <T>(out: T[], x: T[]): T[] => {\n out.push(...x);\n return out;\n}\n\n// const reduceFlatMapTest = () => {\n// const items = [['a'], ['b']];\n// const itemsFlat = items.reduce(reduceFlatMap);\n// };\n","import * as M from '@taquito/michel-codec';\nimport { assertExhaustive, GenerateApiError, reduceFlatMap } from './common';\n\nexport type TypedStorage = {\n storage: TypedType;\n};\nexport type TypedParameter = {\n methods: TypedMethod[];\n};\nexport type TypedMethod = {\n name: string;\n args: TypedVar[];\n};\nexport type TypedVar = {\n name?: string;\n type: TypedType;\n};\nexport type TypedType = {\n raw: M.MichelsonType;\n optional?: boolean;\n} & (\n {\n kind: 'unit';\n } | {\n kind: 'never';\n } | {\n kind: 'unknown';\n } | {\n kind: 'value';\n value: string;\n typescriptType: 'string' | 'boolean' | 'number' | 'Date';\n } | {\n kind: 'union';\n union: TypedVar[];\n } | {\n kind: 'object';\n fields: TypedVar[];\n } | {\n kind: 'array';\n array: { item: TypedType };\n } | {\n kind: 'map';\n map: { key: TypedType, value: TypedType, isBigMap: boolean };\n }\n );\n\nconst toDebugSource = (node: M.MichelsonType) => {\n return JSON.stringify(node);\n};\n\nexport const parseContractStorage = (storage: M.MichelsonContractStorage): TypedStorage => {\n const fields = storage.args\n .map(x => visitVar(x))\n .reduce(reduceFlatMap, []);\n\n if(fields.length === 1 && !fields[0].name){\n return {\n storage: fields[0].type\n };\n }\n\n return {\n storage: {\n kind: `object` as const,\n raw: storage as unknown as M.MichelsonType,\n fields,\n },\n };\n};\n\nexport const parseContractParameter = (parameter: M.MichelsonContractParameter): TypedParameter => {\n return {\n methods: parameter.args\n .map(x => visitContractParameterEndpoint(x as MMethod))\n .reduce(reduceFlatMap, []),\n };\n};\n\n\ntype MMethod = M.MichelsonTypeOr<[M.MichelsonType, M.MichelsonType]>;\nconst visitContractParameterEndpoint = (node: MMethod): TypedMethod[] => {\n\n // console.log('visitContractParameterEndpoint', { node });\n\n // Sub endpoints (i.e. admin endpoints that are imported)\n if (node.prim === `or`) {\n return node.args.map(x => visitContractParameterEndpoint(x as MMethod)).reduce(reduceFlatMap, []);\n }\n\n // Sub endpoints as a list with a single or (i.e. admin endpoints that are imported)\n if (node.prim === `list` && node.args.length as number === 1 && (node.args[0] as MMethod)?.prim === `or`) {\n return node.args.map(x => visitContractParameterEndpoint(x as MMethod)).reduce(reduceFlatMap, []);\n }\n\n const nameRaw = node.annots?.[0];\n const name = nameRaw?.startsWith('%') ? nameRaw.substr(1) : null;\n\n if (!name) {\n console.warn(`Unknown method: ${node.prim as string}`, { node, args: node.args });\n return [];\n }\n\n const nodeType = visitType(node, { ignorePairName: node.prim === 'pair' });\n\n // Method args are usually objects\n if (nodeType.kind === 'object') {\n return [{ name, args: nodeType.fields }];\n }\n\n // Simple methods can have a single unnamed argument\n return [{\n name,\n args: [{ type: nodeType }],\n }];\n};\n\n// type PrimOf<T extends M.MichelsonType> = T extends { prim: infer U } ? U : never;\n// type WithPrim<T extends M.MichelsonType, P extends PrimOf<T>> = T extends { prim: P } ? T : never;\n// const isPrimType = <TPrim extends PrimOf<M.MichelsonType>>(node: undefined | null | M.MichelsonType, prim: TPrim): node is WithPrim<M.MichelsonType, TPrim> => {\n// return (node && 'prim' in node && node.prim === prim) || false;\n// };\n\ntype MVarArgs = M.MichelsonType;\nconst visitVar = (node: MVarArgs): TypedVar[] => {\n const name = `annots` in node && node.annots?.length === 1 ? node.annots[0].substr(1) : undefined;\n const type = visitType(node);\n\n return [{\n name,\n type,\n }];\n};\n\ntype MType = M.MichelsonType;\nconst visitType = (node: MType, options?: { ignorePairName?: boolean }): TypedType => {\n // console.log('visitType', { node });\n // const debug_source = toDebugSource(node);\n\n // if (typeof node === `string`) {\n // return { kind: `value`, raw: node, value: node, typescriptType: `string` };\n // }\n\n if (!(`prim` in node)) {\n // Unknown\n console.error(`visitType no prim`, { node });\n return { kind: `unknown`, raw: node };\n }\n\n // Union\n if (node.prim === `or`) {\n const unionVars = node.args.map(x => visitVar(x)).reduce(reduceFlatMap, []).map(x => x);\n\n // Flatten with child unions\n const union = unionVars.map(x => !x.name && x.type.kind === 'union' ? x.type.union : [x]).reduce(reduceFlatMap, []);\n // const union = unionVars.map(x=>x.type);\n\n // const union = unionVars.map(x => x.type);\n\n // Flatten with child unions\n\n // const rightSide = union[1];\n // if (rightSide.kind === `union`) {\n // union.pop();\n // union.push(...rightSide.union);\n // }\n\n if (union.some(x => !x)) {\n throw new GenerateApiError(`or: Some fields are null`, { node });\n }\n return {\n kind: `union`,\n raw: node,\n union,\n };\n }\n\n // Intersect\n if (node.prim === `pair`) {\n const fields = node.args.map(x => visitVar(x)).reduce(reduceFlatMap, []);\n if (fields.some(x => !x)) {\n throw new GenerateApiError(`pair: Some fields are null`, { node, args: node.args, fields });\n }\n // Disabled Check: Apparently pairs can have more than 2 items\n // if (fields.length !== 2) {\n // throw new GenerateApiError(`pair: Expected 2 items`, { node, length: fields.length, fields });\n // }\n\n // Flatten with unnamed child pairs\n const fieldsFlat = fields.map(x => (!x.name || options?.ignorePairName) && x.type.kind === 'object' ? x.type.fields : [x]).reduce(reduceFlatMap, []);\n\n return {\n kind: `object`,\n raw: node,\n fields: fieldsFlat,\n };\n }\n\n // list\n if (node.prim === `list`\n || node.prim === `set`\n ) {\n if (node.args.length !== 1) {\n throw new GenerateApiError(`list does not have 1 arg`, { node, args: node.args });\n }\n\n const arrayItem = visitType(node.args[0]);\n if (!arrayItem) {\n throw new GenerateApiError(`arrayItem are null`, { node, args: node.args, arrayItem });\n }\n return {\n kind: `array`,\n raw: node,\n array: { item: arrayItem },\n };\n }\n\n // map\n if (node.prim === `map`\n || node.prim === `big_map`\n ) {\n if (node.args.length !== 2) {\n throw new GenerateApiError(`map does not have 2 args`, { node, args: node.args });\n }\n\n const mapKey = visitType(node.args[0]);\n const mapValue = visitType(node.args[1]);\n if (!mapKey || !mapValue) {\n throw new GenerateApiError(`map is missing key or value`, { node, args: node.args, mapKey, mapValue });\n }\n return {\n kind: `map`,\n raw: node,\n map: {\n key: mapKey,\n value: mapValue,\n isBigMap: node.prim === `big_map`,\n },\n };\n }\n\n // option\n if (node.prim === `option`) {\n return {\n ...visitType(node.args[0]),\n optional: true,\n };\n }\n\n // boolean\n if (node.prim === `bool`) {\n return {\n kind: `value`,\n raw: node,\n value: node.prim,\n typescriptType: `boolean`,\n };\n }\n\n // numbers\n if (node.prim === `nat`\n || node.prim === `int`\n || node.prim === `mutez`\n ) {\n return {\n kind: `value`,\n raw: node,\n value: node.prim,\n typescriptType: `number`,\n };\n }\n\n // Date\n if (node.prim === `timestamp`\n\n ) {\n return {\n kind: `value`,\n raw: node,\n value: node.prim,\n typescriptType: `Date`,\n };\n }\n\n // strings\n if (node.prim === `address`\n || node.prim === `key`\n || node.prim === `key_hash`\n || node.prim === `chain_id`\n || node.prim === `string`\n || node.prim === `signature`\n || node.prim === `ticket`\n || node.prim === `bls12_381_fr`\n || node.prim === `bls12_381_g1`\n || node.prim === `bls12_381_g2`\n || node.prim === `sapling_state`\n || node.prim === `sapling_transaction`\n || node.prim === `contract`\n ) {\n return {\n kind: `value`,\n raw: node,\n value: node.prim,\n typescriptType: `string`,\n };\n }\n\n\n // void\n if (node.prim === `unit`) {\n return {\n kind: `unit`,\n raw: node,\n };\n }\n\n // bytes?\n if (node.prim === `bytes`) {\n return {\n kind: `value`,\n raw: node,\n value: node.prim,\n typescriptType: `string`,\n };\n }\n\n // misc?\n if (node.prim === `lambda`\n || node.prim === `operation`\n ) {\n return {\n kind: `value`,\n raw: node,\n value: node.prim,\n typescriptType: `string`,\n };\n }\n\n // chest\n if (node.prim === 'chest' || node.prim === 'chest_key') {\n return {\n kind: `value`,\n raw: node,\n value: node.prim,\n typescriptType: `string`,\n };\n }\n\n // never\n if (node.prim === `never`\n ) {\n return {\n kind: `never`,\n raw: node,\n };\n }\n\n\n // Unknown\n assertExhaustive(node, `Unknown type`);\n throw new GenerateApiError(`Unknown type`, { node });\n};\n","import { GenerateApiError } from './common';\nimport { TypedMethod, TypedVar, TypedType, TypedStorage } from './contract-parser';\n\ntype SchemaObjectType = { [name: string]: SchemaType };\ntype SchemaType = string | SchemaType[] | SchemaObjectType;\ntype SchemaMethods = {\n [name: string]: {\n params: SchemaType;\n };\n};\nexport type SchemaOutput = {\n methods: SchemaMethods;\n storage: SchemaType;\n};\n\nexport const toSchema = (methods: TypedMethod[], storage: TypedStorage): SchemaOutput => {\n\n const getSchemaObjectType = (vars: TypedVar[]) => {\n // console.log('getSchemaObjectType', { vars });\n\n if (vars.some(x => !x)) {\n throw new GenerateApiError(`getSchemaObjectType has null vars`, { vars });\n }\n\n return vars.reduce((out, x, i) => {\n out[x.name ?? i] = getSchemaType(x.type);\n return out;\n }, {} as SchemaObjectType);\n };\n\n const getSchemaType = (t: TypedType): SchemaType => {\n // console.log('getSchemaType', { t });\n\n return (t.kind === `value` && t.value ? t.value : null)\n ?? (t.kind === `array` && t.array ? [getSchemaType(t.array.item)] : null)\n ?? (t.kind === `map` && t.map ? [`map`, getSchemaType(t.map.key), getSchemaType(t.map.value)] : null)\n ?? (t.kind === `object` && t.fields ? getSchemaObjectType(t.fields) : null)\n ?? (t.kind === `unit` ? `unit` : null)\n ?? (t.kind === `never` ? `never` : null)\n ?? `${t.raw as unknown as string}`;\n };\n\n const schemaMethods = methods.reduce((out, x) => {\n // console.log('schemaMethods', { x });\n\n out[x.name] = {\n params: x.args.length === 1 && !x.args[0].name ? getSchemaType(x.args[0].type) : getSchemaObjectType(x.args ?? []),\n };\n return out;\n }, {} as SchemaMethods);\n\n const schemaStorage = getSchemaType(storage.storage);\n\n return {\n methods: schemaMethods,\n storage: schemaStorage,\n };\n};\n","import { assertExhaustive, GenerateApiError, reduceFlatMap } from './common';\nimport { TypedStorage, TypedMethod, TypedType, TypedVar } from './contract-parser';\n\nexport type TypescriptCodeOutput = {\n typesFileContent: string;\n contractCodeFileContent: string;\n storage: string;\n methods: string;\n methodsObject: string;\n};\n\nexport type TypeAliasData = {\n mode: 'local',\n fileContent?: string,\n} | {\n mode: 'file' | 'library',\n importPath?: string,\n} | {\n mode: 'simple',\n};\nexport type TypeUtilsData = {\n importPath: string,\n};\n\nexport const toTypescriptCode = (storage: TypedStorage, methods: TypedMethod[], contractName: string, parsedContract: unknown, protocol: { name: string, key: string }, typeAliasData: TypeAliasData, typeUtilsData: TypeUtilsData): TypescriptCodeOutput => {\n type TypeAlias = { aliasType: string, simpleTypeDefinition: string, simpleTypeImports?: { name: string, isDefault?: boolean, from: string }[] };\n const usedStrictTypes = [] as TypeAlias[];\n const addTypeAlias = (strictType: TypeAlias) => {\n if (!usedStrictTypes.some(x => x.aliasType === strictType.aliasType)) {\n usedStrictTypes.push(strictType);\n }\n };\n\n // Not really tabs :)\n const tabs = (indent: number) => Array(indent).fill(` `).join(``);\n const toIndentedItems = (indent: number, delimeters: { afterItem?: string, beforeItem?: string }, items: string[]) => {\n return `\n${tabs(indent + 1)}${items.join(`${delimeters.afterItem ?? ``}\n${tabs(indent + 1)}${delimeters.beforeItem ?? ``}`)}\n${tabs(indent)}`;\n };\n\n const typeToCode = (t: TypedType, indent: number): string => {\n if (t.kind === `value`) {\n // return `${t.typescriptType}`;\n\n const prim = `prim` in t.raw ? t.raw.prim : `unknown`;\n\n // Strict mode\n if (t.typescriptType === `boolean`\n || t.typescriptType === `string` && prim === `string`\n ) {\n return `${t.typescriptType}`;\n }\n\n if (t.typescriptType === 'number') {\n const simpleBaseType = `string | BigNumber | number`;\n const typeAlias: TypeAlias = { aliasType: prim, simpleTypeDefinition: `type ${prim} = ${simpleBaseType};`, simpleTypeImports: [{ name: 'BigNumber', isDefault: true, from: 'bignumber.js' }] };\n addTypeAlias(typeAlias);\n\n return typeAlias.aliasType;\n }\n\n const simpleBaseType = t.typescriptType === 'Date' ? 'Date | string' : t.typescriptType;\n const typeAlias: TypeAlias = { aliasType: prim, simpleTypeDefinition: `type ${prim} = ${simpleBaseType};` };\n addTypeAlias(typeAlias);\n\n return typeAlias.aliasType;\n }\n if (t.kind === `array`) {\n return `Array<${typeToCode(t.array.item, indent)}>`;\n }\n if (t.kind === `map`) {\n\n const typeAlias: TypeAlias = t.map.isBigMap\n ? { aliasType: `BigMap`, simpleTypeDefinition: 'type BigMap<K, T> = MichelsonMap<K, T>;', simpleTypeImports: [{ name: 'MichelsonMap', from: '@taquito/taquito' }] }\n : { aliasType: `MMap`, simpleTypeDefinition: 'type MMap<K, T> = MichelsonMap<K, T>;', simpleTypeImports: [{ name: 'MichelsonMap', from: '@taquito/taquito' }] };\n addTypeAlias(typeAlias);\n\n return `${typeAlias.aliasType}<${typeToCode(t.map.key, indent)}, ${typeToCode(t.map.value, indent)}>`;\n }\n if (t.kind === `object`) {\n return `{${toIndentedItems(indent, {},\n t.fields.map((a, i) => varToCode(a, i, indent + 1) + `;`),\n )}}`;\n }\n if (t.kind === `union`) {\n\n const getUnionItem = (a: TypedVar, i: number) => {\n const itemCode = `${varToCode(a, i, indent + 1)}`;\n\n // Keep on single line if already on single line\n if (!itemCode.includes(`\\n`)) {\n return `{ ${itemCode} }`;\n }\n\n // Indent if multi-line (and remake with extra indent)\n return `{${toIndentedItems(indent + 1, {}, [`${varToCode(a, i, indent + 2)}`])}}`;\n };\n\n return `(${toIndentedItems(indent, { beforeItem: `| ` },\n t.union.map(getUnionItem),\n )})`;\n }\n if (t.kind === `unit`) {\n const typeAlias: TypeAlias = { aliasType: `unit`, simpleTypeDefinition: `type unit = (true | undefined);`, };\n addTypeAlias(typeAlias);\n return typeAlias.aliasType;\n }\n if (t.kind === `never`) {\n return `never`;\n }\n if (t.kind === `unknown`) {\n return `unknown`;\n }\n\n assertExhaustive(t, `Unknown type`);\n throw new GenerateApiError(`Unknown type node`, { t });\n };\n\n const varToCode = (t: TypedVar, i: number, indent: number, numberVarNamePrefix = ''): string => {\n return `${t.name ?? `${numberVarNamePrefix}${i}`}${t.type.optional ? `?` : ``}: ${typeToCode(t.type, indent)}`;\n };\n\n const argsToCode = (args: TypedVar[], indent: number, asObject: boolean): string => {\n if (args.length === 1) {\n if (args[0].type.kind === `unit`) { return ``; }\n return `${args[0].name ?? `param`}: ${typeToCode(args[0].type, indent + 1)}`;\n }\n\n const result = `${toIndentedItems(indent, {},\n args.filter(x => x.name || x.type.kind !== `unit`).map((a, i) => varToCode(a, i, indent + 1, asObject ? '' : '_') + `,`),\n )}`;\n\n if(asObject){\n return `params: {${result}}`;\n }\n\n return result;\n };\n\n const methodsToCode = (indent: number) => {\n const methodFields = methods.map(x => {\n const methodCode = `${x.name}: (${argsToCode(x.args, indent + 1, false)}) => Promise<void>;`;\n return methodCode;\n });\n\n const methodsTypeCode = `type Methods = {${toIndentedItems(indent, {}, methodFields)}};`;\n return methodsTypeCode;\n };\n const methodsObjectToCode = (indent: number) => {\n const methodFields = methods.map(x => {\n const methodCode = `${x.name}: (${argsToCode(x.args, indent + 1, true)}) => Promise<void>;`;\n return methodCode;\n });\n\n const methodsTypeCode = `type MethodsObject = {${toIndentedItems(indent, {}, methodFields)}};`;\n return methodsTypeCode;\n };\n\n const storageToCode = (indent: number) => {\n const storageTypeCode = `type Storage = ${typeToCode(storage.storage, indent)};`;\n return storageTypeCode;\n };\n\n const methodsCode = methodsToCode(0);\n const methodsObjectCode = methodsObjectToCode(0);\n const storageCode = storageToCode(0);\n\n // Simple type aliases\n const simpleTypeMappingImportsAll = new Map(usedStrictTypes.map(x => x.simpleTypeImports ?? []).reduce(reduceFlatMap, []).map(x => [`${x?.from}:${x?.name}:${x?.isDefault}`, x]));\n const simpleTypeMappingImportsFrom = [...simpleTypeMappingImportsAll.values()].reduce((out, x) => {\n const entry = out[x.from] ?? (out[x.from] = { names: [] });\n if (x.isDefault) {\n entry.default = x.name;\n } else {\n entry.names.push(x.name);\n }\n entry.names.sort((a, b) => a.localeCompare(b));\n return out;\n }, {} as { [from: string]: { names: string[], default?: string } });\n\n const simpleTypeMappingImportsText = Object.keys(simpleTypeMappingImportsFrom)\n .map(k => {\n const entry = simpleTypeMappingImportsFrom[k];\n const items = [entry.default, entry.names.length ? `{ ${entry.names.join(', ')} }` : ''].filter(x => x);\n return `import ${items.join(', ')} from '${k}';\\n`;\n })\n .join('');\n\n const simpleTypeMapping = usedStrictTypes\n .sort((a, b) => a.aliasType.localeCompare(b.aliasType))\n .map(x => x.simpleTypeDefinition).join(`\\n`);\n\n const typeUtilsDefinitions =\n `import { ContractAbstractionFromContractType, WalletContractAbstractionFromContractType } from '${typeUtilsData.importPath}';`;\n\n const typeAliasesDefinitions =\n typeAliasData.mode === 'simple' ? `${simpleTypeMappingImportsText}${simpleTypeMapping}`\n : typeAliasData.mode === 'local' ? typeAliasData.fileContent\n : `import { ${usedStrictTypes.map(x => x.aliasType).join(`, `)} } from '${typeAliasData.importPath}';`;\n\n const contractTypeName = `${contractName}ContractType`;\n const walletTypeName = `${contractName}WalletType`;\n const codeName = `${contractName}Code`;\n\n const typesFileContent = `\n${typeUtilsDefinitions}\n${typeAliasesDefinitions}\n\n${storageCode}\n\n${methodsCode}\n\n${methodsObjectCode}\n\ntype contractTypes = { methods: Methods, methodsObject: MethodsObject, storage: Storage, code: { __type: '${codeName}', protocol: string, code: object[] } };\nexport type ${contractTypeName} = ContractAbstractionFromContractType<contractTypes>;\nexport type ${walletTypeName} = WalletContractAbstractionFromContractType<contractTypes>;\n`;\n\n const contractCodeFileContent = `\nexport const ${codeName}: { __type: '${codeName}', protocol: string, code: object[] } = {\n __type: '${codeName}',\n protocol: '${protocol.key}',\n code: JSON.parse(\\`${JSON.stringify(parsedContract)}\\`)\n};\n`;\n return {\n typesFileContent,\n contractCodeFileContent,\n storage: storageCode,\n methods: methodsCode,\n methodsObject: methodsObjectCode,\n };\n\n};\n\n\n","// This is required for copying the type aliases to a local file\nexport const typeAliasesFileContent = `\nimport { BigNumber } from 'bignumber.js';\nimport { MichelsonMap } from '@taquito/taquito';\n\nexport type unit = (true | undefined) & { __type: 'unit' };\n\nexport type address = string & { __type: 'address' };\nexport type bytes = string & { __type: 'bytes' };\nexport type contract = string & { __type: 'contract' };\nexport type operation = string & { __type: 'operation' };\nexport type key = string & { __type: 'key' };\nexport type key_hash = string & { __type: 'key_hash' };\nexport type signature = string & { __type: 'signature' };\nexport type ticket = string & { __type: 'ticket' };\n\nexport type timestamp = string & { __type: 'timestamp' };\n\nexport type int = BigNumber & { __type: 'int' };\nexport type nat = BigNumber & { __type: 'nat' };\n\nexport type mutez = BigNumber & { __type: 'mutez' };\nexport type tez = BigNumber & { __type: 'tez' };\n\ntype MapKey = Array<any> | object | string | boolean | number;\nexport type MMap<K extends MapKey, V> = Omit<MichelsonMap<K, V>, 'get'> & { get: (key: K) => V };\nexport type BigMap<K extends MapKey, V> = Omit<MichelsonMap<K, V>, 'get'> & { get: (key: K) => Promise<V> };\n\nexport type chest = string & { __type: 'chest' };\nexport type chest_key = string & { __type: 'chest_key' };\n\nconst createStringTypeTas = <T extends string>() => {\n return (value: string): T => value as T;\n};\n\nconst createBigNumberTypeTas = <T extends BigNumber>() => {\n return (value: number | BigNumber | string): T => new BigNumber(value) as T;\n};\n\ntype asMapParamOf<K, V> = K extends string ? { [key: string]: V } | Array<{ key: K, value: V }>\n : K extends number ? { [key: number]: V } | Array<{ key: K, value: V }>\n : Array<{ key: K, value: V }>;\n\nfunction asMap<K extends MapKey, V>(value: asMapParamOf<K, V>): MMap<K, V> {\n const m = new MichelsonMap<K, V>();\n if (Array.isArray(value)) {\n const vArray = value as Array<{ key: K, value: V }>;\n vArray.forEach(x => m.set(x.key, x.value));\n } else {\n const vObject = value as { [key: string]: V };\n Object.keys(vObject).forEach(key => m.set(key as unknown as K, vObject[key]));\n }\n return m as MMap<K, V>;\n}\nconst asBigMap = <K extends MapKey, V>(value: asMapParamOf<K, V>) => asMap(value) as unknown as BigMap<K, V>;\n\nfunction add<T extends BigNumber>(a: T, b: T): T {\n return a.plus(b) as T;\n}\nfunction subtract<T extends BigNumber>(a: T, b: T): T {\n return a.minus(b) as T;\n}\n\n/** tas: Tezos 'as' casting for strict types */\nexport const tas = {\n address: createStringTypeTas<address>(),\n bytes: createStringTypeTas<bytes>(),\n contract: createStringTypeTas<contract>(),\n chest: createStringTypeTas<chest>(),\n chest_key: createStringTypeTas<chest_key>(),\n timestamp: (value: string | Date): timestamp => new Date(value).toISOString() as timestamp,\n\n int: createBigNumberTypeTas<int>(),\n nat: createBigNumberTypeTas<nat>(),\n mutez: createBigNumberTypeTas<mutez>(),\n tez: createBigNumberTypeTas<tez>(),\n\n map: asMap,\n bigMap: asBigMap,\n\n // Operations\n add,\n subtract,\n\n // To number\n number: (value: string | BigNumber) => Number(value + ''),\n};\n`;","// This is required for copying the type utils to a local file\nexport const typeUtilsFileContent = `\nimport { ContractAbstraction, ContractMethod, ContractMethodObject, ContractProvider, Wallet } from '@taquito/taquito';\n\ntype BaseContractType = { methods: unknown, methodsObject: unknown, storage: unknown };\n\ntype ContractMethodsOf<T extends ContractProvider | Wallet, TContract extends BaseContractType> = {\n[M in keyof TContract['methods']]:\nTContract['methods'][M] extends (...args: infer A) => unknown\n? (...args: A) => ContractMethod<T>\n: never\n};\ntype ContractMethodsObjectsOf<T extends ContractProvider | Wallet, TContract extends BaseContractType> = {\n[M in keyof TContract['methodsObject']]:\nTContract['methodsObject'][M] extends (...args: infer A) => unknown\n? (...args: A) => ContractMethodObject<T>\n: never\n};\ntype ContractStorageOf<TContract extends BaseContractType> = TContract['storage'];\n\nexport type ContractAbstractionFromContractType<TContract extends BaseContractType> = \n ContractAbstraction<ContractProvider, \n ContractMethodsOf<ContractProvider, TContract>,\n ContractMethodsObjectsOf<ContractProvider, TContract>,\n {},\n {},\n ContractStorageOf<TContract>\n >;\n\nexport type WalletContractAbstractionFromContractType<TContract extends BaseContractType> = \n ContractAbstraction<Wallet, \n ContractMethodsOf<Wallet, TContract>,\n ContractMethodsObjectsOf<Wallet, TContract>,\n {},\n {},\n ContractStorageOf<TContract>\n >;\n`;"],"names":[],"version":3,"file":"index.js.map","sourceRoot":"../"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@taqueria/plugin-contract-types",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "",
5
5
  "targets": {
6
6
  "default": {
@@ -12,7 +12,7 @@
12
12
  },
13
13
  "scripts": {
14
14
  "pluginInfo": "npx ts-node index.ts --taqRun pluginInfo --i18n {\"foo:\"\"bar\"}",
15
- "build": "npx parcel build",
15
+ "build": "npx tsc -noEmit && npx parcel build",
16
16
  "build-ci": "npm run build",
17
17
  "debugPluginInfo": "node --inspect-brk index.js --taqRun pluginInfo --i18n {\"foo:\"\"bar\"}",
18
18
  "examples": "npm run example && npm run example-json && npm run example-simple && npm run example-file && npm run example-local",
@@ -39,7 +39,7 @@
39
39
  "typescript": "^4.5.4"
40
40
  },
41
41
  "dependencies": {
42
- "@taqueria/node-sdk": "^0.3.0",
42
+ "@taqueria/node-sdk": "^0.3.1",
43
43
  "@taquito/michel-codec": "^12.1.0",
44
44
  "@taquito/signer": "^12.1.0",
45
45
  "@taquito/taquito": "^12.1.0",
@@ -336,11 +336,13 @@ const visitType = (node: MType, options?: { ignorePairName?: boolean }): TypedTy
336
336
  }
337
337
 
338
338
  // chest
339
- if(node.prim === 'chest'){
340
- throw new Error('Not Implemented: chest');
341
- }
342
- if(node.prim === 'chest_key'){
343
- throw new Error('Not Implemented: chest_key');
339
+ if (node.prim === 'chest' || node.prim === 'chest_key') {
340
+ return {
341
+ kind: `value`,
342
+ raw: node,
343
+ value: node.prim,
344
+ typescriptType: `string`,
345
+ };
344
346
  }
345
347
 
346
348
  // never
@@ -53,6 +53,10 @@ export const generateContractTypesFromMichelsonCode = (contractScript: string, c
53
53
 
54
54
  const parameterResult = contractParameter && parseContractParameter(contractParameter);
55
55
  const methods = parameterResult?.methods ?? [];
56
+
57
+ // If there's only one entrypoint, then we call it "default"
58
+ if (methods.length === 1) methods[0].name = `default`
59
+
56
60
  const schemaOutput = toSchema(methods, storage);
57
61
 
58
62
  const typescriptCode = toTypescriptCode(storage, methods, contractName, contract, protocol, typeAliasData, typeUtilsData);
@@ -26,6 +26,8 @@ type MapKey = Array<any> | object | string | boolean | number;
26
26
  export type MMap<K extends MapKey, V> = Omit<MichelsonMap<K, V>, 'get'> & { get: (key: K) => V };
27
27
  export type BigMap<K extends MapKey, V> = Omit<MichelsonMap<K, V>, 'get'> & { get: (key: K) => Promise<V> };
28
28
 
29
+ export type chest = string & { __type: 'chest' };
30
+ export type chest_key = string & { __type: 'chest_key' };
29
31
 
30
32
  const createStringTypeTas = <T extends string>() => {
31
33
  return (value: string): T => value as T;
@@ -64,6 +66,8 @@ export const tas = {
64
66
  address: createStringTypeTas<address>(),
65
67
  bytes: createStringTypeTas<bytes>(),
66
68
  contract: createStringTypeTas<contract>(),
69
+ chest: createStringTypeTas<chest>(),
70
+ chest_key: createStringTypeTas<chest_key>(),
67
71
  timestamp: (value: string | Date): timestamp => new Date(value).toISOString() as timestamp,
68
72
 
69
73
  int: createBigNumberTypeTas<int>(),
@@ -24,6 +24,8 @@ type MapKey = Array<any> | object | string | boolean | number;
24
24
  export type MMap<K extends MapKey, V> = Omit<MichelsonMap<K, V>, 'get'> & { get: (key: K) => V };
25
25
  export type BigMap<K extends MapKey, V> = Omit<MichelsonMap<K, V>, 'get'> & { get: (key: K) => Promise<V> };
26
26
 
27
+ export type chest = string & { __type: 'chest' };
28
+ export type chest_key = string & { __type: 'chest_key' };
27
29
 
28
30
  const createStringTypeTas = <T extends string>() => {
29
31
  return (value: string): T => value as T;
@@ -62,6 +64,8 @@ export const tas = {
62
64
  address: createStringTypeTas<address>(),
63
65
  bytes: createStringTypeTas<bytes>(),
64
66
  contract: createStringTypeTas<contract>(),
67
+ chest: createStringTypeTas<chest>(),
68
+ chest_key: createStringTypeTas<chest_key>(),
65
69
  timestamp: (value: string | Date): timestamp => new Date(value).toISOString() as timestamp,
66
70
 
67
71
  int: createBigNumberTypeTas<int>(),
package/tasks.ts CHANGED
@@ -33,7 +33,6 @@ const generateContractTypesAll = async (parsedArgs: Opts & PluginOpts) : Promise
33
33
  }
34
34
 
35
35
  export const generateTypes = <T>(parsedArgs: Opts): LikeAPromise<PluginResponse, Failure<T>> => {
36
- debugger
37
36
  parsedArgs.typescriptDir = parsedArgs.typescriptDir || 'types';
38
37
 
39
38
  console.log('generateTypes', {
@@ -3,7 +3,7 @@ import path from 'path';
3
3
  import { promisify } from 'util';
4
4
  import { generateContractTypesFromMichelsonCode } from '../src/generator/process';
5
5
  import { normalizeContractName } from '../src/generator/contract-name';
6
- import { TypeAliasData } from '../src/generator/typescript-output';
6
+ import { TypeAliasData, TypeUtilsData } from '../src/generator/typescript-output';
7
7
 
8
8
 
9
9
  const readFileText = async (filePath: string): Promise<string> => {
@@ -23,7 +23,8 @@ describe('Generate Example Contracts', () => {
23
23
  const expectedCodeFileContent = await readFileText(`${exampleDir}/types${mode === 'simple' ? '-simple' : ''}/${contractFileName}.code.ts`);
24
24
  const contractName = normalizeContractName(contractFileName);
25
25
  const typeAliasData = mode === 'library' ? typeAliasDataLibrary : typeAliasDataSimple;
26
- const { typescriptCodeOutput: { typesFileContent: actualTypesFileContent, contractCodeFileContent: actualCodeFileContent } } = generateContractTypesFromMichelsonCode(contractRaw, contractName, format, typeAliasData);
26
+ const typeUtilsData: TypeUtilsData = { importPath: `./type-utils` };
27
+ const { typescriptCodeOutput: { typesFileContent: actualTypesFileContent, contractCodeFileContent: actualCodeFileContent } } = generateContractTypesFromMichelsonCode(contractRaw, contractName, format, typeAliasData, typeUtilsData);
27
28
  expect(actualTypesFileContent.trim()).toEqual(expectedTypeFileContent.trim());
28
29
  expect(actualCodeFileContent.trim()).toEqual(expectedCodeFileContent.trim());
29
30
  };
package/tsconfig.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "compilerOptions": {
3
- "target": "ES6",
3
+ "target": "ES2021",
4
4
  "module": "CommonJS",
5
5
  "declaration": true,
6
6
  "allowSyntheticDefaultImports": true,