diff --git a/.eslintrc.js b/.eslintrc.js index 608371973e..2cdb360e6e 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -2,8 +2,10 @@ module.exports = { root: true, ignorePatterns: [ "**/wrap/**/*.*", + "**/wrap-man/**/*.*", "**/infra-modules/**/*.*", "**/build/**/*.*", + "**/build-man/**/*.*", "**/__tests__/**/*.*", "**/node_modules/**/*.*", "**/coverage/**/*.*" diff --git a/package.json b/package.json index 2cb701b000..44b5a594b2 100644 --- a/package.json +++ b/package.json @@ -25,13 +25,14 @@ "clean": "npx rimraf ./**/node_modules ./**/yarn.lock ./**/build ./**/coverage ./**/.polywrap", "dependencies:install": "cd dependencies && yarn", "preinstall": "yarn dependencies:install", - "build": "yarn build:core && yarn build:interfaces && yarn build:plugins && yarn build:client && yarn build:test-env && yarn build:cli", + "build": "yarn build:core && yarn build:plugins && yarn build:client && yarn build:test-env && yarn build:cli && yarn build:plugins:patch", "build:core": "lerna run build --no-private --ignore @polywrap/*-plugin-js --ignore polywrap --ignore @polywrap/client-js --ignore @polywrap/react --ignore @polywrap/test-env-js --ignore @polywrap/*-interface", "build:interfaces": "lerna run build --scope @polywrap/*-interface --concurrency 1", "build:plugins": "lerna run build --scope @polywrap/*-plugin-js --concurrency 1", "build:client": "lerna run build --scope @polywrap/client-js --scope @polywrap/react", "build:test-env": "lerna run build --scope @polywrap/test-env-js", "build:cli": "lerna run build --scope polywrap", + "build:plugins:patch": "cd packages/js/plugins/ethereum && yarn codegen:patch && cd ../http && yarn codegen:patch && lerna run codegen:patch --scope @polywrap/*-plugin-js --concurrency 1", "link:interface:deps": "yarn link:manifests && yarn link:schema", "link:manifests": "yarn link:manifests:polywrap && yarn link:manifests:wrap", "link:manifests:polywrap": "cd packages/js/manifests/polywrap && (yarn unlink || true) && yarn link && cd ../../../../dependencies && yarn link @polywrap/polywrap-manifest-types-js && cd ../", diff --git a/packages/cli/lang/en.json b/packages/cli/lang/en.json index 449c908ced..82fd6532eb 100644 --- a/packages/cli/lang/en.json +++ b/packages/cli/lang/en.json @@ -225,9 +225,9 @@ "lib_compiler_compileWasmModulesError": "Failed to compile Wasm modules", "lib_compiler_compileWasmModulesText": "Compile Wasm modules", "lib_compiler_compileWasmModulesWarning": "Warnings while compiling Wasm modules", - "lib_compiler_failedSchemaReturn": "Schema composer failed to return a combined schema.", + "lib_compiler_failedAbiReturn": "Abi composer failed to return a combined abi.", "lib_compiler_noModulesToBuild": "No modules to build declared.", - "lib_compiler_missingSchema": "Missing schema definition", + "lib_compiler_missingAbi": "Missing ABI definition", "lib_compiler_missingModule": "Missing module definition", "lib_compiler_noInterfaceModule": "Interfaces cannot have implementation file", "lib_compiler_step": "Compiling WASM module", @@ -239,6 +239,9 @@ "lib_compiler_outputMetadataError": "Failed to output metadata", "lib_compiler_outputMetadataWarning": "Warnings writing metadata", "lib_compiler_outputMetadataFileText": "Metadata written to {path}", + "lib_schemaComposer_abi_not_found": "ABI not found at {path}", + "lib_schemaComposer_unknown_abi": "Unknown ABI type at {path}. Supported types: {types}", + "lib_schemaComposer_invalid_yaml": "Invalid YAML at {path}", "lib_generators_projectGenerator_fallback": "Falling back to the local Yarn cache.", "lib_generators_projectGenerator_offline": "You appear to be offline.", "lib_helpers_manifest_loadError": "Failed to load manifest from {path}", diff --git a/packages/cli/lang/es.json b/packages/cli/lang/es.json index f8ea332c1e..71a843e9b5 100644 --- a/packages/cli/lang/es.json +++ b/packages/cli/lang/es.json @@ -225,9 +225,9 @@ "lib_compiler_compileWasmModulesError": "Failed to compile Wasm modules", "lib_compiler_compileWasmModulesText": "Compile Wasm modules", "lib_compiler_compileWasmModulesWarning": "Warnings while compiling Wasm modules", - "lib_compiler_failedSchemaReturn": "Schema composer failed to return a combined schema.", + "lib_compiler_failedAbiReturn": "Abi composer failed to return a combined abi.", "lib_compiler_noModulesToBuild": "No modules to build declared.", - "lib_compiler_missingSchema": "Missing schema definition", + "lib_compiler_missingAbi": "Missing ABI definition", "lib_compiler_missingModule": "Missing module definition", "lib_compiler_noInterfaceModule": "Interfaces cannot have implementation file", "lib_compiler_step": "Compiling WASM module", @@ -239,6 +239,9 @@ "lib_compiler_outputMetadataError": "Failed to output metadata", "lib_compiler_outputMetadataWarning": "Warnings writing metadata", "lib_compiler_outputMetadataFileText": "Metadata written to {path}", + "lib_schemaComposer_abi_not_found": "ABI not found at {path}", + "lib_schemaComposer_unknown_abi": "Unknown ABI type at {path}. Supported types: {types}", + "lib_schemaComposer_invalid_yaml": "Invalid YAML at {path}", "lib_generators_projectGenerator_fallback": "Falling back to the local Yarn cache.", "lib_generators_projectGenerator_offline": "You appear to be offline.", "lib_helpers_manifest_loadError": "Failed to load manifest from {path}", diff --git a/packages/cli/package.json b/packages/cli/package.json index 648a164f75..a07c2fbd6f 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -16,7 +16,8 @@ "polywrap": "bin/polywrap" }, "scripts": { - "build": "rimraf ./build && tsc --project tsconfig.build.json && yarn build:build-images && yarn build:deploy-modules && yarn build:infra-modules && yarn build:docgen-templates", + "build": "yarn build:intl && yarn build:fast", + "build:fast": "rimraf ./build && tsc --project tsconfig.build.json && yarn build:build-images && yarn build:deploy-modules && yarn build:infra-modules && yarn build:docgen-templates", "build:build-images": "copyfiles ./src/lib/defaults/build-images/**/**/* ./build/lib/defaults/build-images/ -u 4", "build:deploy-modules": "copyfiles ./src/lib/defaults/deploy-modules/**/polywrap.deploy.ext.json ./build/lib/defaults/deploy-modules -u 4", "build:infra-modules": "ts-node ./scripts/copyfiles ./src/lib/defaults/infra-modules ./build/lib/defaults/infra-modules", @@ -24,8 +25,7 @@ "build:docgen-templates:docusaurus": "ts-node ./scripts/copyfiles ./src/lib/docgen/docusaurus/templates ./build/lib/docgen/docusaurus/templates", "build:docgen-templates:jsdoc": "ts-node ./scripts/copyfiles ./src/lib/docgen/jsdoc/templates ./build/lib/docgen/jsdoc/templates", "build:docgen-templates:schema": "ts-node ./scripts/copyfiles ./src/lib/docgen/schema/templates ./build/lib/docgen/schema/templates", - "prebuild": "ts-node ./scripts/generateIntlTypes.ts", - "build:fast": "rimraf ./build && tsc --project tsconfig.build.json", + "build:intl": "ts-node ./scripts/generateIntlTypes.ts", "lint": "eslint --color -c ../../.eslintrc.js .", "test": "cross-env TEST=true jest --passWithNoTests --runInBand --verbose", "test:ci": "cross-env TEST=true jest --passWithNoTests --runInBand --verbose", diff --git a/packages/cli/src/__tests__/e2e/deploy.spec.ts b/packages/cli/src/__tests__/e2e/deploy.spec.ts index fc2224cce4..2df0e8e374 100644 --- a/packages/cli/src/__tests__/e2e/deploy.spec.ts +++ b/packages/cli/src/__tests__/e2e/deploy.spec.ts @@ -207,13 +207,13 @@ describe("e2e tests for deploy command", () => { input: { uri: "wrap://fs/./build" }, - result: "wrap://ipfs/QmPDJ9GMgqx1iScNpZh2MerK27YFNKayY5fBoGXfPWWEqm" + result: "wrap://ipfs/QmT5nBb8xwrfZnmFNRZexmrebzaaxW7CPfh1ZznQ6zsVaG" }, { id: "ipfs_deploy.from_deploy", name: "from_deploy", input: { - uri: "wrap://ipfs/QmPDJ9GMgqx1iScNpZh2MerK27YFNKayY5fBoGXfPWWEqm", + uri: "wrap://ipfs/QmT5nBb8xwrfZnmFNRZexmrebzaaxW7CPfh1ZznQ6zsVaG", config: { domainName: "test1.eth", provider: "http://localhost:8545", @@ -226,7 +226,7 @@ describe("e2e tests for deploy command", () => { id: "ipfs_deploy.from_deploy2", name: "from_deploy2", input: { - uri: "wrap://ipfs/QmPDJ9GMgqx1iScNpZh2MerK27YFNKayY5fBoGXfPWWEqm", + uri: "wrap://ipfs/QmT5nBb8xwrfZnmFNRZexmrebzaaxW7CPfh1ZznQ6zsVaG", config: { domainName: "test2.eth", provider: "http://localhost:8545", diff --git a/packages/cli/src/__tests__/e2e/docgen.spec.ts b/packages/cli/src/__tests__/e2e/docgen.spec.ts index 09d2507e82..ebf34612ea 100644 --- a/packages/cli/src/__tests__/e2e/docgen.spec.ts +++ b/packages/cli/src/__tests__/e2e/docgen.spec.ts @@ -14,7 +14,7 @@ Generate wrapper documentation Arguments: action - schema Generate GraphQL schema + schema Generate GraphQL schema docusaurus Generate Docusaurus markdown jsdoc Generate JSDoc markdown (choices: "schema", "docusaurus", "jsdoc") diff --git a/packages/cli/src/commands/docgen.ts b/packages/cli/src/commands/docgen.ts index 198458271c..3feaf1d798 100644 --- a/packages/cli/src/commands/docgen.ts +++ b/packages/cli/src/commands/docgen.ts @@ -12,12 +12,10 @@ import { PluginProject, parseClientConfigOption, defaultPluginManifest, -} from "../lib"; -import { Command, Program } from "./types"; -import { parseDirOption, parseDocgenManifestFileOption, -} from "../lib/option-parsers"; +} from "../lib"; +import { Command, Program } from "./types"; import { scriptPath as docusaurusScriptPath } from "../lib/docgen/docusaurus"; import { scriptPath as jsdocScriptPath } from "../lib/docgen/jsdoc"; import { scriptPath as schemaScriptPath } from "../lib/docgen/schema"; @@ -55,9 +53,7 @@ enum Actions { } const argumentsDescription = ` - ${chalk.bold( - Actions.SCHEMA - )} ${intlMsg.commands_docgen_options_schema()} + ${chalk.bold(Actions.SCHEMA)} ${intlMsg.commands_docgen_options_schema()} ${chalk.bold( Actions.DOCUSAURUS )} ${intlMsg.commands_docgen_options_markdown({ diff --git a/packages/cli/src/commands/plugin.ts b/packages/cli/src/commands/plugin.ts index 242a7fa593..8a1eea45f2 100644 --- a/packages/cli/src/commands/plugin.ts +++ b/packages/cli/src/commands/plugin.ts @@ -4,18 +4,16 @@ import { PluginProject, SchemaComposer, defaultPluginManifest, - outputManifest, intlMsg, parseDirOption, parsePluginManifestFileOption, parseClientConfigOption, + generateWrapFile, } from "../lib"; -import { ComposerFilter } from "@polywrap/schema-compose"; -import { writeFileSync } from "@polywrap/os-js"; import path from "path"; -import fs from "fs"; import { PolywrapClient, PolywrapClientConfig } from "@polywrap/client-js"; +import fs from "fs"; const defaultPublishDir = "./build"; const defaultCodegenDir = "./wrap"; @@ -87,39 +85,31 @@ async function run(options: PluginCommandOptions) { }); await project.validate(); const manifest = await project.getManifest(); - const schemaComposer = new SchemaComposer({ project, client, }); - let result = false; - const codeGenerator = new CodeGenerator({ project, schemaComposer, codegenDirAbs: codegenDir, }); - result = await codeGenerator.generate(); + const result = await codeGenerator.generate(); + process.exitCode = result ? 0 : 1; - if (result) { - process.exitCode = 0; - } else { - process.exitCode = 1; - } - - // Output the built schema & manifest - const schemas = await schemaComposer.getComposedSchemas( - ComposerFilter.Schema - ); - const publishSchemaPath = path.join(publishDir, "schema.graphql"); - const publishManifestPath = path.join(publishDir, "polywrap.plugin.json"); + // Output the built manifest + const manifestPath = path.join(publishDir, "wrap.info"); if (!fs.existsSync(publishDir)) { fs.mkdirSync(publishDir); } - writeFileSync(publishSchemaPath, schemas.schema); - await outputManifest(manifest, publishManifestPath); + await generateWrapFile( + await schemaComposer.getComposedAbis(), + manifest.name, + "plugin", + manifestPath + ); } diff --git a/packages/cli/src/lib/CodeGenerator.ts b/packages/cli/src/lib/CodeGenerator.ts index 35a202108e..cbbc0cf3de 100644 --- a/packages/cli/src/lib/CodeGenerator.ts +++ b/packages/cli/src/lib/CodeGenerator.ts @@ -81,15 +81,8 @@ export class CodeGenerator { ); } - // Get the fully composed schema - const composed = await schemaComposer.getComposedSchemas(); - - if (!composed) { - throw Error(intlMsg.lib_codeGenerator_noComposedSchema()); - } - - const abi = composed.abi; - this._schema = composed.schema; + // Get the fully composed abi + const abi = await schemaComposer.getComposedAbis(); if (!abi) { throw Error(intlMsg.lib_codeGenerator_abiMissing()); @@ -119,7 +112,6 @@ export class CodeGenerator { const binding = await generateBinding({ projectName: await project.getName(), abi, - schema: this._schema || "", outputDirAbs: codegenDirAbs, bindLanguage, config: this._config.mustacheView, @@ -134,7 +126,7 @@ export class CodeGenerator { ); } else { const binding = await project.generateSchemaBindings( - composed, + abi, path.relative(project.getManifestDir(), codegenDirAbs) ); diff --git a/packages/cli/src/lib/Compiler.ts b/packages/cli/src/lib/Compiler.ts index 5c15a0f9d1..526ed08d88 100644 --- a/packages/cli/src/lib/Compiler.ts +++ b/packages/cli/src/lib/Compiler.ts @@ -8,6 +8,7 @@ import { ensureDockerDaemonRunning, generateDockerfile, generateDockerImageName, + generateWrapFile, intlMsg, outputManifest, outputMetadata, @@ -18,27 +19,17 @@ import { } from "./"; import { PolywrapManifest } from "@polywrap/polywrap-manifest-types-js"; -import { - WrapManifest, - WrapAbi, - validateWrapManifest, -} from "@polywrap/wrap-manifest-types-js"; -import { msgpackEncode } from "@polywrap/msgpack-js"; import { WasmWrapper } from "@polywrap/client-js"; import { WrapImports } from "@polywrap/client-js/build/wasm/types"; import { AsyncWasmInstance } from "@polywrap/asyncify-js"; -import { ComposerOutput } from "@polywrap/schema-compose"; -import { - normalizePath, - writeDirectorySync, - writeFileSync, -} from "@polywrap/os-js"; +import { normalizePath, writeDirectorySync } from "@polywrap/os-js"; import * as gluegun from "gluegun"; import fs from "fs"; import path from "path"; +import { WrapAbi } from "@polywrap/schema-parse"; interface CompilerState { - composerOutput: ComposerOutput; + abi: WrapAbi; compilerOverrides?: CompilerOverrides; } @@ -105,9 +96,6 @@ export class Compiler { // Init & clean output directory resetDir(this._config.outputDir); - // Output: schema.graphql - await this._outputComposedSchema(state); - // Output: wrap.info await this._outputWrapManifest(state); @@ -165,8 +153,8 @@ export class Compiler { // Get the PolywrapManifest const polywrapManifest = await project.getManifest(); - // Compose the schema - const composerOutput = await this._composeSchema(); + // Compose the ABI + const abi = await this._composeAbi(); // Allow the build-image to validate the manifest & override functionality const buildImageDir = `${__dirname}/defaults/build-images/${polywrapManifest.language}`; @@ -190,7 +178,7 @@ export class Compiler { } const state: CompilerState = { - composerOutput, + abi, compilerOverrides, }; @@ -206,26 +194,26 @@ export class Compiler { return manifest.language === "interface"; } - private async _composeSchema(): Promise { + private async _composeAbi(): Promise { const { schemaComposer } = this._config; // Get the fully composed schema - const composerOutput = await schemaComposer.getComposedSchemas(); + const abi = await schemaComposer.getComposedAbis(); - if (!composerOutput) { - throw Error(intlMsg.lib_compiler_failedSchemaReturn()); + if (!abi) { + throw Error(intlMsg.lib_compiler_failedAbiReturn()); } - return composerOutput; + return abi; } private async _generateCode(state: CompilerState): Promise { - const { composerOutput, compilerOverrides } = state; + const { abi, compilerOverrides } = state; const { project } = this._config; // Generate the bindings const binding = await project.generateSchemaBindings( - composerOutput, + abi, compilerOverrides?.generationSubPath ); @@ -331,21 +319,6 @@ export class Compiler { return dockerImageId; } - private async _outputComposedSchema(state: CompilerState): Promise { - const { outputDir } = this._config; - - if (!state.composerOutput.schema) { - // This is not being shown with intlMsg because this will be removed - throw Error("Compiler.outputComposedSchema: no schema found"); - } - - writeFileSync( - `${outputDir}/schema.graphql`, - state.composerOutput.schema, - "utf-8" - ); - } - private async _outputWrapManifest( state: CompilerState, quiet = false @@ -353,41 +326,14 @@ export class Compiler { const { outputDir, project } = this._config; let manifestPath = `${outputDir}/wrap.info`; const run = async () => { - if (!state.composerOutput.abi) { + if (!state.abi) { throw Error(intlMsg.lib_wrap_abi_not_found()); } const manifest = await project.getManifest(); - const abi: WrapAbi = { - ...state.composerOutput.abi, - }; - - const filteredAbi: Record = { ...abi }; - - Object.keys(filteredAbi).forEach((key) => { - const value = filteredAbi[key]; - - if (value === null || value === undefined) { - delete filteredAbi[key]; - } - }); - - const info: WrapManifest = { - abi: (filteredAbi as unknown) as WrapAbi, - name: manifest.name, - type: (await this._isInterface()) ? "interface" : "wasm", - version: "0.1", - }; - - // One last sanity check - await validateWrapManifest(info); - - const s = JSON.stringify(info); - const encodedInfo = msgpackEncode(JSON.parse(s)); - writeFileSync(manifestPath, encodedInfo, { - encoding: "binary", - }); + const type = (await this._isInterface()) ? "interface" : "wasm"; + await generateWrapFile(state.abi, manifest.name, type, manifestPath); }; if (quiet) { @@ -435,15 +381,15 @@ export class Compiler { } private async _validateState(state: CompilerState): Promise { - const { composerOutput } = state; + const { abi } = state; const { project } = this._config; - const manifest = await project.getManifest(); - if (!composerOutput.schema) { - const missingSchemaMessage = intlMsg.lib_compiler_missingSchema(); - throw Error(missingSchemaMessage); + if (!abi) { + throw Error(intlMsg.lib_compiler_missingAbi()); } + const manifest = await project.getManifest(); + if (manifest.language !== "interface" && !manifest.module) { const missingModuleMessage = intlMsg.lib_compiler_missingModule(); throw Error(missingModuleMessage); diff --git a/packages/cli/src/lib/SchemaComposer.ts b/packages/cli/src/lib/SchemaComposer.ts index 1089401c44..c13d0a4a60 100644 --- a/packages/cli/src/lib/SchemaComposer.ts +++ b/packages/cli/src/lib/SchemaComposer.ts @@ -1,19 +1,24 @@ /* eslint-disable @typescript-eslint/naming-convention */ /* eslint-disable @typescript-eslint/no-empty-function */ -import { Project, AnyProjectManifest } from "./"; +import { Project, AnyProjectManifest, intlMsg } from "./"; import { Uri, PolywrapClient } from "@polywrap/client-js"; import { composeSchema, - ComposerOutput, - ComposerFilter, ComposerOptions, SchemaFile, } from "@polywrap/schema-compose"; import fs from "fs"; import path from "path"; import * as gluegun from "gluegun"; +import YAML from "js-yaml"; +import { + deserializeWrapManifest, + validateWrapManifest, +} from "@polywrap/wrap-manifest-types-js"; +import { PolywrapManifest } from "@polywrap/polywrap-manifest-types-js"; +import { WrapAbi } from "@polywrap/schema-parse"; export interface SchemaComposerConfig { project: Project; @@ -22,28 +27,26 @@ export interface SchemaComposerConfig { export class SchemaComposer { private _client: PolywrapClient; - private _composerOutput: ComposerOutput | undefined; + private _abi: WrapAbi | undefined; constructor(private _config: SchemaComposerConfig) { this._client = this._config.client; } - public async getComposedSchemas( - output: ComposerFilter = ComposerFilter.All - ): Promise { - if (this._composerOutput) { - return Promise.resolve(this._composerOutput); + public async getComposedAbis(): Promise { + if (this._abi) { + return Promise.resolve(this._abi); } const { project } = this._config; const schemaNamedPath = await project.getSchemaNamedPath(); - const import_redirects = await project.getImportRedirects(); + const import_abis = await project.getImportAbis(); const getSchemaFile = (schemaPath?: string): SchemaFile | undefined => schemaPath ? { - schema: this._fetchLocalSchema(schemaPath), + schema: fs.readFileSync(schemaPath, "utf-8"), absolutePath: schemaPath, } : undefined; @@ -56,54 +59,145 @@ export class SchemaComposer { const options: ComposerOptions = { schema: schemaFile, resolvers: { - external: (uri: string) => - this._fetchExternalSchema(uri, import_redirects), + external: (uri: string) => this._fetchExternalAbi(uri, import_abis), local: (path: string) => Promise.resolve(this._fetchLocalSchema(path)), }, - output, }; - this._composerOutput = await composeSchema(options); - return this._composerOutput; + this._abi = await composeSchema(options); + return this._abi; } public reset(): void { - this._composerOutput = undefined; + this._abi = undefined; + } + + private _fetchLocalSchema(schemaPath: string) { + return fs.readFileSync( + path.isAbsolute(schemaPath) + ? schemaPath + : path.join(this._config.project.getManifestDir(), schemaPath), + "utf-8" + ); } - private async _fetchExternalSchema( + private async _fetchExternalAbi( uri: string, - import_redirects?: { - uri: string; - schema: string; - }[] - ): Promise { + import_abis?: PolywrapManifest["import_abis"] + ): Promise { // Check to see if we have any import redirects that match - if (import_redirects) { - for (const redirect of import_redirects) { - const redirectUri = new Uri(redirect.uri); + if (import_abis) { + for (const import_abi of import_abis) { + const redirectUri = new Uri(import_abi.uri); const uriParsed = new Uri(uri); - if (Uri.equals(redirectUri, uriParsed)) { - return this._fetchLocalSchema(redirect.schema); + if (!Uri.equals(redirectUri, uriParsed)) { + continue; + } + + const abiPath = path.join( + this._config.project.getManifestDir(), + import_abi.abi + ); + + if (!fs.existsSync(abiPath)) { + throw Error( + intlMsg.lib_schemaComposer_abi_not_found({ + path: abiPath, + }) + ); + } + + if (abiPath.endsWith(".info")) { + return await this._loadWrapAbi(abiPath); + } else if (abiPath.endsWith(".graphql")) { + return await this._loadGraphqlAbi(abiPath, import_abis); + } else if (abiPath.endsWith(".json")) { + return await this._loadJsonAbi(abiPath); + } else if (abiPath.endsWith(".yaml")) { + return await this._loadYamlAbi(abiPath); + } else { + throw Error( + intlMsg.lib_schemaComposer_unknown_abi({ + path: abiPath, + types: ["*.info", "*.graphql", "*.json", "*.yaml"].toString(), + }) + ); } } } try { - return await this._client.getSchema(new Uri(uri)); + const manifest = await this._client.getManifest(new Uri(uri)); + return manifest.abi; } catch (e) { gluegun.print.error(e); throw e; } } - private _fetchLocalSchema(schemaPath: string) { - return fs.readFileSync( - path.isAbsolute(schemaPath) - ? schemaPath - : path.join(this._config.project.getManifestDir(), schemaPath), - "utf-8" - ); + private async _loadGraphqlAbi( + path: string, + import_abis: PolywrapManifest["import_abis"] + ): Promise { + const schema = fs.readFileSync(path, "utf-8"); + + return await composeSchema({ + schema: { + schema: schema, + absolutePath: path, + }, + resolvers: { + external: (uri: string) => this._fetchExternalAbi(uri, import_abis), + local: (path: string) => Promise.resolve(this._fetchLocalSchema(path)), + }, + }); + } + + private async _loadWrapAbi(path: string): Promise { + const manifest = fs.readFileSync(path); + return (await deserializeWrapManifest(manifest)).abi; + } + + private async _loadJsonAbi(path: string): Promise { + // Load the JSON ABI + const json = fs.readFileSync(path, "utf-8"); + const result = JSON.parse(json); + + // Validate the ABI's structure + await validateWrapManifest({ + version: "0.1", + type: "interface", + name: "temp", + abi: result, + }); + + // Return ABI + return result as WrapAbi; + } + + private async _loadYamlAbi(path: string): Promise { + // Load the YAML ABI + const yaml = fs.readFileSync(path, "utf-8"); + const result = YAML.safeLoad(yaml); + + if (!result) { + throw Error( + intlMsg.lib_schemaComposer_invalid_yaml({ + path: path, + }) + ); + } + + // Validate the ABI's structure + await validateWrapManifest({ + version: "0.1", + type: "interface", + name: "temp", + abi: result as WrapAbi, + }); + + // Return ABI + return result as WrapAbi; } } diff --git a/packages/cli/src/lib/docgen/schema/index.ts b/packages/cli/src/lib/docgen/schema/index.ts index 2850d9cc39..0f85d1254d 100644 --- a/packages/cli/src/lib/docgen/schema/index.ts +++ b/packages/cli/src/lib/docgen/schema/index.ts @@ -6,6 +6,7 @@ import { import Mustache from "mustache"; import path from "path"; import { readFileSync } from "fs"; +import { renderSchema } from "@polywrap/schema-compose"; export const scriptPath = path.join(__dirname, "index.js"); @@ -37,7 +38,7 @@ export const generateBinding: GenerateBindingFn = ( // generate schema const schemaContext = { - schema: options.schema, + schema: renderSchema(options.abi, true), }; renderTemplate( "./templates/schema.mustache", diff --git a/packages/cli/src/lib/helpers/index.ts b/packages/cli/src/lib/helpers/index.ts index 6b07ba8337..5503aeaed5 100644 --- a/packages/cli/src/lib/helpers/index.ts +++ b/packages/cli/src/lib/helpers/index.ts @@ -5,3 +5,4 @@ export * from "./spinner"; export * from "./uuid"; export * from "./validate-client-config"; export * from "./workflow-validator"; +export * from "./wrap"; diff --git a/packages/cli/src/lib/helpers/wrap.ts b/packages/cli/src/lib/helpers/wrap.ts new file mode 100644 index 0000000000..5a19533100 --- /dev/null +++ b/packages/cli/src/lib/helpers/wrap.ts @@ -0,0 +1,57 @@ +import { withSpinner } from "./spinner"; +import { intlMsg } from "../intl"; +import { displayPath } from "../system"; + +import { + serializeWrapManifest, + latestWrapManifestVersion, + WrapManifest, + WrapAbi, +} from "@polywrap/wrap-manifest-types-js"; +import { normalizePath, writeFileSync } from "@polywrap/os-js"; + +const run = async ( + abi: WrapAbi, + name: string, + type: "interface" | "wasm" | "plugin", + path: string +): Promise => { + const manifest: WrapManifest = { + version: latestWrapManifestVersion, + name, + type, + abi, + }; + + const bytes = await serializeWrapManifest(manifest); + + writeFileSync(path, bytes, { encoding: "binary" }); +}; + +export const generateWrapFile = async ( + abi: WrapAbi, + name: string, + type: "interface" | "wasm" | "plugin", + path: string, + quiet = false +): Promise => { + if (quiet) { + return run(abi, name, type, path); + } else { + const relativePath = displayPath(path); + return await withSpinner( + intlMsg.lib_helpers_manifest_outputText({ + path: normalizePath(relativePath), + }), + intlMsg.lib_helpers_manifest_outputError({ + path: normalizePath(relativePath), + }), + intlMsg.lib_helpers_manifest_outputWarning({ + path: normalizePath(relativePath), + }), + async (_spinner): Promise => { + await run(abi, name, type, path); + } + ); + } +}; diff --git a/packages/cli/src/lib/project/AppProject.ts b/packages/cli/src/lib/project/AppProject.ts index 7e8557922f..007eba9c17 100644 --- a/packages/cli/src/lib/project/AppProject.ts +++ b/packages/cli/src/lib/project/AppProject.ts @@ -9,7 +9,6 @@ import { import { AppManifest } from "@polywrap/polywrap-manifest-types-js"; import { Client } from "@polywrap/core-js"; -import { ComposerOutput } from "@polywrap/schema-compose"; import { bindSchema, BindOutput } from "@polywrap/schema-bind"; import path from "path"; import { WrapAbi } from "@polywrap/wrap-manifest-types-js"; @@ -95,24 +94,18 @@ export class AppProject extends Project { return path.join(dir, manifest.schema); } - public async getImportRedirects(): Promise< - { - uri: string; - schema: string; - }[] - > { + public async getImportAbis(): Promise { const manifest = await this.getManifest(); - return manifest.import_redirects || []; + return manifest.import_abis || []; } public async generateSchemaBindings( - composerOutput: ComposerOutput, + abi: WrapAbi, generationSubPath?: string ): Promise { return bindSchema({ projectName: await this.getName(), - abi: composerOutput.abi as WrapAbi, - schema: composerOutput.schema as string, + abi, outputDirAbs: this._getGenerationDirectory(generationSubPath), bindLanguage: appManifestLanguageToBindLanguage( await this.getManifestLanguage() diff --git a/packages/cli/src/lib/project/PluginProject.ts b/packages/cli/src/lib/project/PluginProject.ts index 138ef3a40a..1aa8f90159 100644 --- a/packages/cli/src/lib/project/PluginProject.ts +++ b/packages/cli/src/lib/project/PluginProject.ts @@ -10,9 +10,8 @@ import { resetDir } from "../system"; import { PluginManifest } from "@polywrap/polywrap-manifest-types-js"; import { bindSchema, BindOutput, BindOptions } from "@polywrap/schema-bind"; -import { ComposerOutput } from "@polywrap/schema-compose"; +import { WrapAbi } from "@polywrap/schema-parse"; import path from "path"; -import { WrapAbi } from "@polywrap/wrap-manifest-types-js"; export interface PluginProjectConfig extends ProjectConfig { pluginManifestPath: string; @@ -95,18 +94,13 @@ export class PluginProject extends Project { return path.join(dir, manifest.schema); } - public async getImportRedirects(): Promise< - { - uri: string; - schema: string; - }[] - > { + public async getImportAbis(): Promise { const manifest = await this.getManifest(); - return manifest.import_redirects || []; + return manifest.import_abis || []; } public async generateSchemaBindings( - composerOutput: ComposerOutput, + abi: WrapAbi, generationSubPath?: string ): Promise { const manifest = await this.getManifest(); @@ -124,8 +118,7 @@ export class PluginProject extends Project { const options: BindOptions = { projectName: manifest.name, - abi: composerOutput.abi as WrapAbi, - schema: composerOutput.schema as string, + abi, outputDirAbs: moduleDirectory, bindLanguage, }; diff --git a/packages/cli/src/lib/project/PolywrapProject.ts b/packages/cli/src/lib/project/PolywrapProject.ts index 9331c7f8c4..b6bdd8d300 100644 --- a/packages/cli/src/lib/project/PolywrapProject.ts +++ b/packages/cli/src/lib/project/PolywrapProject.ts @@ -27,13 +27,12 @@ import { } from "@polywrap/polywrap-manifest-types-js"; import { normalizePath } from "@polywrap/os-js"; import { BindOptions, BindOutput, bindSchema } from "@polywrap/schema-bind"; -import { ComposerOutput } from "@polywrap/schema-compose"; +import { WrapAbi } from "@polywrap/schema-parse"; import regexParser from "regex-parser"; import path from "path"; import { Schema as JsonSchema } from "jsonschema"; import fs from "fs"; import fsExtra from "fs-extra"; -import { WrapAbi } from "@polywrap/wrap-manifest-types-js"; export interface PolywrapProjectConfig extends ProjectConfig { polywrapManifestPath: string; @@ -136,18 +135,13 @@ export class PolywrapProject extends Project { return path.join(dir, manifest.schema); } - public async getImportRedirects(): Promise< - { - uri: string; - schema: string; - }[] - > { + public async getImportAbis(): Promise { const manifest = await this.getManifest(); - return manifest.import_redirects || []; + return manifest.import_abis || []; } public async generateSchemaBindings( - composerOutput: ComposerOutput, + abi: WrapAbi, generationSubPath?: string ): Promise { const manifest = await this.getManifest(); @@ -166,8 +160,7 @@ export class PolywrapProject extends Project { const options: BindOptions = { projectName: manifest.name, - abi: composerOutput.abi as WrapAbi, - schema: composerOutput.schema as string, + abi, outputDirAbs: moduleDirectory, bindLanguage, }; diff --git a/packages/cli/src/lib/project/Project.ts b/packages/cli/src/lib/project/Project.ts index e18c4802a3..e211f97313 100644 --- a/packages/cli/src/lib/project/Project.ts +++ b/packages/cli/src/lib/project/Project.ts @@ -6,8 +6,9 @@ import { CacheDirectoryConfig, } from "../"; +import { PolywrapManifest } from "@polywrap/polywrap-manifest-types-js"; import { BindOutput } from "@polywrap/schema-bind"; -import { ComposerOutput } from "@polywrap/schema-compose"; +import { Abi } from "@polywrap/schema-parse"; export interface ProjectConfig { rootDir: string; @@ -60,15 +61,10 @@ export abstract class Project { public abstract getSchemaNamedPath(): Promise; - public abstract getImportRedirects(): Promise< - { - uri: string; - schema: string; - }[] - >; + public abstract getImportAbis(): Promise; public abstract generateSchemaBindings( - composerOutput: ComposerOutput, + abi: Abi, generationSubPath?: string ): Promise; diff --git a/packages/interfaces/file-system/build-man/wrap.info b/packages/interfaces/file-system/build-man/wrap.info new file mode 100644 index 0000000000..3f7a1fad51 Binary files /dev/null and b/packages/interfaces/file-system/build-man/wrap.info differ diff --git a/packages/interfaces/file-system/package.json b/packages/interfaces/file-system/package.json index 6ea4cc6e71..0e52659a10 100644 --- a/packages/interfaces/file-system/package.json +++ b/packages/interfaces/file-system/package.json @@ -4,6 +4,7 @@ "version": "0.3.0", "scripts": { "build": "node ../../../dependencies/node_modules/polywrap/bin/polywrap build", + "build:patch": "node ../../cli/bin/polywrap build", "lint": "eslint --color -c ../../../.eslintrc.js .", "test:env:up": "npx polywrap infra up --modules=eth-ens-ipfs", "test:env:down": "npx polywrap infra down --modules=eth-ens-ipfs", diff --git a/packages/interfaces/file-system/polywrap.yaml b/packages/interfaces/file-system/polywrap.yaml index 553128b7d6..1abb1e0601 100644 --- a/packages/interfaces/file-system/polywrap.yaml +++ b/packages/interfaces/file-system/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: FileSystem language: interface deploy: ./polywrap.deploy.yaml diff --git a/packages/interfaces/ipfs/build-man/wrap.info b/packages/interfaces/ipfs/build-man/wrap.info new file mode 100644 index 0000000000..2b3dd654b2 Binary files /dev/null and b/packages/interfaces/ipfs/build-man/wrap.info differ diff --git a/packages/interfaces/ipfs/package.json b/packages/interfaces/ipfs/package.json index e6d2121211..24bbd0f58a 100644 --- a/packages/interfaces/ipfs/package.json +++ b/packages/interfaces/ipfs/package.json @@ -4,6 +4,7 @@ "version": "0.3.0", "scripts": { "build": "node ../../../dependencies/node_modules/polywrap/bin/polywrap build", + "build:patch": "node ../../cli/bin/polywrap build", "lint": "eslint --color -c ../../../.eslintrc.js .", "test:env:up": "npx polywrap infra up --modules=eth-ens-ipfs", "test:env:down": "npx polywrap infra down --modules=eth-ens-ipfs", diff --git a/packages/interfaces/ipfs/polywrap.yaml b/packages/interfaces/ipfs/polywrap.yaml index 396d47cd27..a0af758a21 100644 --- a/packages/interfaces/ipfs/polywrap.yaml +++ b/packages/interfaces/ipfs/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: IPFS language: interface deploy: ./polywrap.deploy.yaml diff --git a/packages/interfaces/logger/build-man/wrap.info b/packages/interfaces/logger/build-man/wrap.info new file mode 100644 index 0000000000..13c58c8eb5 Binary files /dev/null and b/packages/interfaces/logger/build-man/wrap.info differ diff --git a/packages/interfaces/logger/package.json b/packages/interfaces/logger/package.json index e8066c2263..cee78f9874 100644 --- a/packages/interfaces/logger/package.json +++ b/packages/interfaces/logger/package.json @@ -4,6 +4,7 @@ "version": "0.3.0", "scripts": { "build": "node ../../../dependencies/node_modules/polywrap/bin/polywrap build", + "build:patch": "node ../../cli/bin/polywrap build", "lint": "eslint --color -c ../../../.eslintrc.js .", "test:env:up": "npx polywrap infra up --modules=eth-ens-ipfs", "test:env:down": "npx polywrap infra down --modules=eth-ens-ipfs", diff --git a/packages/interfaces/logger/polywrap.deploy.yaml b/packages/interfaces/logger/polywrap.deploy.yaml index 53f91cac12..d9fefbd295 100644 --- a/packages/interfaces/logger/polywrap.deploy.yaml +++ b/packages/interfaces/logger/polywrap.deploy.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" stages: ipfs_deploy: package: ipfs diff --git a/packages/interfaces/logger/polywrap.yaml b/packages/interfaces/logger/polywrap.yaml index 13d0d88f93..fcb1e881b8 100644 --- a/packages/interfaces/logger/polywrap.yaml +++ b/packages/interfaces/logger/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: Logger deploy: ./polywrap.deploy.yaml language: interface diff --git a/packages/interfaces/uri-resolver/build-man/wrap.info b/packages/interfaces/uri-resolver/build-man/wrap.info new file mode 100644 index 0000000000..69a7a52c60 Binary files /dev/null and b/packages/interfaces/uri-resolver/build-man/wrap.info differ diff --git a/packages/interfaces/uri-resolver/package.json b/packages/interfaces/uri-resolver/package.json index 8e67db214b..57c87d7ae0 100644 --- a/packages/interfaces/uri-resolver/package.json +++ b/packages/interfaces/uri-resolver/package.json @@ -4,6 +4,7 @@ "version": "0.3.0", "scripts": { "build": "node ../../../dependencies/node_modules/polywrap/bin/polywrap build", + "build:patch": "node ../../cli/bin/polywrap build", "lint": "eslint --color -c ../../../.eslintrc.js .", "test:env:up": "npx polywrap infra up --modules=eth-ens-ipfs", "test:env:down": "npx polywrap infra down --modules=eth-ens-ipfs", diff --git a/packages/interfaces/uri-resolver/polywrap.yaml b/packages/interfaces/uri-resolver/polywrap.yaml index bcc03d17b9..90f34a5412 100644 --- a/packages/interfaces/uri-resolver/polywrap.yaml +++ b/packages/interfaces/uri-resolver/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: UriResolver deploy: ./polywrap.deploy.yaml language: interface diff --git a/packages/js/client/src/PolywrapClient.ts b/packages/js/client/src/PolywrapClient.ts index cc930b6d14..217a79834a 100644 --- a/packages/js/client/src/PolywrapClient.ts +++ b/packages/js/client/src/PolywrapClient.ts @@ -9,12 +9,10 @@ import { Env, GetEnvsOptions, GetFileOptions, - GetManifestOptions, GetImplementationsOptions, GetInterfacesOptions, GetPluginsOptions, GetRedirectsOptions, - GetSchemaOptions, InterfaceImplementations, InvokeOptions, InvokeResult, @@ -46,6 +44,7 @@ import { JobRunner, PluginPackage, RunOptions, + GetManifestOptions, } from "@polywrap/core-js"; import { msgpackEncode, msgpackDecode } from "@polywrap/msgpack-js"; import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; @@ -171,20 +170,10 @@ export class PolywrapClient implements Client { ); } - @Tracer.traceMethod("PolywrapClient: getSchema") - public async getSchema( - uri: TUri, - options: GetSchemaOptions = {} - ): Promise { - const wrapper = await this._loadWrapper(this._toUri(uri), options); - const client = contextualizeClient(this, options.contextId); - return await wrapper.getSchema(client); - } - @Tracer.traceMethod("PolywrapClient: getManifest") public async getManifest( uri: TUri, - options: GetManifestOptions + options: GetManifestOptions = {} ): Promise { const wrapper = await this._loadWrapper(this._toUri(uri), options); const client = contextualizeClient(this, options.contextId); @@ -857,19 +846,13 @@ const contextualizeClient = ( uri: TUri, options: GetFileOptions ) => { - return client.getFile(uri, options); - }, - getSchema: ( - uri: TUri, - options: GetSchemaOptions = {} - ) => { - return client.getSchema(uri, { ...options, contextId }); + return client.getFile(uri, { ...options, contextId }); }, getManifest: ( uri: TUri, - options: GetManifestOptions + options: GetManifestOptions = {} ) => { - return client.getManifest(uri, options); + return client.getManifest(uri, { ...options, contextId }); }, getImplementations: ( uri: TUri, diff --git a/packages/js/client/src/__tests__/core/interface-impls.spec.ts b/packages/js/client/src/__tests__/core/interface-impls.spec.ts index d1aa30e318..d7ce00a66a 100644 --- a/packages/js/client/src/__tests__/core/interface-impls.spec.ts +++ b/packages/js/client/src/__tests__/core/interface-impls.spec.ts @@ -5,6 +5,7 @@ import { PluginModule, PolywrapClient, } from "../.."; +import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; import { getClient } from "../utils/getClient"; jest.setTimeout(200000); @@ -75,10 +76,7 @@ describe("interface-impls", () => { uri: implementation4Uri, plugin: { factory: () => ({} as PluginModule<{}>), - manifest: { - schema: "", - implements: [], - }, + manifest: {} as WrapManifest }, }, ], @@ -137,20 +135,14 @@ describe("interface-impls", () => { uri: interface1Uri, plugin: { factory: () => ({} as PluginModule<{}>), - manifest: { - schema: "", - implements: [], - }, + manifest: {} as WrapManifest }, }, { uri: interface2Uri, plugin: { factory: () => ({} as PluginModule<{}>), - manifest: { - schema: "", - implements: [], - }, + manifest: {} as WrapManifest, }, }, ], @@ -189,10 +181,7 @@ describe("interface-impls", () => { uri: interfaceUri, plugin: { factory: () => ({} as PluginModule<{}>), - manifest: { - schema: "", - implements: [], - }, + manifest: {} as WrapManifest, }, }, ], @@ -287,10 +276,7 @@ describe("interface-impls", () => { uri: implementation1Uri, plugin: { factory: () => ({} as PluginModule<{}>), - manifest: { - schema: "", - implements: [new Uri(interfaceUri)], - }, + manifest: {} as WrapManifest, }, }, ], @@ -322,10 +308,7 @@ describe("interface-impls", () => { uri: implementation1Uri, plugin: { factory: () => ({} as PluginModule<{}>), - manifest: { - schema: "", - implements: [], - }, + manifest: {} as WrapManifest, }, }, ], diff --git a/packages/js/client/src/__tests__/core/plugin-wrapper.spec.ts b/packages/js/client/src/__tests__/core/plugin-wrapper.spec.ts index ab0b8efb35..e30c235823 100644 --- a/packages/js/client/src/__tests__/core/plugin-wrapper.spec.ts +++ b/packages/js/client/src/__tests__/core/plugin-wrapper.spec.ts @@ -1,5 +1,7 @@ import { PolywrapClient, PluginModule } from "../.."; import { getClient } from "../utils/getClient"; +import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; + jest.setTimeout(200000); @@ -40,14 +42,10 @@ describe("plugin-wrapper", () => { } return { - factory: () => - new MockMapPlugin({ - map: new Map().set("a", 1).set("b", 2), - }), - manifest: { - schema: ``, - implements: [], - }, + factory: () => new MockMapPlugin({ + map: new Map().set("a", 1).set("b", 2) + }), + manifest: {} as WrapManifest, }; }; @@ -60,10 +58,7 @@ describe("plugin-wrapper", () => { uri: implementationUri, plugin: { factory: () => ({} as PluginModule<{}>), - manifest: { - schema: "", - implements: [], - }, + manifest: {} as WrapManifest, }, }, ], @@ -74,32 +69,6 @@ describe("plugin-wrapper", () => { expect(pluginUris).toEqual([implementationUri].concat(defaultPlugins)); }); - test("getSchema -- plugin schema", async () => { - const testPluginUri = "ens/test-plugin.eth"; - const pluginSchema = "type Module { someMethod(arg: String): String }"; - - const pluginPackage = { - factory: () => ({} as PluginModule<{}>), - manifest: { - schema: pluginSchema, - implements: [], - }, - }; - - const client = new PolywrapClient({ - plugins: [ - { - uri: testPluginUri, - plugin: pluginPackage, - }, - ], - }); - - const schema: string = await client.getSchema(testPluginUri); - - expect(schema).toStrictEqual(pluginSchema); - }); - it("plugin map types", async () => { const implementationUri = "wrap://ens/some-implementation.eth"; const mockPlugin = mockMapPlugin(); @@ -143,10 +112,7 @@ describe("plugin-wrapper", () => { const pluginPackage = { factory: () => ({} as PluginModule<{}>), - manifest: { - schema: "", - implements: [], - }, + manifest: {} as WrapManifest, }; const client = new PolywrapClient({ @@ -174,18 +140,12 @@ describe("plugin-wrapper", () => { const pluginPackage1 = { factory: () => ({} as PluginModule<{}>), - manifest: { - schema: "", - implements: [], - }, + manifest: {} as WrapManifest, }; const pluginPackage2 = { factory: () => ({} as PluginModule<{}>), - manifest: { - schema: "", - implements: [], - }, + manifest: {} as WrapManifest, }; const client = new PolywrapClient({ @@ -211,4 +171,11 @@ describe("plugin-wrapper", () => { expect(registeredPlugin?.plugin).toEqual(pluginPackage1); }); + + test("get manifest should fetch wrap manifest from plugin", async () => { + const client = await getClient() + const manifest = await client.getManifest("ens/ipfs.polywrap.eth") + expect(manifest.type).toEqual("plugin") + expect(manifest.name).toEqual("Ipfs") + }) }); diff --git a/packages/js/client/src/__tests__/core/resolveUri.spec.ts b/packages/js/client/src/__tests__/core/resolveUri.spec.ts index ee7bc4a03a..f722092ec9 100644 --- a/packages/js/client/src/__tests__/core/resolveUri.spec.ts +++ b/packages/js/client/src/__tests__/core/resolveUri.spec.ts @@ -7,6 +7,7 @@ import { ResolveUriErrorType, } from "@polywrap/core-js"; import { getClient } from "../utils/getClient"; +import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; jest.setTimeout(200000); @@ -169,10 +170,7 @@ describe("resolveUri", () => { factory: () => { return ({} as unknown) as PluginModule<{}>; }, - manifest: { - schema: "", - implements: [], - }, + manifest: {} as WrapManifest, }, }, ], diff --git a/packages/js/client/src/__tests__/core/sanity.spec.ts b/packages/js/client/src/__tests__/core/sanity.spec.ts index f67fbcdbe2..034cf4fab0 100644 --- a/packages/js/client/src/__tests__/core/sanity.spec.ts +++ b/packages/js/client/src/__tests__/core/sanity.spec.ts @@ -1,4 +1,4 @@ -import { coreInterfaceUris, PluginModule } from "@polywrap/core-js"; +import { coreInterfaceUris } from "@polywrap/core-js"; import { Uri, PolywrapClient } from "../.."; jest.setTimeout(200000); @@ -73,30 +73,4 @@ describe("sanity", () => { }, ]); }); - - test("loadPolywrap - pass string or Uri", async () => { - const implementationUri = "wrap://ens/some-implementation.eth"; - const schemaStr = "test-schema"; - - const client = new PolywrapClient({ - plugins: [ - { - uri: implementationUri, - plugin: { - factory: () => ({} as PluginModule<{}>), - manifest: { - schema: schemaStr, - implements: [], - }, - }, - }, - ], - }); - - const schemaWhenString = await client.getSchema(implementationUri); - const schemaWhenUri = await client.getSchema(new Uri(implementationUri)); - - expect(schemaWhenString).toEqual(schemaStr); - expect(schemaWhenUri).toEqual(schemaStr); - }); }); diff --git a/packages/js/client/src/__tests__/core/wasm-wrapper.spec.ts b/packages/js/client/src/__tests__/core/wasm-wrapper.spec.ts index 09c79e3858..a8aab25e9d 100644 --- a/packages/js/client/src/__tests__/core/wasm-wrapper.spec.ts +++ b/packages/js/client/src/__tests__/core/wasm-wrapper.spec.ts @@ -1,8 +1,9 @@ import { buildWrapper } from "@polywrap/test-env-js"; import { msgpackDecode } from "@polywrap/msgpack-js"; -import { Uri, PluginModule, Subscription } from "../.."; import { GetPathToTestWrappers } from "@polywrap/test-cases"; import fs from "fs"; +import { Uri, PluginModule, Subscription } from "../.."; +import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; import { getClient } from "../utils/getClient"; import { makeMemoryStoragePlugin } from "../e2e/memory-storage"; @@ -31,10 +32,7 @@ describe("wasm-wrapper", () => { return { factory: () => new MockPlugin({}), - manifest: { - schema: ``, - implements: [], - }, + manifest: {} as WrapManifest, }; }; @@ -198,10 +196,7 @@ describe("wasm-wrapper", () => { uri: "ens/mock-plugin.eth", plugin: { factory: () => ({} as PluginModule<{}>), - manifest: { - schema: "", - implements: [], - }, + manifest: {} as WrapManifest }, }, ], diff --git a/packages/js/client/src/__tests__/e2e/env.spec.ts b/packages/js/client/src/__tests__/e2e/env.spec.ts index 9f56ca6eee..dbb24a125a 100644 --- a/packages/js/client/src/__tests__/e2e/env.spec.ts +++ b/packages/js/client/src/__tests__/e2e/env.spec.ts @@ -1,4 +1,5 @@ import { PluginModule } from "@polywrap/core-js"; +import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; import { getClient } from "../utils/getClient"; jest.setTimeout(200000); @@ -17,10 +18,7 @@ describe("env", () => { return { factory: () => new MockEnvPlugin({}), - manifest: { - schema: ``, - implements: [], - }, + manifest: {} as WrapManifest, }; }; diff --git a/packages/js/client/src/__tests__/e2e/memory-storage.ts b/packages/js/client/src/__tests__/e2e/memory-storage.ts index 4c0094533a..11130cce3e 100644 --- a/packages/js/client/src/__tests__/e2e/memory-storage.ts +++ b/packages/js/client/src/__tests__/e2e/memory-storage.ts @@ -1,4 +1,5 @@ import { Client, PluginFactory, PluginModule } from "@polywrap/core-js"; +import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; type NoConfig = Record; @@ -24,10 +25,7 @@ export const makeMemoryStoragePlugin: PluginFactory = () => { return { factory: () => new MemoryStoragePlugin({}), - manifest: { - schema: ``, - implements: [], - }, + manifest: {} as WrapManifest, }; }; diff --git a/packages/js/client/src/__tests__/e2e/wasm-as.spec.ts b/packages/js/client/src/__tests__/e2e/wasm-as.spec.ts index 7696b4f541..c73e995b36 100644 --- a/packages/js/client/src/__tests__/e2e/wasm-as.spec.ts +++ b/packages/js/client/src/__tests__/e2e/wasm-as.spec.ts @@ -271,7 +271,7 @@ describe("wasm-as test cases", () => { await buildWrapper(wrapperPath); await TestCases.runSimpleEnvTest( - await await getClient({ + await getClient({ envs: [ { uri: wrapperUri, diff --git a/packages/js/client/src/createPolywrapClient.ts b/packages/js/client/src/createPolywrapClient.ts index a68d704194..197a243aed 100644 --- a/packages/js/client/src/createPolywrapClient.ts +++ b/packages/js/client/src/createPolywrapClient.ts @@ -52,7 +52,6 @@ export const createPolywrapClient = Tracer.traceFunc( const pluginPackage = pluginFactory( (pluginConfigs as Record)[plugin] ); - if ( !pluginPackage || typeof pluginPackage !== "object" || diff --git a/packages/js/client/src/plugin/PluginWrapper.ts b/packages/js/client/src/plugin/PluginWrapper.ts index 94d4c00af6..0de639af91 100644 --- a/packages/js/client/src/plugin/PluginWrapper.ts +++ b/packages/js/client/src/plugin/PluginWrapper.ts @@ -7,8 +7,8 @@ import { PluginPackage, Uri, GetFileOptions, - Env, GetManifestOptions, + Env, isBuffer, } from "@polywrap/core-js"; import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; @@ -35,21 +35,18 @@ export class PluginWrapper extends Wrapper { } public async getFile( - _options: GetFileOptions, + _: GetFileOptions, _client: Client ): Promise { throw Error("client.getFile(...) is not implemented for Plugins."); } - public async getSchema(_client: Client): Promise { - return Promise.resolve(this._plugin.manifest.schema); - } - + @Tracer.traceMethod("PluginWrapper: getManifest") public async getManifest( - _options: GetManifestOptions, + _: GetManifestOptions, _client: Client ): Promise { - throw Error("client.getManifest(...) is not implemented for Plugins."); + return this._plugin.manifest; } @Tracer.traceMethod("PluginWrapper: invoke") diff --git a/packages/js/client/src/wasm/WasmWrapper.ts b/packages/js/client/src/wasm/WasmWrapper.ts index 37c6cade80..09473a5dc6 100644 --- a/packages/js/client/src/wasm/WasmWrapper.ts +++ b/packages/js/client/src/wasm/WasmWrapper.ts @@ -3,18 +3,18 @@ import { WrapExports } from "./types"; import { createImports } from "./imports"; import { - InvokeOptions, - InvokeResult, - InvocableResult, - Wrapper, - Uri, Client, combinePaths, Env, - UriResolverInterface, GetFileOptions, GetManifestOptions, + InvocableResult, + InvokeOptions, + InvokeResult, isBuffer, + Uri, + UriResolverInterface, + Wrapper, } from "@polywrap/core-js"; import { deserializeWrapManifest, @@ -54,7 +54,6 @@ export class WasmWrapper extends Wrapper { public static requiredExports: readonly string[] = ["_wrap_invoke"]; private _info: WrapManifest | undefined = undefined; - private _schema?: string; private _wasm: Uint8Array | undefined = undefined; constructor( @@ -126,14 +125,6 @@ export class WasmWrapper extends Wrapper { return this._info; } - this._schema = (await this.getFile( - { - path: "schema.graphql", - encoding: "utf-8", - }, - client - )) as string; - const moduleManifest = "wrap.info"; const data = (await this.getFile( @@ -228,21 +219,6 @@ export class WasmWrapper extends Wrapper { } } - @Tracer.traceMethod("WasmWrapper: getSchema") - public async getSchema(client: Client): Promise { - if (this._schema) { - return this._schema; - } - - const schema = "schema.graphql"; - this._schema = (await this.getFile( - { path: schema, encoding: "utf8" }, - client - )) as string; - - return this._schema; - } - @Tracer.traceMethod("WasmWrapper: _processInvokeResult") private _processInvokeResult( state: State, diff --git a/packages/js/core/src/__tests__/resolveUri.spec.ts b/packages/js/core/src/__tests__/resolveUri.spec.ts index cbffb343bf..839a95892c 100644 --- a/packages/js/core/src/__tests__/resolveUri.spec.ts +++ b/packages/js/core/src/__tests__/resolveUri.spec.ts @@ -23,7 +23,6 @@ import { SubscribeOptions, Subscription, PluginPackage, - GetManifestOptions, } from ".."; import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; @@ -71,7 +70,7 @@ describe("resolveUri", () => { subscribe: < TData extends Record = Record >( - _options: SubscribeOptions, string | Uri> + _options: SubscribeOptions ): Subscription => { return { frequency: 0, @@ -106,9 +105,8 @@ describe("resolveUri", () => { }, encoded: false }), - getSchema: (_client: Client): Promise => Promise.resolve(""), getFile: (options: GetFileOptions, client: Client) => Promise.resolve(""), - getManifest: (options: GetManifestOptions, client: Client) => Promise.resolve({} as WrapManifest) + getManifest: (client: Client) => Promise.resolve({} as WrapManifest) }; }; @@ -127,17 +125,16 @@ describe("resolveUri", () => { }, encoded: false }), - getSchema: (_client: Client): Promise => Promise.resolve(""), getFile: (options: GetFileOptions, client: Client) => Promise.resolve(""), - getManifest: (options: GetManifestOptions, client) => Promise.reject("") + getManifest: (client) => Promise.reject("") }; }; const testManifest: WrapManifest = { - version: "0.1.0", + version: "0.1", type: "wasm", name: "dog-cat", - abi: {} + abi: {} as never }; const ensWrapper = { @@ -159,7 +156,7 @@ describe("resolveUri", () => { return { manifest: args.authority === "ipfs" ? - msgpackEncode(testManifest) : + msgpackEncode(testManifest, true) : undefined, }; } @@ -173,7 +170,7 @@ describe("resolveUri", () => { return { manifest: args.authority === "my" ? - msgpackEncode(testManifest) : + msgpackEncode(testManifest, true) : undefined, }; }, @@ -184,10 +181,7 @@ describe("resolveUri", () => { uri: new Uri("ens/my-plugin"), plugin: { factory: () => ({} as PluginModule<{}>), - manifest: { - schema: "", - implements: [coreInterfaceUris.uriResolver], - }, + manifest: {} as WrapManifest, }, }, ]; @@ -384,10 +378,7 @@ describe("resolveUri", () => { uri: new Uri("some/wrapper"), plugin: { factory: () => ({} as PluginModule<{}>), - manifest: { - schema: "", - implements: [coreInterfaceUris.uriResolver], - }, + manifest: {} as WrapManifest, }, }, ]; diff --git a/packages/js/core/src/types/Client.ts b/packages/js/core/src/types/Client.ts index 234df0dc3d..fe27370f2a 100644 --- a/packages/js/core/src/types/Client.ts +++ b/packages/js/core/src/types/Client.ts @@ -36,8 +36,6 @@ export type GetEnvsOptions = Contextualized; export type GetUriResolversOptions = Contextualized; -export type GetSchemaOptions = Contextualized; - export interface GetManifestOptions extends Contextualized { noValidate?: boolean; } @@ -57,28 +55,23 @@ export interface Client SubscriptionHandler, WorkflowHandler, UriResolverHandler { - getRedirects(options: GetRedirectsOptions): readonly UriRedirect[]; + getRedirects(options?: GetRedirectsOptions): readonly UriRedirect[]; - getPlugins(options: GetPluginsOptions): readonly PluginRegistration[]; + getPlugins(options?: GetPluginsOptions): readonly PluginRegistration[]; getInterfaces( - options: GetInterfacesOptions + options?: GetInterfacesOptions ): readonly InterfaceImplementations[]; - getEnvs(options: GetEnvsOptions): readonly Env[]; + getEnvs(options?: GetEnvsOptions): readonly Env[]; getEnvByUri( uri: TUri, - options: GetEnvsOptions + options?: GetEnvsOptions ): Env | undefined; getUriResolvers(options: GetUriResolversOptions): readonly UriResolver[]; - getSchema( - uri: TUri, - options: GetSchemaOptions - ): Promise; - getManifest( uri: TUri, options: GetManifestOptions diff --git a/packages/js/core/src/types/Plugin.ts b/packages/js/core/src/types/Plugin.ts index 4ff082c4a9..1251ffcd1d 100644 --- a/packages/js/core/src/types/Plugin.ts +++ b/packages/js/core/src/types/Plugin.ts @@ -1,5 +1,7 @@ /* eslint-disable @typescript-eslint/naming-convention */ -import { Client, MaybeAsync, executeMaybeAsyncFunction, Uri } from "."; +import { Client, MaybeAsync, executeMaybeAsyncFunction } from "."; + +import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; /** * Invocable plugin method. @@ -71,18 +73,9 @@ export abstract class PluginModule< } } -/** The plugin package's manifest */ -export interface PluginPackageManifest { - /** The Wrapper's schema */ - schema: string; - - /** All interface schemas implemented by this plugin. */ - implements: Uri[]; -} - export type PluginPackage = { factory: () => PluginModule; - manifest: PluginPackageManifest; + manifest: WrapManifest; }; export type PluginFactory = ( diff --git a/packages/js/core/src/types/Wrapper.ts b/packages/js/core/src/types/Wrapper.ts index b11e46a6c1..c92f98e7e9 100644 --- a/packages/js/core/src/types/Wrapper.ts +++ b/packages/js/core/src/types/Wrapper.ts @@ -22,7 +22,7 @@ export abstract class Wrapper implements Invocable { * Invoke the Wrapper based on the provided [[InvokeOptions]] * * @param options Options for this invocation. - * @param client The client instance requesting this invocation. + * @param invoker The client instance requesting this invocation. * This client will be used for any sub-invokes that occur. */ public abstract invoke( @@ -46,20 +46,12 @@ export abstract class Wrapper implements Invocable { * Get a manifest from the Wrapper package. * Not implemented for plugin wrappers. * - * @param options Configuration options for manifest retrieval * @param client The client instance requesting the manifest. */ public abstract getManifest( options: GetManifestOptions, client: Client ): Promise; - - /** - * Get the Wrapper's schema - * - * @param client The client instance the schema. - */ - public abstract getSchema(client: Client): Promise; } export type WrapperCache = Map; diff --git a/packages/js/manifests/polywrap/src/__tests__/PolywrapManifest.spec.ts b/packages/js/manifests/polywrap/src/__tests__/PolywrapManifest.spec.ts index 232a17d7f8..092fc2fa27 100644 --- a/packages/js/manifests/polywrap/src/__tests__/PolywrapManifest.spec.ts +++ b/packages/js/manifests/polywrap/src/__tests__/PolywrapManifest.spec.ts @@ -32,4 +32,11 @@ describe("Polywrap Manifest Validation", () => { expect(() => deserializePolywrapManifest(manifest)).toThrowError(/instance.module is not of a type\(s\) string/); }); + it("Should deserialize manifest as expected", async () => { + const manifestPath = __dirname + "/manifest/polywrap/sanity/polywrap.yaml"; + const manifest = fs.readFileSync(manifestPath, "utf-8"); + + const info = deserializePolywrapManifest(manifest) + expect(info.name).toEqual("package-name") + }); }); diff --git a/packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/file-string-malformed/polywrap.yaml b/packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/file-string-malformed/polywrap.yaml index ea193bd853..27e7f6fb74 100644 --- a/packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/file-string-malformed/polywrap.yaml +++ b/packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/file-string-malformed/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: package-name language: wasm/assemblyscript module: ../index.ts diff --git a/packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/not-accepted-field/polywrap.yaml b/packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/not-accepted-field/polywrap.yaml index ffebba73d1..1bfb31b79a 100644 --- a/packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/not-accepted-field/polywrap.yaml +++ b/packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/not-accepted-field/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" language: wasm/assemblyscript schema: ../schema.graphql file: ../query.ts diff --git a/packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/required-field-missing/polywrap.yaml b/packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/required-field-missing/polywrap.yaml index 1be2c762ba..7a1354140b 100644 --- a/packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/required-field-missing/polywrap.yaml +++ b/packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/required-field-missing/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: "Required missing field" language: wasm/assemblyscript module: ../index.ts \ No newline at end of file diff --git a/packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/sanity/polywrap.yaml b/packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/sanity/polywrap.yaml new file mode 100644 index 0000000000..4b64bb7185 --- /dev/null +++ b/packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/sanity/polywrap.yaml @@ -0,0 +1,5 @@ +format: "0.2" +name: package-name +language: wasm/assemblyscript +module: ../index.ts +schema: ../schema.graphql diff --git a/packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/wrong-type/polywrap.yaml b/packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/wrong-type/polywrap.yaml index 11b9eddbe9..11c3d3b3bd 100644 --- a/packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/wrong-type/polywrap.yaml +++ b/packages/js/manifests/polywrap/src/__tests__/manifest/polywrap/wrong-type/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: "Wrong Type" language: wasm/assemblyscript module: 2345235235235 diff --git a/packages/js/manifests/polywrap/src/formats/polywrap.app/0.2.ts b/packages/js/manifests/polywrap/src/formats/polywrap.app/0.2.ts new file mode 100644 index 0000000000..7338a99169 --- /dev/null +++ b/packages/js/manifests/polywrap/src/formats/polywrap.app/0.2.ts @@ -0,0 +1,41 @@ +/* eslint-disable @typescript-eslint/naming-convention */ +/* tslint:disable */ +/** + * This file was automatically generated by json-schema-to-typescript. + * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, + * and run json-schema-to-typescript to regenerate this file. + */ + +export interface AppManifest { + /** + * Polywrap app manifest format version. + */ + format: "0.2"; + /** + * Name of this wrapper package. + */ + name: string; + /** + * Language in which the source code is written. + */ + language: string; + /** + * Path to graphql schema. + */ + schema: string; + /** + * Specify ABIs to be used for the import URIs within your schema. + */ + import_abis?: ImportAbis[]; + __type: "AppManifest"; +} +export interface ImportAbis { + /** + * One of the schema's import URI. + */ + uri: string; + /** + * Path to a local ABI (or schema). Supported file formats: [*.graphql, *.info, *.json, *.yaml] + */ + abi: string; +} diff --git a/packages/js/manifests/polywrap/src/formats/polywrap.app/index.ts b/packages/js/manifests/polywrap/src/formats/polywrap.app/index.ts index 5e42f7ded1..345a21045e 100644 --- a/packages/js/manifests/polywrap/src/formats/polywrap.app/index.ts +++ b/packages/js/manifests/polywrap/src/formats/polywrap.app/index.ts @@ -8,23 +8,29 @@ import { AppManifest as AppManifest_0_1 } from "./0.1"; +import { + AppManifest as AppManifest_0_2 +} from "./0.2"; export { AppManifest_0_1, + AppManifest_0_2, }; export enum AppManifestFormats { // NOTE: Patch fix for backwards compatability "v0.1.0" = "0.1.0", "v0.1" = "0.1", + "v0.2" = "0.2", } export type AnyAppManifest = | AppManifest_0_1 + | AppManifest_0_2 -export type AppManifest = AppManifest_0_1; +export type AppManifest = AppManifest_0_2; -export const latestAppManifestFormat = AppManifestFormats["v0.1"] +export const latestAppManifestFormat = AppManifestFormats["v0.2"] export { migrateAppManifest } from "./migrate"; diff --git a/packages/js/manifests/polywrap/src/formats/polywrap.app/migrate.ts b/packages/js/manifests/polywrap/src/formats/polywrap.app/migrate.ts index 8098e613ec..74cb80c892 100644 --- a/packages/js/manifests/polywrap/src/formats/polywrap.app/migrate.ts +++ b/packages/js/manifests/polywrap/src/formats/polywrap.app/migrate.ts @@ -11,12 +11,16 @@ import { latestAppManifestFormat } from "."; +import { + migrate as migrate_0_1_to_0_2 +} from "./migrators/0.1_to_0.2"; type Migrator = { [key in AppManifestFormats]?: (m: AnyAppManifest) => AppManifest; }; export const migrators: Migrator = { + "0.1": migrate_0_1_to_0_2, }; export function migrateAppManifest( @@ -33,5 +37,12 @@ export function migrateAppManifest( throw new Error(`Unrecognized AppManifestFormat "${manifest.format}"`); } - throw new Error(`This should never happen, AppManifest migrators is empty. from: ${from}, to: ${to}`); + const migrator = migrators[from]; + if (!migrator) { + throw new Error( + `Migrator from AppManifestFormat "${from}" to "${to}" is not available` + ); + } + + return migrator(manifest); } diff --git a/packages/js/manifests/polywrap/src/formats/polywrap.app/migrators/0.1_to_0.2.ts b/packages/js/manifests/polywrap/src/formats/polywrap.app/migrators/0.1_to_0.2.ts new file mode 100644 index 0000000000..def8fcadb6 --- /dev/null +++ b/packages/js/manifests/polywrap/src/formats/polywrap.app/migrators/0.1_to_0.2.ts @@ -0,0 +1,20 @@ +/* eslint-disable @typescript-eslint/naming-convention */ + +import { AppManifest as OldManifest } from "../0.1"; +import { AppManifest as NewManifest } from "../0.2"; + +export function migrate(oldFormat: OldManifest): NewManifest { + return { + __type: "AppManifest", + format: "0.2", + name: oldFormat.name, + language: oldFormat.language, + schema: oldFormat.schema, + import_abis: oldFormat.import_redirects?.map( + (redirect) => ({ + uri: redirect.uri, + abi: redirect.schema + }) + ) + }; +} diff --git a/packages/js/manifests/polywrap/src/formats/polywrap.app/validate.ts b/packages/js/manifests/polywrap/src/formats/polywrap.app/validate.ts index 5fe7ee082e..08bb2138f5 100644 --- a/packages/js/manifests/polywrap/src/formats/polywrap.app/validate.ts +++ b/packages/js/manifests/polywrap/src/formats/polywrap.app/validate.ts @@ -10,6 +10,7 @@ import { } from "."; import AppManifestSchema_0_1 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.app/0.1.json"; +import AppManifestSchema_0_2 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.app/0.2.json"; import { Schema, @@ -26,6 +27,7 @@ const schemas: AppManifestSchemas = { // NOTE: Patch fix for backwards compatability "0.1.0": AppManifestSchema_0_1, "0.1": AppManifestSchema_0_1, + "0.2": AppManifestSchema_0_2, }; const validator = new Validator(); diff --git a/packages/js/manifests/polywrap/src/formats/polywrap.plugin/0.2.ts b/packages/js/manifests/polywrap/src/formats/polywrap.plugin/0.2.ts new file mode 100644 index 0000000000..df234293be --- /dev/null +++ b/packages/js/manifests/polywrap/src/formats/polywrap.plugin/0.2.ts @@ -0,0 +1,45 @@ +/* eslint-disable @typescript-eslint/naming-convention */ +/* tslint:disable */ +/** + * This file was automatically generated by json-schema-to-typescript. + * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, + * and run json-schema-to-typescript to regenerate this file. + */ + +export interface PluginManifest { + /** + * Polywrap plugin manifest format version. + */ + format: "0.2"; + /** + * Plugin name. + */ + name: string; + /** + * Plugin language. + */ + language: string; + /** + * Path to Polywrap implementation. + */ + module?: string; + /** + * Path to graphql schema. + */ + schema: string; + /** + * Specify ABIs to be used for the import URIs within your schema. + */ + import_abis?: ImportAbis[]; + __type: "PluginManifest"; +} +export interface ImportAbis { + /** + * One of the schema's import URI. + */ + uri: string; + /** + * Path to a local ABI (or schema). Supported file formats: [*.graphql, *.info, *.json, *.yaml] + */ + abi: string; +} diff --git a/packages/js/manifests/polywrap/src/formats/polywrap.plugin/index.ts b/packages/js/manifests/polywrap/src/formats/polywrap.plugin/index.ts index 3f35d60ac5..1ac0751105 100644 --- a/packages/js/manifests/polywrap/src/formats/polywrap.plugin/index.ts +++ b/packages/js/manifests/polywrap/src/formats/polywrap.plugin/index.ts @@ -8,23 +8,29 @@ import { PluginManifest as PluginManifest_0_1 } from "./0.1"; +import { + PluginManifest as PluginManifest_0_2 +} from "./0.2"; export { PluginManifest_0_1, + PluginManifest_0_2, }; export enum PluginManifestFormats { // NOTE: Patch fix for backwards compatability "v0.1.0" = "0.1.0", "v0.1" = "0.1", + "v0.2" = "0.2", } export type AnyPluginManifest = | PluginManifest_0_1 + | PluginManifest_0_2 -export type PluginManifest = PluginManifest_0_1; +export type PluginManifest = PluginManifest_0_2; -export const latestPluginManifestFormat = PluginManifestFormats["v0.1"] +export const latestPluginManifestFormat = PluginManifestFormats["v0.2"] export { migratePluginManifest } from "./migrate"; diff --git a/packages/js/manifests/polywrap/src/formats/polywrap.plugin/migrate.ts b/packages/js/manifests/polywrap/src/formats/polywrap.plugin/migrate.ts index f66819b7b7..741f98c07c 100644 --- a/packages/js/manifests/polywrap/src/formats/polywrap.plugin/migrate.ts +++ b/packages/js/manifests/polywrap/src/formats/polywrap.plugin/migrate.ts @@ -11,12 +11,16 @@ import { latestPluginManifestFormat } from "."; +import { + migrate as migrate_0_1_to_0_2 +} from "./migrators/0.1_to_0.2"; type Migrator = { [key in PluginManifestFormats]?: (m: AnyPluginManifest) => PluginManifest; }; export const migrators: Migrator = { + "0.1": migrate_0_1_to_0_2, }; export function migratePluginManifest( @@ -33,5 +37,12 @@ export function migratePluginManifest( throw new Error(`Unrecognized PluginManifestFormat "${manifest.format}"`); } - throw new Error(`This should never happen, PluginManifest migrators is empty. from: ${from}, to: ${to}`); + const migrator = migrators[from]; + if (!migrator) { + throw new Error( + `Migrator from PluginManifestFormat "${from}" to "${to}" is not available` + ); + } + + return migrator(manifest); } diff --git a/packages/js/manifests/polywrap/src/formats/polywrap.plugin/migrators/0.1_to_0.2.ts b/packages/js/manifests/polywrap/src/formats/polywrap.plugin/migrators/0.1_to_0.2.ts new file mode 100644 index 0000000000..e0e817330e --- /dev/null +++ b/packages/js/manifests/polywrap/src/formats/polywrap.plugin/migrators/0.1_to_0.2.ts @@ -0,0 +1,21 @@ +/* eslint-disable @typescript-eslint/naming-convention */ + +import { PluginManifest as OldManifest } from "../0.1"; +import { PluginManifest as NewManifest } from "../0.2"; + +export function migrate(oldFormat: OldManifest): NewManifest { + return { + __type: "PluginManifest", + format: "0.2", + name: oldFormat.name, + language: oldFormat.language, + module: oldFormat.module, + schema: oldFormat.schema, + import_abis: oldFormat.import_redirects?.map( + (redirect) => ({ + uri: redirect.uri, + abi: redirect.schema + }) + ) + }; +} diff --git a/packages/js/manifests/polywrap/src/formats/polywrap.plugin/validate.ts b/packages/js/manifests/polywrap/src/formats/polywrap.plugin/validate.ts index de976b7646..a305e1e486 100644 --- a/packages/js/manifests/polywrap/src/formats/polywrap.plugin/validate.ts +++ b/packages/js/manifests/polywrap/src/formats/polywrap.plugin/validate.ts @@ -10,6 +10,7 @@ import { } from "."; import PluginManifestSchema_0_1 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.plugin/0.1.json"; +import PluginManifestSchema_0_2 from "@polywrap/polywrap-manifest-schemas/formats/polywrap.plugin/0.2.json"; import { Schema, @@ -26,6 +27,7 @@ const schemas: PluginManifestSchemas = { // NOTE: Patch fix for backwards compatability "0.1.0": PluginManifestSchema_0_1, "0.1": PluginManifestSchema_0_1, + "0.2": PluginManifestSchema_0_2, }; const validator = new Validator(); diff --git a/packages/js/manifests/polywrap/src/formats/polywrap/0.2.ts b/packages/js/manifests/polywrap/src/formats/polywrap/0.2.ts new file mode 100644 index 0000000000..91ce0dd6c3 --- /dev/null +++ b/packages/js/manifests/polywrap/src/formats/polywrap/0.2.ts @@ -0,0 +1,57 @@ +/* eslint-disable @typescript-eslint/naming-convention */ +/* tslint:disable */ +/** + * This file was automatically generated by json-schema-to-typescript. + * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, + * and run json-schema-to-typescript to regenerate this file. + */ + +export interface PolywrapManifest { + /** + * Polywrap manifest format version. + */ + format: "0.2"; + /** + * Name of this wrapper package. + */ + name: string; + /** + * Path to the wrapper build manifest file. + */ + build?: string; + /** + * Path to wrapper metadata manifest file. + */ + meta?: string; + /** + * Path to wrapper deploy manifest file. + */ + deploy?: string; + /** + * Language in which the source code is written. + */ + language: string; + /** + * Path to the module's entry point. + */ + module?: string; + /** + * Path to the module's graphql schema. + */ + schema: string; + /** + * Specify ABIs to be used for the import URIs within your schema. + */ + import_abis?: ImportAbis[]; + __type: "PolywrapManifest"; +} +export interface ImportAbis { + /** + * One of the schema's import URI. + */ + uri: string; + /** + * Path to a local ABI (or schema). Supported file formats: [*.graphql, *.info, *.json, *.yaml] + */ + abi: string; +} diff --git a/packages/js/manifests/polywrap/src/formats/polywrap/index.ts b/packages/js/manifests/polywrap/src/formats/polywrap/index.ts index 139d11c4b9..51492f1e9c 100644 --- a/packages/js/manifests/polywrap/src/formats/polywrap/index.ts +++ b/packages/js/manifests/polywrap/src/formats/polywrap/index.ts @@ -8,23 +8,29 @@ import { PolywrapManifest as PolywrapManifest_0_1 } from "./0.1"; +import { + PolywrapManifest as PolywrapManifest_0_2 +} from "./0.2"; export { PolywrapManifest_0_1, + PolywrapManifest_0_2, }; export enum PolywrapManifestFormats { // NOTE: Patch fix for backwards compatability "v0.1.0" = "0.1.0", "v0.1" = "0.1", + "v0.2" = "0.2", } export type AnyPolywrapManifest = | PolywrapManifest_0_1 + | PolywrapManifest_0_2 -export type PolywrapManifest = PolywrapManifest_0_1; +export type PolywrapManifest = PolywrapManifest_0_2; -export const latestPolywrapManifestFormat = PolywrapManifestFormats["v0.1"] +export const latestPolywrapManifestFormat = PolywrapManifestFormats["v0.2"] export { migratePolywrapManifest } from "./migrate"; diff --git a/packages/js/manifests/polywrap/src/formats/polywrap/migrate.ts b/packages/js/manifests/polywrap/src/formats/polywrap/migrate.ts index fe25c1417f..749d78b227 100644 --- a/packages/js/manifests/polywrap/src/formats/polywrap/migrate.ts +++ b/packages/js/manifests/polywrap/src/formats/polywrap/migrate.ts @@ -11,12 +11,16 @@ import { latestPolywrapManifestFormat } from "."; +import { + migrate as migrate_0_1_to_0_2 +} from "./migrators/0.1_to_0.2"; type Migrator = { [key in PolywrapManifestFormats]?: (m: AnyPolywrapManifest) => PolywrapManifest; }; export const migrators: Migrator = { + "0.1": migrate_0_1_to_0_2, }; export function migratePolywrapManifest( @@ -33,5 +37,12 @@ export function migratePolywrapManifest( throw new Error(`Unrecognized PolywrapManifestFormat "${manifest.format}"`); } - throw new Error(`This should never happen, PolywrapManifest migrators is empty. from: ${from}, to: ${to}`); + const migrator = migrators[from]; + if (!migrator) { + throw new Error( + `Migrator from PolywrapManifestFormat "${from}" to "${to}" is not available` + ); + } + + return migrator(manifest); } diff --git a/packages/js/manifests/polywrap/src/formats/polywrap/migrators/0.1_to_0.2.ts b/packages/js/manifests/polywrap/src/formats/polywrap/migrators/0.1_to_0.2.ts new file mode 100644 index 0000000000..ad9aae6a35 --- /dev/null +++ b/packages/js/manifests/polywrap/src/formats/polywrap/migrators/0.1_to_0.2.ts @@ -0,0 +1,24 @@ +/* eslint-disable @typescript-eslint/naming-convention */ + +import { PolywrapManifest as OldManifest } from "../0.1"; +import { PolywrapManifest as NewManifest } from "../0.2"; + +export function migrate(oldFormat: OldManifest): NewManifest { + return { + __type: "PolywrapManifest", + format: "0.2", + name: oldFormat.name, + build: oldFormat.build, + meta: oldFormat.meta, + deploy: oldFormat.deploy, + language: oldFormat.language, + module: oldFormat.module, + schema: oldFormat.schema, + import_abis: oldFormat.import_redirects?.map( + (redirect) => ({ + uri: redirect.uri, + abi: redirect.schema + }) + ) + }; +} diff --git a/packages/js/manifests/polywrap/src/formats/polywrap/validate.ts b/packages/js/manifests/polywrap/src/formats/polywrap/validate.ts index e6357a2f66..f2c53c6da1 100644 --- a/packages/js/manifests/polywrap/src/formats/polywrap/validate.ts +++ b/packages/js/manifests/polywrap/src/formats/polywrap/validate.ts @@ -10,6 +10,7 @@ import { } from "."; import PolywrapManifestSchema_0_1 from "@polywrap/polywrap-manifest-schemas/formats/polywrap/0.1.json"; +import PolywrapManifestSchema_0_2 from "@polywrap/polywrap-manifest-schemas/formats/polywrap/0.2.json"; import { Schema, @@ -26,6 +27,7 @@ const schemas: PolywrapManifestSchemas = { // NOTE: Patch fix for backwards compatability "0.1.0": PolywrapManifestSchema_0_1, "0.1": PolywrapManifestSchema_0_1, + "0.2": PolywrapManifestSchema_0_2, }; const validator = new Validator(); diff --git a/packages/js/manifests/wrap/scripts/generate.ts b/packages/js/manifests/wrap/scripts/generate.ts index 341f48d690..0f345557d2 100644 --- a/packages/js/manifests/wrap/scripts/generate.ts +++ b/packages/js/manifests/wrap/scripts/generate.ts @@ -66,7 +66,10 @@ async function generateFormatTypes() { wrapSchemas.push(bundledSchema); // Convert it to a TypeScript interface - const tsFile = await compile(bundledSchema as any, wrapSchema.id, {additionalProperties: false}); + let tsFile = await compile(bundledSchema as any, wrapSchema.id, {additionalProperties: false}); + + // Hack: replace all instances of `abi: unknown;` with `abi: Abi;` + tsFile = tsFile.replace("abi: unknown;", "abi: Abi;"); // Emit the result const tsOutputPath = path.join(wrapOutputDir, `${wrapVersion}.ts`); @@ -142,11 +145,12 @@ async function generateFormatTypes() { renderTemplate("migrate", migrateContext); // Generate a deserialize.ts file that exports a deserialization function for the latest format version - const deserializeContext = { + const serializeContext = { type: migrateContext.latest.type, }; - renderTemplate("deserialize", deserializeContext); + renderTemplate("deserialize", serializeContext); + renderTemplate("serialize", serializeContext); // Generate a validate.ts file that validates the manifest against the JSON schema const validateFormats = wrapModules.map((module) => { diff --git a/packages/js/manifests/wrap/scripts/templates/deserialize-ts.mustache b/packages/js/manifests/wrap/scripts/templates/deserialize-ts.mustache index 878d407f28..003f6b51b6 100644 --- a/packages/js/manifests/wrap/scripts/templates/deserialize-ts.mustache +++ b/packages/js/manifests/wrap/scripts/templates/deserialize-ts.mustache @@ -23,7 +23,7 @@ export async function deserializeWrapManifest( ): Promise { let anyWrapManifest: AnyWrapManifest | undefined; try { - anyWrapManifest = msgpackDecode(manifest) as AnyWrapManifest; + anyWrapManifest = msgpackDecode(manifest, true) as AnyWrapManifest; } catch (e) { throw Error(`Unable to parse WrapManifest: ${`[${new Uint8Array(manifest).toString()}]`}`); } diff --git a/packages/js/manifests/wrap/scripts/templates/index-ts.mustache b/packages/js/manifests/wrap/scripts/templates/index-ts.mustache index ea7177577f..716256dc3c 100644 --- a/packages/js/manifests/wrap/scripts/templates/index-ts.mustache +++ b/packages/js/manifests/wrap/scripts/templates/index-ts.mustache @@ -64,4 +64,5 @@ export type AnyWrapAbi = export { migrateWrapManifest } from "./migrate"; export { deserializeWrapManifest } from "./deserialize"; +export { serializeWrapManifest } from "./serialize"; export { validateWrapManifest } from "./validate"; diff --git a/packages/js/manifests/wrap/scripts/templates/serialize-ts.mustache b/packages/js/manifests/wrap/scripts/templates/serialize-ts.mustache new file mode 100644 index 0000000000..ba50dd48a4 --- /dev/null +++ b/packages/js/manifests/wrap/scripts/templates/serialize-ts.mustache @@ -0,0 +1,18 @@ +import { + AnyWrapManifest, + validateWrapManifest +} from "."; +import { SerializeManifestOptions } from "../../"; + +import { msgpackEncode } from "@polywrap/msgpack-js"; + +export async function serializeWrapManifest( + manifest: AnyWrapManifest, + options?: SerializeManifestOptions +): Promise { + if (!options || !options.noValidate) { + await validateWrapManifest(manifest); + } + + return msgpackEncode(manifest, true); +} diff --git a/packages/js/manifests/wrap/src/__tests__/WrapManifest.spec.ts b/packages/js/manifests/wrap/src/__tests__/WrapManifest.spec.ts index 8947aba80f..4c2628db7f 100644 --- a/packages/js/manifests/wrap/src/__tests__/WrapManifest.spec.ts +++ b/packages/js/manifests/wrap/src/__tests__/WrapManifest.spec.ts @@ -78,7 +78,7 @@ const testManifest: WrapManifest = { describe("Polywrap Manifest Validation", () => { it("Should succeed", async () => { - const manifest = msgpackEncode(testManifest); + const manifest = msgpackEncode(testManifest, true); expect(await deserializeWrapManifest(manifest)).toMatchObject(testManifest); }); @@ -86,7 +86,7 @@ describe("Polywrap Manifest Validation", () => { const manifest = msgpackEncode({ ...testManifest, version: "bad-str", - }); + }, true); await expect(() => deserializeWrapManifest(manifest)).rejects.toThrow( /Unrecognized WrapManifest schema version/ @@ -97,7 +97,7 @@ describe("Polywrap Manifest Validation", () => { const manifest = msgpackEncode({ ...testManifest, not_accepted_field: "not_accepted_field", - }); + }, true); await expect(() => deserializeWrapManifest(manifest)).rejects.toThrow( /not allowed to have the additional property "not_accepted_field"/ @@ -108,7 +108,7 @@ describe("Polywrap Manifest Validation", () => { const manifest = msgpackEncode({ ...testManifest, name: undefined, - }); + }, true); await expect(() => deserializeWrapManifest(manifest)).rejects.toThrow( /instance requires property "name"/ @@ -119,7 +119,7 @@ describe("Polywrap Manifest Validation", () => { const manifest = msgpackEncode({ ...testManifest, name: "foo bar baz $%##$@#$@#$@#$#$", - }); + }, true); await expect(() => deserializeWrapManifest(manifest)).rejects.toThrow( /instance.name does not match pattern/ @@ -130,7 +130,7 @@ describe("Polywrap Manifest Validation", () => { const manifest = msgpackEncode({ ...testManifest, abi: true, - }); + }, true); await expect(() => deserializeWrapManifest(manifest)).rejects.toThrow( /instance.abi is not of a type\(s\) object/ diff --git a/packages/js/manifests/wrap/src/deserialize.ts b/packages/js/manifests/wrap/src/deserialize.ts deleted file mode 100644 index 6f411a2b97..0000000000 --- a/packages/js/manifests/wrap/src/deserialize.ts +++ /dev/null @@ -1,3 +0,0 @@ -export interface DeserializeManifestOptions { - noValidate?: boolean; -} \ No newline at end of file diff --git a/packages/js/manifests/wrap/src/formats/wrap.info/deserialize.ts b/packages/js/manifests/wrap/src/formats/wrap.info/deserialize.ts index 878d407f28..003f6b51b6 100644 --- a/packages/js/manifests/wrap/src/formats/wrap.info/deserialize.ts +++ b/packages/js/manifests/wrap/src/formats/wrap.info/deserialize.ts @@ -23,7 +23,7 @@ export async function deserializeWrapManifest( ): Promise { let anyWrapManifest: AnyWrapManifest | undefined; try { - anyWrapManifest = msgpackDecode(manifest) as AnyWrapManifest; + anyWrapManifest = msgpackDecode(manifest, true) as AnyWrapManifest; } catch (e) { throw Error(`Unable to parse WrapManifest: ${`[${new Uint8Array(manifest).toString()}]`}`); } diff --git a/packages/js/manifests/wrap/src/formats/wrap.info/index.ts b/packages/js/manifests/wrap/src/formats/wrap.info/index.ts index a26080885a..a137a85ac3 100644 --- a/packages/js/manifests/wrap/src/formats/wrap.info/index.ts +++ b/packages/js/manifests/wrap/src/formats/wrap.info/index.ts @@ -50,4 +50,5 @@ export const latestWrapAbiVersion = "0.1"; export { migrateWrapManifest } from "./migrate"; export { deserializeWrapManifest } from "./deserialize"; +export { serializeWrapManifest } from "./serialize"; export { validateWrapManifest } from "./validate"; diff --git a/packages/js/manifests/wrap/src/formats/wrap.info/serialize.ts b/packages/js/manifests/wrap/src/formats/wrap.info/serialize.ts new file mode 100644 index 0000000000..ba50dd48a4 --- /dev/null +++ b/packages/js/manifests/wrap/src/formats/wrap.info/serialize.ts @@ -0,0 +1,18 @@ +import { + AnyWrapManifest, + validateWrapManifest +} from "."; +import { SerializeManifestOptions } from "../../"; + +import { msgpackEncode } from "@polywrap/msgpack-js"; + +export async function serializeWrapManifest( + manifest: AnyWrapManifest, + options?: SerializeManifestOptions +): Promise { + if (!options || !options.noValidate) { + await validateWrapManifest(manifest); + } + + return msgpackEncode(manifest, true); +} diff --git a/packages/js/manifests/wrap/src/index.ts b/packages/js/manifests/wrap/src/index.ts index 041f37b508..fbd606d0ca 100644 --- a/packages/js/manifests/wrap/src/index.ts +++ b/packages/js/manifests/wrap/src/index.ts @@ -1,2 +1,2 @@ export * from "./formats"; -export * from "./deserialize"; +export * from "./types"; diff --git a/packages/js/manifests/wrap/src/types.ts b/packages/js/manifests/wrap/src/types.ts new file mode 100644 index 0000000000..2a2366e0fe --- /dev/null +++ b/packages/js/manifests/wrap/src/types.ts @@ -0,0 +1,7 @@ +export interface DeserializeManifestOptions { + noValidate?: boolean; +} + +export interface SerializeManifestOptions { + noValidate?: boolean; +} diff --git a/packages/js/msgpack/src/index.ts b/packages/js/msgpack/src/index.ts index b571ef277e..97ee43341f 100644 --- a/packages/js/msgpack/src/index.ts +++ b/packages/js/msgpack/src/index.ts @@ -33,7 +33,35 @@ extensionCodec.register({ }, }); -export function msgpackEncode(object: unknown): Uint8Array { +const shouldIgnore = (obj: unknown) => + obj instanceof ArrayBuffer || ArrayBuffer.isView(obj) || obj instanceof Map; + +function sanitize(obj: Record): Record { + if (shouldIgnore(obj)) { + return obj; + } + + for (const key of Object.keys(obj)) { + if (typeof obj[key] === "function") { + delete obj[key]; + } else if (obj[key] === null || obj[key] === undefined) { + delete obj[key]; + } else if (typeof obj[key] === "object") { + const sanitized = sanitize(obj[key] as Record); + if (Array.isArray(obj[key])) { + obj[key] = Object.values(sanitized); + } else { + obj[key] = sanitized; + } + } + } + return obj; +} + +export function msgpackEncode( + object: unknown, + sanitizeObj = false +): Uint8Array { const encoder = new Encoder( extensionCodec, undefined, // context @@ -45,12 +73,24 @@ export function msgpackEncode(object: unknown): Uint8Array { undefined // forceIntegerToFloat ); + if (sanitizeObj && typeof object === "object" && !shouldIgnore(object)) { + const deepClone = JSON.parse(JSON.stringify(object)); + object = sanitize(deepClone); + } + return encoder.encode(object); } export function msgpackDecode( - buffer: ArrayLike | BufferSource + buffer: ArrayLike | BufferSource, + sanitizeResult = false ): unknown { const decoder = new Decoder(extensionCodec); - return decoder.decode(buffer); + const result = decoder.decode(buffer); + + if (sanitizeResult && typeof result === "object" && !shouldIgnore(result)) { + return sanitize(result as Record); + } else { + return result; + } } diff --git a/packages/js/plugins/ethereum/package.json b/packages/js/plugins/ethereum/package.json index 2152669b39..f5366636d4 100644 --- a/packages/js/plugins/ethereum/package.json +++ b/packages/js/plugins/ethereum/package.json @@ -12,8 +12,9 @@ "build" ], "scripts": { - "build": "rimraf ./build && yarn codegen && tsc --project tsconfig.build.json", + "build": "rimraf ./build && tsc --project tsconfig.build.json", "codegen": "node ../../../../dependencies/node_modules/polywrap/bin/polywrap plugin codegen", + "codegen:patch": "node ../../../cli/bin/polywrap plugin codegen && rimraf ./src/wrap", "lint": "eslint --color -c ../../../../.eslintrc.js src/", "test": "jest --passWithNoTests --runInBand --verbose", "test:ci": "jest --passWithNoTests --runInBand --detectOpenHandles --verbose", diff --git a/packages/js/plugins/ethereum/polywrap.plugin.yaml b/packages/js/plugins/ethereum/polywrap.plugin.yaml index 0e33040206..53cbec7ac9 100644 --- a/packages/js/plugins/ethereum/polywrap.plugin.yaml +++ b/packages/js/plugins/ethereum/polywrap.plugin.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" language: plugin/typescript name: Ethereum module: ./src/index.ts diff --git a/packages/js/plugins/ethereum/src/Connection.ts b/packages/js/plugins/ethereum/src/Connection.ts index a370075ca0..9bc730d6c7 100644 --- a/packages/js/plugins/ethereum/src/Connection.ts +++ b/packages/js/plugins/ethereum/src/Connection.ts @@ -1,4 +1,4 @@ -import { Connection as SchemaConnection } from "./wrap"; +import { Connection as SchemaConnection } from "./wrap-man"; import { Signer, ethers } from "ethers"; import { diff --git a/packages/js/plugins/ethereum/src/__tests__/e2e.spec.ts b/packages/js/plugins/ethereum/src/__tests__/e2e.spec.ts index e9582171db..ead35f1635 100644 --- a/packages/js/plugins/ethereum/src/__tests__/e2e.spec.ts +++ b/packages/js/plugins/ethereum/src/__tests__/e2e.spec.ts @@ -1,5 +1,5 @@ import { ethereumPlugin } from ".."; -import * as Schema from "../wrap"; +import * as Schema from "../wrap-man"; import { PolywrapClient, defaultIpfsProviders } from "@polywrap/client-js"; import { ensResolverPlugin } from "@polywrap/ens-resolver-plugin-js"; diff --git a/packages/js/plugins/ethereum/src/__tests__/integration/polywrap.yaml b/packages/js/plugins/ethereum/src/__tests__/integration/polywrap.yaml index d9531cd03f..60e07843f7 100644 --- a/packages/js/plugins/ethereum/src/__tests__/integration/polywrap.yaml +++ b/packages/js/plugins/ethereum/src/__tests__/integration/polywrap.yaml @@ -1,7 +1,9 @@ -format: 0.1.0 +format: "0.2" name: EthereumIntegration build: ./polywrap.build.yaml language: wasm/assemblyscript module: ./src/index.ts schema: ./src/schema.graphql - +import_abis: + - uri: "wrap://ens/ethereum.polywrap.eth" + abi: ../../../build/wrap.info diff --git a/packages/js/plugins/ethereum/src/index.ts b/packages/js/plugins/ethereum/src/index.ts index 8f5fda11d2..b550700762 100644 --- a/packages/js/plugins/ethereum/src/index.ts +++ b/packages/js/plugins/ethereum/src/index.ts @@ -37,7 +37,7 @@ import { Network, Connection as SchemaConnection, manifest, -} from "./wrap"; +} from "./wrap-man"; import { Connections, Connection, diff --git a/packages/js/plugins/ethereum/src/utils/mapping.ts b/packages/js/plugins/ethereum/src/utils/mapping.ts index 7d3d603ef2..eb15b01667 100644 --- a/packages/js/plugins/ethereum/src/utils/mapping.ts +++ b/packages/js/plugins/ethereum/src/utils/mapping.ts @@ -1,4 +1,4 @@ -import { Access, TxReceipt, TxResponse, TxRequest, Log } from "../wrap"; +import { Access, TxReceipt, TxResponse, TxRequest, Log } from "../wrap-man"; import { ethers } from "ethers"; diff --git a/packages/js/plugins/ethereum/src/wrap-man/index.ts b/packages/js/plugins/ethereum/src/wrap-man/index.ts new file mode 100644 index 0000000000..315871f96d --- /dev/null +++ b/packages/js/plugins/ethereum/src/wrap-man/index.ts @@ -0,0 +1,8 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +export * from "./wrap.info"; +export * from "./module"; +export * from "./types"; + +export { Client } from "@polywrap/core-js"; diff --git a/packages/js/plugins/ethereum/src/wrap-man/module.ts b/packages/js/plugins/ethereum/src/wrap-man/module.ts new file mode 100644 index 0000000000..a37c433540 --- /dev/null +++ b/packages/js/plugins/ethereum/src/wrap-man/module.ts @@ -0,0 +1,314 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +import * as Types from "./types"; + +import { + Client, + PluginModule, + MaybeAsync +} from "@polywrap/core-js"; + +export interface Args_callContractView extends Record { + address: Types.String; + method: Types.String; + args?: Array | null; + connection?: Types.Connection | null; +} + +export interface Args_callContractStatic extends Record { + address: Types.String; + method: Types.String; + args?: Array | null; + connection?: Types.Connection | null; + txOverrides?: Types.TxOverrides | null; +} + +export interface Args_getBalance extends Record { + address: Types.String; + blockTag?: Types.BigInt | null; + connection?: Types.Connection | null; +} + +export interface Args_encodeParams extends Record { + types: Array; + values: Array; +} + +export interface Args_encodeFunction extends Record { + method: Types.String; + args?: Array | null; +} + +export interface Args_solidityPack extends Record { + types: Array; + values: Array; +} + +export interface Args_solidityKeccak256 extends Record { + types: Array; + values: Array; +} + +export interface Args_soliditySha256 extends Record { + types: Array; + values: Array; +} + +export interface Args_getSignerAddress extends Record { + connection?: Types.Connection | null; +} + +export interface Args_getSignerBalance extends Record { + blockTag?: Types.BigInt | null; + connection?: Types.Connection | null; +} + +export interface Args_getSignerTransactionCount extends Record { + blockTag?: Types.BigInt | null; + connection?: Types.Connection | null; +} + +export interface Args_getGasPrice extends Record { + connection?: Types.Connection | null; +} + +export interface Args_estimateTransactionGas extends Record { + tx: Types.TxRequest; + connection?: Types.Connection | null; +} + +export interface Args_estimateContractCallGas extends Record { + address: Types.String; + method: Types.String; + args?: Array | null; + connection?: Types.Connection | null; + txOverrides?: Types.TxOverrides | null; +} + +export interface Args_checkAddress extends Record { + address: Types.String; +} + +export interface Args_toWei extends Record { + eth: Types.String; +} + +export interface Args_toEth extends Record { + wei: Types.BigInt; +} + +export interface Args_awaitTransaction extends Record { + txHash: Types.String; + confirmations: Types.UInt32; + timeout: Types.UInt32; + connection?: Types.Connection | null; +} + +export interface Args_waitForEvent extends Record { + address: Types.String; + event: Types.String; + args?: Array | null; + timeout?: Types.UInt32 | null; + connection?: Types.Connection | null; +} + +export interface Args_getNetwork extends Record { + connection?: Types.Connection | null; +} + +export interface Args_requestAccounts extends Record { + connection?: Types.Connection | null; +} + +export interface Args_callContractMethod extends Record { + address: Types.String; + method: Types.String; + args?: Array | null; + connection?: Types.Connection | null; + txOverrides?: Types.TxOverrides | null; +} + +export interface Args_callContractMethodAndWait extends Record { + address: Types.String; + method: Types.String; + args?: Array | null; + connection?: Types.Connection | null; + txOverrides?: Types.TxOverrides | null; +} + +export interface Args_sendTransaction extends Record { + tx: Types.TxRequest; + connection?: Types.Connection | null; +} + +export interface Args_sendTransactionAndWait extends Record { + tx: Types.TxRequest; + connection?: Types.Connection | null; +} + +export interface Args_deployContract extends Record { + abi: Types.String; + bytecode: Types.String; + args?: Array | null; + connection?: Types.Connection | null; +} + +export interface Args_signMessage extends Record { + message: Types.String; + connection?: Types.Connection | null; +} + +export interface Args_sendRPC extends Record { + method: Types.String; + params: Array; + connection?: Types.Connection | null; +} + +export abstract class Module< + TConfig +> extends PluginModule< + TConfig, + Types.Env +> { + + abstract callContractView( + args: Args_callContractView, + client: Client + ): MaybeAsync; + + abstract callContractStatic( + args: Args_callContractStatic, + client: Client + ): MaybeAsync; + + abstract getBalance( + args: Args_getBalance, + client: Client + ): MaybeAsync; + + abstract encodeParams( + args: Args_encodeParams, + client: Client + ): MaybeAsync; + + abstract encodeFunction( + args: Args_encodeFunction, + client: Client + ): MaybeAsync; + + abstract solidityPack( + args: Args_solidityPack, + client: Client + ): MaybeAsync; + + abstract solidityKeccak256( + args: Args_solidityKeccak256, + client: Client + ): MaybeAsync; + + abstract soliditySha256( + args: Args_soliditySha256, + client: Client + ): MaybeAsync; + + abstract getSignerAddress( + args: Args_getSignerAddress, + client: Client + ): MaybeAsync; + + abstract getSignerBalance( + args: Args_getSignerBalance, + client: Client + ): MaybeAsync; + + abstract getSignerTransactionCount( + args: Args_getSignerTransactionCount, + client: Client + ): MaybeAsync; + + abstract getGasPrice( + args: Args_getGasPrice, + client: Client + ): MaybeAsync; + + abstract estimateTransactionGas( + args: Args_estimateTransactionGas, + client: Client + ): MaybeAsync; + + abstract estimateContractCallGas( + args: Args_estimateContractCallGas, + client: Client + ): MaybeAsync; + + abstract checkAddress( + args: Args_checkAddress, + client: Client + ): MaybeAsync; + + abstract toWei( + args: Args_toWei, + client: Client + ): MaybeAsync; + + abstract toEth( + args: Args_toEth, + client: Client + ): MaybeAsync; + + abstract awaitTransaction( + args: Args_awaitTransaction, + client: Client + ): MaybeAsync; + + abstract waitForEvent( + args: Args_waitForEvent, + client: Client + ): MaybeAsync; + + abstract getNetwork( + args: Args_getNetwork, + client: Client + ): MaybeAsync; + + abstract requestAccounts( + args: Args_requestAccounts, + client: Client + ): MaybeAsync>; + + abstract callContractMethod( + args: Args_callContractMethod, + client: Client + ): MaybeAsync; + + abstract callContractMethodAndWait( + args: Args_callContractMethodAndWait, + client: Client + ): MaybeAsync; + + abstract sendTransaction( + args: Args_sendTransaction, + client: Client + ): MaybeAsync; + + abstract sendTransactionAndWait( + args: Args_sendTransactionAndWait, + client: Client + ): MaybeAsync; + + abstract deployContract( + args: Args_deployContract, + client: Client + ): MaybeAsync; + + abstract signMessage( + args: Args_signMessage, + client: Client + ): MaybeAsync; + + abstract sendRPC( + args: Args_sendRPC, + client: Client + ): MaybeAsync; +} diff --git a/packages/js/plugins/ethereum/src/wrap-man/types.ts b/packages/js/plugins/ethereum/src/wrap-man/types.ts new file mode 100644 index 0000000000..a4fde4d2d9 --- /dev/null +++ b/packages/js/plugins/ethereum/src/wrap-man/types.ts @@ -0,0 +1,145 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +// @ts-ignore +import * as Types from "./"; + +// @ts-ignore +import { + Client, + InvokeResult +} from "@polywrap/core-js"; + +export type UInt = number; +export type UInt8 = number; +export type UInt16 = number; +export type UInt32 = number; +export type Int = number; +export type Int8 = number; +export type Int16 = number; +export type Int32 = number; +export type Bytes = Uint8Array; +export type BigInt = string; +export type BigNumber = string; +export type Json = string; +export type String = string; +export type Boolean = boolean; + +/// Env START /// +export interface Env extends Record { + connection?: Types.Connection | null; +} +/// Env END /// + +/// Objects START /// +export interface TxReceipt { + to: Types.String; + from: Types.String; + contractAddress: Types.String; + transactionIndex: Types.UInt32; + root?: Types.String | null; + gasUsed: Types.BigInt; + logsBloom: Types.String; + transactionHash: Types.String; + logs: Array; + blockNumber: Types.BigInt; + blockHash: Types.String; + confirmations: Types.UInt32; + cumulativeGasUsed: Types.BigInt; + effectiveGasPrice: Types.BigInt; + byzantium: Types.Boolean; + type: Types.UInt32; + status?: Types.UInt32 | null; +} + +export interface TxResponse { + hash: Types.String; + to?: Types.String | null; + from: Types.String; + nonce: Types.UInt32; + gasLimit: Types.BigInt; + gasPrice?: Types.BigInt | null; + data: Types.String; + value: Types.BigInt; + chainId: Types.BigInt; + blockNumber?: Types.BigInt | null; + blockHash?: Types.String | null; + timestamp?: Types.UInt32 | null; + confirmations: Types.UInt32; + raw?: Types.String | null; + r?: Types.String | null; + s?: Types.String | null; + v?: Types.UInt32 | null; + type?: Types.UInt32 | null; + accessList?: Array | null; +} + +export interface TxRequest { + to?: Types.String | null; + from?: Types.String | null; + nonce?: Types.UInt32 | null; + gasLimit?: Types.BigInt | null; + gasPrice?: Types.BigInt | null; + data?: Types.String | null; + value?: Types.BigInt | null; + chainId?: Types.BigInt | null; + type?: Types.UInt32 | null; +} + +export interface TxOverrides { + gasLimit?: Types.BigInt | null; + gasPrice?: Types.BigInt | null; + value?: Types.BigInt | null; +} + +export interface StaticTxResult { + result: Types.String; + error: Types.Boolean; +} + +export interface Log { + blockNumber: Types.BigInt; + blockHash: Types.String; + transactionIndex: Types.UInt32; + removed: Types.Boolean; + address: Types.String; + data: Types.String; + topics: Array; + transactionHash: Types.String; + logIndex: Types.UInt32; +} + +export interface EventNotification { + data: Types.String; + address: Types.String; + log: Types.Log; +} + +export interface Access { + address: Types.String; + storageKeys: Array; +} + +export interface Connection { + node?: Types.String | null; + networkNameOrChainId?: Types.String | null; +} + +export interface Network { + name: Types.String; + chainId: Types.BigInt; + ensAddress?: Types.String | null; +} + +/// Objects END /// + +/// Enums START /// +/// Enums END /// + +/// Imported Objects START /// + +/// Imported Objects END /// + +/// Imported Modules START /// + +/// Imported Modules END /// diff --git a/packages/js/plugins/ethereum/src/wrap-man/wrap.info.ts b/packages/js/plugins/ethereum/src/wrap-man/wrap.info.ts new file mode 100644 index 0000000000..254bc9f56f --- /dev/null +++ b/packages/js/plugins/ethereum/src/wrap-man/wrap.info.ts @@ -0,0 +1,2482 @@ +import { WrapManifest, WrapAbi } from "@polywrap/wrap-manifest-types-js"; + +const abi: WrapAbi = { + version: "0.1", + objectTypes: [ + { + type: "TxReceipt", + kind: 1, + properties: [ + { + type: "String", + name: "to", + required: true, + kind: 34, + scalar: { + type: "String", + name: "to", + required: true, + kind: 4, + }, + }, + { + type: "String", + name: "from", + required: true, + kind: 34, + scalar: { + type: "String", + name: "from", + required: true, + kind: 4, + }, + }, + { + type: "String", + name: "contractAddress", + required: true, + kind: 34, + scalar: { + type: "String", + name: "contractAddress", + required: true, + kind: 4, + }, + }, + { + type: "UInt32", + name: "transactionIndex", + required: true, + kind: 34, + scalar: { + type: "UInt32", + name: "transactionIndex", + required: true, + kind: 4, + }, + }, + { + type: "String", + name: "root", + kind: 34, + scalar: { + type: "String", + name: "root", + kind: 4, + }, + }, + { + type: "BigInt", + name: "gasUsed", + required: true, + kind: 34, + scalar: { + type: "BigInt", + name: "gasUsed", + required: true, + kind: 4, + }, + }, + { + type: "String", + name: "logsBloom", + required: true, + kind: 34, + scalar: { + type: "String", + name: "logsBloom", + required: true, + kind: 4, + }, + }, + { + type: "String", + name: "transactionHash", + required: true, + kind: 34, + scalar: { + type: "String", + name: "transactionHash", + required: true, + kind: 4, + }, + }, + { + type: "[Log]", + name: "logs", + required: true, + kind: 34, + array: { + type: "[Log]", + name: "logs", + required: true, + kind: 18, + object: { + type: "Log", + name: "logs", + required: true, + kind: 8192, + }, + item: { + type: "Log", + name: "logs", + required: true, + kind: 8192, + }, + }, + }, + { + type: "BigInt", + name: "blockNumber", + required: true, + kind: 34, + scalar: { + type: "BigInt", + name: "blockNumber", + required: true, + kind: 4, + }, + }, + { + type: "String", + name: "blockHash", + required: true, + kind: 34, + scalar: { + type: "String", + name: "blockHash", + required: true, + kind: 4, + }, + }, + { + type: "UInt32", + name: "confirmations", + required: true, + kind: 34, + scalar: { + type: "UInt32", + name: "confirmations", + required: true, + kind: 4, + }, + }, + { + type: "BigInt", + name: "cumulativeGasUsed", + required: true, + kind: 34, + scalar: { + type: "BigInt", + name: "cumulativeGasUsed", + required: true, + kind: 4, + }, + }, + { + type: "BigInt", + name: "effectiveGasPrice", + required: true, + kind: 34, + scalar: { + type: "BigInt", + name: "effectiveGasPrice", + required: true, + kind: 4, + }, + }, + { + type: "Boolean", + name: "byzantium", + required: true, + kind: 34, + scalar: { + type: "Boolean", + name: "byzantium", + required: true, + kind: 4, + }, + }, + { + type: "UInt32", + name: "type", + required: true, + kind: 34, + scalar: { + type: "UInt32", + name: "type", + required: true, + kind: 4, + }, + }, + { + type: "UInt32", + name: "status", + kind: 34, + scalar: { + type: "UInt32", + name: "status", + kind: 4, + }, + }, + ], + }, + { + type: "TxResponse", + kind: 1, + properties: [ + { + type: "String", + name: "hash", + required: true, + kind: 34, + scalar: { + type: "String", + name: "hash", + required: true, + kind: 4, + }, + }, + { + type: "String", + name: "to", + kind: 34, + scalar: { + type: "String", + name: "to", + kind: 4, + }, + }, + { + type: "String", + name: "from", + required: true, + kind: 34, + scalar: { + type: "String", + name: "from", + required: true, + kind: 4, + }, + }, + { + type: "UInt32", + name: "nonce", + required: true, + kind: 34, + scalar: { + type: "UInt32", + name: "nonce", + required: true, + kind: 4, + }, + }, + { + type: "BigInt", + name: "gasLimit", + required: true, + kind: 34, + scalar: { + type: "BigInt", + name: "gasLimit", + required: true, + kind: 4, + }, + }, + { + type: "BigInt", + name: "gasPrice", + kind: 34, + scalar: { + type: "BigInt", + name: "gasPrice", + kind: 4, + }, + }, + { + type: "String", + name: "data", + required: true, + kind: 34, + scalar: { + type: "String", + name: "data", + required: true, + kind: 4, + }, + }, + { + type: "BigInt", + name: "value", + required: true, + kind: 34, + scalar: { + type: "BigInt", + name: "value", + required: true, + kind: 4, + }, + }, + { + type: "BigInt", + name: "chainId", + required: true, + kind: 34, + scalar: { + type: "BigInt", + name: "chainId", + required: true, + kind: 4, + }, + }, + { + type: "BigInt", + name: "blockNumber", + kind: 34, + scalar: { + type: "BigInt", + name: "blockNumber", + kind: 4, + }, + }, + { + type: "String", + name: "blockHash", + kind: 34, + scalar: { + type: "String", + name: "blockHash", + kind: 4, + }, + }, + { + type: "UInt32", + name: "timestamp", + kind: 34, + scalar: { + type: "UInt32", + name: "timestamp", + kind: 4, + }, + }, + { + type: "UInt32", + name: "confirmations", + required: true, + kind: 34, + scalar: { + type: "UInt32", + name: "confirmations", + required: true, + kind: 4, + }, + }, + { + type: "String", + name: "raw", + kind: 34, + scalar: { + type: "String", + name: "raw", + kind: 4, + }, + }, + { + type: "String", + name: "r", + kind: 34, + scalar: { + type: "String", + name: "r", + kind: 4, + }, + }, + { + type: "String", + name: "s", + kind: 34, + scalar: { + type: "String", + name: "s", + kind: 4, + }, + }, + { + type: "UInt32", + name: "v", + kind: 34, + scalar: { + type: "UInt32", + name: "v", + kind: 4, + }, + }, + { + type: "UInt32", + name: "type", + kind: 34, + scalar: { + type: "UInt32", + name: "type", + kind: 4, + }, + }, + { + type: "[Access]", + name: "accessList", + kind: 34, + array: { + type: "[Access]", + name: "accessList", + kind: 18, + object: { + type: "Access", + name: "accessList", + required: true, + kind: 8192, + }, + item: { + type: "Access", + name: "accessList", + required: true, + kind: 8192, + }, + }, + }, + ], + }, + { + type: "TxRequest", + kind: 1, + properties: [ + { + type: "String", + name: "to", + kind: 34, + scalar: { + type: "String", + name: "to", + kind: 4, + }, + }, + { + type: "String", + name: "from", + kind: 34, + scalar: { + type: "String", + name: "from", + kind: 4, + }, + }, + { + type: "UInt32", + name: "nonce", + kind: 34, + scalar: { + type: "UInt32", + name: "nonce", + kind: 4, + }, + }, + { + type: "BigInt", + name: "gasLimit", + kind: 34, + scalar: { + type: "BigInt", + name: "gasLimit", + kind: 4, + }, + }, + { + type: "BigInt", + name: "gasPrice", + kind: 34, + scalar: { + type: "BigInt", + name: "gasPrice", + kind: 4, + }, + }, + { + type: "String", + name: "data", + kind: 34, + scalar: { + type: "String", + name: "data", + kind: 4, + }, + }, + { + type: "BigInt", + name: "value", + kind: 34, + scalar: { + type: "BigInt", + name: "value", + kind: 4, + }, + }, + { + type: "BigInt", + name: "chainId", + kind: 34, + scalar: { + type: "BigInt", + name: "chainId", + kind: 4, + }, + }, + { + type: "UInt32", + name: "type", + kind: 34, + scalar: { + type: "UInt32", + name: "type", + kind: 4, + }, + }, + ], + }, + { + type: "TxOverrides", + kind: 1, + properties: [ + { + type: "BigInt", + name: "gasLimit", + kind: 34, + scalar: { + type: "BigInt", + name: "gasLimit", + kind: 4, + }, + }, + { + type: "BigInt", + name: "gasPrice", + kind: 34, + scalar: { + type: "BigInt", + name: "gasPrice", + kind: 4, + }, + }, + { + type: "BigInt", + name: "value", + kind: 34, + scalar: { + type: "BigInt", + name: "value", + kind: 4, + }, + }, + ], + }, + { + type: "StaticTxResult", + kind: 1, + properties: [ + { + type: "String", + name: "result", + required: true, + kind: 34, + scalar: { + type: "String", + name: "result", + required: true, + kind: 4, + }, + }, + { + type: "Boolean", + name: "error", + required: true, + kind: 34, + scalar: { + type: "Boolean", + name: "error", + required: true, + kind: 4, + }, + }, + ], + }, + { + type: "Log", + kind: 1, + properties: [ + { + type: "BigInt", + name: "blockNumber", + required: true, + kind: 34, + scalar: { + type: "BigInt", + name: "blockNumber", + required: true, + kind: 4, + }, + }, + { + type: "String", + name: "blockHash", + required: true, + kind: 34, + scalar: { + type: "String", + name: "blockHash", + required: true, + kind: 4, + }, + }, + { + type: "UInt32", + name: "transactionIndex", + required: true, + kind: 34, + scalar: { + type: "UInt32", + name: "transactionIndex", + required: true, + kind: 4, + }, + }, + { + type: "Boolean", + name: "removed", + required: true, + kind: 34, + scalar: { + type: "Boolean", + name: "removed", + required: true, + kind: 4, + }, + }, + { + type: "String", + name: "address", + required: true, + kind: 34, + scalar: { + type: "String", + name: "address", + required: true, + kind: 4, + }, + }, + { + type: "String", + name: "data", + required: true, + kind: 34, + scalar: { + type: "String", + name: "data", + required: true, + kind: 4, + }, + }, + { + type: "[String]", + name: "topics", + required: true, + kind: 34, + array: { + type: "[String]", + name: "topics", + required: true, + kind: 18, + scalar: { + type: "String", + name: "topics", + required: true, + kind: 4, + }, + item: { + type: "String", + name: "topics", + required: true, + kind: 4, + }, + }, + }, + { + type: "String", + name: "transactionHash", + required: true, + kind: 34, + scalar: { + type: "String", + name: "transactionHash", + required: true, + kind: 4, + }, + }, + { + type: "UInt32", + name: "logIndex", + required: true, + kind: 34, + scalar: { + type: "UInt32", + name: "logIndex", + required: true, + kind: 4, + }, + }, + ], + }, + { + type: "EventNotification", + kind: 1, + properties: [ + { + type: "String", + name: "data", + required: true, + kind: 34, + scalar: { + type: "String", + name: "data", + required: true, + kind: 4, + }, + }, + { + type: "String", + name: "address", + required: true, + kind: 34, + scalar: { + type: "String", + name: "address", + required: true, + kind: 4, + }, + }, + { + type: "Log", + name: "log", + required: true, + kind: 34, + object: { + type: "Log", + name: "log", + required: true, + kind: 8192, + }, + }, + ], + }, + { + type: "Access", + kind: 1, + properties: [ + { + type: "String", + name: "address", + required: true, + kind: 34, + scalar: { + type: "String", + name: "address", + required: true, + kind: 4, + }, + }, + { + type: "[String]", + name: "storageKeys", + required: true, + kind: 34, + array: { + type: "[String]", + name: "storageKeys", + required: true, + kind: 18, + scalar: { + type: "String", + name: "storageKeys", + required: true, + kind: 4, + }, + item: { + type: "String", + name: "storageKeys", + required: true, + kind: 4, + }, + }, + }, + ], + }, + { + type: "Connection", + kind: 1, + properties: [ + { + type: "String", + name: "node", + kind: 34, + scalar: { + type: "String", + name: "node", + kind: 4, + }, + }, + { + type: "String", + name: "networkNameOrChainId", + kind: 34, + scalar: { + type: "String", + name: "networkNameOrChainId", + kind: 4, + }, + }, + ], + }, + { + type: "Network", + kind: 1, + properties: [ + { + type: "String", + name: "name", + required: true, + kind: 34, + scalar: { + type: "String", + name: "name", + required: true, + kind: 4, + }, + }, + { + type: "BigInt", + name: "chainId", + required: true, + kind: 34, + scalar: { + type: "BigInt", + name: "chainId", + required: true, + kind: 4, + }, + }, + { + type: "String", + name: "ensAddress", + kind: 34, + scalar: { + type: "String", + name: "ensAddress", + kind: 4, + }, + }, + ], + }, + ], + moduleType: { + type: "Module", + kind: 128, + methods: [ + { + type: "Method", + name: "callContractView", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "address", + required: true, + kind: 34, + scalar: { + type: "String", + name: "address", + required: true, + kind: 4, + }, + }, + { + type: "String", + name: "method", + required: true, + kind: 34, + scalar: { + type: "String", + name: "method", + required: true, + kind: 4, + }, + }, + { + type: "[String]", + name: "args", + kind: 34, + array: { + type: "[String]", + name: "args", + kind: 18, + scalar: { + type: "String", + name: "args", + required: true, + kind: 4, + }, + item: { + type: "String", + name: "args", + required: true, + kind: 4, + }, + }, + }, + { + type: "Connection", + name: "connection", + kind: 34, + object: { + type: "Connection", + name: "connection", + kind: 8192, + }, + }, + ], + return: { + type: "String", + name: "callContractView", + required: true, + kind: 34, + scalar: { + type: "String", + name: "callContractView", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "callContractStatic", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "address", + required: true, + kind: 34, + scalar: { + type: "String", + name: "address", + required: true, + kind: 4, + }, + }, + { + type: "String", + name: "method", + required: true, + kind: 34, + scalar: { + type: "String", + name: "method", + required: true, + kind: 4, + }, + }, + { + type: "[String]", + name: "args", + kind: 34, + array: { + type: "[String]", + name: "args", + kind: 18, + scalar: { + type: "String", + name: "args", + required: true, + kind: 4, + }, + item: { + type: "String", + name: "args", + required: true, + kind: 4, + }, + }, + }, + { + type: "Connection", + name: "connection", + kind: 34, + object: { + type: "Connection", + name: "connection", + kind: 8192, + }, + }, + { + type: "TxOverrides", + name: "txOverrides", + kind: 34, + object: { + type: "TxOverrides", + name: "txOverrides", + kind: 8192, + }, + }, + ], + return: { + type: "StaticTxResult", + name: "callContractStatic", + required: true, + kind: 34, + object: { + type: "StaticTxResult", + name: "callContractStatic", + required: true, + kind: 8192, + }, + }, + }, + { + type: "Method", + name: "getBalance", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "address", + required: true, + kind: 34, + scalar: { + type: "String", + name: "address", + required: true, + kind: 4, + }, + }, + { + type: "BigInt", + name: "blockTag", + kind: 34, + scalar: { + type: "BigInt", + name: "blockTag", + kind: 4, + }, + }, + { + type: "Connection", + name: "connection", + kind: 34, + object: { + type: "Connection", + name: "connection", + kind: 8192, + }, + }, + ], + return: { + type: "BigInt", + name: "getBalance", + required: true, + kind: 34, + scalar: { + type: "BigInt", + name: "getBalance", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "encodeParams", + required: true, + kind: 64, + arguments: [ + { + type: "[String]", + name: "types", + required: true, + kind: 34, + array: { + type: "[String]", + name: "types", + required: true, + kind: 18, + scalar: { + type: "String", + name: "types", + required: true, + kind: 4, + }, + item: { + type: "String", + name: "types", + required: true, + kind: 4, + }, + }, + }, + { + type: "[String]", + name: "values", + required: true, + kind: 34, + array: { + type: "[String]", + name: "values", + required: true, + kind: 18, + scalar: { + type: "String", + name: "values", + required: true, + kind: 4, + }, + item: { + type: "String", + name: "values", + required: true, + kind: 4, + }, + }, + }, + ], + return: { + type: "String", + name: "encodeParams", + required: true, + kind: 34, + scalar: { + type: "String", + name: "encodeParams", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "encodeFunction", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "method", + required: true, + kind: 34, + scalar: { + type: "String", + name: "method", + required: true, + kind: 4, + }, + }, + { + type: "[String]", + name: "args", + kind: 34, + array: { + type: "[String]", + name: "args", + kind: 18, + scalar: { + type: "String", + name: "args", + required: true, + kind: 4, + }, + item: { + type: "String", + name: "args", + required: true, + kind: 4, + }, + }, + }, + ], + return: { + type: "String", + name: "encodeFunction", + required: true, + kind: 34, + scalar: { + type: "String", + name: "encodeFunction", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "solidityPack", + required: true, + kind: 64, + arguments: [ + { + type: "[String]", + name: "types", + required: true, + kind: 34, + array: { + type: "[String]", + name: "types", + required: true, + kind: 18, + scalar: { + type: "String", + name: "types", + required: true, + kind: 4, + }, + item: { + type: "String", + name: "types", + required: true, + kind: 4, + }, + }, + }, + { + type: "[String]", + name: "values", + required: true, + kind: 34, + array: { + type: "[String]", + name: "values", + required: true, + kind: 18, + scalar: { + type: "String", + name: "values", + required: true, + kind: 4, + }, + item: { + type: "String", + name: "values", + required: true, + kind: 4, + }, + }, + }, + ], + return: { + type: "String", + name: "solidityPack", + required: true, + kind: 34, + scalar: { + type: "String", + name: "solidityPack", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "solidityKeccak256", + required: true, + kind: 64, + arguments: [ + { + type: "[String]", + name: "types", + required: true, + kind: 34, + array: { + type: "[String]", + name: "types", + required: true, + kind: 18, + scalar: { + type: "String", + name: "types", + required: true, + kind: 4, + }, + item: { + type: "String", + name: "types", + required: true, + kind: 4, + }, + }, + }, + { + type: "[String]", + name: "values", + required: true, + kind: 34, + array: { + type: "[String]", + name: "values", + required: true, + kind: 18, + scalar: { + type: "String", + name: "values", + required: true, + kind: 4, + }, + item: { + type: "String", + name: "values", + required: true, + kind: 4, + }, + }, + }, + ], + return: { + type: "String", + name: "solidityKeccak256", + required: true, + kind: 34, + scalar: { + type: "String", + name: "solidityKeccak256", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "soliditySha256", + required: true, + kind: 64, + arguments: [ + { + type: "[String]", + name: "types", + required: true, + kind: 34, + array: { + type: "[String]", + name: "types", + required: true, + kind: 18, + scalar: { + type: "String", + name: "types", + required: true, + kind: 4, + }, + item: { + type: "String", + name: "types", + required: true, + kind: 4, + }, + }, + }, + { + type: "[String]", + name: "values", + required: true, + kind: 34, + array: { + type: "[String]", + name: "values", + required: true, + kind: 18, + scalar: { + type: "String", + name: "values", + required: true, + kind: 4, + }, + item: { + type: "String", + name: "values", + required: true, + kind: 4, + }, + }, + }, + ], + return: { + type: "String", + name: "soliditySha256", + required: true, + kind: 34, + scalar: { + type: "String", + name: "soliditySha256", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "getSignerAddress", + required: true, + kind: 64, + arguments: [ + { + type: "Connection", + name: "connection", + kind: 34, + object: { + type: "Connection", + name: "connection", + kind: 8192, + }, + }, + ], + return: { + type: "String", + name: "getSignerAddress", + required: true, + kind: 34, + scalar: { + type: "String", + name: "getSignerAddress", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "getSignerBalance", + required: true, + kind: 64, + arguments: [ + { + type: "BigInt", + name: "blockTag", + kind: 34, + scalar: { + type: "BigInt", + name: "blockTag", + kind: 4, + }, + }, + { + type: "Connection", + name: "connection", + kind: 34, + object: { + type: "Connection", + name: "connection", + kind: 8192, + }, + }, + ], + return: { + type: "BigInt", + name: "getSignerBalance", + required: true, + kind: 34, + scalar: { + type: "BigInt", + name: "getSignerBalance", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "getSignerTransactionCount", + required: true, + kind: 64, + arguments: [ + { + type: "BigInt", + name: "blockTag", + kind: 34, + scalar: { + type: "BigInt", + name: "blockTag", + kind: 4, + }, + }, + { + type: "Connection", + name: "connection", + kind: 34, + object: { + type: "Connection", + name: "connection", + kind: 8192, + }, + }, + ], + return: { + type: "BigInt", + name: "getSignerTransactionCount", + required: true, + kind: 34, + scalar: { + type: "BigInt", + name: "getSignerTransactionCount", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "getGasPrice", + required: true, + kind: 64, + arguments: [ + { + type: "Connection", + name: "connection", + kind: 34, + object: { + type: "Connection", + name: "connection", + kind: 8192, + }, + }, + ], + return: { + type: "BigInt", + name: "getGasPrice", + required: true, + kind: 34, + scalar: { + type: "BigInt", + name: "getGasPrice", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "estimateTransactionGas", + required: true, + kind: 64, + arguments: [ + { + type: "TxRequest", + name: "tx", + required: true, + kind: 34, + object: { + type: "TxRequest", + name: "tx", + required: true, + kind: 8192, + }, + }, + { + type: "Connection", + name: "connection", + kind: 34, + object: { + type: "Connection", + name: "connection", + kind: 8192, + }, + }, + ], + return: { + type: "BigInt", + name: "estimateTransactionGas", + required: true, + kind: 34, + scalar: { + type: "BigInt", + name: "estimateTransactionGas", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "estimateContractCallGas", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "address", + required: true, + kind: 34, + scalar: { + type: "String", + name: "address", + required: true, + kind: 4, + }, + }, + { + type: "String", + name: "method", + required: true, + kind: 34, + scalar: { + type: "String", + name: "method", + required: true, + kind: 4, + }, + }, + { + type: "[String]", + name: "args", + kind: 34, + array: { + type: "[String]", + name: "args", + kind: 18, + scalar: { + type: "String", + name: "args", + required: true, + kind: 4, + }, + item: { + type: "String", + name: "args", + required: true, + kind: 4, + }, + }, + }, + { + type: "Connection", + name: "connection", + kind: 34, + object: { + type: "Connection", + name: "connection", + kind: 8192, + }, + }, + { + type: "TxOverrides", + name: "txOverrides", + kind: 34, + object: { + type: "TxOverrides", + name: "txOverrides", + kind: 8192, + }, + }, + ], + return: { + type: "BigInt", + name: "estimateContractCallGas", + required: true, + kind: 34, + scalar: { + type: "BigInt", + name: "estimateContractCallGas", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "checkAddress", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "address", + required: true, + kind: 34, + scalar: { + type: "String", + name: "address", + required: true, + kind: 4, + }, + }, + ], + return: { + type: "Boolean", + name: "checkAddress", + required: true, + kind: 34, + scalar: { + type: "Boolean", + name: "checkAddress", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "toWei", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "eth", + required: true, + kind: 34, + scalar: { + type: "String", + name: "eth", + required: true, + kind: 4, + }, + }, + ], + return: { + type: "BigInt", + name: "toWei", + required: true, + kind: 34, + scalar: { + type: "BigInt", + name: "toWei", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "toEth", + required: true, + kind: 64, + arguments: [ + { + type: "BigInt", + name: "wei", + required: true, + kind: 34, + scalar: { + type: "BigInt", + name: "wei", + required: true, + kind: 4, + }, + }, + ], + return: { + type: "String", + name: "toEth", + required: true, + kind: 34, + scalar: { + type: "String", + name: "toEth", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "awaitTransaction", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "txHash", + required: true, + kind: 34, + scalar: { + type: "String", + name: "txHash", + required: true, + kind: 4, + }, + }, + { + type: "UInt32", + name: "confirmations", + required: true, + kind: 34, + scalar: { + type: "UInt32", + name: "confirmations", + required: true, + kind: 4, + }, + }, + { + type: "UInt32", + name: "timeout", + required: true, + kind: 34, + scalar: { + type: "UInt32", + name: "timeout", + required: true, + kind: 4, + }, + }, + { + type: "Connection", + name: "connection", + kind: 34, + object: { + type: "Connection", + name: "connection", + kind: 8192, + }, + }, + ], + return: { + type: "TxReceipt", + name: "awaitTransaction", + required: true, + kind: 34, + object: { + type: "TxReceipt", + name: "awaitTransaction", + required: true, + kind: 8192, + }, + }, + }, + { + type: "Method", + name: "waitForEvent", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "address", + required: true, + kind: 34, + scalar: { + type: "String", + name: "address", + required: true, + kind: 4, + }, + }, + { + type: "String", + name: "event", + required: true, + kind: 34, + scalar: { + type: "String", + name: "event", + required: true, + kind: 4, + }, + }, + { + type: "[String]", + name: "args", + kind: 34, + array: { + type: "[String]", + name: "args", + kind: 18, + scalar: { + type: "String", + name: "args", + required: true, + kind: 4, + }, + item: { + type: "String", + name: "args", + required: true, + kind: 4, + }, + }, + }, + { + type: "UInt32", + name: "timeout", + kind: 34, + scalar: { + type: "UInt32", + name: "timeout", + kind: 4, + }, + }, + { + type: "Connection", + name: "connection", + kind: 34, + object: { + type: "Connection", + name: "connection", + kind: 8192, + }, + }, + ], + return: { + type: "EventNotification", + name: "waitForEvent", + required: true, + kind: 34, + object: { + type: "EventNotification", + name: "waitForEvent", + required: true, + kind: 8192, + }, + }, + }, + { + type: "Method", + name: "getNetwork", + required: true, + kind: 64, + arguments: [ + { + type: "Connection", + name: "connection", + kind: 34, + object: { + type: "Connection", + name: "connection", + kind: 8192, + }, + }, + ], + return: { + type: "Network", + name: "getNetwork", + required: true, + kind: 34, + object: { + type: "Network", + name: "getNetwork", + required: true, + kind: 8192, + }, + }, + }, + { + type: "Method", + name: "requestAccounts", + required: true, + kind: 64, + arguments: [ + { + type: "Connection", + name: "connection", + kind: 34, + object: { + type: "Connection", + name: "connection", + kind: 8192, + }, + }, + ], + return: { + type: "[String]", + name: "requestAccounts", + required: true, + kind: 34, + array: { + type: "[String]", + name: "requestAccounts", + required: true, + kind: 18, + scalar: { + type: "String", + name: "requestAccounts", + required: true, + kind: 4, + }, + item: { + type: "String", + name: "requestAccounts", + required: true, + kind: 4, + }, + }, + }, + }, + { + type: "Method", + name: "callContractMethod", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "address", + required: true, + kind: 34, + scalar: { + type: "String", + name: "address", + required: true, + kind: 4, + }, + }, + { + type: "String", + name: "method", + required: true, + kind: 34, + scalar: { + type: "String", + name: "method", + required: true, + kind: 4, + }, + }, + { + type: "[String]", + name: "args", + kind: 34, + array: { + type: "[String]", + name: "args", + kind: 18, + scalar: { + type: "String", + name: "args", + required: true, + kind: 4, + }, + item: { + type: "String", + name: "args", + required: true, + kind: 4, + }, + }, + }, + { + type: "Connection", + name: "connection", + kind: 34, + object: { + type: "Connection", + name: "connection", + kind: 8192, + }, + }, + { + type: "TxOverrides", + name: "txOverrides", + kind: 34, + object: { + type: "TxOverrides", + name: "txOverrides", + kind: 8192, + }, + }, + ], + return: { + type: "TxResponse", + name: "callContractMethod", + required: true, + kind: 34, + object: { + type: "TxResponse", + name: "callContractMethod", + required: true, + kind: 8192, + }, + }, + }, + { + type: "Method", + name: "callContractMethodAndWait", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "address", + required: true, + kind: 34, + scalar: { + type: "String", + name: "address", + required: true, + kind: 4, + }, + }, + { + type: "String", + name: "method", + required: true, + kind: 34, + scalar: { + type: "String", + name: "method", + required: true, + kind: 4, + }, + }, + { + type: "[String]", + name: "args", + kind: 34, + array: { + type: "[String]", + name: "args", + kind: 18, + scalar: { + type: "String", + name: "args", + required: true, + kind: 4, + }, + item: { + type: "String", + name: "args", + required: true, + kind: 4, + }, + }, + }, + { + type: "Connection", + name: "connection", + kind: 34, + object: { + type: "Connection", + name: "connection", + kind: 8192, + }, + }, + { + type: "TxOverrides", + name: "txOverrides", + kind: 34, + object: { + type: "TxOverrides", + name: "txOverrides", + kind: 8192, + }, + }, + ], + return: { + type: "TxReceipt", + name: "callContractMethodAndWait", + required: true, + kind: 34, + object: { + type: "TxReceipt", + name: "callContractMethodAndWait", + required: true, + kind: 8192, + }, + }, + }, + { + type: "Method", + name: "sendTransaction", + required: true, + kind: 64, + arguments: [ + { + type: "TxRequest", + name: "tx", + required: true, + kind: 34, + object: { + type: "TxRequest", + name: "tx", + required: true, + kind: 8192, + }, + }, + { + type: "Connection", + name: "connection", + kind: 34, + object: { + type: "Connection", + name: "connection", + kind: 8192, + }, + }, + ], + return: { + type: "TxResponse", + name: "sendTransaction", + required: true, + kind: 34, + object: { + type: "TxResponse", + name: "sendTransaction", + required: true, + kind: 8192, + }, + }, + }, + { + type: "Method", + name: "sendTransactionAndWait", + required: true, + kind: 64, + arguments: [ + { + type: "TxRequest", + name: "tx", + required: true, + kind: 34, + object: { + type: "TxRequest", + name: "tx", + required: true, + kind: 8192, + }, + }, + { + type: "Connection", + name: "connection", + kind: 34, + object: { + type: "Connection", + name: "connection", + kind: 8192, + }, + }, + ], + return: { + type: "TxReceipt", + name: "sendTransactionAndWait", + required: true, + kind: 34, + object: { + type: "TxReceipt", + name: "sendTransactionAndWait", + required: true, + kind: 8192, + }, + }, + }, + { + type: "Method", + name: "deployContract", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "abi", + required: true, + kind: 34, + scalar: { + type: "String", + name: "abi", + required: true, + kind: 4, + }, + }, + { + type: "String", + name: "bytecode", + required: true, + kind: 34, + scalar: { + type: "String", + name: "bytecode", + required: true, + kind: 4, + }, + }, + { + type: "[String]", + name: "args", + kind: 34, + array: { + type: "[String]", + name: "args", + kind: 18, + scalar: { + type: "String", + name: "args", + required: true, + kind: 4, + }, + item: { + type: "String", + name: "args", + required: true, + kind: 4, + }, + }, + }, + { + type: "Connection", + name: "connection", + kind: 34, + object: { + type: "Connection", + name: "connection", + kind: 8192, + }, + }, + ], + return: { + type: "String", + name: "deployContract", + required: true, + kind: 34, + scalar: { + type: "String", + name: "deployContract", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "signMessage", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "message", + required: true, + kind: 34, + scalar: { + type: "String", + name: "message", + required: true, + kind: 4, + }, + }, + { + type: "Connection", + name: "connection", + kind: 34, + object: { + type: "Connection", + name: "connection", + kind: 8192, + }, + }, + ], + return: { + type: "String", + name: "signMessage", + required: true, + kind: 34, + scalar: { + type: "String", + name: "signMessage", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "sendRPC", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "method", + required: true, + kind: 34, + scalar: { + type: "String", + name: "method", + required: true, + kind: 4, + }, + }, + { + type: "[String]", + name: "params", + required: true, + kind: 34, + array: { + type: "[String]", + name: "params", + required: true, + kind: 18, + scalar: { + type: "String", + name: "params", + required: true, + kind: 4, + }, + item: { + type: "String", + name: "params", + required: true, + kind: 4, + }, + }, + }, + { + type: "Connection", + name: "connection", + kind: 34, + object: { + type: "Connection", + name: "connection", + kind: 8192, + }, + }, + ], + return: { + type: "String", + name: "sendRPC", + kind: 34, + scalar: { + type: "String", + name: "sendRPC", + kind: 4, + }, + }, + }, + ], + }, + envType: { + type: "Env", + kind: 65536, + properties: [ + { + type: "Connection", + name: "connection", + kind: 34, + object: { + type: "Connection", + name: "connection", + kind: 8192, + }, + }, + ], + }, +}; + +export const manifest: WrapManifest = { + name: "Ethereum", + type: "plugin", + version: "0.1", + abi: abi +}; diff --git a/packages/js/plugins/file-system/package.json b/packages/js/plugins/file-system/package.json index f0fd8f6e0e..eb64d20570 100644 --- a/packages/js/plugins/file-system/package.json +++ b/packages/js/plugins/file-system/package.json @@ -12,8 +12,9 @@ "build" ], "scripts": { - "build": "rimraf ./build && yarn codegen && tsc --project tsconfig.build.json", + "build": "rimraf ./build && tsc --project tsconfig.build.json", "codegen": "node ../../../../dependencies/node_modules/polywrap/bin/polywrap plugin codegen", + "codegen:patch": "node ../../../cli/bin/polywrap plugin codegen && rimraf ./src/wrap", "lint": "eslint --color -c ../../../../.eslintrc.js src/", "test": "jest --passWithNoTests --runInBand --verbose", "test:ci": "jest --passWithNoTests --runInBand --verbose", diff --git a/packages/js/plugins/file-system/polywrap.plugin.yaml b/packages/js/plugins/file-system/polywrap.plugin.yaml index 5cbcea1779..56d55a49b4 100644 --- a/packages/js/plugins/file-system/polywrap.plugin.yaml +++ b/packages/js/plugins/file-system/polywrap.plugin.yaml @@ -1,8 +1,8 @@ -format: 0.1.0 +format: "0.2" language: plugin/typescript name: FileSystem module: ./src/index.ts schema: ./src/schema.graphql -import_redirects: +import_abis: - uri: "ens/fs.polywrap.eth" - schema: ../../../interfaces/file-system/build/schema.graphql + abi: ../../../interfaces/file-system/build-man/wrap.info diff --git a/packages/js/plugins/file-system/src/__tests__/e2e.spec.ts b/packages/js/plugins/file-system/src/__tests__/e2e.spec.ts index d9a2474139..e5032d6e7b 100644 --- a/packages/js/plugins/file-system/src/__tests__/e2e.spec.ts +++ b/packages/js/plugins/file-system/src/__tests__/e2e.spec.ts @@ -1,6 +1,6 @@ import { fileSystemPlugin } from "../index"; import { PolywrapClient, PolywrapClientConfig } from "@polywrap/client-js"; -import { FileSystem_Module, FileSystem_EncodingEnum } from "../wrap"; +import { FileSystem_Module, FileSystem_EncodingEnum } from "../wrap-man"; import fs from "fs"; import path from "path"; import fileSystemEncodingToBufferEncoding from "../utils/fileSystemEncodingToBufferEncoding"; diff --git a/packages/js/plugins/file-system/src/index.ts b/packages/js/plugins/file-system/src/index.ts index 66b46ef9f7..663225d9e4 100644 --- a/packages/js/plugins/file-system/src/index.ts +++ b/packages/js/plugins/file-system/src/index.ts @@ -9,7 +9,7 @@ import { Args_mkdir, Args_rm, Args_rmdir, -} from "./wrap"; +} from "./wrap-man"; import fileSystemEncodingToBufferEncoding from "./utils/fileSystemEncodingToBufferEncoding"; import fs from "fs"; diff --git a/packages/js/plugins/file-system/src/utils/fileSystemEncodingToBufferEncoding.ts b/packages/js/plugins/file-system/src/utils/fileSystemEncodingToBufferEncoding.ts index ea7871cbbd..76ea7948b4 100644 --- a/packages/js/plugins/file-system/src/utils/fileSystemEncodingToBufferEncoding.ts +++ b/packages/js/plugins/file-system/src/utils/fileSystemEncodingToBufferEncoding.ts @@ -1,4 +1,4 @@ -import { FileSystem_Encoding, FileSystem_EncodingEnum } from "../wrap"; +import { FileSystem_Encoding, FileSystem_EncodingEnum } from "../wrap-man"; const fileSystemEncodingToBufferEncoding = ( encoding: FileSystem_Encoding | null | undefined diff --git a/packages/js/plugins/file-system/src/wrap-man/index.ts b/packages/js/plugins/file-system/src/wrap-man/index.ts new file mode 100644 index 0000000000..315871f96d --- /dev/null +++ b/packages/js/plugins/file-system/src/wrap-man/index.ts @@ -0,0 +1,8 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +export * from "./wrap.info"; +export * from "./module"; +export * from "./types"; + +export { Client } from "@polywrap/core-js"; diff --git a/packages/js/plugins/file-system/src/wrap-man/module.ts b/packages/js/plugins/file-system/src/wrap-man/module.ts new file mode 100644 index 0000000000..ba85991542 --- /dev/null +++ b/packages/js/plugins/file-system/src/wrap-man/module.ts @@ -0,0 +1,85 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +import * as Types from "./types"; + +import { + Client, + PluginModule, + MaybeAsync +} from "@polywrap/core-js"; + +export interface Args_readFile extends Record { + path: Types.String; +} + +export interface Args_readFileAsString extends Record { + path: Types.String; + encoding?: Types.FileSystem_Encoding | null; +} + +export interface Args_exists extends Record { + path: Types.String; +} + +export interface Args_writeFile extends Record { + path: Types.String; + data: Types.Bytes; +} + +export interface Args_mkdir extends Record { + path: Types.String; + recursive?: Types.Boolean | null; +} + +export interface Args_rm extends Record { + path: Types.String; + recursive?: Types.Boolean | null; + force?: Types.Boolean | null; +} + +export interface Args_rmdir extends Record { + path: Types.String; +} + +export abstract class Module< + TConfig +> extends PluginModule< + TConfig +> { + + abstract readFile( + args: Args_readFile, + client: Client + ): MaybeAsync; + + abstract readFileAsString( + args: Args_readFileAsString, + client: Client + ): MaybeAsync; + + abstract exists( + args: Args_exists, + client: Client + ): MaybeAsync; + + abstract writeFile( + args: Args_writeFile, + client: Client + ): MaybeAsync; + + abstract mkdir( + args: Args_mkdir, + client: Client + ): MaybeAsync; + + abstract rm( + args: Args_rm, + client: Client + ): MaybeAsync; + + abstract rmdir( + args: Args_rmdir, + client: Client + ): MaybeAsync; +} diff --git a/packages/js/plugins/file-system/src/wrap-man/types.ts b/packages/js/plugins/file-system/src/wrap-man/types.ts new file mode 100644 index 0000000000..b34d031052 --- /dev/null +++ b/packages/js/plugins/file-system/src/wrap-man/types.ts @@ -0,0 +1,189 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +// @ts-ignore +import * as Types from "./"; + +// @ts-ignore +import { + Client, + InvokeResult +} from "@polywrap/core-js"; + +export type UInt = number; +export type UInt8 = number; +export type UInt16 = number; +export type UInt32 = number; +export type Int = number; +export type Int8 = number; +export type Int16 = number; +export type Int32 = number; +export type Bytes = Uint8Array; +export type BigInt = string; +export type BigNumber = string; +export type Json = string; +export type String = string; +export type Boolean = boolean; + +/// Env START /// +/// Env END /// + +/// Objects START /// +/// Objects END /// + +/// Enums START /// +/// Enums END /// + +/// Imported Objects START /// + +/* URI: "ens/fs.polywrap.eth" */ +export enum FileSystem_EncodingEnum { + ASCII, + UTF8, + UTF16LE, + UCS2, + BASE64, + BASE64URL, + LATIN1, + BINARY, + HEX, +} + +export type FileSystem_EncodingString = + | "ASCII" + | "UTF8" + | "UTF16LE" + | "UCS2" + | "BASE64" + | "BASE64URL" + | "LATIN1" + | "BINARY" + | "HEX" + +export type FileSystem_Encoding = FileSystem_EncodingEnum | FileSystem_EncodingString; + +/// Imported Objects END /// + +/// Imported Modules START /// + +/* URI: "ens/fs.polywrap.eth" */ +interface FileSystem_Module_Args_readFile extends Record { + path: Types.String; +} + +/* URI: "ens/fs.polywrap.eth" */ +interface FileSystem_Module_Args_readFileAsString extends Record { + path: Types.String; + encoding?: Types.FileSystem_Encoding | null; +} + +/* URI: "ens/fs.polywrap.eth" */ +interface FileSystem_Module_Args_exists extends Record { + path: Types.String; +} + +/* URI: "ens/fs.polywrap.eth" */ +interface FileSystem_Module_Args_writeFile extends Record { + path: Types.String; + data: Types.Bytes; +} + +/* URI: "ens/fs.polywrap.eth" */ +interface FileSystem_Module_Args_mkdir extends Record { + path: Types.String; + recursive?: Types.Boolean | null; +} + +/* URI: "ens/fs.polywrap.eth" */ +interface FileSystem_Module_Args_rm extends Record { + path: Types.String; + recursive?: Types.Boolean | null; + force?: Types.Boolean | null; +} + +/* URI: "ens/fs.polywrap.eth" */ +interface FileSystem_Module_Args_rmdir extends Record { + path: Types.String; +} + +/* URI: "ens/fs.polywrap.eth" */ +export const FileSystem_Module = { + readFile: async ( + args: FileSystem_Module_Args_readFile, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/fs.polywrap.eth", + method: "readFile", + args + }); + }, + + readFileAsString: async ( + args: FileSystem_Module_Args_readFileAsString, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/fs.polywrap.eth", + method: "readFileAsString", + args + }); + }, + + exists: async ( + args: FileSystem_Module_Args_exists, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/fs.polywrap.eth", + method: "exists", + args + }); + }, + + writeFile: async ( + args: FileSystem_Module_Args_writeFile, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/fs.polywrap.eth", + method: "writeFile", + args + }); + }, + + mkdir: async ( + args: FileSystem_Module_Args_mkdir, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/fs.polywrap.eth", + method: "mkdir", + args + }); + }, + + rm: async ( + args: FileSystem_Module_Args_rm, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/fs.polywrap.eth", + method: "rm", + args + }); + }, + + rmdir: async ( + args: FileSystem_Module_Args_rmdir, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/fs.polywrap.eth", + method: "rmdir", + args + }); + } +} + +/// Imported Modules END /// diff --git a/packages/js/plugins/file-system/src/wrap-man/wrap.info.ts b/packages/js/plugins/file-system/src/wrap-man/wrap.info.ts new file mode 100644 index 0000000000..62bbaed220 --- /dev/null +++ b/packages/js/plugins/file-system/src/wrap-man/wrap.info.ts @@ -0,0 +1,542 @@ +import { WrapManifest, WrapAbi } from "@polywrap/wrap-manifest-types-js"; + +const abi: WrapAbi = { + version: "0.1", + objectTypes: [], + enumTypes: [], + interfaceTypes: [], + importedObjectTypes: [], + importedModuleTypes: [ + { + type: "FileSystem_Module", + kind: 256, + methods: [ + { + type: "Method", + name: "readFile", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "path", + required: true, + kind: 34, + scalar: { + type: "String", + name: "path", + required: true, + kind: 4, + }, + }, + ], + return: { + type: "Bytes", + name: "readFile", + required: true, + kind: 34, + scalar: { + type: "Bytes", + name: "readFile", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "readFileAsString", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "path", + required: true, + kind: 34, + scalar: { + type: "String", + name: "path", + required: true, + kind: 4, + }, + }, + { + type: "FileSystem_Encoding", + name: "encoding", + kind: 34, + enum: { + type: "FileSystem_Encoding", + name: "encoding", + kind: 16384, + }, + }, + ], + return: { + type: "String", + name: "readFileAsString", + required: true, + kind: 34, + scalar: { + type: "String", + name: "readFileAsString", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "exists", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "path", + required: true, + kind: 34, + scalar: { + type: "String", + name: "path", + required: true, + kind: 4, + }, + }, + ], + return: { + type: "Boolean", + name: "exists", + required: true, + kind: 34, + scalar: { + type: "Boolean", + name: "exists", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "writeFile", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "path", + required: true, + kind: 34, + scalar: { + type: "String", + name: "path", + required: true, + kind: 4, + }, + }, + { + type: "Bytes", + name: "data", + required: true, + kind: 34, + scalar: { + type: "Bytes", + name: "data", + required: true, + kind: 4, + }, + }, + ], + return: { + type: "Boolean", + name: "writeFile", + kind: 34, + scalar: { + type: "Boolean", + name: "writeFile", + kind: 4, + }, + }, + }, + { + type: "Method", + name: "mkdir", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "path", + required: true, + kind: 34, + scalar: { + type: "String", + name: "path", + required: true, + kind: 4, + }, + }, + { + type: "Boolean", + name: "recursive", + kind: 34, + scalar: { + type: "Boolean", + name: "recursive", + kind: 4, + }, + }, + ], + return: { + type: "Boolean", + name: "mkdir", + kind: 34, + scalar: { + type: "Boolean", + name: "mkdir", + kind: 4, + }, + }, + }, + { + type: "Method", + name: "rm", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "path", + required: true, + kind: 34, + scalar: { + type: "String", + name: "path", + required: true, + kind: 4, + }, + }, + { + type: "Boolean", + name: "recursive", + kind: 34, + scalar: { + type: "Boolean", + name: "recursive", + kind: 4, + }, + }, + { + type: "Boolean", + name: "force", + kind: 34, + scalar: { + type: "Boolean", + name: "force", + kind: 4, + }, + }, + ], + return: { + type: "Boolean", + name: "rm", + kind: 34, + scalar: { type: "Boolean", name: "rm", kind: 4 }, + }, + }, + { + type: "Method", + name: "rmdir", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "path", + required: true, + kind: 34, + scalar: { + type: "String", + name: "path", + required: true, + kind: 4, + }, + }, + ], + return: { + type: "Boolean", + name: "rmdir", + kind: 34, + scalar: { + type: "Boolean", + name: "rmdir", + kind: 4, + }, + }, + }, + ], + uri: "ens/fs.polywrap.eth", + namespace: "FileSystem", + nativeType: "Module", + isInterface: false, + }, + ], + importedEnumTypes: [ + { + type: "FileSystem_Encoding", + kind: 520, + constants: [ + "ASCII", + "UTF8", + "UTF16LE", + "UCS2", + "BASE64", + "BASE64URL", + "LATIN1", + "BINARY", + "HEX", + ], + uri: "ens/fs.polywrap.eth", + namespace: "FileSystem", + nativeType: "Encoding", + }, + ], + importedEnvTypes: [], + moduleType: { + type: "Module", + kind: 128, + methods: [ + { + type: "Method", + name: "readFile", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "path", + required: true, + kind: 34, + scalar: { type: "String", name: "path", required: true, kind: 4 }, + }, + ], + return: { + type: "Bytes", + name: "readFile", + required: true, + kind: 34, + scalar: { + type: "Bytes", + name: "readFile", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "readFileAsString", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "path", + required: true, + kind: 34, + scalar: { type: "String", name: "path", required: true, kind: 4 }, + }, + { + type: "FileSystem_Encoding", + name: "encoding", + kind: 34, + enum: { + type: "FileSystem_Encoding", + name: "encoding", + kind: 16384, + }, + }, + ], + return: { + type: "String", + name: "readFileAsString", + required: true, + kind: 34, + scalar: { + type: "String", + name: "readFileAsString", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "exists", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "path", + required: true, + kind: 34, + scalar: { type: "String", name: "path", required: true, kind: 4 }, + }, + ], + return: { + type: "Boolean", + name: "exists", + required: true, + kind: 34, + scalar: { + type: "Boolean", + name: "exists", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "writeFile", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "path", + required: true, + kind: 34, + scalar: { type: "String", name: "path", required: true, kind: 4 }, + }, + { + type: "Bytes", + name: "data", + required: true, + kind: 34, + scalar: { type: "Bytes", name: "data", required: true, kind: 4 }, + }, + ], + return: { + type: "Boolean", + name: "writeFile", + kind: 34, + scalar: { + type: "Boolean", + name: "writeFile", + kind: 4, + }, + }, + }, + { + type: "Method", + name: "mkdir", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "path", + required: true, + kind: 34, + scalar: { type: "String", name: "path", required: true, kind: 4 }, + }, + { + type: "Boolean", + name: "recursive", + kind: 34, + scalar: { + type: "Boolean", + name: "recursive", + kind: 4, + }, + }, + ], + return: { + type: "Boolean", + name: "mkdir", + kind: 34, + scalar: { type: "Boolean", name: "mkdir", kind: 4 }, + }, + }, + { + type: "Method", + name: "rm", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "path", + required: true, + kind: 34, + scalar: { type: "String", name: "path", required: true, kind: 4 }, + }, + { + type: "Boolean", + name: "recursive", + kind: 34, + scalar: { + type: "Boolean", + name: "recursive", + kind: 4, + }, + }, + { + type: "Boolean", + name: "force", + kind: 34, + scalar: { + type: "Boolean", + name: "force", + kind: 4, + }, + }, + ], + return: { + type: "Boolean", + name: "rm", + kind: 34, + scalar: { type: "Boolean", name: "rm", kind: 4 }, + }, + }, + { + type: "Method", + name: "rmdir", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "path", + required: true, + kind: 34, + scalar: { type: "String", name: "path", required: true, kind: 4 }, + }, + ], + return: { + type: "Boolean", + name: "rmdir", + kind: 34, + scalar: { type: "Boolean", name: "rmdir", kind: 4 }, + }, + }, + ], + imports: [{ type: "FileSystem_Module" }, { type: "FileSystem_Encoding" }], + interfaces: [ + { + type: "FileSystem_Module", + kind: 2048, + }, + ], + }, +}; + +export const manifest: WrapManifest = { + name: "FileSystem", + type: "plugin", + version: "0.1", + abi: abi +}; diff --git a/packages/js/plugins/graph-node/package.json b/packages/js/plugins/graph-node/package.json index f9f3812e5a..8a6a099c4d 100644 --- a/packages/js/plugins/graph-node/package.json +++ b/packages/js/plugins/graph-node/package.json @@ -12,8 +12,9 @@ "build" ], "scripts": { - "build": "rimraf ./build && yarn codegen && tsc --project tsconfig.build.json", + "build": "rimraf ./build && tsc --project tsconfig.build.json", "codegen": "node ../../../../dependencies/node_modules/polywrap/bin/polywrap plugin codegen", + "codegen:patch": "node ../../../cli/bin/polywrap plugin codegen && rimraf ./src/wrap", "lint": "eslint --color -c ../../../../.eslintrc.js src/", "test": "jest --passWithNoTests --runInBand --verbose", "test:ci": "jest --passWithNoTests --runInBand --verbose", diff --git a/packages/js/plugins/graph-node/polywrap.plugin.yaml b/packages/js/plugins/graph-node/polywrap.plugin.yaml index 9a9c373675..a2e1babae7 100644 --- a/packages/js/plugins/graph-node/polywrap.plugin.yaml +++ b/packages/js/plugins/graph-node/polywrap.plugin.yaml @@ -1,5 +1,8 @@ -format: 0.1.0 +format: "0.2" language: plugin/typescript name: GraphNode module: ./src/index.ts schema: ./src/schema.graphql +import_abis: + - uri: "ens/http.polywrap.eth" + abi: ../http/build/wrap.info diff --git a/packages/js/plugins/graph-node/src/index.ts b/packages/js/plugins/graph-node/src/index.ts index 97fb020fb6..d0abd3f3fe 100644 --- a/packages/js/plugins/graph-node/src/index.ts +++ b/packages/js/plugins/graph-node/src/index.ts @@ -4,7 +4,7 @@ import { Args_querySubgraph, HTTP_Module, manifest, -} from "./wrap"; +} from "./wrap-man"; import { PluginFactory } from "@polywrap/core-js"; diff --git a/packages/js/plugins/graph-node/src/wrap-man/index.ts b/packages/js/plugins/graph-node/src/wrap-man/index.ts new file mode 100644 index 0000000000..315871f96d --- /dev/null +++ b/packages/js/plugins/graph-node/src/wrap-man/index.ts @@ -0,0 +1,8 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +export * from "./wrap.info"; +export * from "./module"; +export * from "./types"; + +export { Client } from "@polywrap/core-js"; diff --git a/packages/js/plugins/graph-node/src/wrap-man/module.ts b/packages/js/plugins/graph-node/src/wrap-man/module.ts new file mode 100644 index 0000000000..019e364770 --- /dev/null +++ b/packages/js/plugins/graph-node/src/wrap-man/module.ts @@ -0,0 +1,28 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +import * as Types from "./types"; + +import { + Client, + PluginModule, + MaybeAsync +} from "@polywrap/core-js"; + +export interface Args_querySubgraph extends Record { + subgraphAuthor: Types.String; + subgraphName: Types.String; + query: Types.String; +} + +export abstract class Module< + TConfig +> extends PluginModule< + TConfig +> { + + abstract querySubgraph( + args: Args_querySubgraph, + client: Client + ): MaybeAsync; +} diff --git a/packages/js/plugins/graph-node/src/wrap-man/types.ts b/packages/js/plugins/graph-node/src/wrap-man/types.ts new file mode 100644 index 0000000000..4ef10e944c --- /dev/null +++ b/packages/js/plugins/graph-node/src/wrap-man/types.ts @@ -0,0 +1,120 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +// @ts-ignore +import * as Types from "./"; + +// @ts-ignore +import { + Client, + InvokeResult +} from "@polywrap/core-js"; + +export type UInt = number; +export type UInt8 = number; +export type UInt16 = number; +export type UInt32 = number; +export type Int = number; +export type Int8 = number; +export type Int16 = number; +export type Int32 = number; +export type Bytes = Uint8Array; +export type BigInt = string; +export type BigNumber = string; +export type Json = string; +export type String = string; +export type Boolean = boolean; + +/// Env START /// +/// Env END /// + +/// Objects START /// +/// Objects END /// + +/// Enums START /// +/// Enums END /// + +/// Imported Objects START /// + +/* URI: "ens/http.polywrap.eth" */ +export interface HTTP_Request { + headers?: Array | null; + urlParams?: Array | null; + responseType: Types.HTTP_ResponseType; + body?: Types.String | null; +} + +/* URI: "ens/http.polywrap.eth" */ +export interface HTTP_Header { + key: Types.String; + value: Types.String; +} + +/* URI: "ens/http.polywrap.eth" */ +export interface HTTP_UrlParam { + key: Types.String; + value: Types.String; +} + +/* URI: "ens/http.polywrap.eth" */ +export interface HTTP_Response { + status: Types.Int; + statusText: Types.String; + headers?: Array | null; + body?: Types.String | null; +} + +/* URI: "ens/http.polywrap.eth" */ +export enum HTTP_ResponseTypeEnum { + TEXT, + BINARY, +} + +export type HTTP_ResponseTypeString = + | "TEXT" + | "BINARY" + +export type HTTP_ResponseType = HTTP_ResponseTypeEnum | HTTP_ResponseTypeString; + +/// Imported Objects END /// + +/// Imported Modules START /// + +/* URI: "ens/http.polywrap.eth" */ +interface HTTP_Module_Args_get extends Record { + url: Types.String; + request?: Types.HTTP_Request | null; +} + +/* URI: "ens/http.polywrap.eth" */ +interface HTTP_Module_Args_post extends Record { + url: Types.String; + request?: Types.HTTP_Request | null; +} + +/* URI: "ens/http.polywrap.eth" */ +export const HTTP_Module = { + get: async ( + args: HTTP_Module_Args_get, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/http.polywrap.eth", + method: "get", + args + }); + }, + + post: async ( + args: HTTP_Module_Args_post, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/http.polywrap.eth", + method: "post", + args + }); + } +} + +/// Imported Modules END /// diff --git a/packages/js/plugins/graph-node/src/wrap-man/wrap.info.ts b/packages/js/plugins/graph-node/src/wrap-man/wrap.info.ts new file mode 100644 index 0000000000..58d40c3401 --- /dev/null +++ b/packages/js/plugins/graph-node/src/wrap-man/wrap.info.ts @@ -0,0 +1,357 @@ +import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; + +export const manifest: WrapManifest = { + name: "GraphNode", + type: "plugin", + version: "0.1", + abi: { + version: "0.1", + importedObjectTypes: [ + { + type: "HTTP_Request", + kind: 1025, + properties: [ + { + type: "[HTTP_Header]", + name: "headers", + kind: 34, + array: { + type: "[HTTP_Header]", + name: "headers", + kind: 18, + object: { + type: "HTTP_Header", + name: "headers", + required: true, + kind: 8192, + }, + item: { + type: "HTTP_Header", + name: "headers", + required: true, + kind: 8192, + }, + }, + }, + { + type: "[HTTP_UrlParam]", + name: "urlParams", + kind: 34, + array: { + type: "[HTTP_UrlParam]", + name: "urlParams", + kind: 18, + object: { + type: "HTTP_UrlParam", + name: "urlParams", + required: true, + kind: 8192, + }, + item: { + type: "HTTP_UrlParam", + name: "urlParams", + required: true, + kind: 8192, + }, + }, + }, + { + type: "HTTP_ResponseType", + name: "responseType", + required: true, + kind: 34, + enum: { + type: "HTTP_ResponseType", + name: "responseType", + required: true, + kind: 16384, + }, + }, + { + type: "String", + name: "body", + kind: 34, + scalar: { type: "String", name: "body", kind: 4 }, + }, + ], + uri: "ens/http.polywrap.eth", + namespace: "HTTP", + nativeType: "Request", + }, + { + type: "HTTP_Header", + kind: 1025, + properties: [ + { + type: "String", + name: "key", + required: true, + kind: 34, + scalar: { type: "String", name: "key", required: true, kind: 4 }, + }, + { + type: "String", + name: "value", + required: true, + kind: 34, + scalar: { type: "String", name: "value", required: true, kind: 4 }, + }, + ], + uri: "ens/http.polywrap.eth", + namespace: "HTTP", + nativeType: "Header", + }, + { + type: "HTTP_UrlParam", + kind: 1025, + properties: [ + { + type: "String", + name: "key", + required: true, + kind: 34, + scalar: { type: "String", name: "key", required: true, kind: 4 }, + }, + { + type: "String", + name: "value", + required: true, + kind: 34, + scalar: { type: "String", name: "value", required: true, kind: 4 }, + }, + ], + uri: "ens/http.polywrap.eth", + namespace: "HTTP", + nativeType: "UrlParam", + }, + { + type: "HTTP_Response", + kind: 1025, + properties: [ + { + type: "Int", + name: "status", + required: true, + kind: 34, + scalar: { type: "Int", name: "status", required: true, kind: 4 }, + }, + { + type: "String", + name: "statusText", + required: true, + kind: 34, + scalar: { + type: "String", + name: "statusText", + required: true, + kind: 4, + }, + }, + { + type: "[HTTP_Header]", + name: "headers", + kind: 34, + array: { + type: "[HTTP_Header]", + name: "headers", + kind: 18, + object: { + type: "HTTP_Header", + name: "headers", + required: true, + kind: 8192, + }, + item: { + type: "HTTP_Header", + name: "headers", + required: true, + kind: 8192, + }, + }, + }, + { + type: "String", + name: "body", + kind: 34, + scalar: { type: "String", name: "body", kind: 4 }, + }, + ], + uri: "ens/http.polywrap.eth", + namespace: "HTTP", + nativeType: "Response", + }, + ], + importedModuleTypes: [ + { + type: "HTTP_Module", + kind: 256, + methods: [ + { + type: "Method", + name: "get", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "url", + required: true, + kind: 34, + scalar: { + type: "String", + name: "url", + required: true, + kind: 4, + }, + }, + { + type: "HTTP_Request", + name: "request", + kind: 34, + object: { + type: "HTTP_Request", + name: "request", + kind: 8192, + }, + }, + ], + return: { + type: "HTTP_Response", + name: "get", + kind: 34, + object: { + type: "HTTP_Response", + name: "get", + kind: 8192, + }, + }, + }, + { + type: "Method", + name: "post", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "url", + required: true, + kind: 34, + scalar: { + type: "String", + name: "url", + required: true, + kind: 4, + }, + }, + { + type: "HTTP_Request", + name: "request", + kind: 34, + object: { + type: "HTTP_Request", + name: "request", + kind: 8192, + }, + }, + ], + return: { + type: "HTTP_Response", + name: "post", + kind: 34, + object: { + type: "HTTP_Response", + name: "post", + kind: 8192, + }, + }, + }, + ], + uri: "ens/http.polywrap.eth", + namespace: "HTTP", + nativeType: "Module", + isInterface: false, + }, + ], + importedEnumTypes: [ + { + type: "HTTP_ResponseType", + kind: 520, + constants: ["TEXT", "BINARY"], + uri: "ens/http.polywrap.eth", + namespace: "HTTP", + nativeType: "ResponseType", + }, + ], + moduleType: { + type: "Module", + kind: 128, + methods: [ + { + type: "Method", + name: "querySubgraph", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "subgraphAuthor", + required: true, + kind: 34, + scalar: { + type: "String", + name: "subgraphAuthor", + required: true, + kind: 4, + }, + }, + { + type: "String", + name: "subgraphName", + required: true, + kind: 34, + scalar: { + type: "String", + name: "subgraphName", + required: true, + kind: 4, + }, + }, + { + type: "String", + name: "query", + required: true, + kind: 34, + scalar: { + type: "String", + name: "query", + required: true, + kind: 4, + }, + }, + ], + return: { + type: "String", + name: "querySubgraph", + required: true, + kind: 34, + scalar: { + type: "String", + name: "querySubgraph", + required: true, + kind: 4, + }, + }, + }, + ], + imports: [ + { type: "HTTP_Module" }, + { type: "HTTP_Request" }, + { type: "HTTP_Header" }, + { type: "HTTP_UrlParam" }, + { type: "HTTP_ResponseType" }, + { type: "HTTP_Response" }, + ], + }, + }, +}; diff --git a/packages/js/plugins/http/package.json b/packages/js/plugins/http/package.json index b10cc2645a..4f3a469ee1 100644 --- a/packages/js/plugins/http/package.json +++ b/packages/js/plugins/http/package.json @@ -12,8 +12,9 @@ "build" ], "scripts": { - "build": "rimraf ./build && yarn codegen && tsc --project tsconfig.build.json", + "build": "rimraf ./build && tsc --project tsconfig.build.json", "codegen": "node ../../../../dependencies/node_modules/polywrap/bin/polywrap plugin codegen", + "codegen:patch": "node ../../../cli/bin/polywrap plugin codegen && rimraf ./src/wrap", "lint": "eslint --color -c ../../../../.eslintrc.js src/", "test": "jest --passWithNoTests --runInBand --verbose", "test:ci": "jest --passWithNoTests --runInBand --verbose", diff --git a/packages/js/plugins/http/polywrap.plugin.yaml b/packages/js/plugins/http/polywrap.plugin.yaml index e0ee16c4d5..dbaeffed62 100644 --- a/packages/js/plugins/http/polywrap.plugin.yaml +++ b/packages/js/plugins/http/polywrap.plugin.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" language: plugin/typescript name: Http module: ./src/index.ts diff --git a/packages/js/plugins/http/src/__tests__/e2e/e2e.spec.ts b/packages/js/plugins/http/src/__tests__/e2e/e2e.spec.ts index c15cafad28..7c2dbe8a86 100644 --- a/packages/js/plugins/http/src/__tests__/e2e/e2e.spec.ts +++ b/packages/js/plugins/http/src/__tests__/e2e/e2e.spec.ts @@ -1,5 +1,5 @@ import { httpPlugin } from "../.."; -import { Response } from "../../wrap"; +import { Response } from "../../wrap-man"; import { PolywrapClient } from "@polywrap/client-js"; import nock from "nock"; diff --git a/packages/js/plugins/http/src/__tests__/e2e/integration.spec.ts b/packages/js/plugins/http/src/__tests__/e2e/integration.spec.ts index 8ff69c568c..4be0a42e3a 100644 --- a/packages/js/plugins/http/src/__tests__/e2e/integration.spec.ts +++ b/packages/js/plugins/http/src/__tests__/e2e/integration.spec.ts @@ -1,5 +1,5 @@ import { httpPlugin } from "../.."; -import { Response } from "../../wrap"; +import { Response } from "../../wrap-man"; import { PolywrapClient } from "@polywrap/client-js"; import { buildWrapper } from "@polywrap/test-env-js"; diff --git a/packages/js/plugins/http/src/__tests__/e2e/integration/polywrap.yaml b/packages/js/plugins/http/src/__tests__/e2e/integration/polywrap.yaml index ca0289365c..b04d41f04d 100644 --- a/packages/js/plugins/http/src/__tests__/e2e/integration/polywrap.yaml +++ b/packages/js/plugins/http/src/__tests__/e2e/integration/polywrap.yaml @@ -1,9 +1,9 @@ -format: 0.1.0 +format: "0.2" name: HTTP-Integration build: ./polywrap.build.yaml language: wasm/assemblyscript schema: ./schema.graphql module: ./src/index.ts -import_redirects: - - uri: "ens/http.polywrap.eth" - schema: ../../../schema.graphql +import_abis: + - uri: "wrap://ens/http.polywrap.eth" + abi: ../../../../build/wrap.info diff --git a/packages/js/plugins/http/src/__tests__/unit/index.test.ts b/packages/js/plugins/http/src/__tests__/unit/index.test.ts index c507dea1a7..21844f20ae 100644 --- a/packages/js/plugins/http/src/__tests__/unit/index.test.ts +++ b/packages/js/plugins/http/src/__tests__/unit/index.test.ts @@ -1,5 +1,5 @@ import { HttpPlugin } from "../.."; -import { ResponseTypeEnum, Client } from "../../wrap"; +import { ResponseTypeEnum, Client } from "../../wrap-man"; import axios, { AxiosResponse, AxiosRequestConfig } from "axios"; diff --git a/packages/js/plugins/http/src/__tests__/unit/util.test.ts b/packages/js/plugins/http/src/__tests__/unit/util.test.ts index f9dc031135..67750f2d8f 100644 --- a/packages/js/plugins/http/src/__tests__/unit/util.test.ts +++ b/packages/js/plugins/http/src/__tests__/unit/util.test.ts @@ -1,5 +1,5 @@ import { fromAxiosResponse, toAxiosRequestConfig } from "../../util"; -import { ResponseTypeEnum } from "../../wrap"; +import { ResponseTypeEnum } from "../../wrap-man"; describe("converting axios response", () => { test("response type: text", () => { diff --git a/packages/js/plugins/http/src/index.ts b/packages/js/plugins/http/src/index.ts index ef692214fd..a3e2e685fa 100644 --- a/packages/js/plugins/http/src/index.ts +++ b/packages/js/plugins/http/src/index.ts @@ -5,7 +5,7 @@ import { Args_post, Response, manifest, -} from "./wrap"; +} from "./wrap-man"; import { fromAxiosResponse, toAxiosRequestConfig } from "./util"; import axios from "axios"; diff --git a/packages/js/plugins/http/src/util.ts b/packages/js/plugins/http/src/util.ts index 15ee505ce3..65461c8087 100644 --- a/packages/js/plugins/http/src/util.ts +++ b/packages/js/plugins/http/src/util.ts @@ -1,4 +1,4 @@ -import { Request, Response, ResponseTypeEnum } from "./wrap"; +import { Request, Response, ResponseTypeEnum } from "./wrap-man"; import { AxiosResponse, AxiosRequestConfig } from "axios"; diff --git a/packages/js/plugins/http/src/wrap-man/index.ts b/packages/js/plugins/http/src/wrap-man/index.ts new file mode 100644 index 0000000000..315871f96d --- /dev/null +++ b/packages/js/plugins/http/src/wrap-man/index.ts @@ -0,0 +1,8 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +export * from "./wrap.info"; +export * from "./module"; +export * from "./types"; + +export { Client } from "@polywrap/core-js"; diff --git a/packages/js/plugins/http/src/wrap-man/module.ts b/packages/js/plugins/http/src/wrap-man/module.ts new file mode 100644 index 0000000000..f2016d681b --- /dev/null +++ b/packages/js/plugins/http/src/wrap-man/module.ts @@ -0,0 +1,37 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +import * as Types from "./types"; + +import { + Client, + PluginModule, + MaybeAsync +} from "@polywrap/core-js"; + +export interface Args_get extends Record { + url: Types.String; + request?: Types.Request | null; +} + +export interface Args_post extends Record { + url: Types.String; + request?: Types.Request | null; +} + +export abstract class Module< + TConfig +> extends PluginModule< + TConfig +> { + + abstract get( + args: Args_get, + client: Client + ): MaybeAsync; + + abstract post( + args: Args_post, + client: Client + ): MaybeAsync; +} diff --git a/packages/js/plugins/http/src/wrap-man/types.ts b/packages/js/plugins/http/src/wrap-man/types.ts new file mode 100644 index 0000000000..febe292d7a --- /dev/null +++ b/packages/js/plugins/http/src/wrap-man/types.ts @@ -0,0 +1,69 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +// @ts-ignore +import * as Types from "./"; + +// @ts-ignore +import { + Client, + InvokeResult +} from "@polywrap/core-js"; + +export type UInt = number; +export type UInt8 = number; +export type UInt16 = number; +export type UInt32 = number; +export type Int = number; +export type Int8 = number; +export type Int16 = number; +export type Int32 = number; +export type Bytes = Uint8Array; +export type BigInt = string; +export type BigNumber = string; +export type Json = string; +export type String = string; +export type Boolean = boolean; + +/// Env START /// +/// Env END /// + +/// Objects START /// + +export interface Response { + status: Types.Int; + statusText: Types.String; + headers?: Map | null; + body?: Types.String | null; +} + +export interface Request { + headers?: Map | null; + urlParams?: Map | null; + responseType: Types.ResponseType; + body?: Types.String | null; +} + +/// Objects END /// + +/// Enums START /// +export enum ResponseTypeEnum { + TEXT, + BINARY, +} + +export type ResponseTypeString = + | "TEXT" + | "BINARY" + +export type ResponseType = ResponseTypeEnum | ResponseTypeString; + +/// Enums END /// + +/// Imported Objects START /// + +/// Imported Objects END /// + +/// Imported Modules START /// + +/// Imported Modules END /// diff --git a/packages/js/plugins/http/src/wrap-man/wrap.info.ts b/packages/js/plugins/http/src/wrap-man/wrap.info.ts new file mode 100644 index 0000000000..1fb93a44d3 --- /dev/null +++ b/packages/js/plugins/http/src/wrap-man/wrap.info.ts @@ -0,0 +1,240 @@ +import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; + +export const manifest: WrapManifest = { + name: "Http", + type: "plugin", + version: "0.1", + abi: { + version: "0.1", + objectTypes: [ + { + type: "Response", + kind: 1, + properties: [ + { + type: "Int", + name: "status", + required: true, + kind: 34, + scalar: { type: "Int", name: "status", required: true, kind: 4 }, + }, + { + type: "String", + name: "statusText", + required: true, + kind: 34, + scalar: { + type: "String", + name: "statusText", + required: true, + kind: 4, + }, + }, + { + type: "Map", + name: "headers", + map: { + type: "Map", + scalar: { + name: "headers", + type: "String", + required: true, + kind: 4 + }, + kind: 262146, + name: "headers", + key: { + name: "headers", + type: "String", + required: true, + kind: 4 + }, + value: { + name: "headers", + type: "String", + required: true, + kind: 4 + }, + required: true + }, + required: false, + kind: 34 + }, + { + type: "String", + name: "body", + kind: 34, + scalar: { type: "String", name: "body", kind: 4 }, + }, + ], + }, + { + type: "Request", + kind: 1, + properties: [ + { + type: "Map", + name: "headers", + map: { + type: "Map", + scalar: { + name: "headers", + type: "String", + required: true, + kind: 4 + }, + kind: 262146, + name: "headers", + key: { + name: "headers", + type: "String", + required: true, + kind: 4 + }, + value: { + name: "headers", + type: "String", + required: true, + kind: 4 + }, + required: true + }, + required: false, + kind: 34 + }, + { + type: "Map", + name: "urlParams", + map: { + type: "Map", + scalar: { + name: "urlParams", + type: "String", + required: true, + kind: 4 + }, + kind: 262146, + name: "urlParams", + key: { + name: "urlParams", + type: "String", + required: true, + kind: 4 + }, + value: { + name: "urlParams", + type: "String", + required: true, + kind: 4 + }, + required: true + }, + required: false, + kind: 34 + }, + { + type: "ResponseType", + name: "responseType", + required: true, + kind: 34, + enum: { + type: "ResponseType", + name: "responseType", + required: true, + kind: 16384, + }, + }, + { + type: "String", + name: "body", + kind: 34, + scalar: { type: "String", name: "body", kind: 4 }, + }, + ], + }, + ], + enumTypes: [ + { + type: "ResponseType", + kind: 8, + constants: ["TEXT", "BINARY"], + }, + ], + moduleType: { + type: "Module", + kind: 128, + methods: [ + { + type: "Method", + name: "get", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "url", + required: true, + kind: 34, + scalar: { type: "String", name: "url", required: true, kind: 4 }, + }, + { + type: "Request", + name: "request", + kind: 34, + object: { + type: "Request", + name: "request", + kind: 8192, + }, + }, + ], + return: { + type: "Response", + name: "get", + kind: 34, + object: { + type: "Response", + name: "get", + kind: 8192, + }, + }, + }, + { + type: "Method", + name: "post", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "url", + required: true, + kind: 34, + scalar: { type: "String", name: "url", required: true, kind: 4 }, + }, + { + type: "Request", + name: "request", + kind: 34, + object: { + type: "Request", + name: "request", + kind: 8192, + }, + }, + ], + return: { + type: "Response", + name: "post", + kind: 34, + object: { + type: "Response", + name: "post", + kind: 8192, + }, + }, + }, + ], + }, + }, +}; diff --git a/packages/js/plugins/ipfs/package.json b/packages/js/plugins/ipfs/package.json index 34372583dc..55e99a5f98 100644 --- a/packages/js/plugins/ipfs/package.json +++ b/packages/js/plugins/ipfs/package.json @@ -12,8 +12,9 @@ "build" ], "scripts": { - "build": "rimraf ./build && yarn codegen && tsc --project tsconfig.build.json", + "build": "rimraf ./build && tsc --project tsconfig.build.json", "codegen": "node ../../../../dependencies/node_modules/polywrap/bin/polywrap plugin codegen", + "codegen:patch": "node ../../../cli/bin/polywrap plugin codegen && rimraf ./src/wrap", "lint": "eslint --color -c ../../../../.eslintrc.js src/", "test": "jest --passWithNoTests --runInBand --verbose", "test:ci": "jest --passWithNoTests --runInBand --verbose", diff --git a/packages/js/plugins/ipfs/polywrap.plugin.yaml b/packages/js/plugins/ipfs/polywrap.plugin.yaml index 38df4a445e..4c5efc6d59 100644 --- a/packages/js/plugins/ipfs/polywrap.plugin.yaml +++ b/packages/js/plugins/ipfs/polywrap.plugin.yaml @@ -1,8 +1,8 @@ -format: 0.1.0 +format: "0.2" name: Ipfs language: plugin/typescript module: ./src/index.ts schema: ./src/schema.graphql -import_redirects: +import_abis: - uri: "ens/ipfs.polywrap.eth" - schema: ../../../interfaces/ipfs/build/schema.graphql + abi: ../../../interfaces/ipfs/build-man/wrap.info diff --git a/packages/js/plugins/ipfs/src/__tests__/e2e.spec.ts b/packages/js/plugins/ipfs/src/__tests__/e2e.spec.ts index f732bc6955..3c25d04a37 100644 --- a/packages/js/plugins/ipfs/src/__tests__/e2e.spec.ts +++ b/packages/js/plugins/ipfs/src/__tests__/e2e.spec.ts @@ -7,7 +7,7 @@ import { import { ipfsPlugin } from ".."; import { IpfsClient, IpfsFileInfo } from "../utils/IpfsClient"; -import { Ipfs_Module } from "../wrap"; +import { Ipfs_Module } from "../wrap-man"; const createIpfsClient = require("@dorgjelli-test/ipfs-http-client-lite"); diff --git a/packages/js/plugins/ipfs/src/index.ts b/packages/js/plugins/ipfs/src/index.ts index d0db1d7530..93b3af0615 100644 --- a/packages/js/plugins/ipfs/src/index.ts +++ b/packages/js/plugins/ipfs/src/index.ts @@ -7,7 +7,7 @@ import { Ipfs_ResolveResult, Env, manifest, -} from "./wrap"; +} from "./wrap-man"; import { IpfsClient } from "./utils/IpfsClient"; import { execSimple, execFallbacks } from "./utils/exec"; diff --git a/packages/js/plugins/ipfs/src/wrap-man/index.ts b/packages/js/plugins/ipfs/src/wrap-man/index.ts new file mode 100644 index 0000000000..315871f96d --- /dev/null +++ b/packages/js/plugins/ipfs/src/wrap-man/index.ts @@ -0,0 +1,8 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +export * from "./wrap.info"; +export * from "./module"; +export * from "./types"; + +export { Client } from "@polywrap/core-js"; diff --git a/packages/js/plugins/ipfs/src/wrap-man/module.ts b/packages/js/plugins/ipfs/src/wrap-man/module.ts new file mode 100644 index 0000000000..2e558b1801 --- /dev/null +++ b/packages/js/plugins/ipfs/src/wrap-man/module.ts @@ -0,0 +1,47 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +import * as Types from "./types"; + +import { + Client, + PluginModule, + MaybeAsync +} from "@polywrap/core-js"; + +export interface Args_cat extends Record { + cid: Types.String; + options?: Types.Ipfs_Options | null; +} + +export interface Args_resolve extends Record { + cid: Types.String; + options?: Types.Ipfs_Options | null; +} + +export interface Args_addFile extends Record { + data: Types.Bytes; +} + +export abstract class Module< + TConfig +> extends PluginModule< + TConfig, + Types.Env +> { + + abstract cat( + args: Args_cat, + client: Client + ): MaybeAsync; + + abstract resolve( + args: Args_resolve, + client: Client + ): MaybeAsync; + + abstract addFile( + args: Args_addFile, + client: Client + ): MaybeAsync; +} diff --git a/packages/js/plugins/ipfs/src/wrap-man/types.ts b/packages/js/plugins/ipfs/src/wrap-man/types.ts new file mode 100644 index 0000000000..e40827d782 --- /dev/null +++ b/packages/js/plugins/ipfs/src/wrap-man/types.ts @@ -0,0 +1,112 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +// @ts-ignore +import * as Types from "./"; + +// @ts-ignore +import { + Client, + InvokeResult +} from "@polywrap/core-js"; + +export type UInt = number; +export type UInt8 = number; +export type UInt16 = number; +export type UInt32 = number; +export type Int = number; +export type Int8 = number; +export type Int16 = number; +export type Int32 = number; +export type Bytes = Uint8Array; +export type BigInt = string; +export type BigNumber = string; +export type Json = string; +export type String = string; +export type Boolean = boolean; + +/// Env START /// +export interface Env extends Record { + disableParallelRequests?: Types.Boolean | null; +} +/// Env END /// + +/// Objects START /// +/// Objects END /// + +/// Enums START /// +/// Enums END /// + +/// Imported Objects START /// + +/* URI: "ens/ipfs.polywrap.eth" */ +export interface Ipfs_Options { + timeout?: Types.UInt32 | null; + provider?: Types.String | null; + disableParallelRequests?: Types.Boolean | null; +} + +/* URI: "ens/ipfs.polywrap.eth" */ +export interface Ipfs_ResolveResult { + cid: Types.String; + provider: Types.String; +} + +/// Imported Objects END /// + +/// Imported Modules START /// + +/* URI: "ens/ipfs.polywrap.eth" */ +interface Ipfs_Module_Args_cat extends Record { + cid: Types.String; + options?: Types.Ipfs_Options | null; +} + +/* URI: "ens/ipfs.polywrap.eth" */ +interface Ipfs_Module_Args_resolve extends Record { + cid: Types.String; + options?: Types.Ipfs_Options | null; +} + +/* URI: "ens/ipfs.polywrap.eth" */ +interface Ipfs_Module_Args_addFile extends Record { + data: Types.Bytes; +} + +/* URI: "ens/ipfs.polywrap.eth" */ +export const Ipfs_Module = { + cat: async ( + args: Ipfs_Module_Args_cat, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ipfs.polywrap.eth", + method: "cat", + args + }); + }, + + resolve: async ( + args: Ipfs_Module_Args_resolve, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ipfs.polywrap.eth", + method: "resolve", + args + }); + }, + + addFile: async ( + args: Ipfs_Module_Args_addFile, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ipfs.polywrap.eth", + method: "addFile", + args + }); + } +} + +/// Imported Modules END /// diff --git a/packages/js/plugins/ipfs/src/wrap-man/wrap.info.ts b/packages/js/plugins/ipfs/src/wrap-man/wrap.info.ts new file mode 100644 index 0000000000..3be2e648fd --- /dev/null +++ b/packages/js/plugins/ipfs/src/wrap-man/wrap.info.ts @@ -0,0 +1,333 @@ +import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; + +export const manifest: WrapManifest = { + name: "Ipfs", + type: "plugin", + version: "0.1", + abi: { + version: "0.1", + importedObjectTypes: [ + { + type: "Ipfs_Options", + kind: 1025, + properties: [ + { + type: "UInt32", + name: "timeout", + kind: 34, + scalar: { + type: "UInt32", + name: "timeout", + kind: 4, + }, + comment: + " Timeout (in ms) for the operation.\nFallback providers are used if timeout is reached.", + }, + { + type: "String", + name: "provider", + kind: 34, + scalar: { + type: "String", + name: "provider", + kind: 4, + }, + comment: "The IPFS provider to be used", + }, + { + type: "Boolean", + name: "disableParallelRequests", + kind: 34, + scalar: { + type: "Boolean", + name: "disableParallelRequests", + kind: 4, + }, + comment: + "Disable querying providers in parallel when resolving URIs", + }, + ], + uri: "ens/ipfs.polywrap.eth", + namespace: "Ipfs", + nativeType: "Options", + }, + { + type: "Ipfs_ResolveResult", + kind: 1025, + properties: [ + { + type: "String", + name: "cid", + required: true, + kind: 34, + scalar: { type: "String", name: "cid", required: true, kind: 4 }, + }, + { + type: "String", + name: "provider", + required: true, + kind: 34, + scalar: { + type: "String", + name: "provider", + required: true, + kind: 4, + }, + }, + ], + uri: "ens/ipfs.polywrap.eth", + namespace: "Ipfs", + nativeType: "ResolveResult", + }, + ], + importedModuleTypes: [ + { + type: "Ipfs_Module", + kind: 256, + methods: [ + { + type: "Method", + name: "cat", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "cid", + required: true, + kind: 34, + scalar: { + type: "String", + name: "cid", + required: true, + kind: 4, + }, + }, + { + type: "Ipfs_Options", + name: "options", + kind: 34, + object: { + type: "Ipfs_Options", + name: "options", + kind: 8192, + }, + }, + ], + return: { + type: "Bytes", + name: "cat", + required: true, + kind: 34, + scalar: { type: "Bytes", name: "cat", required: true, kind: 4 }, + }, + }, + { + type: "Method", + name: "resolve", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "cid", + required: true, + kind: 34, + scalar: { + type: "String", + name: "cid", + required: true, + kind: 4, + }, + }, + { + type: "Ipfs_Options", + name: "options", + kind: 34, + object: { + type: "Ipfs_Options", + name: "options", + kind: 8192, + }, + }, + ], + return: { + type: "Ipfs_ResolveResult", + name: "resolve", + kind: 34, + object: { + type: "Ipfs_ResolveResult", + name: "resolve", + kind: 8192, + }, + }, + }, + { + type: "Method", + name: "addFile", + required: true, + kind: 64, + arguments: [ + { + type: "Bytes", + name: "data", + required: true, + kind: 34, + scalar: { + type: "Bytes", + name: "data", + required: true, + kind: 4, + }, + }, + ], + return: { + type: "String", + name: "addFile", + required: true, + kind: 34, + scalar: { + type: "String", + name: "addFile", + required: true, + kind: 4, + }, + }, + }, + ], + uri: "ens/ipfs.polywrap.eth", + namespace: "Ipfs", + nativeType: "Module", + isInterface: false, + }, + ], + envType: { + type: "Env", + kind: 65536, + properties: [ + { + type: "Boolean", + name: "disableParallelRequests", + kind: 34, + scalar: { + type: "Boolean", + name: "disableParallelRequests", + kind: 4, + }, + comment: "Disable querying providers in parallel when resolving URIs", + }, + ], + }, + moduleType: { + type: "Module", + kind: 128, + methods: [ + { + type: "Method", + name: "cat", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "cid", + required: true, + kind: 34, + scalar: { type: "String", name: "cid", required: true, kind: 4 }, + }, + { + type: "Ipfs_Options", + name: "options", + kind: 34, + object: { + type: "Ipfs_Options", + name: "options", + kind: 8192, + }, + }, + ], + return: { + type: "Bytes", + name: "cat", + required: true, + kind: 34, + scalar: { type: "Bytes", name: "cat", required: true, kind: 4 }, + }, + }, + { + type: "Method", + name: "resolve", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "cid", + required: true, + kind: 34, + scalar: { type: "String", name: "cid", required: true, kind: 4 }, + }, + { + type: "Ipfs_Options", + name: "options", + kind: 34, + object: { + type: "Ipfs_Options", + name: "options", + kind: 8192, + }, + }, + ], + return: { + type: "Ipfs_ResolveResult", + name: "resolve", + kind: 34, + object: { + type: "Ipfs_ResolveResult", + name: "resolve", + kind: 8192, + }, + }, + }, + { + type: "Method", + name: "addFile", + required: true, + kind: 64, + arguments: [ + { + type: "Bytes", + name: "data", + required: true, + kind: 34, + scalar: { type: "Bytes", name: "data", required: true, kind: 4 }, + }, + ], + return: { + type: "String", + name: "addFile", + required: true, + kind: 34, + scalar: { + type: "String", + name: "addFile", + required: true, + kind: 4, + }, + }, + }, + ], + imports: [ + { type: "Ipfs_Module" }, + { type: "Ipfs_Options" }, + { type: "Ipfs_ResolveResult" }, + ], + interfaces: [ + { + type: "Ipfs_Module", + kind: 2048, + }, + ], + }, + }, +}; diff --git a/packages/js/plugins/logger/package.json b/packages/js/plugins/logger/package.json index 7086ce4031..df351b62d7 100644 --- a/packages/js/plugins/logger/package.json +++ b/packages/js/plugins/logger/package.json @@ -12,8 +12,9 @@ "version": "0.3.0", "main": "build/index.js", "scripts": { - "build": "rimraf ./build && yarn codegen && tsc --project tsconfig.build.json", + "build": "rimraf ./build && tsc --project tsconfig.build.json", "codegen": "node ../../../../dependencies/node_modules/polywrap/bin/polywrap plugin codegen", + "codegen:patch": "node ../../../cli/bin/polywrap plugin codegen && rimraf ./src/wrap", "lint": "eslint --color -c ../../../../.eslintrc.js src/", "test": "jest --passWithNoTests --runInBand --verbose", "test:ci": "jest --passWithNoTests --runInBand --verbose", diff --git a/packages/js/plugins/logger/polywrap.plugin.yaml b/packages/js/plugins/logger/polywrap.plugin.yaml index fda8c966e5..37b503ee05 100644 --- a/packages/js/plugins/logger/polywrap.plugin.yaml +++ b/packages/js/plugins/logger/polywrap.plugin.yaml @@ -1,8 +1,8 @@ -format: 0.1.0 +format: "0.2" name: Logger language: plugin/typescript module: ./src/index.ts schema: ./src/schema.graphql -import_redirects: +import_abis: - uri: "ens/logger.core.polywrap.eth" - schema: ../../../interfaces/logger/src/schema.graphql + abi: ../../../interfaces/logger/build-man/wrap.info diff --git a/packages/js/plugins/logger/src/index.ts b/packages/js/plugins/logger/src/index.ts index b40ea2dac4..d9526c8ec4 100644 --- a/packages/js/plugins/logger/src/index.ts +++ b/packages/js/plugins/logger/src/index.ts @@ -4,7 +4,7 @@ import { Logger_LogLevel, Logger_LogLevelEnum, manifest, -} from "./wrap"; +} from "./wrap-man"; import { PluginFactory } from "@polywrap/core-js"; diff --git a/packages/js/plugins/logger/src/wrap-man/index.ts b/packages/js/plugins/logger/src/wrap-man/index.ts new file mode 100644 index 0000000000..315871f96d --- /dev/null +++ b/packages/js/plugins/logger/src/wrap-man/index.ts @@ -0,0 +1,8 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +export * from "./wrap.info"; +export * from "./module"; +export * from "./types"; + +export { Client } from "@polywrap/core-js"; diff --git a/packages/js/plugins/logger/src/wrap-man/module.ts b/packages/js/plugins/logger/src/wrap-man/module.ts new file mode 100644 index 0000000000..15f9609ded --- /dev/null +++ b/packages/js/plugins/logger/src/wrap-man/module.ts @@ -0,0 +1,27 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +import * as Types from "./types"; + +import { + Client, + PluginModule, + MaybeAsync +} from "@polywrap/core-js"; + +export interface Args_log extends Record { + level: Types.Logger_LogLevel; + message: Types.String; +} + +export abstract class Module< + TConfig +> extends PluginModule< + TConfig +> { + + abstract log( + args: Args_log, + client: Client + ): MaybeAsync; +} diff --git a/packages/js/plugins/logger/src/wrap-man/types.ts b/packages/js/plugins/logger/src/wrap-man/types.ts new file mode 100644 index 0000000000..cf143be7c1 --- /dev/null +++ b/packages/js/plugins/logger/src/wrap-man/types.ts @@ -0,0 +1,79 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +// @ts-ignore +import * as Types from "./"; + +// @ts-ignore +import { + Client, + InvokeResult +} from "@polywrap/core-js"; + +export type UInt = number; +export type UInt8 = number; +export type UInt16 = number; +export type UInt32 = number; +export type Int = number; +export type Int8 = number; +export type Int16 = number; +export type Int32 = number; +export type Bytes = Uint8Array; +export type BigInt = string; +export type BigNumber = string; +export type Json = string; +export type String = string; +export type Boolean = boolean; + +/// Env START /// +/// Env END /// + +/// Objects START /// +/// Objects END /// + +/// Enums START /// +/// Enums END /// + +/// Imported Objects START /// + +/* URI: "ens/logger.core.polywrap.eth" */ +export enum Logger_LogLevelEnum { + DEBUG, + INFO, + WARN, + ERROR, +} + +export type Logger_LogLevelString = + | "DEBUG" + | "INFO" + | "WARN" + | "ERROR" + +export type Logger_LogLevel = Logger_LogLevelEnum | Logger_LogLevelString; + +/// Imported Objects END /// + +/// Imported Modules START /// + +/* URI: "ens/logger.core.polywrap.eth" */ +interface Logger_Module_Args_log extends Record { + level: Types.Logger_LogLevel; + message: Types.String; +} + +/* URI: "ens/logger.core.polywrap.eth" */ +export const Logger_Module = { + log: async ( + args: Logger_Module_Args_log, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/logger.core.polywrap.eth", + method: "log", + args + }); + } +} + +/// Imported Modules END /// diff --git a/packages/js/plugins/logger/src/wrap-man/wrap.info.ts b/packages/js/plugins/logger/src/wrap-man/wrap.info.ts new file mode 100644 index 0000000000..da5624a0e8 --- /dev/null +++ b/packages/js/plugins/logger/src/wrap-man/wrap.info.ts @@ -0,0 +1,123 @@ +import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; + +export const manifest: WrapManifest = { + name: "Logger", + type: "plugin", + version: "0.1", + abi: { + version: "0.1", + importedModuleTypes: [ + { + type: "Logger_Module", + kind: 256, + methods: [ + { + type: "Method", + name: "log", + required: true, + kind: 64, + arguments: [ + { + type: "Logger_LogLevel", + name: "level", + required: true, + kind: 34, + enum: { + type: "Logger_LogLevel", + name: "level", + required: true, + kind: 16384, + }, + }, + { + type: "String", + name: "message", + required: true, + kind: 34, + scalar: { + type: "String", + name: "message", + required: true, + kind: 4, + }, + }, + ], + return: { + type: "Boolean", + name: "log", + required: true, + kind: 34, + scalar: { type: "Boolean", name: "log", required: true, kind: 4 }, + }, + }, + ], + uri: "ens/logger.core.polywrap.eth", + namespace: "Logger", + nativeType: "Module", + isInterface: false, + }, + ], + importedEnumTypes: [ + { + type: "Logger_LogLevel", + kind: 520, + constants: ["DEBUG", "INFO", "WARN", "ERROR"], + uri: "ens/logger.core.polywrap.eth", + namespace: "Logger", + nativeType: "LogLevel", + }, + ], + moduleType: { + type: "Module", + kind: 128, + methods: [ + { + type: "Method", + name: "log", + required: true, + kind: 64, + arguments: [ + { + type: "Logger_LogLevel", + name: "level", + required: true, + kind: 34, + enum: { + type: "Logger_LogLevel", + name: "level", + required: true, + kind: 16384, + }, + }, + { + type: "String", + name: "message", + required: true, + kind: 34, + scalar: { + type: "String", + name: "message", + required: true, + kind: 4, + }, + }, + ], + return: { + type: "Boolean", + name: "log", + required: true, + kind: 34, + scalar: { type: "Boolean", name: "log", required: true, kind: 4 }, + }, + }, + ], + imports: [{ type: "Logger_Module" }, { type: "Logger_LogLevel" }], + interfaces: [ + { + type: "Logger_Module", + kind: 2048, + }, + ], + } + } +}; diff --git a/packages/js/plugins/sha3/package.json b/packages/js/plugins/sha3/package.json index c6e52c9109..549b94bf25 100644 --- a/packages/js/plugins/sha3/package.json +++ b/packages/js/plugins/sha3/package.json @@ -12,8 +12,9 @@ "build" ], "scripts": { - "build": "rimraf ./build && yarn codegen && tsc --project tsconfig.build.json", + "build": "rimraf ./build && tsc --project tsconfig.build.json", "codegen": "node ../../../../dependencies/node_modules/polywrap/bin/polywrap plugin codegen", + "codegen:patch": "node ../../../cli/bin/polywrap plugin codegen && rimraf ./src/wrap", "lint": "eslint --color -c ../../../../.eslintrc.js src/", "test": "jest --passWithNoTests --runInBand --verbose", "test:ci": "jest --passWithNoTests --runInBand --verbose", diff --git a/packages/js/plugins/sha3/polywrap.plugin.yaml b/packages/js/plugins/sha3/polywrap.plugin.yaml index aeaec3569e..b0468c424f 100644 --- a/packages/js/plugins/sha3/polywrap.plugin.yaml +++ b/packages/js/plugins/sha3/polywrap.plugin.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: Sha3 language: plugin/typescript module: ./src/index.ts diff --git a/packages/js/plugins/sha3/src/index.ts b/packages/js/plugins/sha3/src/index.ts index 508686dcd5..a3d522b5c7 100644 --- a/packages/js/plugins/sha3/src/index.ts +++ b/packages/js/plugins/sha3/src/index.ts @@ -16,7 +16,7 @@ import { Args_shake_128, Args_shake_256, manifest, -} from "./wrap"; +} from "./wrap-man"; import { sha3_512, diff --git a/packages/js/plugins/sha3/src/wrap-man/index.ts b/packages/js/plugins/sha3/src/wrap-man/index.ts new file mode 100644 index 0000000000..315871f96d --- /dev/null +++ b/packages/js/plugins/sha3/src/wrap-man/index.ts @@ -0,0 +1,8 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +export * from "./wrap.info"; +export * from "./module"; +export * from "./types"; + +export { Client } from "@polywrap/core-js"; diff --git a/packages/js/plugins/sha3/src/wrap-man/module.ts b/packages/js/plugins/sha3/src/wrap-man/module.ts new file mode 100644 index 0000000000..4c77351a4e --- /dev/null +++ b/packages/js/plugins/sha3/src/wrap-man/module.ts @@ -0,0 +1,127 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +import * as Types from "./types"; + +import { + Client, + PluginModule, + MaybeAsync +} from "@polywrap/core-js"; + +export interface Args_sha3_512 extends Record { + message: Types.String; +} + +export interface Args_sha3_384 extends Record { + message: Types.String; +} + +export interface Args_sha3_256 extends Record { + message: Types.String; +} + +export interface Args_sha3_224 extends Record { + message: Types.String; +} + +export interface Args_keccak_512 extends Record { + message: Types.String; +} + +export interface Args_keccak_384 extends Record { + message: Types.String; +} + +export interface Args_keccak_256 extends Record { + message: Types.String; +} + +export interface Args_keccak_224 extends Record { + message: Types.String; +} + +export interface Args_hex_keccak_256 extends Record { + message: Types.String; +} + +export interface Args_buffer_keccak_256 extends Record { + message: Types.Bytes; +} + +export interface Args_shake_128 extends Record { + message: Types.String; + outputBits: Types.Int; +} + +export interface Args_shake_256 extends Record { + message: Types.String; + outputBits: Types.Int; +} + +export abstract class Module< + TConfig +> extends PluginModule< + TConfig +> { + + abstract sha3_512( + args: Args_sha3_512, + client: Client + ): MaybeAsync; + + abstract sha3_384( + args: Args_sha3_384, + client: Client + ): MaybeAsync; + + abstract sha3_256( + args: Args_sha3_256, + client: Client + ): MaybeAsync; + + abstract sha3_224( + args: Args_sha3_224, + client: Client + ): MaybeAsync; + + abstract keccak_512( + args: Args_keccak_512, + client: Client + ): MaybeAsync; + + abstract keccak_384( + args: Args_keccak_384, + client: Client + ): MaybeAsync; + + abstract keccak_256( + args: Args_keccak_256, + client: Client + ): MaybeAsync; + + abstract keccak_224( + args: Args_keccak_224, + client: Client + ): MaybeAsync; + + abstract hex_keccak_256( + args: Args_hex_keccak_256, + client: Client + ): MaybeAsync; + + abstract buffer_keccak_256( + args: Args_buffer_keccak_256, + client: Client + ): MaybeAsync; + + abstract shake_128( + args: Args_shake_128, + client: Client + ): MaybeAsync; + + abstract shake_256( + args: Args_shake_256, + client: Client + ): MaybeAsync; +} diff --git a/packages/js/plugins/sha3/src/wrap-man/types.ts b/packages/js/plugins/sha3/src/wrap-man/types.ts new file mode 100644 index 0000000000..bbcdcda02d --- /dev/null +++ b/packages/js/plugins/sha3/src/wrap-man/types.ts @@ -0,0 +1,43 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +// @ts-ignore +import * as Types from "./"; + +// @ts-ignore +import { + Client, + InvokeResult +} from "@polywrap/core-js"; + +export type UInt = number; +export type UInt8 = number; +export type UInt16 = number; +export type UInt32 = number; +export type Int = number; +export type Int8 = number; +export type Int16 = number; +export type Int32 = number; +export type Bytes = Uint8Array; +export type BigInt = string; +export type BigNumber = string; +export type Json = string; +export type String = string; +export type Boolean = boolean; + +/// Env START /// +/// Env END /// + +/// Objects START /// +/// Objects END /// + +/// Enums START /// +/// Enums END /// + +/// Imported Objects START /// + +/// Imported Objects END /// + +/// Imported Modules START /// + +/// Imported Modules END /// diff --git a/packages/js/plugins/sha3/src/wrap-man/wrap.info.ts b/packages/js/plugins/sha3/src/wrap-man/wrap.info.ts new file mode 100644 index 0000000000..ece55b9806 --- /dev/null +++ b/packages/js/plugins/sha3/src/wrap-man/wrap.info.ts @@ -0,0 +1,424 @@ +import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; + +export const manifest: WrapManifest = { + name: "Sha3", + type: "plugin", + version: "0.1", + abi: { + version: "0.1", + moduleType: { + type: "Module", + kind: 128, + methods: [ + { + type: "Method", + name: "sha3_512", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "message", + required: true, + kind: 34, + scalar: { + type: "String", + name: "message", + required: true, + kind: 4, + }, + }, + ], + return: { + type: "String", + name: "sha3_512", + required: true, + kind: 34, + scalar: { + type: "String", + name: "sha3_512", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "sha3_384", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "message", + required: true, + kind: 34, + scalar: { + type: "String", + name: "message", + required: true, + kind: 4, + }, + }, + ], + return: { + type: "String", + name: "sha3_384", + required: true, + kind: 34, + scalar: { + type: "String", + name: "sha3_384", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "sha3_256", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "message", + required: true, + kind: 34, + scalar: { + type: "String", + name: "message", + required: true, + kind: 4, + }, + }, + ], + return: { + type: "String", + name: "sha3_256", + required: true, + kind: 34, + scalar: { + type: "String", + name: "sha3_256", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "sha3_224", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "message", + required: true, + kind: 34, + scalar: { + type: "String", + name: "message", + required: true, + kind: 4, + }, + }, + ], + return: { + type: "String", + name: "sha3_224", + required: true, + kind: 34, + scalar: { + type: "String", + name: "sha3_224", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "keccak_512", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "message", + required: true, + kind: 34, + scalar: { + type: "String", + name: "message", + required: true, + kind: 4, + }, + }, + ], + return: { + type: "String", + name: "keccak_512", + required: true, + kind: 34, + scalar: { + type: "String", + name: "keccak_512", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "keccak_384", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "message", + required: true, + kind: 34, + scalar: { + type: "String", + name: "message", + required: true, + kind: 4, + }, + }, + ], + return: { + type: "String", + name: "keccak_384", + required: true, + kind: 34, + scalar: { + type: "String", + name: "keccak_384", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "keccak_256", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "message", + required: true, + kind: 34, + scalar: { + type: "String", + name: "message", + required: true, + kind: 4, + }, + }, + ], + return: { + type: "String", + name: "keccak_256", + required: true, + kind: 34, + scalar: { + type: "String", + name: "keccak_256", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "keccak_224", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "message", + required: true, + kind: 34, + scalar: { + type: "String", + name: "message", + required: true, + kind: 4, + }, + }, + ], + return: { + type: "String", + name: "keccak_224", + required: true, + kind: 34, + scalar: { + type: "String", + name: "keccak_224", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "hex_keccak_256", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "message", + required: true, + kind: 34, + scalar: { + type: "String", + name: "message", + required: true, + kind: 4, + }, + }, + ], + return: { + type: "String", + name: "hex_keccak_256", + required: true, + kind: 34, + scalar: { + type: "String", + name: "hex_keccak_256", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "buffer_keccak_256", + required: true, + kind: 64, + arguments: [ + { + type: "Bytes", + name: "message", + required: true, + kind: 34, + scalar: { + type: "Bytes", + name: "message", + required: true, + kind: 4, + }, + }, + ], + return: { + type: "String", + name: "buffer_keccak_256", + required: true, + kind: 34, + scalar: { + type: "String", + name: "buffer_keccak_256", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "shake_128", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "message", + required: true, + kind: 34, + scalar: { + type: "String", + name: "message", + required: true, + kind: 4, + }, + }, + { + type: "Int", + name: "outputBits", + required: true, + kind: 34, + scalar: { + type: "Int", + name: "outputBits", + required: true, + kind: 4, + }, + }, + ], + return: { + type: "String", + name: "shake_128", + required: true, + kind: 34, + scalar: { + type: "String", + name: "shake_128", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "shake_256", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "message", + required: true, + kind: 34, + scalar: { + type: "String", + name: "message", + required: true, + kind: 4, + }, + }, + { + type: "Int", + name: "outputBits", + required: true, + kind: 34, + scalar: { + type: "Int", + name: "outputBits", + required: true, + kind: 4, + }, + }, + ], + return: { + type: "String", + name: "shake_256", + required: true, + kind: 34, + scalar: { + type: "String", + name: "shake_256", + required: true, + kind: 4, + }, + }, + }, + ], + } + } +}; diff --git a/packages/js/plugins/uri-resolvers/ens-resolver/package.json b/packages/js/plugins/uri-resolvers/ens-resolver/package.json index ab5a28b553..7918a8b4e2 100644 --- a/packages/js/plugins/uri-resolvers/ens-resolver/package.json +++ b/packages/js/plugins/uri-resolvers/ens-resolver/package.json @@ -12,8 +12,9 @@ "build" ], "scripts": { - "build": "rimraf ./build && yarn codegen && tsc --project tsconfig.build.json", + "build": "rimraf ./build && tsc --project tsconfig.build.json", "codegen": "node ../../../../../dependencies/node_modules/polywrap/bin/polywrap plugin codegen", + "codegen:patch": "node ../../../../cli/bin/polywrap plugin codegen && rimraf ./src/wrap", "lint": "eslint --color -c ../../../../../.eslintrc.js src/", "test": "jest --passWithNoTests --runInBand --verbose", "test:ci": "jest --passWithNoTests --runInBand --verbose", diff --git a/packages/js/plugins/uri-resolvers/ens-resolver/polywrap.plugin.yaml b/packages/js/plugins/uri-resolvers/ens-resolver/polywrap.plugin.yaml index 53f1288e7a..3050945754 100644 --- a/packages/js/plugins/uri-resolvers/ens-resolver/polywrap.plugin.yaml +++ b/packages/js/plugins/uri-resolvers/ens-resolver/polywrap.plugin.yaml @@ -1,8 +1,10 @@ -format: 0.1.0 +format: "0.2" language: plugin/typescript name: EnsUriResolver module: ./src/index.ts schema: ./src/schema.graphql -import_redirects: +import_abis: - uri: "ens/uri-resolver.core.polywrap.eth" - schema: ../../../../interfaces/uri-resolver/src/schema.graphql + abi: ../../../../interfaces/uri-resolver/build-man/wrap.info + - uri: "ens/ethereum.polywrap.eth" + abi: ../../ethereum/build/wrap.info diff --git a/packages/js/plugins/uri-resolvers/ens-resolver/src/__tests__/e2e.spec.ts b/packages/js/plugins/uri-resolvers/ens-resolver/src/__tests__/e2e.spec.ts index 910ed05684..cc9d9b047e 100644 --- a/packages/js/plugins/uri-resolvers/ens-resolver/src/__tests__/e2e.spec.ts +++ b/packages/js/plugins/uri-resolvers/ens-resolver/src/__tests__/e2e.spec.ts @@ -12,9 +12,6 @@ import { ensResolverPlugin } from ".."; import { ipfsPlugin } from "@polywrap/ipfs-plugin-js"; import { ethereumPlugin } from "@polywrap/ethereum-plugin-js"; -import fs from "fs"; -import path from "path"; - jest.setTimeout(300000); describe("ENS Resolver Plugin", () => { @@ -78,15 +75,6 @@ describe("ENS Resolver Plugin", () => { expect(resolution.error).toBeFalsy(); expect(resolution.wrapper).toBeTruthy(); - const expectedSchema = await fs.promises.readFile( - path.resolve(wrapperAbsPath, "build/schema.graphql"), - { encoding: "utf-8" } - ); - - const schema = await resolution.wrapper?.getSchema(client); - - expect(schema).toEqual(expectedSchema); - const manifest = await resolution.wrapper?.getManifest( {}, client diff --git a/packages/js/plugins/uri-resolvers/ens-resolver/src/index.ts b/packages/js/plugins/uri-resolvers/ens-resolver/src/index.ts index 17dcc81de5..e0c5448d65 100644 --- a/packages/js/plugins/uri-resolvers/ens-resolver/src/index.ts +++ b/packages/js/plugins/uri-resolvers/ens-resolver/src/index.ts @@ -7,7 +7,7 @@ import { Bytes, Ethereum_Module, manifest, -} from "./wrap"; +} from "./wrap-man"; import { ethers } from "ethers"; import { Base58 } from "@ethersproject/basex"; diff --git a/packages/js/plugins/uri-resolvers/ens-resolver/src/schema.graphql b/packages/js/plugins/uri-resolvers/ens-resolver/src/schema.graphql index 25518256f7..94c2d9f698 100644 --- a/packages/js/plugins/uri-resolvers/ens-resolver/src/schema.graphql +++ b/packages/js/plugins/uri-resolvers/ens-resolver/src/schema.graphql @@ -1,4 +1,4 @@ #import { Module, MaybeUriOrManifest } into UriResolver from "ens/uri-resolver.core.polywrap.eth" #import { Module } into Ethereum from "ens/ethereum.polywrap.eth" -type Module implements UriResolver_Module { } \ No newline at end of file +type Module implements UriResolver_Module { } diff --git a/packages/js/plugins/uri-resolvers/ens-resolver/src/wrap-man/index.ts b/packages/js/plugins/uri-resolvers/ens-resolver/src/wrap-man/index.ts new file mode 100644 index 0000000000..315871f96d --- /dev/null +++ b/packages/js/plugins/uri-resolvers/ens-resolver/src/wrap-man/index.ts @@ -0,0 +1,8 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +export * from "./wrap.info"; +export * from "./module"; +export * from "./types"; + +export { Client } from "@polywrap/core-js"; diff --git a/packages/js/plugins/uri-resolvers/ens-resolver/src/wrap-man/module.ts b/packages/js/plugins/uri-resolvers/ens-resolver/src/wrap-man/module.ts new file mode 100644 index 0000000000..a92a0a5277 --- /dev/null +++ b/packages/js/plugins/uri-resolvers/ens-resolver/src/wrap-man/module.ts @@ -0,0 +1,36 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +import * as Types from "./types"; + +import { + Client, + PluginModule, + MaybeAsync +} from "@polywrap/core-js"; + +export interface Args_tryResolveUri extends Record { + authority: Types.String; + path: Types.String; +} + +export interface Args_getFile extends Record { + path: Types.String; +} + +export abstract class Module< + TConfig +> extends PluginModule< + TConfig +> { + + abstract tryResolveUri( + args: Args_tryResolveUri, + client: Client + ): MaybeAsync; + + abstract getFile( + args: Args_getFile, + client: Client + ): MaybeAsync; +} diff --git a/packages/js/plugins/uri-resolvers/ens-resolver/src/wrap-man/types.ts b/packages/js/plugins/uri-resolvers/ens-resolver/src/wrap-man/types.ts new file mode 100644 index 0000000000..50df6a8ff6 --- /dev/null +++ b/packages/js/plugins/uri-resolvers/ens-resolver/src/wrap-man/types.ts @@ -0,0 +1,673 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +// @ts-ignore +import * as Types from "./"; + +// @ts-ignore +import { + Client, + InvokeResult +} from "@polywrap/core-js"; + +export type UInt = number; +export type UInt8 = number; +export type UInt16 = number; +export type UInt32 = number; +export type Int = number; +export type Int8 = number; +export type Int16 = number; +export type Int32 = number; +export type Bytes = Uint8Array; +export type BigInt = string; +export type BigNumber = string; +export type Json = string; +export type String = string; +export type Boolean = boolean; + +/// Env START /// +/// Env END /// + +/// Objects START /// +/// Objects END /// + +/// Enums START /// +/// Enums END /// + +/// Imported Objects START /// + +/* URI: "ens/uri-resolver.core.polywrap.eth" */ +export interface UriResolver_MaybeUriOrManifest { + uri?: Types.String | null; + manifest?: Types.Bytes | null; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +export interface Ethereum_Connection { + node?: Types.String | null; + networkNameOrChainId?: Types.String | null; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +export interface Ethereum_TxOverrides { + gasLimit?: Types.BigInt | null; + gasPrice?: Types.BigInt | null; + value?: Types.BigInt | null; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +export interface Ethereum_StaticTxResult { + result: Types.String; + error: Types.Boolean; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +export interface Ethereum_TxRequest { + to?: Types.String | null; + from?: Types.String | null; + nonce?: Types.UInt32 | null; + gasLimit?: Types.BigInt | null; + gasPrice?: Types.BigInt | null; + data?: Types.String | null; + value?: Types.BigInt | null; + chainId?: Types.BigInt | null; + type?: Types.UInt32 | null; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +export interface Ethereum_TxReceipt { + to: Types.String; + from: Types.String; + contractAddress: Types.String; + transactionIndex: Types.UInt32; + root?: Types.String | null; + gasUsed: Types.BigInt; + logsBloom: Types.String; + transactionHash: Types.String; + logs: Array; + blockNumber: Types.BigInt; + blockHash: Types.String; + confirmations: Types.UInt32; + cumulativeGasUsed: Types.BigInt; + effectiveGasPrice: Types.BigInt; + byzantium: Types.Boolean; + type: Types.UInt32; + status?: Types.UInt32 | null; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +export interface Ethereum_Log { + blockNumber: Types.BigInt; + blockHash: Types.String; + transactionIndex: Types.UInt32; + removed: Types.Boolean; + address: Types.String; + data: Types.String; + topics: Array; + transactionHash: Types.String; + logIndex: Types.UInt32; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +export interface Ethereum_EventNotification { + data: Types.String; + address: Types.String; + log: Types.Ethereum_Log; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +export interface Ethereum_Network { + name: Types.String; + chainId: Types.BigInt; + ensAddress?: Types.String | null; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +export interface Ethereum_TxResponse { + hash: Types.String; + to?: Types.String | null; + from: Types.String; + nonce: Types.UInt32; + gasLimit: Types.BigInt; + gasPrice?: Types.BigInt | null; + data: Types.String; + value: Types.BigInt; + chainId: Types.BigInt; + blockNumber?: Types.BigInt | null; + blockHash?: Types.String | null; + timestamp?: Types.UInt32 | null; + confirmations: Types.UInt32; + raw?: Types.String | null; + r?: Types.String | null; + s?: Types.String | null; + v?: Types.UInt32 | null; + type?: Types.UInt32 | null; + accessList?: Array | null; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +export interface Ethereum_Access { + address: Types.String; + storageKeys: Array; +} + +/// Imported Objects END /// + +/// Imported Modules START /// + +/* URI: "ens/uri-resolver.core.polywrap.eth" */ +interface UriResolver_Module_Args_tryResolveUri extends Record { + authority: Types.String; + path: Types.String; +} + +/* URI: "ens/uri-resolver.core.polywrap.eth" */ +interface UriResolver_Module_Args_getFile extends Record { + path: Types.String; +} + +/* URI: "ens/uri-resolver.core.polywrap.eth" */ +export const UriResolver_Module = { + tryResolveUri: async ( + args: UriResolver_Module_Args_tryResolveUri, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/uri-resolver.core.polywrap.eth", + method: "tryResolveUri", + args + }); + }, + + getFile: async ( + args: UriResolver_Module_Args_getFile, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/uri-resolver.core.polywrap.eth", + method: "getFile", + args + }); + } +} + +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_callContractView extends Record { + address: Types.String; + method: Types.String; + args?: Array | null; + connection?: Types.Ethereum_Connection | null; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_callContractStatic extends Record { + address: Types.String; + method: Types.String; + args?: Array | null; + connection?: Types.Ethereum_Connection | null; + txOverrides?: Types.Ethereum_TxOverrides | null; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_getBalance extends Record { + address: Types.String; + blockTag?: Types.BigInt | null; + connection?: Types.Ethereum_Connection | null; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_encodeParams extends Record { + types: Array; + values: Array; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_encodeFunction extends Record { + method: Types.String; + args?: Array | null; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_solidityPack extends Record { + types: Array; + values: Array; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_solidityKeccak256 extends Record { + types: Array; + values: Array; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_soliditySha256 extends Record { + types: Array; + values: Array; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_getSignerAddress extends Record { + connection?: Types.Ethereum_Connection | null; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_getSignerBalance extends Record { + blockTag?: Types.BigInt | null; + connection?: Types.Ethereum_Connection | null; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_getSignerTransactionCount extends Record { + blockTag?: Types.BigInt | null; + connection?: Types.Ethereum_Connection | null; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_getGasPrice extends Record { + connection?: Types.Ethereum_Connection | null; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_estimateTransactionGas extends Record { + tx: Types.Ethereum_TxRequest; + connection?: Types.Ethereum_Connection | null; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_estimateContractCallGas extends Record { + address: Types.String; + method: Types.String; + args?: Array | null; + connection?: Types.Ethereum_Connection | null; + txOverrides?: Types.Ethereum_TxOverrides | null; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_checkAddress extends Record { + address: Types.String; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_toWei extends Record { + eth: Types.String; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_toEth extends Record { + wei: Types.BigInt; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_awaitTransaction extends Record { + txHash: Types.String; + confirmations: Types.UInt32; + timeout: Types.UInt32; + connection?: Types.Ethereum_Connection | null; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_waitForEvent extends Record { + address: Types.String; + event: Types.String; + args?: Array | null; + timeout?: Types.UInt32 | null; + connection?: Types.Ethereum_Connection | null; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_getNetwork extends Record { + connection?: Types.Ethereum_Connection | null; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_callContractMethod extends Record { + address: Types.String; + method: Types.String; + args?: Array | null; + connection?: Types.Ethereum_Connection | null; + txOverrides?: Types.Ethereum_TxOverrides | null; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_callContractMethodAndWait extends Record { + address: Types.String; + method: Types.String; + args?: Array | null; + connection?: Types.Ethereum_Connection | null; + txOverrides?: Types.Ethereum_TxOverrides | null; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_sendTransaction extends Record { + tx: Types.Ethereum_TxRequest; + connection?: Types.Ethereum_Connection | null; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_sendTransactionAndWait extends Record { + tx: Types.Ethereum_TxRequest; + connection?: Types.Ethereum_Connection | null; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_deployContract extends Record { + abi: Types.String; + bytecode: Types.String; + args?: Array | null; + connection?: Types.Ethereum_Connection | null; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_signMessage extends Record { + message: Types.String; + connection?: Types.Ethereum_Connection | null; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +interface Ethereum_Module_Args_sendRPC extends Record { + method: Types.String; + params: Array; + connection?: Types.Ethereum_Connection | null; +} + +/* URI: "ens/ethereum.polywrap.eth" */ +export const Ethereum_Module = { + callContractView: async ( + args: Ethereum_Module_Args_callContractView, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "callContractView", + args + }); + }, + + callContractStatic: async ( + args: Ethereum_Module_Args_callContractStatic, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "callContractStatic", + args + }); + }, + + getBalance: async ( + args: Ethereum_Module_Args_getBalance, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "getBalance", + args + }); + }, + + encodeParams: async ( + args: Ethereum_Module_Args_encodeParams, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "encodeParams", + args + }); + }, + + encodeFunction: async ( + args: Ethereum_Module_Args_encodeFunction, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "encodeFunction", + args + }); + }, + + solidityPack: async ( + args: Ethereum_Module_Args_solidityPack, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "solidityPack", + args + }); + }, + + solidityKeccak256: async ( + args: Ethereum_Module_Args_solidityKeccak256, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "solidityKeccak256", + args + }); + }, + + soliditySha256: async ( + args: Ethereum_Module_Args_soliditySha256, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "soliditySha256", + args + }); + }, + + getSignerAddress: async ( + args: Ethereum_Module_Args_getSignerAddress, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "getSignerAddress", + args + }); + }, + + getSignerBalance: async ( + args: Ethereum_Module_Args_getSignerBalance, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "getSignerBalance", + args + }); + }, + + getSignerTransactionCount: async ( + args: Ethereum_Module_Args_getSignerTransactionCount, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "getSignerTransactionCount", + args + }); + }, + + getGasPrice: async ( + args: Ethereum_Module_Args_getGasPrice, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "getGasPrice", + args + }); + }, + + estimateTransactionGas: async ( + args: Ethereum_Module_Args_estimateTransactionGas, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "estimateTransactionGas", + args + }); + }, + + estimateContractCallGas: async ( + args: Ethereum_Module_Args_estimateContractCallGas, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "estimateContractCallGas", + args + }); + }, + + checkAddress: async ( + args: Ethereum_Module_Args_checkAddress, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "checkAddress", + args + }); + }, + + toWei: async ( + args: Ethereum_Module_Args_toWei, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "toWei", + args + }); + }, + + toEth: async ( + args: Ethereum_Module_Args_toEth, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "toEth", + args + }); + }, + + awaitTransaction: async ( + args: Ethereum_Module_Args_awaitTransaction, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "awaitTransaction", + args + }); + }, + + waitForEvent: async ( + args: Ethereum_Module_Args_waitForEvent, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "waitForEvent", + args + }); + }, + + getNetwork: async ( + args: Ethereum_Module_Args_getNetwork, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "getNetwork", + args + }); + }, + + callContractMethod: async ( + args: Ethereum_Module_Args_callContractMethod, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "callContractMethod", + args + }); + }, + + callContractMethodAndWait: async ( + args: Ethereum_Module_Args_callContractMethodAndWait, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "callContractMethodAndWait", + args + }); + }, + + sendTransaction: async ( + args: Ethereum_Module_Args_sendTransaction, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "sendTransaction", + args + }); + }, + + sendTransactionAndWait: async ( + args: Ethereum_Module_Args_sendTransactionAndWait, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "sendTransactionAndWait", + args + }); + }, + + deployContract: async ( + args: Ethereum_Module_Args_deployContract, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "deployContract", + args + }); + }, + + signMessage: async ( + args: Ethereum_Module_Args_signMessage, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "signMessage", + args + }); + }, + + sendRPC: async ( + args: Ethereum_Module_Args_sendRPC, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ethereum.polywrap.eth", + method: "sendRPC", + args + }); + } +} + +/// Imported Modules END /// diff --git a/packages/js/plugins/uri-resolvers/ens-resolver/src/wrap-man/wrap.info.ts b/packages/js/plugins/uri-resolvers/ens-resolver/src/wrap-man/wrap.info.ts new file mode 100644 index 0000000000..41911ade76 --- /dev/null +++ b/packages/js/plugins/uri-resolvers/ens-resolver/src/wrap-man/wrap.info.ts @@ -0,0 +1,2694 @@ +import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; + +export const manifest: WrapManifest = { + name: "EnsResolver", + type: "plugin", + version: "0.1", + abi: { + "version": "0.1", + "importedObjectTypes": [ + { + "type": "UriResolver_MaybeUriOrManifest", + "kind": 1025, + "properties": [ + { + "type": "String", + "name": "uri", + "kind": 34, + "scalar": { + "type": "String", + "name": "uri", + "kind": 4 + }, + }, + { + "type": "Bytes", + "name": "manifest", + "kind": 34, + "scalar": { + "type": "Bytes", + "name": "manifest", + "kind": 4 + }, + } + ], + "uri": "ens/uri-resolver.core.polywrap.eth", + "namespace": "UriResolver", + "nativeType": "MaybeUriOrManifest" + }, + { + "type": "Ethereum_Connection", + "kind": 1025, + "properties": [ + { + "type": "String", + "name": "node", + "kind": 34, + "scalar": { + "type": "String", + "name": "node", + "kind": 4 + }, + }, + { + "type": "String", + "name": "networkNameOrChainId", + "kind": 34, + "scalar": { + "type": "String", + "name": "networkNameOrChainId", + "kind": 4 + }, + } + ], + "uri": "ens/ethereum.polywrap.eth", + "namespace": "Ethereum", + "nativeType": "Connection" + }, + { + "type": "Ethereum_TxOverrides", + "kind": 1025, + "properties": [ + { + "type": "BigInt", + "name": "gasLimit", + "kind": 34, + "scalar": { + "type": "BigInt", + "name": "gasLimit", + "kind": 4 + }, + }, + { + "type": "BigInt", + "name": "gasPrice", + "kind": 34, + "scalar": { + "type": "BigInt", + "name": "gasPrice", + "kind": 4 + }, + }, + { + "type": "BigInt", + "name": "value", + "kind": 34, + "scalar": { + "type": "BigInt", + "name": "value", + "kind": 4 + }, + } + ], + "uri": "ens/ethereum.polywrap.eth", + "namespace": "Ethereum", + "nativeType": "TxOverrides" + }, + { + "type": "Ethereum_StaticTxResult", + "kind": 1025, + "properties": [ + { + "type": "String", + "name": "result", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "result", + "required": true, + "kind": 4 + }, + }, + { + "type": "Boolean", + "name": "error", + "required": true, + "kind": 34, + "scalar": { + "type": "Boolean", + "name": "error", + "required": true, + "kind": 4 + }, + } + ], + "uri": "ens/ethereum.polywrap.eth", + "namespace": "Ethereum", + "nativeType": "StaticTxResult" + }, + { + "type": "Ethereum_TxRequest", + "kind": 1025, + "properties": [ + { + "type": "String", + "name": "to", + "kind": 34, + "scalar": { + "type": "String", + "name": "to", + "kind": 4 + }, + }, + { + "type": "String", + "name": "from", + "kind": 34, + "scalar": { + "type": "String", + "name": "from", + "kind": 4 + }, + }, + { + "type": "UInt32", + "name": "nonce", + "kind": 34, + "scalar": { + "type": "UInt32", + "name": "nonce", + "kind": 4 + }, + }, + { + "type": "BigInt", + "name": "gasLimit", + "kind": 34, + "scalar": { + "type": "BigInt", + "name": "gasLimit", + "kind": 4 + }, + }, + { + "type": "BigInt", + "name": "gasPrice", + "kind": 34, + "scalar": { + "type": "BigInt", + "name": "gasPrice", + "kind": 4 + }, + }, + { + "type": "String", + "name": "data", + "kind": 34, + "scalar": { + "type": "String", + "name": "data", + "kind": 4 + }, + }, + { + "type": "BigInt", + "name": "value", + "kind": 34, + "scalar": { + "type": "BigInt", + "name": "value", + "kind": 4 + }, + }, + { + "type": "BigInt", + "name": "chainId", + "kind": 34, + "scalar": { + "type": "BigInt", + "name": "chainId", + "kind": 4 + }, + }, + { + "type": "UInt32", + "name": "type", + "kind": 34, + "scalar": { + "type": "UInt32", + "name": "type", + "kind": 4 + }, + } + ], + "uri": "ens/ethereum.polywrap.eth", + "namespace": "Ethereum", + "nativeType": "TxRequest" + }, + { + "type": "Ethereum_TxReceipt", + "kind": 1025, + "properties": [ + { + "type": "String", + "name": "to", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "to", + "required": true, + "kind": 4 + }, + }, + { + "type": "String", + "name": "from", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "from", + "required": true, + "kind": 4 + }, + }, + { + "type": "String", + "name": "contractAddress", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "contractAddress", + "required": true, + "kind": 4 + }, + }, + { + "type": "UInt32", + "name": "transactionIndex", + "required": true, + "kind": 34, + "scalar": { + "type": "UInt32", + "name": "transactionIndex", + "required": true, + "kind": 4 + }, + }, + { + "type": "String", + "name": "root", + "kind": 34, + "scalar": { + "type": "String", + "name": "root", + "kind": 4 + }, + }, + { + "type": "BigInt", + "name": "gasUsed", + "required": true, + "kind": 34, + "scalar": { + "type": "BigInt", + "name": "gasUsed", + "required": true, + "kind": 4 + }, + }, + { + "type": "String", + "name": "logsBloom", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "logsBloom", + "required": true, + "kind": 4 + }, + }, + { + "type": "String", + "name": "transactionHash", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "transactionHash", + "required": true, + "kind": 4 + }, + }, + { + "type": "[Ethereum_Log]", + "name": "logs", + "required": true, + "kind": 34, + "array": { + "type": "[Ethereum_Log]", + "name": "logs", + "required": true, + "kind": 18, + "object": { + "type": "Ethereum_Log", + "name": "logs", + "required": true, + "kind": 8192 + }, + "item": { + "type": "Ethereum_Log", + "name": "logs", + "required": true, + "kind": 8192 + } + }, + }, + { + "type": "BigInt", + "name": "blockNumber", + "required": true, + "kind": 34, + "scalar": { + "type": "BigInt", + "name": "blockNumber", + "required": true, + "kind": 4 + }, + }, + { + "type": "String", + "name": "blockHash", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "blockHash", + "required": true, + "kind": 4 + }, + }, + { + "type": "UInt32", + "name": "confirmations", + "required": true, + "kind": 34, + "scalar": { + "type": "UInt32", + "name": "confirmations", + "required": true, + "kind": 4 + }, + }, + { + "type": "BigInt", + "name": "cumulativeGasUsed", + "required": true, + "kind": 34, + "scalar": { + "type": "BigInt", + "name": "cumulativeGasUsed", + "required": true, + "kind": 4 + }, + }, + { + "type": "BigInt", + "name": "effectiveGasPrice", + "required": true, + "kind": 34, + "scalar": { + "type": "BigInt", + "name": "effectiveGasPrice", + "required": true, + "kind": 4 + }, + }, + { + "type": "Boolean", + "name": "byzantium", + "required": true, + "kind": 34, + "scalar": { + "type": "Boolean", + "name": "byzantium", + "required": true, + "kind": 4 + }, + }, + { + "type": "UInt32", + "name": "type", + "required": true, + "kind": 34, + "scalar": { + "type": "UInt32", + "name": "type", + "required": true, + "kind": 4 + }, + }, + { + "type": "UInt32", + "name": "status", + "kind": 34, + "scalar": { + "type": "UInt32", + "name": "status", + "kind": 4 + }, + } + ], + "uri": "ens/ethereum.polywrap.eth", + "namespace": "Ethereum", + "nativeType": "TxReceipt" + }, + { + "type": "Ethereum_Log", + "kind": 1025, + "properties": [ + { + "type": "BigInt", + "name": "blockNumber", + "required": true, + "kind": 34, + "scalar": { + "type": "BigInt", + "name": "blockNumber", + "required": true, + "kind": 4 + }, + }, + { + "type": "String", + "name": "blockHash", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "blockHash", + "required": true, + "kind": 4 + }, + }, + { + "type": "UInt32", + "name": "transactionIndex", + "required": true, + "kind": 34, + "scalar": { + "type": "UInt32", + "name": "transactionIndex", + "required": true, + "kind": 4 + }, + }, + { + "type": "Boolean", + "name": "removed", + "required": true, + "kind": 34, + "scalar": { + "type": "Boolean", + "name": "removed", + "required": true, + "kind": 4 + }, + }, + { + "type": "String", + "name": "address", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "address", + "required": true, + "kind": 4 + }, + }, + { + "type": "String", + "name": "data", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "data", + "required": true, + "kind": 4 + }, + }, + { + "type": "[String]", + "name": "topics", + "required": true, + "kind": 34, + "array": { + "type": "[String]", + "name": "topics", + "required": true, + "kind": 18, + "scalar": { + "type": "String", + "name": "topics", + "required": true, + "kind": 4 + }, + "item": { + "type": "String", + "name": "topics", + "required": true, + "kind": 4 + } + }, + }, + { + "type": "String", + "name": "transactionHash", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "transactionHash", + "required": true, + "kind": 4 + }, + }, + { + "type": "UInt32", + "name": "logIndex", + "required": true, + "kind": 34, + "scalar": { + "type": "UInt32", + "name": "logIndex", + "required": true, + "kind": 4 + }, + } + ], + "uri": "ens/ethereum.polywrap.eth", + "namespace": "Ethereum", + "nativeType": "Log" + }, + { + "type": "Ethereum_EventNotification", + "kind": 1025, + "properties": [ + { + "type": "String", + "name": "data", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "data", + "required": true, + "kind": 4 + }, + }, + { + "type": "String", + "name": "address", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "address", + "required": true, + "kind": 4 + }, + }, + { + "type": "Ethereum_Log", + "name": "log", + "required": true, + "kind": 34, + "object": { + "type": "Ethereum_Log", + "name": "log", + "required": true, + "kind": 8192 + }, + } + ], + "uri": "ens/ethereum.polywrap.eth", + "namespace": "Ethereum", + "nativeType": "EventNotification" + }, + { + "type": "Ethereum_Network", + "kind": 1025, + "properties": [ + { + "type": "String", + "name": "name", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "name", + "required": true, + "kind": 4 + }, + }, + { + "type": "BigInt", + "name": "chainId", + "required": true, + "kind": 34, + "scalar": { + "type": "BigInt", + "name": "chainId", + "required": true, + "kind": 4 + }, + }, + { + "type": "String", + "name": "ensAddress", + "kind": 34, + "scalar": { + "type": "String", + "name": "ensAddress", + "kind": 4 + }, + } + ], + "uri": "ens/ethereum.polywrap.eth", + "namespace": "Ethereum", + "nativeType": "Network" + }, + { + "type": "Ethereum_TxResponse", + "kind": 1025, + "properties": [ + { + "type": "String", + "name": "hash", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "hash", + "required": true, + "kind": 4 + }, + }, + { + "type": "String", + "name": "to", + "kind": 34, + "scalar": { + "type": "String", + "name": "to", + "kind": 4 + }, + }, + { + "type": "String", + "name": "from", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "from", + "required": true, + "kind": 4 + }, + }, + { + "type": "UInt32", + "name": "nonce", + "required": true, + "kind": 34, + "scalar": { + "type": "UInt32", + "name": "nonce", + "required": true, + "kind": 4 + }, + }, + { + "type": "BigInt", + "name": "gasLimit", + "required": true, + "kind": 34, + "scalar": { + "type": "BigInt", + "name": "gasLimit", + "required": true, + "kind": 4 + }, + }, + { + "type": "BigInt", + "name": "gasPrice", + "kind": 34, + "scalar": { + "type": "BigInt", + "name": "gasPrice", + "kind": 4 + }, + }, + { + "type": "String", + "name": "data", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "data", + "required": true, + "kind": 4 + }, + }, + { + "type": "BigInt", + "name": "value", + "required": true, + "kind": 34, + "scalar": { + "type": "BigInt", + "name": "value", + "required": true, + "kind": 4 + }, + }, + { + "type": "BigInt", + "name": "chainId", + "required": true, + "kind": 34, + "scalar": { + "type": "BigInt", + "name": "chainId", + "required": true, + "kind": 4 + }, + }, + { + "type": "BigInt", + "name": "blockNumber", + "kind": 34, + "scalar": { + "type": "BigInt", + "name": "blockNumber", + "kind": 4 + }, + }, + { + "type": "String", + "name": "blockHash", + "kind": 34, + "scalar": { + "type": "String", + "name": "blockHash", + "kind": 4 + }, + }, + { + "type": "UInt32", + "name": "timestamp", + "kind": 34, + "scalar": { + "type": "UInt32", + "name": "timestamp", + "kind": 4 + }, + }, + { + "type": "UInt32", + "name": "confirmations", + "required": true, + "kind": 34, + "scalar": { + "type": "UInt32", + "name": "confirmations", + "required": true, + "kind": 4 + }, + }, + { + "type": "String", + "name": "raw", + "kind": 34, + "scalar": { + "type": "String", + "name": "raw", + "kind": 4 + }, + }, + { + "type": "String", + "name": "r", + "kind": 34, + "scalar": { + "type": "String", + "name": "r", + "kind": 4 + }, + }, + { + "type": "String", + "name": "s", + "kind": 34, + "scalar": { + "type": "String", + "name": "s", + "kind": 4 + }, + }, + { + "type": "UInt32", + "name": "v", + "kind": 34, + "scalar": { + "type": "UInt32", + "name": "v", + "kind": 4 + }, + }, + { + "type": "UInt32", + "name": "type", + "kind": 34, + "scalar": { + "type": "UInt32", + "name": "type", + "kind": 4 + }, + }, + { + "type": "[Ethereum_Access]", + "name": "accessList", + "kind": 34, + "array": { + "type": "[Ethereum_Access]", + "name": "accessList", + "kind": 18, + "object": { + "type": "Ethereum_Access", + "name": "accessList", + "required": true, + "kind": 8192 + }, + "item": { + "type": "Ethereum_Access", + "name": "accessList", + "required": true, + "kind": 8192 + } + }, + } + ], + "uri": "ens/ethereum.polywrap.eth", + "namespace": "Ethereum", + "nativeType": "TxResponse" + }, + { + "type": "Ethereum_Access", + "kind": 1025, + "properties": [ + { + "type": "String", + "name": "address", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "address", + "required": true, + "kind": 4 + }, + }, + { + "type": "[String]", + "name": "storageKeys", + "required": true, + "kind": 34, + "array": { + "type": "[String]", + "name": "storageKeys", + "required": true, + "kind": 18, + "scalar": { + "type": "String", + "name": "storageKeys", + "required": true, + "kind": 4 + }, + "item": { + "type": "String", + "name": "storageKeys", + "required": true, + "kind": 4 + } + }, + } + ], + "uri": "ens/ethereum.polywrap.eth", + "namespace": "Ethereum", + "nativeType": "Access" + } + ], + "importedModuleTypes": [ + { + "type": "UriResolver_Module", + "kind": 256, + "methods": [ + { + "type": "Method", + "name": "tryResolveUri", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "String", + "name": "authority", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "authority", + "required": true, + "kind": 4 + }, + }, + { + "type": "String", + "name": "path", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "path", + "required": true, + "kind": 4 + }, + } + ], + "return": { + "type": "UriResolver_MaybeUriOrManifest", + "name": "tryResolveUri", + "kind": 34, + "object": { + "type": "UriResolver_MaybeUriOrManifest", + "name": "tryResolveUri", + "kind": 8192 + }, + } + }, + { + "type": "Method", + "name": "getFile", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "String", + "name": "path", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "path", + "required": true, + "kind": 4 + }, + } + ], + "return": { + "type": "Bytes", + "name": "getFile", + "kind": 34, + "scalar": { + "type": "Bytes", + "name": "getFile", + "kind": 4 + }, + } + } + ], + "uri": "ens/uri-resolver.core.polywrap.eth", + "namespace": "UriResolver", + "nativeType": "Module", + "isInterface": false + }, + { + "type": "Ethereum_Module", + "kind": 256, + "methods": [ + { + "type": "Method", + "name": "callContractView", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "String", + "name": "address", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "address", + "required": true, + "kind": 4 + }, + }, + { + "type": "String", + "name": "method", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "method", + "required": true, + "kind": 4 + }, + }, + { + "type": "[String]", + "name": "args", + "kind": 34, + "array": { + "type": "[String]", + "name": "args", + "kind": 18, + "scalar": { + "type": "String", + "name": "args", + "required": true, + "kind": 4 + }, + "item": { + "type": "String", + "name": "args", + "required": true, + "kind": 4 + } + }, + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 8192 + }, + } + ], + "return": { + "type": "String", + "name": "callContractView", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "callContractView", + "required": true, + "kind": 4 + }, + } + }, + { + "type": "Method", + "name": "callContractStatic", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "String", + "name": "address", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "address", + "required": true, + "kind": 4 + }, + }, + { + "type": "String", + "name": "method", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "method", + "required": true, + "kind": 4 + }, + }, + { + "type": "[String]", + "name": "args", + "kind": 34, + "array": { + "type": "[String]", + "name": "args", + "kind": 18, + "scalar": { + "type": "String", + "name": "args", + "required": true, + "kind": 4 + }, + "item": { + "type": "String", + "name": "args", + "required": true, + "kind": 4 + } + }, + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 8192 + }, + }, + { + "type": "Ethereum_TxOverrides", + "name": "txOverrides", + "kind": 34, + "object": { + "type": "Ethereum_TxOverrides", + "name": "txOverrides", + "kind": 8192 + }, + } + ], + "return": { + "type": "Ethereum_StaticTxResult", + "name": "callContractStatic", + "required": true, + "kind": 34, + "object": { + "type": "Ethereum_StaticTxResult", + "name": "callContractStatic", + "required": true, + "kind": 8192 + }, + } + }, + { + "type": "Method", + "name": "getBalance", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "String", + "name": "address", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "address", + "required": true, + "kind": 4 + }, + }, + { + "type": "BigInt", + "name": "blockTag", + "kind": 34, + "scalar": { + "type": "BigInt", + "name": "blockTag", + "kind": 4 + }, + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 8192 + }, + } + ], + "return": { + "type": "BigInt", + "name": "getBalance", + "required": true, + "kind": 34, + "scalar": { + "type": "BigInt", + "name": "getBalance", + "required": true, + "kind": 4 + }, + } + }, + { + "type": "Method", + "name": "encodeParams", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "[String]", + "name": "types", + "required": true, + "kind": 34, + "array": { + "type": "[String]", + "name": "types", + "required": true, + "kind": 18, + "scalar": { + "type": "String", + "name": "types", + "required": true, + "kind": 4 + }, + "item": { + "type": "String", + "name": "types", + "required": true, + "kind": 4 + } + }, + }, + { + "type": "[String]", + "name": "values", + "required": true, + "kind": 34, + "array": { + "type": "[String]", + "name": "values", + "required": true, + "kind": 18, + "scalar": { + "type": "String", + "name": "values", + "required": true, + "kind": 4 + }, + "item": { + "type": "String", + "name": "values", + "required": true, + "kind": 4 + } + }, + } + ], + "return": { + "type": "String", + "name": "encodeParams", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "encodeParams", + "required": true, + "kind": 4 + }, + } + }, + { + "type": "Method", + "name": "encodeFunction", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "String", + "name": "method", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "method", + "required": true, + "kind": 4 + }, + }, + { + "type": "[String]", + "name": "args", + "kind": 34, + "array": { + "type": "[String]", + "name": "args", + "kind": 18, + "scalar": { + "type": "String", + "name": "args", + "required": true, + "kind": 4 + }, + "item": { + "type": "String", + "name": "args", + "required": true, + "kind": 4 + } + }, + } + ], + "return": { + "type": "String", + "name": "encodeFunction", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "encodeFunction", + "required": true, + "kind": 4 + }, + } + }, + { + "type": "Method", + "name": "solidityPack", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "[String]", + "name": "types", + "required": true, + "kind": 34, + "array": { + "type": "[String]", + "name": "types", + "required": true, + "kind": 18, + "scalar": { + "type": "String", + "name": "types", + "required": true, + "kind": 4 + }, + "item": { + "type": "String", + "name": "types", + "required": true, + "kind": 4 + } + }, + }, + { + "type": "[String]", + "name": "values", + "required": true, + "kind": 34, + "array": { + "type": "[String]", + "name": "values", + "required": true, + "kind": 18, + "scalar": { + "type": "String", + "name": "values", + "required": true, + "kind": 4 + }, + "item": { + "type": "String", + "name": "values", + "required": true, + "kind": 4 + } + }, + } + ], + "return": { + "type": "String", + "name": "solidityPack", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "solidityPack", + "required": true, + "kind": 4 + }, + } + }, + { + "type": "Method", + "name": "solidityKeccak256", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "[String]", + "name": "types", + "required": true, + "kind": 34, + "array": { + "type": "[String]", + "name": "types", + "required": true, + "kind": 18, + "scalar": { + "type": "String", + "name": "types", + "required": true, + "kind": 4 + }, + "item": { + "type": "String", + "name": "types", + "required": true, + "kind": 4 + } + }, + }, + { + "type": "[String]", + "name": "values", + "required": true, + "kind": 34, + "array": { + "type": "[String]", + "name": "values", + "required": true, + "kind": 18, + "scalar": { + "type": "String", + "name": "values", + "required": true, + "kind": 4 + }, + "item": { + "type": "String", + "name": "values", + "required": true, + "kind": 4 + } + }, + } + ], + "return": { + "type": "String", + "name": "solidityKeccak256", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "solidityKeccak256", + "required": true, + "kind": 4 + }, + } + }, + { + "type": "Method", + "name": "soliditySha256", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "[String]", + "name": "types", + "required": true, + "kind": 34, + "array": { + "type": "[String]", + "name": "types", + "required": true, + "kind": 18, + "scalar": { + "type": "String", + "name": "types", + "required": true, + "kind": 4 + }, + "item": { + "type": "String", + "name": "types", + "required": true, + "kind": 4 + } + }, + }, + { + "type": "[String]", + "name": "values", + "required": true, + "kind": 34, + "array": { + "type": "[String]", + "name": "values", + "required": true, + "kind": 18, + "scalar": { + "type": "String", + "name": "values", + "required": true, + "kind": 4 + }, + "item": { + "type": "String", + "name": "values", + "required": true, + "kind": 4 + } + }, + } + ], + "return": { + "type": "String", + "name": "soliditySha256", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "soliditySha256", + "required": true, + "kind": 4 + }, + } + }, + { + "type": "Method", + "name": "getSignerAddress", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 8192 + }, + } + ], + "return": { + "type": "String", + "name": "getSignerAddress", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "getSignerAddress", + "required": true, + "kind": 4 + }, + } + }, + { + "type": "Method", + "name": "getSignerBalance", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "BigInt", + "name": "blockTag", + "kind": 34, + "scalar": { + "type": "BigInt", + "name": "blockTag", + "kind": 4 + }, + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 8192 + }, + } + ], + "return": { + "type": "BigInt", + "name": "getSignerBalance", + "required": true, + "kind": 34, + "scalar": { + "type": "BigInt", + "name": "getSignerBalance", + "required": true, + "kind": 4 + }, + } + }, + { + "type": "Method", + "name": "getSignerTransactionCount", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "BigInt", + "name": "blockTag", + "kind": 34, + "scalar": { + "type": "BigInt", + "name": "blockTag", + "kind": 4 + }, + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 8192 + }, + } + ], + "return": { + "type": "BigInt", + "name": "getSignerTransactionCount", + "required": true, + "kind": 34, + "scalar": { + "type": "BigInt", + "name": "getSignerTransactionCount", + "required": true, + "kind": 4 + }, + } + }, + { + "type": "Method", + "name": "getGasPrice", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 8192 + }, + } + ], + "return": { + "type": "BigInt", + "name": "getGasPrice", + "required": true, + "kind": 34, + "scalar": { + "type": "BigInt", + "name": "getGasPrice", + "required": true, + "kind": 4 + }, + } + }, + { + "type": "Method", + "name": "estimateTransactionGas", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "Ethereum_TxRequest", + "name": "tx", + "required": true, + "kind": 34, + "object": { + "type": "Ethereum_TxRequest", + "name": "tx", + "required": true, + "kind": 8192 + }, + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 8192 + }, + } + ], + "return": { + "type": "BigInt", + "name": "estimateTransactionGas", + "required": true, + "kind": 34, + "scalar": { + "type": "BigInt", + "name": "estimateTransactionGas", + "required": true, + "kind": 4 + }, + } + }, + { + "type": "Method", + "name": "estimateContractCallGas", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "String", + "name": "address", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "address", + "required": true, + "kind": 4 + }, + }, + { + "type": "String", + "name": "method", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "method", + "required": true, + "kind": 4 + }, + }, + { + "type": "[String]", + "name": "args", + "kind": 34, + "array": { + "type": "[String]", + "name": "args", + "kind": 18, + "scalar": { + "type": "String", + "name": "args", + "required": true, + "kind": 4 + }, + "item": { + "type": "String", + "name": "args", + "required": true, + "kind": 4 + } + }, + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 8192 + }, + }, + { + "type": "Ethereum_TxOverrides", + "name": "txOverrides", + "kind": 34, + "object": { + "type": "Ethereum_TxOverrides", + "name": "txOverrides", + "kind": 8192 + }, + } + ], + "return": { + "type": "BigInt", + "name": "estimateContractCallGas", + "required": true, + "kind": 34, + "scalar": { + "type": "BigInt", + "name": "estimateContractCallGas", + "required": true, + "kind": 4 + }, + } + }, + { + "type": "Method", + "name": "checkAddress", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "String", + "name": "address", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "address", + "required": true, + "kind": 4 + }, + } + ], + "return": { + "type": "Boolean", + "name": "checkAddress", + "required": true, + "kind": 34, + "scalar": { + "type": "Boolean", + "name": "checkAddress", + "required": true, + "kind": 4 + }, + } + }, + { + "type": "Method", + "name": "toWei", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "String", + "name": "eth", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "eth", + "required": true, + "kind": 4 + }, + } + ], + "return": { + "type": "BigInt", + "name": "toWei", + "required": true, + "kind": 34, + "scalar": { + "type": "BigInt", + "name": "toWei", + "required": true, + "kind": 4 + }, + } + }, + { + "type": "Method", + "name": "toEth", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "BigInt", + "name": "wei", + "required": true, + "kind": 34, + "scalar": { + "type": "BigInt", + "name": "wei", + "required": true, + "kind": 4 + }, + } + ], + "return": { + "type": "String", + "name": "toEth", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "toEth", + "required": true, + "kind": 4 + }, + } + }, + { + "type": "Method", + "name": "awaitTransaction", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "String", + "name": "txHash", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "txHash", + "required": true, + "kind": 4 + }, + }, + { + "type": "UInt32", + "name": "confirmations", + "required": true, + "kind": 34, + "scalar": { + "type": "UInt32", + "name": "confirmations", + "required": true, + "kind": 4 + }, + }, + { + "type": "UInt32", + "name": "timeout", + "required": true, + "kind": 34, + "scalar": { + "type": "UInt32", + "name": "timeout", + "required": true, + "kind": 4 + }, + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 8192 + }, + } + ], + "return": { + "type": "Ethereum_TxReceipt", + "name": "awaitTransaction", + "required": true, + "kind": 34, + "object": { + "type": "Ethereum_TxReceipt", + "name": "awaitTransaction", + "required": true, + "kind": 8192 + }, + } + }, + { + "type": "Method", + "name": "waitForEvent", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "String", + "name": "address", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "address", + "required": true, + "kind": 4 + }, + }, + { + "type": "String", + "name": "event", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "event", + "required": true, + "kind": 4 + }, + }, + { + "type": "[String]", + "name": "args", + "kind": 34, + "array": { + "type": "[String]", + "name": "args", + "kind": 18, + "scalar": { + "type": "String", + "name": "args", + "required": true, + "kind": 4 + }, + "item": { + "type": "String", + "name": "args", + "required": true, + "kind": 4 + } + }, + }, + { + "type": "UInt32", + "name": "timeout", + "kind": 34, + "scalar": { + "type": "UInt32", + "name": "timeout", + "kind": 4 + }, + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 8192 + }, + } + ], + "return": { + "type": "Ethereum_EventNotification", + "name": "waitForEvent", + "required": true, + "kind": 34, + "object": { + "type": "Ethereum_EventNotification", + "name": "waitForEvent", + "required": true, + "kind": 8192 + }, + } + }, + { + "type": "Method", + "name": "getNetwork", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 8192 + }, + } + ], + "return": { + "type": "Ethereum_Network", + "name": "getNetwork", + "required": true, + "kind": 34, + "object": { + "type": "Ethereum_Network", + "name": "getNetwork", + "required": true, + "kind": 8192 + }, + } + }, + { + "type": "Method", + "name": "callContractMethod", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "String", + "name": "address", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "address", + "required": true, + "kind": 4 + }, + }, + { + "type": "String", + "name": "method", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "method", + "required": true, + "kind": 4 + }, + }, + { + "type": "[String]", + "name": "args", + "kind": 34, + "array": { + "type": "[String]", + "name": "args", + "kind": 18, + "scalar": { + "type": "String", + "name": "args", + "required": true, + "kind": 4 + }, + "item": { + "type": "String", + "name": "args", + "required": true, + "kind": 4 + } + }, + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 8192 + }, + }, + { + "type": "Ethereum_TxOverrides", + "name": "txOverrides", + "kind": 34, + "object": { + "type": "Ethereum_TxOverrides", + "name": "txOverrides", + "kind": 8192 + }, + } + ], + "return": { + "type": "Ethereum_TxResponse", + "name": "callContractMethod", + "required": true, + "kind": 34, + "object": { + "type": "Ethereum_TxResponse", + "name": "callContractMethod", + "required": true, + "kind": 8192 + }, + } + }, + { + "type": "Method", + "name": "callContractMethodAndWait", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "String", + "name": "address", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "address", + "required": true, + "kind": 4 + }, + }, + { + "type": "String", + "name": "method", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "method", + "required": true, + "kind": 4 + }, + }, + { + "type": "[String]", + "name": "args", + "kind": 34, + "array": { + "type": "[String]", + "name": "args", + "kind": 18, + "scalar": { + "type": "String", + "name": "args", + "required": true, + "kind": 4 + }, + "item": { + "type": "String", + "name": "args", + "required": true, + "kind": 4 + } + }, + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 8192 + }, + }, + { + "type": "Ethereum_TxOverrides", + "name": "txOverrides", + "kind": 34, + "object": { + "type": "Ethereum_TxOverrides", + "name": "txOverrides", + "kind": 8192 + }, + } + ], + "return": { + "type": "Ethereum_TxReceipt", + "name": "callContractMethodAndWait", + "required": true, + "kind": 34, + "object": { + "type": "Ethereum_TxReceipt", + "name": "callContractMethodAndWait", + "required": true, + "kind": 8192 + }, + } + }, + { + "type": "Method", + "name": "sendTransaction", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "Ethereum_TxRequest", + "name": "tx", + "required": true, + "kind": 34, + "object": { + "type": "Ethereum_TxRequest", + "name": "tx", + "required": true, + "kind": 8192 + }, + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 8192 + }, + } + ], + "return": { + "type": "Ethereum_TxResponse", + "name": "sendTransaction", + "required": true, + "kind": 34, + "object": { + "type": "Ethereum_TxResponse", + "name": "sendTransaction", + "required": true, + "kind": 8192 + }, + } + }, + { + "type": "Method", + "name": "sendTransactionAndWait", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "Ethereum_TxRequest", + "name": "tx", + "required": true, + "kind": 34, + "object": { + "type": "Ethereum_TxRequest", + "name": "tx", + "required": true, + "kind": 8192 + }, + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 8192 + }, + } + ], + "return": { + "type": "Ethereum_TxReceipt", + "name": "sendTransactionAndWait", + "required": true, + "kind": 34, + "object": { + "type": "Ethereum_TxReceipt", + "name": "sendTransactionAndWait", + "required": true, + "kind": 8192 + }, + } + }, + { + "type": "Method", + "name": "deployContract", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "String", + "name": "abi", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "abi", + "required": true, + "kind": 4 + }, + }, + { + "type": "String", + "name": "bytecode", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "bytecode", + "required": true, + "kind": 4 + }, + }, + { + "type": "[String]", + "name": "args", + "kind": 34, + "array": { + "type": "[String]", + "name": "args", + "kind": 18, + "scalar": { + "type": "String", + "name": "args", + "required": true, + "kind": 4 + }, + "item": { + "type": "String", + "name": "args", + "required": true, + "kind": 4 + } + }, + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 8192 + }, + } + ], + "return": { + "type": "String", + "name": "deployContract", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "deployContract", + "required": true, + "kind": 4 + }, + } + }, + { + "type": "Method", + "name": "signMessage", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "String", + "name": "message", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "message", + "required": true, + "kind": 4 + }, + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 8192 + }, + } + ], + "return": { + "type": "String", + "name": "signMessage", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "signMessage", + "required": true, + "kind": 4 + }, + } + }, + { + "type": "Method", + "name": "sendRPC", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "String", + "name": "method", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "method", + "required": true, + "kind": 4 + }, + }, + { + "type": "[String]", + "name": "params", + "required": true, + "kind": 34, + "array": { + "type": "[String]", + "name": "params", + "required": true, + "kind": 18, + "scalar": { + "type": "String", + "name": "params", + "required": true, + "kind": 4 + }, + "item": { + "type": "String", + "name": "params", + "required": true, + "kind": 4 + } + }, + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 8192 + }, + } + ], + "return": { + "type": "String", + "name": "sendRPC", + "kind": 34, + "scalar": { + "type": "String", + "name": "sendRPC", + "kind": 4 + }, + } + } + ], + "uri": "ens/ethereum.polywrap.eth", + "namespace": "Ethereum", + "nativeType": "Module", + "isInterface": false + } + ], + "moduleType": { + "type": "Module", + "kind": 128, + "methods": [ + { + "type": "Method", + "name": "tryResolveUri", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "String", + "name": "authority", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "authority", + "required": true, + "kind": 4 + }, + }, + { + "type": "String", + "name": "path", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "path", + "required": true, + "kind": 4 + }, + } + ], + "return": { + "type": "UriResolver_MaybeUriOrManifest", + "name": "tryResolveUri", + "kind": 34, + "object": { + "type": "UriResolver_MaybeUriOrManifest", + "name": "tryResolveUri", + "kind": 8192 + }, + } + }, + { + "type": "Method", + "name": "getFile", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "String", + "name": "path", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "path", + "required": true, + "kind": 4 + }, + } + ], + "return": { + "type": "Bytes", + "name": "getFile", + "kind": 34, + "scalar": { + "type": "Bytes", + "name": "getFile", + "kind": 4 + }, + } + } + ], + "imports": [ + { + "type": "UriResolver_Module" + }, + { + "type": "UriResolver_MaybeUriOrManifest" + }, + { + "type": "Ethereum_Module" + }, + { + "type": "Ethereum_Connection" + }, + { + "type": "Ethereum_TxOverrides" + }, + { + "type": "Ethereum_StaticTxResult" + }, + { + "type": "Ethereum_TxRequest" + }, + { + "type": "Ethereum_TxReceipt" + }, + { + "type": "Ethereum_Log" + }, + { + "type": "Ethereum_EventNotification" + }, + { + "type": "Ethereum_Network" + }, + { + "type": "Ethereum_TxResponse" + }, + { + "type": "Ethereum_Access" + } + ], + "interfaces": [ + { + "type": "UriResolver_Module", + "kind": 2048, + } + ] + } + } +} \ No newline at end of file diff --git a/packages/js/plugins/uri-resolvers/file-system-resolver/package.json b/packages/js/plugins/uri-resolvers/file-system-resolver/package.json index 51ccffdf04..1428baa046 100644 --- a/packages/js/plugins/uri-resolvers/file-system-resolver/package.json +++ b/packages/js/plugins/uri-resolvers/file-system-resolver/package.json @@ -12,8 +12,9 @@ "build" ], "scripts": { - "build": "rimraf ./build && yarn codegen && tsc --project tsconfig.build.json", + "build": "rimraf ./build && tsc --project tsconfig.build.json", "codegen": "node ../../../../../dependencies/node_modules/polywrap/bin/polywrap plugin codegen", + "codegen:patch": "node ../../../../cli/bin/polywrap plugin codegen && rimraf ./src/wrap", "lint": "eslint --color -c ../../../../../.eslintrc.js src/", "test": "jest --passWithNoTests --runInBand --verbose", "test:ci": "jest --passWithNoTests --runInBand --verbose", diff --git a/packages/js/plugins/uri-resolvers/file-system-resolver/polywrap.plugin.yaml b/packages/js/plugins/uri-resolvers/file-system-resolver/polywrap.plugin.yaml index bc77efc8cf..7f3780487c 100644 --- a/packages/js/plugins/uri-resolvers/file-system-resolver/polywrap.plugin.yaml +++ b/packages/js/plugins/uri-resolvers/file-system-resolver/polywrap.plugin.yaml @@ -1,10 +1,10 @@ -format: 0.1.0 +format: "0.2" name: FileSystemResolver language: plugin/typescript module: ./src/index.ts schema: ./src/schema.graphql -import_redirects: +import_abis: - uri: "ens/uri-resolver.core.polywrap.eth" - schema: ../../../../interfaces/uri-resolver/src/schema.graphql + abi: ../../../../interfaces/uri-resolver/build-man/wrap.info - uri: "ens/fs.polywrap.eth" - schema: ../../../../interfaces/file-system/build/schema.graphql \ No newline at end of file + abi: ../../../../interfaces/file-system/build-man/wrap.info \ No newline at end of file diff --git a/packages/js/plugins/uri-resolvers/file-system-resolver/src/__tests__/e2e.spec.ts b/packages/js/plugins/uri-resolvers/file-system-resolver/src/__tests__/e2e.spec.ts index 115ec159f7..ff5fbe5109 100644 --- a/packages/js/plugins/uri-resolvers/file-system-resolver/src/__tests__/e2e.spec.ts +++ b/packages/js/plugins/uri-resolvers/file-system-resolver/src/__tests__/e2e.spec.ts @@ -91,17 +91,8 @@ describe("Filesystem plugin", () => { expect(deploy.data).toBeTruthy(); expect(deploy.data?.indexOf("0x")).toBeGreaterThan(-1); - // get the schema - const schema = await client.getSchema(fsUri); - const expectedSchema = await fs.promises.readFile( - `${fsPath}/schema.graphql`, - "utf-8" - ); - - expect(schema).toBe(expectedSchema); - // get the manifest - const manifest = await client.getManifest(fsUri, {}); + const manifest = await client.getManifest(fsUri); expect(manifest).toBeTruthy(); expect(manifest.version).toBe("0.1"); diff --git a/packages/js/plugins/uri-resolvers/file-system-resolver/src/index.ts b/packages/js/plugins/uri-resolvers/file-system-resolver/src/index.ts index 6596b6b0ff..891f4bab69 100644 --- a/packages/js/plugins/uri-resolvers/file-system-resolver/src/index.ts +++ b/packages/js/plugins/uri-resolvers/file-system-resolver/src/index.ts @@ -8,7 +8,7 @@ import { Module, UriResolver_MaybeUriOrManifest, manifest, -} from "./wrap"; +} from "./wrap-man"; import { PluginFactory } from "@polywrap/core-js"; import path from "path"; diff --git a/packages/js/plugins/uri-resolvers/file-system-resolver/src/wrap-man/index.ts b/packages/js/plugins/uri-resolvers/file-system-resolver/src/wrap-man/index.ts new file mode 100644 index 0000000000..315871f96d --- /dev/null +++ b/packages/js/plugins/uri-resolvers/file-system-resolver/src/wrap-man/index.ts @@ -0,0 +1,8 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +export * from "./wrap.info"; +export * from "./module"; +export * from "./types"; + +export { Client } from "@polywrap/core-js"; diff --git a/packages/js/plugins/uri-resolvers/file-system-resolver/src/wrap-man/module.ts b/packages/js/plugins/uri-resolvers/file-system-resolver/src/wrap-man/module.ts new file mode 100644 index 0000000000..a92a0a5277 --- /dev/null +++ b/packages/js/plugins/uri-resolvers/file-system-resolver/src/wrap-man/module.ts @@ -0,0 +1,36 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +import * as Types from "./types"; + +import { + Client, + PluginModule, + MaybeAsync +} from "@polywrap/core-js"; + +export interface Args_tryResolveUri extends Record { + authority: Types.String; + path: Types.String; +} + +export interface Args_getFile extends Record { + path: Types.String; +} + +export abstract class Module< + TConfig +> extends PluginModule< + TConfig +> { + + abstract tryResolveUri( + args: Args_tryResolveUri, + client: Client + ): MaybeAsync; + + abstract getFile( + args: Args_getFile, + client: Client + ): MaybeAsync; +} diff --git a/packages/js/plugins/uri-resolvers/file-system-resolver/src/wrap-man/types.ts b/packages/js/plugins/uri-resolvers/file-system-resolver/src/wrap-man/types.ts new file mode 100644 index 0000000000..b7044625a6 --- /dev/null +++ b/packages/js/plugins/uri-resolvers/file-system-resolver/src/wrap-man/types.ts @@ -0,0 +1,231 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +// @ts-ignore +import * as Types from "./"; + +// @ts-ignore +import { + Client, + InvokeResult +} from "@polywrap/core-js"; + +export type UInt = number; +export type UInt8 = number; +export type UInt16 = number; +export type UInt32 = number; +export type Int = number; +export type Int8 = number; +export type Int16 = number; +export type Int32 = number; +export type Bytes = Uint8Array; +export type BigInt = string; +export type BigNumber = string; +export type Json = string; +export type String = string; +export type Boolean = boolean; + +/// Env START /// +/// Env END /// + +/// Objects START /// +/// Objects END /// + +/// Enums START /// +/// Enums END /// + +/// Imported Objects START /// + +/* URI: "ens/uri-resolver.core.polywrap.eth" */ +export interface UriResolver_MaybeUriOrManifest { + uri?: Types.String | null; + manifest?: Types.Bytes | null; +} + +/* URI: "ens/fs.polywrap.eth" */ +export enum FileSystem_EncodingEnum { + ASCII, + UTF8, + UTF16LE, + UCS2, + BASE64, + BASE64URL, + LATIN1, + BINARY, + HEX, +} + +export type FileSystem_EncodingString = + | "ASCII" + | "UTF8" + | "UTF16LE" + | "UCS2" + | "BASE64" + | "BASE64URL" + | "LATIN1" + | "BINARY" + | "HEX" + +export type FileSystem_Encoding = FileSystem_EncodingEnum | FileSystem_EncodingString; + +/// Imported Objects END /// + +/// Imported Modules START /// + +/* URI: "ens/uri-resolver.core.polywrap.eth" */ +interface UriResolver_Module_Args_tryResolveUri extends Record { + authority: Types.String; + path: Types.String; +} + +/* URI: "ens/uri-resolver.core.polywrap.eth" */ +interface UriResolver_Module_Args_getFile extends Record { + path: Types.String; +} + +/* URI: "ens/uri-resolver.core.polywrap.eth" */ +export const UriResolver_Module = { + tryResolveUri: async ( + args: UriResolver_Module_Args_tryResolveUri, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/uri-resolver.core.polywrap.eth", + method: "tryResolveUri", + args + }); + }, + + getFile: async ( + args: UriResolver_Module_Args_getFile, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/uri-resolver.core.polywrap.eth", + method: "getFile", + args + }); + } +} + +/* URI: "ens/fs.polywrap.eth" */ +interface FileSystem_Module_Args_readFile extends Record { + path: Types.String; +} + +/* URI: "ens/fs.polywrap.eth" */ +interface FileSystem_Module_Args_readFileAsString extends Record { + path: Types.String; + encoding?: Types.FileSystem_Encoding | null; +} + +/* URI: "ens/fs.polywrap.eth" */ +interface FileSystem_Module_Args_exists extends Record { + path: Types.String; +} + +/* URI: "ens/fs.polywrap.eth" */ +interface FileSystem_Module_Args_writeFile extends Record { + path: Types.String; + data: Types.Bytes; +} + +/* URI: "ens/fs.polywrap.eth" */ +interface FileSystem_Module_Args_mkdir extends Record { + path: Types.String; + recursive?: Types.Boolean | null; +} + +/* URI: "ens/fs.polywrap.eth" */ +interface FileSystem_Module_Args_rm extends Record { + path: Types.String; + recursive?: Types.Boolean | null; + force?: Types.Boolean | null; +} + +/* URI: "ens/fs.polywrap.eth" */ +interface FileSystem_Module_Args_rmdir extends Record { + path: Types.String; +} + +/* URI: "ens/fs.polywrap.eth" */ +export const FileSystem_Module = { + readFile: async ( + args: FileSystem_Module_Args_readFile, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/fs.polywrap.eth", + method: "readFile", + args + }); + }, + + readFileAsString: async ( + args: FileSystem_Module_Args_readFileAsString, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/fs.polywrap.eth", + method: "readFileAsString", + args + }); + }, + + exists: async ( + args: FileSystem_Module_Args_exists, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/fs.polywrap.eth", + method: "exists", + args + }); + }, + + writeFile: async ( + args: FileSystem_Module_Args_writeFile, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/fs.polywrap.eth", + method: "writeFile", + args + }); + }, + + mkdir: async ( + args: FileSystem_Module_Args_mkdir, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/fs.polywrap.eth", + method: "mkdir", + args + }); + }, + + rm: async ( + args: FileSystem_Module_Args_rm, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/fs.polywrap.eth", + method: "rm", + args + }); + }, + + rmdir: async ( + args: FileSystem_Module_Args_rmdir, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/fs.polywrap.eth", + method: "rmdir", + args + }); + } +} + +/// Imported Modules END /// diff --git a/packages/js/plugins/uri-resolvers/file-system-resolver/src/wrap-man/wrap.info.ts b/packages/js/plugins/uri-resolvers/file-system-resolver/src/wrap-man/wrap.info.ts new file mode 100644 index 0000000000..628c0f4818 --- /dev/null +++ b/packages/js/plugins/uri-resolvers/file-system-resolver/src/wrap-man/wrap.info.ts @@ -0,0 +1,425 @@ +import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; + +export const manifest: WrapManifest = { + name: "FileSystemResolver", + type: "plugin", + version: "0.1", + abi: { + version: "0.1", + importedObjectTypes: [ + { + type: "UriResolver_MaybeUriOrManifest", + kind: 1025, + properties: [ + { + type: "String", + name: "uri", + kind: 34, + scalar: { type: "String", name: "uri", kind: 4 }, + }, + { + type: "Bytes", + name: "manifest", + kind: 34, + scalar: { type: "Bytes", name: "manifest", kind: 4 }, + }, + ], + uri: "ens/uri-resolver.core.polywrap.eth", + namespace: "UriResolver", + nativeType: "MaybeUriOrManifest", + }, + ], + importedModuleTypes: [ + { + type: "UriResolver_Module", + kind: 256, + methods: [ + { + type: "Method", + name: "tryResolveUri", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "authority", + required: true, + kind: 34, + scalar: { + type: "String", + name: "authority", + required: true, + kind: 4, + }, + }, + { + type: "String", + name: "path", + required: true, + kind: 34, + scalar: { type: "String", name: "path", required: true, kind: 4 }, + }, + ], + return: { + type: "UriResolver_MaybeUriOrManifest", + name: "tryResolveUri", + kind: 34, + object: { + type: "UriResolver_MaybeUriOrManifest", + name: "tryResolveUri", + kind: 8192, + }, + }, + }, + { + type: "Method", + name: "getFile", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "path", + required: true, + kind: 34, + scalar: { type: "String", name: "path", required: true, kind: 4 }, + }, + ], + return: { + type: "Bytes", + name: "getFile", + kind: 34, + scalar: { type: "Bytes", name: "getFile", kind: 4 }, + }, + }, + ], + uri: "ens/uri-resolver.core.polywrap.eth", + namespace: "UriResolver", + nativeType: "Module", + isInterface: false, + }, + { + type: "FileSystem_Module", + kind: 256, + methods: [ + { + type: "Method", + name: "readFile", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "path", + required: true, + kind: 34, + scalar: { type: "String", name: "path", required: true, kind: 4 }, + }, + ], + return: { + type: "Bytes", + name: "readFile", + required: true, + kind: 34, + scalar: { + type: "Bytes", + name: "readFile", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "readFileAsString", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "path", + required: true, + kind: 34, + scalar: { type: "String", name: "path", required: true, kind: 4 }, + }, + { + type: "FileSystem_Encoding", + name: "encoding", + kind: 34, + enum: { + type: "FileSystem_Encoding", + name: "encoding", + kind: 16384, + }, + }, + ], + return: { + type: "String", + name: "readFileAsString", + required: true, + kind: 34, + scalar: { + type: "String", + name: "readFileAsString", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "exists", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "path", + required: true, + kind: 34, + scalar: { type: "String", name: "path", required: true, kind: 4 }, + }, + ], + return: { + type: "Boolean", + name: "exists", + required: true, + kind: 34, + scalar: { + type: "Boolean", + name: "exists", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "writeFile", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "path", + required: true, + kind: 34, + scalar: { type: "String", name: "path", required: true, kind: 4 }, + }, + { + type: "Bytes", + name: "data", + required: true, + kind: 34, + scalar: { type: "Bytes", name: "data", required: true, kind: 4 }, + }, + ], + return: { + type: "Boolean", + name: "writeFile", + kind: 34, + scalar: { + type: "Boolean", + name: "writeFile", + kind: 4, + }, + }, + }, + { + type: "Method", + name: "mkdir", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "path", + required: true, + kind: 34, + scalar: { type: "String", name: "path", required: true, kind: 4 }, + }, + { + type: "Boolean", + name: "recursive", + kind: 34, + scalar: { + type: "Boolean", + name: "recursive", + kind: 4, + }, + }, + ], + return: { + type: "Boolean", + name: "mkdir", + kind: 34, + scalar: { type: "Boolean", name: "mkdir", kind: 4 }, + }, + }, + { + type: "Method", + name: "rm", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "path", + required: true, + kind: 34, + scalar: { type: "String", name: "path", required: true, kind: 4 }, + }, + { + type: "Boolean", + name: "recursive", + kind: 34, + scalar: { + type: "Boolean", + name: "recursive", + kind: 4, + }, + }, + { + type: "Boolean", + name: "force", + kind: 34, + scalar: { + type: "Boolean", + name: "force", + kind: 4, + }, + }, + ], + return: { + type: "Boolean", + name: "rm", + kind: 34, + scalar: { type: "Boolean", name: "rm", kind: 4 }, + }, + }, + { + type: "Method", + name: "rmdir", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "path", + required: true, + kind: 34, + scalar: { type: "String", name: "path", required: true, kind: 4 }, + }, + ], + return: { + type: "Boolean", + name: "rmdir", + kind: 34, + scalar: { type: "Boolean", name: "rmdir", kind: 4 }, + }, + }, + ], + uri: "ens/fs.polywrap.eth", + namespace: "FileSystem", + nativeType: "Module", + isInterface: false, + }, + ], + importedEnumTypes: [ + { + type: "FileSystem_Encoding", + kind: 520, + constants: [ + "ASCII", + "UTF8", + "UTF16LE", + "UCS2", + "BASE64", + "BASE64URL", + "LATIN1", + "BINARY", + "HEX", + ], + uri: "ens/fs.polywrap.eth", + namespace: "FileSystem", + nativeType: "Encoding", + }, + ], + moduleType: { + type: "Module", + kind: 128, + methods: [ + { + type: "Method", + name: "tryResolveUri", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "authority", + required: true, + kind: 34, + scalar: { + type: "String", + name: "authority", + required: true, + kind: 4, + }, + }, + { + type: "String", + name: "path", + required: true, + kind: 34, + scalar: { type: "String", name: "path", required: true, kind: 4 }, + }, + ], + return: { + type: "UriResolver_MaybeUriOrManifest", + name: "tryResolveUri", + kind: 34, + object: { + type: "UriResolver_MaybeUriOrManifest", + name: "tryResolveUri", + kind: 8192, + }, + }, + }, + { + type: "Method", + name: "getFile", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "path", + required: true, + kind: 34, + scalar: { type: "String", name: "path", required: true, kind: 4 }, + }, + ], + return: { + type: "Bytes", + name: "getFile", + kind: 34, + scalar: { type: "Bytes", name: "getFile", kind: 4 }, + }, + }, + ], + imports: [ + { type: "UriResolver_Module" }, + { type: "UriResolver_MaybeUriOrManifest" }, + { type: "FileSystem_Module" }, + { type: "FileSystem_Encoding" }, + ], + interfaces: [ + { + type: "UriResolver_Module", + kind: 2048, + }, + ], + } + } +}; diff --git a/packages/js/plugins/uri-resolvers/ipfs-resolver/package.json b/packages/js/plugins/uri-resolvers/ipfs-resolver/package.json index d8c37a9029..e40f950c9a 100644 --- a/packages/js/plugins/uri-resolvers/ipfs-resolver/package.json +++ b/packages/js/plugins/uri-resolvers/ipfs-resolver/package.json @@ -12,12 +12,12 @@ "build" ], "scripts": { - "build": "rimraf ./build && yarn codegen && tsc --project tsconfig.build.json", + "build": "rimraf ./build && tsc --project tsconfig.build.json", "codegen": "node ../../../../../dependencies/node_modules/polywrap/bin/polywrap plugin codegen", "codegen:patch": "node ../../../../cli/bin/polywrap plugin codegen && rimraf ./src/wrap", "lint": "eslint --color -c ../../../../../.eslintrc.js src/", "test": "jest --passWithNoTests --runInBand --verbose", - "test:ci": "yarn codegen && yarn test", + "test:ci": "yarn test", "test:watch": "jest --watch --passWithNoTests --verbose" }, "dependencies": { diff --git a/packages/js/plugins/uri-resolvers/ipfs-resolver/polywrap.plugin.yaml b/packages/js/plugins/uri-resolvers/ipfs-resolver/polywrap.plugin.yaml index b5fa784695..2e294e9626 100644 --- a/packages/js/plugins/uri-resolvers/ipfs-resolver/polywrap.plugin.yaml +++ b/packages/js/plugins/uri-resolvers/ipfs-resolver/polywrap.plugin.yaml @@ -1,10 +1,10 @@ -format: 0.1.0 +format: "0.2" name: IpfsResolver language: plugin/typescript module: ./src/index.ts schema: ./src/schema.graphql -import_redirects: +import_abis: - uri: "ens/uri-resolver.core.polywrap.eth" - schema: ../../../../interfaces/uri-resolver/src/schema.graphql + abi: ../../../../interfaces/uri-resolver/build-man/wrap.info - uri: "ens/ipfs.polywrap.eth" - schema: ../../../../interfaces/ipfs/build/schema.graphql + abi: ../../ipfs/build/wrap.info diff --git a/packages/js/plugins/uri-resolvers/ipfs-resolver/src/__tests__/e2e.spec.ts b/packages/js/plugins/uri-resolvers/ipfs-resolver/src/__tests__/e2e.spec.ts index 708eaf4534..27b08549f9 100644 --- a/packages/js/plugins/uri-resolvers/ipfs-resolver/src/__tests__/e2e.spec.ts +++ b/packages/js/plugins/uri-resolvers/ipfs-resolver/src/__tests__/e2e.spec.ts @@ -4,22 +4,17 @@ import { buildAndDeployWrapper, initTestEnvironment, providers, stopTestEnvironm import { ipfsResolverPlugin } from ".."; import { ipfsPlugin } from "@polywrap/ipfs-plugin-js"; -import { IpfsClient } from "./helpers/IpfsClient"; -import { createIpfsClient } from "./helpers/createIpfsClient"; jest.setTimeout(300000); describe("IPFS Plugin", () => { let client: PolywrapClient; - let ipfs: IpfsClient; let wrapperIpfsCid: string; beforeAll(async () => { await initTestEnvironment(); - ipfs = createIpfsClient(providers.ipfs); - let { ipfsCid } = await buildAndDeployWrapper({ wrapperAbsPath: `${GetPathToTestWrappers()}/wasm-as/simple-storage`, ipfsProvider: providers.ipfs, @@ -56,14 +51,6 @@ describe("IPFS Plugin", () => { expect(resolution.wrapper).toBeTruthy(); - const expectedSchema = ( - await ipfs.cat(`${wrapperIpfsCid}/schema.graphql`) - ).toString("utf-8"); - - const schema = await resolution.wrapper?.getSchema(client); - - expect(schema).toEqual(expectedSchema); - const info = await resolution.wrapper?.getManifest({}, client); expect(info?.name).toBe("SimpleStorage"); }); diff --git a/packages/js/plugins/uri-resolvers/ipfs-resolver/src/index.ts b/packages/js/plugins/uri-resolvers/ipfs-resolver/src/index.ts index 0a1d7a2ec1..6d65a59f0d 100644 --- a/packages/js/plugins/uri-resolvers/ipfs-resolver/src/index.ts +++ b/packages/js/plugins/uri-resolvers/ipfs-resolver/src/index.ts @@ -7,7 +7,7 @@ import { manifest, Module, UriResolver_MaybeUriOrManifest, -} from "./wrap"; +} from "./wrap-man"; import { PluginFactory } from "@polywrap/core-js"; diff --git a/packages/js/plugins/uri-resolvers/ipfs-resolver/src/wrap-man/index.ts b/packages/js/plugins/uri-resolvers/ipfs-resolver/src/wrap-man/index.ts new file mode 100644 index 0000000000..315871f96d --- /dev/null +++ b/packages/js/plugins/uri-resolvers/ipfs-resolver/src/wrap-man/index.ts @@ -0,0 +1,8 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +export * from "./wrap.info"; +export * from "./module"; +export * from "./types"; + +export { Client } from "@polywrap/core-js"; diff --git a/packages/js/plugins/uri-resolvers/ipfs-resolver/src/wrap-man/module.ts b/packages/js/plugins/uri-resolvers/ipfs-resolver/src/wrap-man/module.ts new file mode 100644 index 0000000000..a92a0a5277 --- /dev/null +++ b/packages/js/plugins/uri-resolvers/ipfs-resolver/src/wrap-man/module.ts @@ -0,0 +1,36 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +import * as Types from "./types"; + +import { + Client, + PluginModule, + MaybeAsync +} from "@polywrap/core-js"; + +export interface Args_tryResolveUri extends Record { + authority: Types.String; + path: Types.String; +} + +export interface Args_getFile extends Record { + path: Types.String; +} + +export abstract class Module< + TConfig +> extends PluginModule< + TConfig +> { + + abstract tryResolveUri( + args: Args_tryResolveUri, + client: Client + ): MaybeAsync; + + abstract getFile( + args: Args_getFile, + client: Client + ): MaybeAsync; +} diff --git a/packages/js/plugins/uri-resolvers/ipfs-resolver/src/wrap-man/types.ts b/packages/js/plugins/uri-resolvers/ipfs-resolver/src/wrap-man/types.ts new file mode 100644 index 0000000000..7db907e0af --- /dev/null +++ b/packages/js/plugins/uri-resolvers/ipfs-resolver/src/wrap-man/types.ts @@ -0,0 +1,151 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +// @ts-ignore +import * as Types from "./"; + +// @ts-ignore +import { + Client, + InvokeResult +} from "@polywrap/core-js"; + +export type UInt = number; +export type UInt8 = number; +export type UInt16 = number; +export type UInt32 = number; +export type Int = number; +export type Int8 = number; +export type Int16 = number; +export type Int32 = number; +export type Bytes = Uint8Array; +export type BigInt = string; +export type BigNumber = string; +export type Json = string; +export type String = string; +export type Boolean = boolean; + +/// Env START /// +/// Env END /// + +/// Objects START /// +/// Objects END /// + +/// Enums START /// +/// Enums END /// + +/// Imported Objects START /// + +/* URI: "ens/uri-resolver.core.polywrap.eth" */ +export interface UriResolver_MaybeUriOrManifest { + uri?: Types.String | null; + manifest?: Types.Bytes | null; +} + +/* URI: "ens/ipfs.polywrap.eth" */ +export interface Ipfs_Options { + timeout?: Types.UInt32 | null; + provider?: Types.String | null; + disableParallelRequests?: Types.Boolean | null; +} + +/* URI: "ens/ipfs.polywrap.eth" */ +export interface Ipfs_ResolveResult { + cid: Types.String; + provider: Types.String; +} + +/// Imported Objects END /// + +/// Imported Modules START /// + +/* URI: "ens/uri-resolver.core.polywrap.eth" */ +interface UriResolver_Module_Args_tryResolveUri extends Record { + authority: Types.String; + path: Types.String; +} + +/* URI: "ens/uri-resolver.core.polywrap.eth" */ +interface UriResolver_Module_Args_getFile extends Record { + path: Types.String; +} + +/* URI: "ens/uri-resolver.core.polywrap.eth" */ +export const UriResolver_Module = { + tryResolveUri: async ( + args: UriResolver_Module_Args_tryResolveUri, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/uri-resolver.core.polywrap.eth", + method: "tryResolveUri", + args + }); + }, + + getFile: async ( + args: UriResolver_Module_Args_getFile, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/uri-resolver.core.polywrap.eth", + method: "getFile", + args + }); + } +} + +/* URI: "ens/ipfs.polywrap.eth" */ +interface Ipfs_Module_Args_cat extends Record { + cid: Types.String; + options?: Types.Ipfs_Options | null; +} + +/* URI: "ens/ipfs.polywrap.eth" */ +interface Ipfs_Module_Args_resolve extends Record { + cid: Types.String; + options?: Types.Ipfs_Options | null; +} + +/* URI: "ens/ipfs.polywrap.eth" */ +interface Ipfs_Module_Args_addFile extends Record { + data: Types.Bytes; +} + +/* URI: "ens/ipfs.polywrap.eth" */ +export const Ipfs_Module = { + cat: async ( + args: Ipfs_Module_Args_cat, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ipfs.polywrap.eth", + method: "cat", + args + }); + }, + + resolve: async ( + args: Ipfs_Module_Args_resolve, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ipfs.polywrap.eth", + method: "resolve", + args + }); + }, + + addFile: async ( + args: Ipfs_Module_Args_addFile, + client: Client + ): Promise> => { + return client.invoke({ + uri: "ens/ipfs.polywrap.eth", + method: "addFile", + args + }); + } +} + +/// Imported Modules END /// diff --git a/packages/js/plugins/uri-resolvers/ipfs-resolver/src/wrap-man/wrap.info.ts b/packages/js/plugins/uri-resolvers/ipfs-resolver/src/wrap-man/wrap.info.ts new file mode 100644 index 0000000000..f4d2a3d9f7 --- /dev/null +++ b/packages/js/plugins/uri-resolvers/ipfs-resolver/src/wrap-man/wrap.info.ts @@ -0,0 +1,342 @@ +import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; + +export const manifest: WrapManifest = { + name: "IpfsResolver", + type: "plugin", + version: "0.1", + abi: { + version: "0.1", + importedObjectTypes: [ + { + type: "UriResolver_MaybeUriOrManifest", + kind: 1025, + properties: [ + { + type: "String", + name: "uri", + kind: 34, + scalar: { type: "String", name: "uri", kind: 4 }, + }, + { + type: "Bytes", + name: "manifest", + kind: 34, + scalar: { type: "Bytes", name: "manifest", kind: 4 }, + }, + ], + uri: "ens/uri-resolver.core.polywrap.eth", + namespace: "UriResolver", + nativeType: "MaybeUriOrManifest", + }, + { + type: "Ipfs_Options", + kind: 1025, + properties: [ + { + type: "UInt32", + name: "timeout", + kind: 34, + scalar: { type: "UInt32", name: "timeout", kind: 4 }, + comment: + " Timeout (in ms) for the operation.\nFallback providers are used if timeout is reached.", + }, + { + type: "String", + name: "provider", + kind: 34, + scalar: { type: "String", name: "provider", kind: 4 }, + comment: "The IPFS provider to be used", + }, + { + type: "Boolean", + name: "disableParallelRequests", + kind: 34, + scalar: { + type: "Boolean", + name: "disableParallelRequests", + kind: 4, + }, + comment: "Disable querying providers in parallel when resolving URIs", + }, + ], + uri: "ens/ipfs.polywrap.eth", + namespace: "Ipfs", + nativeType: "Options", + }, + { + type: "Ipfs_ResolveResult", + kind: 1025, + properties: [ + { + type: "String", + name: "cid", + required: true, + kind: 34, + scalar: { type: "String", name: "cid", required: true, kind: 4 }, + }, + { + type: "String", + name: "provider", + required: true, + kind: 34, + scalar: { type: "String", name: "provider", required: true, kind: 4 }, + }, + ], + uri: "ens/ipfs.polywrap.eth", + namespace: "Ipfs", + nativeType: "ResolveResult", + }, + ], + importedModuleTypes: [ + { + type: "UriResolver_Module", + kind: 256, + methods: [ + { + type: "Method", + name: "tryResolveUri", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "authority", + required: true, + kind: 34, + scalar: { + type: "String", + name: "authority", + required: true, + kind: 4, + }, + }, + { + type: "String", + name: "path", + required: true, + kind: 34, + scalar: { type: "String", name: "path", required: true, kind: 4 }, + }, + ], + return: { + type: "UriResolver_MaybeUriOrManifest", + name: "tryResolveUri", + kind: 34, + object: { + type: "UriResolver_MaybeUriOrManifest", + name: "tryResolveUri", + kind: 8192, + }, + }, + }, + { + type: "Method", + name: "getFile", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "path", + required: true, + kind: 34, + scalar: { type: "String", name: "path", required: true, kind: 4 }, + }, + ], + return: { + type: "Bytes", + name: "getFile", + kind: 34, + scalar: { type: "Bytes", name: "getFile", kind: 4 }, + }, + }, + ], + uri: "ens/uri-resolver.core.polywrap.eth", + namespace: "UriResolver", + nativeType: "Module", + isInterface: false, + }, + { + type: "Ipfs_Module", + kind: 256, + methods: [ + { + type: "Method", + name: "cat", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "cid", + required: true, + kind: 34, + scalar: { type: "String", name: "cid", required: true, kind: 4 }, + }, + { + type: "Ipfs_Options", + name: "options", + kind: 34, + object: { + type: "Ipfs_Options", + name: "options", + kind: 8192, + }, + }, + ], + return: { + type: "Bytes", + name: "cat", + required: true, + kind: 34, + scalar: { type: "Bytes", name: "cat", required: true, kind: 4 }, + }, + }, + { + type: "Method", + name: "resolve", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "cid", + required: true, + kind: 34, + scalar: { type: "String", name: "cid", required: true, kind: 4 }, + }, + { + type: "Ipfs_Options", + name: "options", + kind: 34, + object: { + type: "Ipfs_Options", + name: "options", + kind: 8192, + }, + }, + ], + return: { + type: "Ipfs_ResolveResult", + name: "resolve", + kind: 34, + object: { + type: "Ipfs_ResolveResult", + name: "resolve", + kind: 8192, + }, + }, + }, + { + type: "Method", + name: "addFile", + required: true, + kind: 64, + arguments: [ + { + type: "Bytes", + name: "data", + required: true, + kind: 34, + scalar: { type: "Bytes", name: "data", required: true, kind: 4 }, + }, + ], + return: { + type: "String", + name: "addFile", + required: true, + kind: 34, + scalar: { + type: "String", + name: "addFile", + required: true, + kind: 4, + }, + }, + }, + ], + uri: "ens/ipfs.polywrap.eth", + namespace: "Ipfs", + nativeType: "Module", + isInterface: false, + }, + ], + moduleType: { + type: "Module", + kind: 128, + methods: [ + { + type: "Method", + name: "tryResolveUri", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "authority", + required: true, + kind: 34, + scalar: { + type: "String", + name: "authority", + required: true, + kind: 4, + }, + }, + { + type: "String", + name: "path", + required: true, + kind: 34, + scalar: { type: "String", name: "path", required: true, kind: 4 }, + }, + ], + return: { + type: "UriResolver_MaybeUriOrManifest", + name: "tryResolveUri", + kind: 34, + object: { + type: "UriResolver_MaybeUriOrManifest", + name: "tryResolveUri", + kind: 8192, + }, + }, + }, + { + type: "Method", + name: "getFile", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "path", + required: true, + kind: 34, + scalar: { type: "String", name: "path", required: true, kind: 4 }, + }, + ], + return: { + type: "Bytes", + name: "getFile", + kind: 34, + scalar: { type: "Bytes", name: "getFile", kind: 4 }, + }, + }, + ], + imports: [ + { type: "UriResolver_Module" }, + { type: "UriResolver_MaybeUriOrManifest" }, + { type: "Ipfs_Module" }, + { type: "Ipfs_Options" }, + { type: "Ipfs_ResolveResult" }, + ], + interfaces: [ + { + type: "UriResolver_Module", + kind: 2048, + }, + ], + } + } +}; diff --git a/packages/js/plugins/uts46/package.json b/packages/js/plugins/uts46/package.json index f3115ad7d1..293771be42 100644 --- a/packages/js/plugins/uts46/package.json +++ b/packages/js/plugins/uts46/package.json @@ -12,8 +12,9 @@ "build" ], "scripts": { - "build": "rimraf ./build && yarn codegen && tsc --project tsconfig.build.json", + "build": "rimraf ./build && tsc --project tsconfig.build.json", "codegen": "node ../../../../dependencies/node_modules/polywrap/bin/polywrap plugin codegen", + "codegen:patch": "node ../../../cli/bin/polywrap plugin codegen && rimraf ./src/wrap", "lint": "eslint --color -c ../../../../.eslintrc.js src/", "test": "jest --passWithNoTests --runInBand --verbose", "test:ci": "jest --passWithNoTests --runInBand --verbose", diff --git a/packages/js/plugins/uts46/polywrap.plugin.yaml b/packages/js/plugins/uts46/polywrap.plugin.yaml index b1c442ada0..280cf5dd2f 100644 --- a/packages/js/plugins/uts46/polywrap.plugin.yaml +++ b/packages/js/plugins/uts46/polywrap.plugin.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: Uts46 language: plugin/typescript module: ./src/index.ts diff --git a/packages/js/plugins/uts46/src/index.ts b/packages/js/plugins/uts46/src/index.ts index bd751e4a66..58f56a830d 100644 --- a/packages/js/plugins/uts46/src/index.ts +++ b/packages/js/plugins/uts46/src/index.ts @@ -5,7 +5,7 @@ import { Args_convert, ConvertResult, manifest, -} from "./wrap"; +} from "./wrap-man"; import { PluginFactory } from "@polywrap/core-js"; diff --git a/packages/js/plugins/uts46/src/wrap-man/index.ts b/packages/js/plugins/uts46/src/wrap-man/index.ts new file mode 100644 index 0000000000..315871f96d --- /dev/null +++ b/packages/js/plugins/uts46/src/wrap-man/index.ts @@ -0,0 +1,8 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +export * from "./wrap.info"; +export * from "./module"; +export * from "./types"; + +export { Client } from "@polywrap/core-js"; diff --git a/packages/js/plugins/uts46/src/wrap-man/module.ts b/packages/js/plugins/uts46/src/wrap-man/module.ts new file mode 100644 index 0000000000..14991e1225 --- /dev/null +++ b/packages/js/plugins/uts46/src/wrap-man/module.ts @@ -0,0 +1,44 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +import * as Types from "./types"; + +import { + Client, + PluginModule, + MaybeAsync +} from "@polywrap/core-js"; + +export interface Args_toAscii extends Record { + value: Types.String; +} + +export interface Args_toUnicode extends Record { + value: Types.String; +} + +export interface Args_convert extends Record { + value: Types.String; +} + +export abstract class Module< + TConfig +> extends PluginModule< + TConfig +> { + + abstract toAscii( + args: Args_toAscii, + client: Client + ): MaybeAsync; + + abstract toUnicode( + args: Args_toUnicode, + client: Client + ): MaybeAsync; + + abstract convert( + args: Args_convert, + client: Client + ): MaybeAsync; +} diff --git a/packages/js/plugins/uts46/src/wrap-man/types.ts b/packages/js/plugins/uts46/src/wrap-man/types.ts new file mode 100644 index 0000000000..ac826940e7 --- /dev/null +++ b/packages/js/plugins/uts46/src/wrap-man/types.ts @@ -0,0 +1,48 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. + +// @ts-ignore +import * as Types from "./"; + +// @ts-ignore +import { + Client, + InvokeResult +} from "@polywrap/core-js"; + +export type UInt = number; +export type UInt8 = number; +export type UInt16 = number; +export type UInt32 = number; +export type Int = number; +export type Int8 = number; +export type Int16 = number; +export type Int32 = number; +export type Bytes = Uint8Array; +export type BigInt = string; +export type BigNumber = string; +export type Json = string; +export type String = string; +export type Boolean = boolean; + +/// Env START /// +/// Env END /// + +/// Objects START /// +export interface ConvertResult { + IDN: Types.String; + PC: Types.String; +} + +/// Objects END /// + +/// Enums START /// +/// Enums END /// + +/// Imported Objects START /// + +/// Imported Objects END /// + +/// Imported Modules START /// + +/// Imported Modules END /// diff --git a/packages/js/plugins/uts46/src/wrap-man/wrap.info.ts b/packages/js/plugins/uts46/src/wrap-man/wrap.info.ts new file mode 100644 index 0000000000..b3c85bebad --- /dev/null +++ b/packages/js/plugins/uts46/src/wrap-man/wrap.info.ts @@ -0,0 +1,114 @@ +import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; + +export const manifest: WrapManifest = { + name: "Uts46", + type: "plugin", + version: "0.1", + abi: { + version: "0.1", + objectTypes: [ + { + type: "ConvertResult", + kind: 1, + properties: [ + { + type: "String", + name: "IDN", + required: true, + kind: 34, + scalar: { type: "String", name: "IDN", required: true, kind: 4 } + }, + { + type: "String", + name: "PC", + required: true, + kind: 34, + scalar: { type: "String", name: "PC", required: true, kind: 4 }, + }, + ], + }, + ], + moduleType: { + type: "Module", + kind: 128, + methods: [ + { + type: "Method", + name: "toAscii", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "value", + required: true, + kind: 34, + scalar: { type: "String", name: "value", required: true, kind: 4 }, + }, + ], + return: { + type: "String", + name: "toAscii", + required: true, + kind: 34, + scalar: { type: "String", name: "toAscii", required: true, kind: 4 }, + }, + }, + { + type: "Method", + name: "toUnicode", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "value", + required: true, + kind: 34, + scalar: { type: "String", name: "value", required: true, kind: 4 }, + }, + ], + return: { + type: "String", + name: "toUnicode", + required: true, + kind: 34, + scalar: { + type: "String", + name: "toUnicode", + required: true, + kind: 4, + }, + }, + }, + { + type: "Method", + name: "convert", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "value", + required: true, + kind: 34, + scalar: { type: "String", name: "value", required: true, kind: 4 }, + }, + ], + return: { + type: "ConvertResult", + name: "convert", + required: true, + kind: 34, + object: { + type: "ConvertResult", + name: "convert", + required: true, + kind: 8192, + }, + }, + }, + ], + } + } +}; diff --git a/packages/manifests/polywrap/formats/polywrap.app/0.2.json b/packages/manifests/polywrap/formats/polywrap.app/0.2.json new file mode 100644 index 0000000000..2a60be3a12 --- /dev/null +++ b/packages/manifests/polywrap/formats/polywrap.app/0.2.json @@ -0,0 +1,62 @@ +{ + "id": "AppManifest", + "type": "object", + "additionalProperties": false, + "required": [ + "format", + "name", + "language", + "schema" + ], + "properties": { + "format": { + "description": "Polywrap app manifest format version.", + "type": "string", + "const": "0.2" + }, + "name": { + "description": "Name of this wrapper package.", + "type": "string", + "pattern": "^[a-zA-Z0-9\\-\\_]+$" + }, + "language": { + "description": "Language in which the source code is written.", + "type": "string", + "pattern": "^app\\/[a-z0-9]+$" + }, + "schema": { + "description": "Path to graphql schema.", + "type": "string", + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" + }, + "import_abis": { + "description": "Specify ABIs to be used for the import URIs within your schema.", + "type": "array", + "items": { + "$ref": "#/definitions/import_abis" + } + } + }, + "definitions": { + "import_abis": { + "type": "object", + "additionalProperties": false, + "properties": { + "uri": { + "description": "One of the schema's import URI.", + "type": "string", + "pattern": "^[wrap://]*[a-z\\-\\_0-9]+\\/.+$" + }, + "abi": { + "description": "Path to a local ABI (or schema). Supported file formats: [*.graphql, *.info, *.json, *.yaml]", + "type": "string", + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.(info|graphql|json|yaml)$" + } + }, + "required": [ + "uri", + "abi" + ] + } + } +} diff --git a/packages/manifests/polywrap/formats/polywrap.plugin/0.2.json b/packages/manifests/polywrap/formats/polywrap.plugin/0.2.json new file mode 100644 index 0000000000..e56bf2c858 --- /dev/null +++ b/packages/manifests/polywrap/formats/polywrap.plugin/0.2.json @@ -0,0 +1,67 @@ +{ + "id": "PluginManifest", + "type": "object", + "additionalProperties": false, + "required": [ + "format", + "name", + "language", + "schema" + ], + "properties": { + "format": { + "description": "Polywrap plugin manifest format version.", + "type": "string", + "const": "0.2" + }, + "name": { + "description": "Plugin name.", + "type": "string", + "pattern": "^[a-zA-Z0-9\\-\\_]+$" + }, + "language": { + "description" : "Plugin language.", + "type": "string", + "pattern": "^plugin\\/[a-z0-9]+$" + }, + "module": { + "description": "Path to Polywrap implementation.", + "type": "string", + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" + }, + "schema": { + "description": "Path to graphql schema.", + "type": "string", + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.graphql$" + }, + "import_abis": { + "description": "Specify ABIs to be used for the import URIs within your schema.", + "type": "array", + "items": { + "$ref": "#/definitions/import_abis" + } + } + }, + "definitions": { + "import_abis": { + "type": "object", + "additionalProperties": false, + "properties": { + "uri": { + "description": "One of the schema's import URI.", + "type": "string", + "pattern": "^[wrap://]*[a-z\\-\\_0-9]+\\/.+$" + }, + "abi": { + "description": "Path to a local ABI (or schema). Supported file formats: [*.graphql, *.info, *.json, *.yaml]", + "type": "string", + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.(info|graphql|json|yaml)$" + } + }, + "required": [ + "uri", + "abi" + ] + } + } +} diff --git a/packages/manifests/polywrap/formats/polywrap/0.2.json b/packages/manifests/polywrap/formats/polywrap/0.2.json new file mode 100644 index 0000000000..8a023e7d29 --- /dev/null +++ b/packages/manifests/polywrap/formats/polywrap/0.2.json @@ -0,0 +1,82 @@ +{ + "id": "PolywrapManifest", + "type": "object", + "additionalProperties": false, + "required": [ + "format", + "name", + "schema", + "language" + ], + "properties": { + "format": { + "description": "Polywrap manifest format version.", + "type": "string", + "const": "0.2" + }, + "name": { + "description": "Name of this wrapper package.", + "type": "string", + "pattern": "^[a-zA-Z0-9\\-\\_]+$" + }, + "build": { + "description": "Path to the wrapper build manifest file.", + "type": "string", + "pattern": "^\\.?\\.?(\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)*\\/[\\w\\-\\.]+\\.(yaml|json)$" + }, + "meta": { + "description": "Path to wrapper metadata manifest file.", + "type": "string", + "pattern": "^\\.?\\.?(\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)*\\/[\\w\\-\\.]+\\.(yaml|json)$" + }, + "deploy": { + "description": "Path to wrapper deploy manifest file.", + "type": "string", + "pattern": "^\\.?\\.?(\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)*\\/[\\w\\-\\.]+\\.(yaml|json)$" + }, + "language": { + "description": "Language in which the source code is written.", + "type": "string", + "pattern": "^interface|wasm\\/[a-z0-9]+$" + }, + "module": { + "description": "Path to the module's entry point.", + "type": "string", + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.?[\\w\\-\\.]*$" + }, + "schema": { + "description": "Path to the module's graphql schema.", + "type": "string", + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.graphql$" + }, + "import_abis": { + "description": "Specify ABIs to be used for the import URIs within your schema.", + "type": "array", + "items": { + "$ref": "#/definitions/import_abis" + } + } + }, + "definitions": { + "import_abis": { + "type": "object", + "additionalProperties": false, + "properties": { + "uri": { + "description": "One of the schema's import URI.", + "type": "string", + "pattern": "^[wrap://]*[a-z\\-\\_0-9]+\\/.+$" + }, + "abi": { + "description": "Path to a local ABI (or schema). Supported file formats: [*.graphql, *.info, *.json, *.yaml]", + "type": "string", + "pattern": "^\\.?\\.?\\/?((\\/[\\w\\-\\.]+|\\/\\.\\.|\\/\\.)+\\/)?[\\w\\-\\.]+\\.(info|graphql|json|yaml)$" + } + }, + "required": [ + "uri", + "abi" + ] + } + } +} diff --git a/packages/schema/bind/src/__tests__/index.ts b/packages/schema/bind/src/__tests__/index.ts index b30c0411ad..1fd3557924 100644 --- a/packages/schema/bind/src/__tests__/index.ts +++ b/packages/schema/bind/src/__tests__/index.ts @@ -78,7 +78,6 @@ export function fetchTestCases(): TestCases { projectName: "Test", bindLanguage: "TBD" as BindLanguage, abi, - schema, outputDirAbs: path.join(root, "combined") }; diff --git a/packages/schema/bind/src/bindings/typescript/app/index.ts b/packages/schema/bind/src/bindings/typescript/app/index.ts index bd02e94c63..4a3a71bd8a 100644 --- a/packages/schema/bind/src/bindings/typescript/app/index.ts +++ b/packages/schema/bind/src/bindings/typescript/app/index.ts @@ -25,12 +25,11 @@ export const generateBinding: GenerateBindingFn = ( outputDirAbs: options.outputDirAbs, }; const output = result.output; - const schema = options.schema; const abi = applyTransforms(options.abi); output.entries = renderTemplates( path.join(__dirname, "./templates"), - { ...abi, schema }, + abi, {} ); diff --git a/packages/schema/bind/src/bindings/typescript/app/templates/index-ts.mustache b/packages/schema/bind/src/bindings/typescript/app/templates/index-ts.mustache index d0bb0ac74a..eea524d655 100644 --- a/packages/schema/bind/src/bindings/typescript/app/templates/index-ts.mustache +++ b/packages/schema/bind/src/bindings/typescript/app/templates/index-ts.mustache @@ -1,2 +1 @@ export * from "./types"; -export * from "./schema"; diff --git a/packages/schema/bind/src/bindings/typescript/app/templates/schema-ts.mustache b/packages/schema/bind/src/bindings/typescript/app/templates/schema-ts.mustache deleted file mode 100644 index 394b057efc..0000000000 --- a/packages/schema/bind/src/bindings/typescript/app/templates/schema-ts.mustache +++ /dev/null @@ -1 +0,0 @@ -export const schema: string = `{{schema}}`; diff --git a/packages/schema/bind/src/bindings/typescript/plugin/index.ts b/packages/schema/bind/src/bindings/typescript/plugin/index.ts index bcb389eaa9..c6111472dc 100644 --- a/packages/schema/bind/src/bindings/typescript/plugin/index.ts +++ b/packages/schema/bind/src/bindings/typescript/plugin/index.ts @@ -13,12 +13,29 @@ import { } from "@polywrap/schema-parse"; import { WrapAbi } from "@polywrap/wrap-manifest-types-js"; import path from "path"; +import { latestWrapManifestVersion } from "@polywrap/wrap-manifest-types-js"; export { Functions }; const templatePath = (subpath: string) => path.join(__dirname, "./templates", subpath); +const sort = (obj: Record) => + Object.keys(obj) + .sort() + .reduce((map: Record, key: string) => { + if (typeof obj[key] === "object") { + map[key] = sort(obj[key] as Record); + + if (Array.isArray(obj[key])) { + map[key] = Object.values(map[key] as Record); + } + } else { + map[key] = obj[key]; + } + return map; + }, {}); + export const generateBinding: GenerateBindingFn = ( options: BindOptions ): BindOutput => { @@ -33,12 +50,18 @@ export const generateBinding: GenerateBindingFn = ( outputDirAbs: options.outputDirAbs, }; const output = result.output; + const manifest = { + name: options.projectName, + type: "plugin", + version: latestWrapManifestVersion, + abi: JSON.stringify( + sort((options.abi as unknown) as Record), + null, + 2 + ), + }; - output.entries = renderTemplates( - templatePath(""), - { ...abi, schema: options.schema }, - {} - ); + output.entries = renderTemplates(templatePath(""), { ...abi, manifest }, {}); return result; }; diff --git a/packages/schema/bind/src/bindings/typescript/plugin/templates/index-ts.mustache b/packages/schema/bind/src/bindings/typescript/plugin/templates/index-ts.mustache index f367d143d9..315871f96d 100644 --- a/packages/schema/bind/src/bindings/typescript/plugin/templates/index-ts.mustache +++ b/packages/schema/bind/src/bindings/typescript/plugin/templates/index-ts.mustache @@ -1,8 +1,7 @@ /// NOTE: This is an auto-generated file. /// All modifications will be overwritten. -export * from "./schema"; -export * from "./manifest"; +export * from "./wrap.info"; export * from "./module"; export * from "./types"; diff --git a/packages/schema/bind/src/bindings/typescript/plugin/templates/manifest-ts.mustache b/packages/schema/bind/src/bindings/typescript/plugin/templates/manifest-ts.mustache deleted file mode 100644 index 9a6f3b20da..0000000000 --- a/packages/schema/bind/src/bindings/typescript/plugin/templates/manifest-ts.mustache +++ /dev/null @@ -1,18 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { schema } from "./"; - -// @ts-ignore -import { PluginPackageManifest, Uri } from "@polywrap/core-js"; - -export const manifest: PluginPackageManifest = { - schema, - implements: [ - {{#interfaceUris}} - new Uri("{{.}}"), - {{/interfaceUris}} - ], -}; diff --git a/packages/schema/bind/src/bindings/typescript/plugin/templates/schema-ts.mustache b/packages/schema/bind/src/bindings/typescript/plugin/templates/schema-ts.mustache deleted file mode 100644 index 6f24be9051..0000000000 --- a/packages/schema/bind/src/bindings/typescript/plugin/templates/schema-ts.mustache +++ /dev/null @@ -1,4 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export const schema: string = `{{schema}}`; diff --git a/packages/schema/bind/src/bindings/typescript/plugin/templates/wrap.info-ts.mustache b/packages/schema/bind/src/bindings/typescript/plugin/templates/wrap.info-ts.mustache new file mode 100644 index 0000000000..32296868a0 --- /dev/null +++ b/packages/schema/bind/src/bindings/typescript/plugin/templates/wrap.info-ts.mustache @@ -0,0 +1,12 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. +import { WrapManifest } from "@polywrap/wrap-manifest-types-js" + +{{#manifest}} +export const manifest: WrapManifest = { + name: "{{name}}", + type: "{{type}}", + version: "{{version}}", + abi: {{abi}} +} +{{/manifest}} diff --git a/packages/schema/bind/src/fail.json b/packages/schema/bind/src/fail.json new file mode 100644 index 0000000000..bff631af64 --- /dev/null +++ b/packages/schema/bind/src/fail.json @@ -0,0 +1,2743 @@ +{ + "moduleType": { + "imports": [ + { + "type": "Ethereum_Module" + }, + { + "type": "Ethereum_Connection" + }, + { + "type": "Ethereum_TxOverrides" + }, + { + "type": "Ethereum_StaticTxResult" + }, + { + "type": "Ethereum_TxRequest" + }, + { + "type": "Ethereum_TxReceipt" + }, + { + "type": "Ethereum_Log" + }, + { + "type": "Ethereum_EventNotification" + }, + { + "type": "Ethereum_Network" + }, + { + "type": "Ethereum_TxResponse" + }, + { + "type": "Ethereum_Access" + } + ], + "type": "Module", + "kind": 128, + "methods": [ + { + "name": "getData", + "return": { + "type": "Int", + "name": "getData", + "required": true, + "kind": 34, + "scalar": { + "name": "getData", + "type": "Int", + "required": true, + "kind": 4 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "String", + "name": "address", + "required": true, + "kind": 34, + "scalar": { + "name": "address", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "name": "connection", + "type": "Ethereum_Connection", + "kind": 8192 + } + } + ] + }, + { + "name": "tryGetData", + "return": { + "type": "String", + "name": "tryGetData", + "required": true, + "kind": 34, + "scalar": { + "name": "tryGetData", + "type": "String", + "required": true, + "kind": 4 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "String", + "name": "address", + "required": true, + "kind": 34, + "scalar": { + "name": "address", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "name": "connection", + "type": "Ethereum_Connection", + "kind": 8192 + } + } + ] + }, + { + "name": "throwGetData", + "return": { + "type": "String", + "name": "throwGetData", + "required": true, + "kind": 34, + "scalar": { + "name": "throwGetData", + "type": "String", + "required": true, + "kind": 4 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "String", + "name": "address", + "required": true, + "kind": 34, + "scalar": { + "name": "address", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "name": "connection", + "type": "Ethereum_Connection", + "kind": 8192 + } + } + ] + }, + { + "name": "setData", + "return": { + "type": "String", + "name": "setData", + "required": true, + "kind": 34, + "scalar": { + "name": "setData", + "type": "String", + "required": true, + "kind": 4 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "String", + "name": "address", + "required": true, + "kind": 34, + "scalar": { + "name": "address", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "Int", + "name": "value", + "required": true, + "kind": 34, + "scalar": { + "name": "value", + "type": "Int", + "required": true, + "kind": 4 + } + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "name": "connection", + "type": "Ethereum_Connection", + "kind": 8192 + } + } + ] + }, + { + "name": "deployContract", + "return": { + "type": "String", + "name": "deployContract", + "required": true, + "kind": 34, + "scalar": { + "name": "deployContract", + "type": "String", + "required": true, + "kind": 4 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "name": "connection", + "type": "Ethereum_Connection", + "kind": 8192 + } + } + ] + } + ] + }, + "importedObjectTypes": [ + { + "type": "Ethereum_Connection", + "uri": "wrap://ens/ethereum.polywrap.eth", + "namespace": "Ethereum", + "nativeType": "Connection", + "kind": 1025, + "properties": [ + { + "type": "String", + "name": "node", + "kind": 34, + "scalar": { + "name": "node", + "type": "String", + "kind": 4 + } + }, + { + "type": "String", + "name": "networkNameOrChainId", + "kind": 34, + "scalar": { + "name": "networkNameOrChainId", + "type": "String", + "kind": 4 + } + } + ] + }, + { + "type": "Ethereum_TxOverrides", + "uri": "wrap://ens/ethereum.polywrap.eth", + "namespace": "Ethereum", + "nativeType": "TxOverrides", + "kind": 1025, + "properties": [ + { + "type": "BigInt", + "name": "gasLimit", + "kind": 34, + "scalar": { + "name": "gasLimit", + "type": "BigInt", + "kind": 4 + } + }, + { + "type": "BigInt", + "name": "gasPrice", + "kind": 34, + "scalar": { + "name": "gasPrice", + "type": "BigInt", + "kind": 4 + } + }, + { + "type": "BigInt", + "name": "value", + "kind": 34, + "scalar": { + "name": "value", + "type": "BigInt", + "kind": 4 + } + } + ] + }, + { + "type": "Ethereum_StaticTxResult", + "uri": "wrap://ens/ethereum.polywrap.eth", + "namespace": "Ethereum", + "nativeType": "StaticTxResult", + "kind": 1025, + "properties": [ + { + "type": "String", + "name": "result", + "required": true, + "kind": 34, + "scalar": { + "name": "result", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "Boolean", + "name": "error", + "required": true, + "kind": 34, + "scalar": { + "name": "error", + "type": "Boolean", + "required": true, + "kind": 4 + } + } + ] + }, + { + "type": "Ethereum_TxRequest", + "uri": "wrap://ens/ethereum.polywrap.eth", + "namespace": "Ethereum", + "nativeType": "TxRequest", + "kind": 1025, + "properties": [ + { + "type": "String", + "name": "to", + "kind": 34, + "scalar": { + "name": "to", + "type": "String", + "kind": 4 + } + }, + { + "type": "String", + "name": "from", + "kind": 34, + "scalar": { + "name": "from", + "type": "String", + "kind": 4 + } + }, + { + "type": "UInt32", + "name": "nonce", + "kind": 34, + "scalar": { + "name": "nonce", + "type": "UInt32", + "kind": 4 + } + }, + { + "type": "BigInt", + "name": "gasLimit", + "kind": 34, + "scalar": { + "name": "gasLimit", + "type": "BigInt", + "kind": 4 + } + }, + { + "type": "BigInt", + "name": "gasPrice", + "kind": 34, + "scalar": { + "name": "gasPrice", + "type": "BigInt", + "kind": 4 + } + }, + { + "type": "String", + "name": "data", + "kind": 34, + "scalar": { + "name": "data", + "type": "String", + "kind": 4 + } + }, + { + "type": "BigInt", + "name": "value", + "kind": 34, + "scalar": { + "name": "value", + "type": "BigInt", + "kind": 4 + } + }, + { + "type": "BigInt", + "name": "chainId", + "kind": 34, + "scalar": { + "name": "chainId", + "type": "BigInt", + "kind": 4 + } + }, + { + "type": "UInt32", + "name": "type", + "kind": 34, + "scalar": { + "name": "type", + "type": "UInt32", + "kind": 4 + } + } + ] + }, + { + "type": "Ethereum_TxReceipt", + "uri": "wrap://ens/ethereum.polywrap.eth", + "namespace": "Ethereum", + "nativeType": "TxReceipt", + "kind": 1025, + "properties": [ + { + "type": "String", + "name": "to", + "required": true, + "kind": 34, + "scalar": { + "name": "to", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "String", + "name": "from", + "required": true, + "kind": 34, + "scalar": { + "name": "from", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "String", + "name": "contractAddress", + "required": true, + "kind": 34, + "scalar": { + "name": "contractAddress", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "UInt32", + "name": "transactionIndex", + "required": true, + "kind": 34, + "scalar": { + "name": "transactionIndex", + "type": "UInt32", + "required": true, + "kind": 4 + } + }, + { + "type": "String", + "name": "root", + "kind": 34, + "scalar": { + "name": "root", + "type": "String", + "kind": 4 + } + }, + { + "type": "BigInt", + "name": "gasUsed", + "required": true, + "kind": 34, + "scalar": { + "name": "gasUsed", + "type": "BigInt", + "required": true, + "kind": 4 + } + }, + { + "type": "String", + "name": "logsBloom", + "required": true, + "kind": 34, + "scalar": { + "name": "logsBloom", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "String", + "name": "transactionHash", + "required": true, + "kind": 34, + "scalar": { + "name": "transactionHash", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "[Ethereum_Log]", + "name": "logs", + "required": true, + "kind": 34, + "array": { + "name": "logs", + "type": "[Ethereum_Log]", + "required": true, + "object": { + "name": "logs", + "required": true, + "type": "Ethereum_Log", + "kind": 8192 + }, + "kind": 18, + "item": { + "name": "logs", + "required": true, + "type": "Ethereum_Log", + "kind": 8192 + } + } + }, + { + "type": "BigInt", + "name": "blockNumber", + "required": true, + "kind": 34, + "scalar": { + "name": "blockNumber", + "type": "BigInt", + "required": true, + "kind": 4 + } + }, + { + "type": "String", + "name": "blockHash", + "required": true, + "kind": 34, + "scalar": { + "name": "blockHash", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "UInt32", + "name": "confirmations", + "required": true, + "kind": 34, + "scalar": { + "name": "confirmations", + "type": "UInt32", + "required": true, + "kind": 4 + } + }, + { + "type": "BigInt", + "name": "cumulativeGasUsed", + "required": true, + "kind": 34, + "scalar": { + "name": "cumulativeGasUsed", + "type": "BigInt", + "required": true, + "kind": 4 + } + }, + { + "type": "BigInt", + "name": "effectiveGasPrice", + "required": true, + "kind": 34, + "scalar": { + "name": "effectiveGasPrice", + "type": "BigInt", + "required": true, + "kind": 4 + } + }, + { + "type": "Boolean", + "name": "byzantium", + "required": true, + "kind": 34, + "scalar": { + "name": "byzantium", + "type": "Boolean", + "required": true, + "kind": 4 + } + }, + { + "type": "UInt32", + "name": "type", + "required": true, + "kind": 34, + "scalar": { + "name": "type", + "type": "UInt32", + "required": true, + "kind": 4 + } + }, + { + "type": "UInt32", + "name": "status", + "kind": 34, + "scalar": { + "name": "status", + "type": "UInt32", + "kind": 4 + } + } + ] + }, + { + "type": "Ethereum_Log", + "uri": "wrap://ens/ethereum.polywrap.eth", + "namespace": "Ethereum", + "nativeType": "Log", + "kind": 1025, + "properties": [ + { + "type": "BigInt", + "name": "blockNumber", + "required": true, + "kind": 34, + "scalar": { + "name": "blockNumber", + "type": "BigInt", + "required": true, + "kind": 4 + } + }, + { + "type": "String", + "name": "blockHash", + "required": true, + "kind": 34, + "scalar": { + "name": "blockHash", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "UInt32", + "name": "transactionIndex", + "required": true, + "kind": 34, + "scalar": { + "name": "transactionIndex", + "type": "UInt32", + "required": true, + "kind": 4 + } + }, + { + "type": "Boolean", + "name": "removed", + "required": true, + "kind": 34, + "scalar": { + "name": "removed", + "type": "Boolean", + "required": true, + "kind": 4 + } + }, + { + "type": "String", + "name": "address", + "required": true, + "kind": 34, + "scalar": { + "name": "address", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "String", + "name": "data", + "required": true, + "kind": 34, + "scalar": { + "name": "data", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "[String]", + "name": "topics", + "required": true, + "kind": 34, + "array": { + "name": "topics", + "type": "[String]", + "required": true, + "scalar": { + "name": "topics", + "type": "String", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "topics", + "type": "String", + "required": true, + "kind": 4 + } + } + }, + { + "type": "String", + "name": "transactionHash", + "required": true, + "kind": 34, + "scalar": { + "name": "transactionHash", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "UInt32", + "name": "logIndex", + "required": true, + "kind": 34, + "scalar": { + "name": "logIndex", + "type": "UInt32", + "required": true, + "kind": 4 + } + } + ] + }, + { + "type": "Ethereum_EventNotification", + "uri": "wrap://ens/ethereum.polywrap.eth", + "namespace": "Ethereum", + "nativeType": "EventNotification", + "kind": 1025, + "properties": [ + { + "type": "String", + "name": "data", + "required": true, + "kind": 34, + "scalar": { + "name": "data", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "String", + "name": "address", + "required": true, + "kind": 34, + "scalar": { + "name": "address", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "Ethereum_Log", + "name": "log", + "required": true, + "kind": 34, + "object": { + "name": "log", + "required": true, + "type": "Ethereum_Log", + "kind": 8192 + } + } + ] + }, + { + "type": "Ethereum_Network", + "uri": "wrap://ens/ethereum.polywrap.eth", + "namespace": "Ethereum", + "nativeType": "Network", + "kind": 1025, + "properties": [ + { + "type": "String", + "name": "name", + "required": true, + "kind": 34, + "scalar": { + "name": "name", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "BigInt", + "name": "chainId", + "required": true, + "kind": 34, + "scalar": { + "name": "chainId", + "type": "BigInt", + "required": true, + "kind": 4 + } + }, + { + "type": "String", + "name": "ensAddress", + "kind": 34, + "scalar": { + "name": "ensAddress", + "type": "String", + "kind": 4 + } + } + ] + }, + { + "type": "Ethereum_TxResponse", + "uri": "wrap://ens/ethereum.polywrap.eth", + "namespace": "Ethereum", + "nativeType": "TxResponse", + "kind": 1025, + "properties": [ + { + "type": "String", + "name": "hash", + "required": true, + "kind": 34, + "scalar": { + "name": "hash", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "String", + "name": "to", + "kind": 34, + "scalar": { + "name": "to", + "type": "String", + "kind": 4 + } + }, + { + "type": "String", + "name": "from", + "required": true, + "kind": 34, + "scalar": { + "name": "from", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "UInt32", + "name": "nonce", + "required": true, + "kind": 34, + "scalar": { + "name": "nonce", + "type": "UInt32", + "required": true, + "kind": 4 + } + }, + { + "type": "BigInt", + "name": "gasLimit", + "required": true, + "kind": 34, + "scalar": { + "name": "gasLimit", + "type": "BigInt", + "required": true, + "kind": 4 + } + }, + { + "type": "BigInt", + "name": "gasPrice", + "kind": 34, + "scalar": { + "name": "gasPrice", + "type": "BigInt", + "kind": 4 + } + }, + { + "type": "String", + "name": "data", + "required": true, + "kind": 34, + "scalar": { + "name": "data", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "BigInt", + "name": "value", + "required": true, + "kind": 34, + "scalar": { + "name": "value", + "type": "BigInt", + "required": true, + "kind": 4 + } + }, + { + "type": "BigInt", + "name": "chainId", + "required": true, + "kind": 34, + "scalar": { + "name": "chainId", + "type": "BigInt", + "required": true, + "kind": 4 + } + }, + { + "type": "BigInt", + "name": "blockNumber", + "kind": 34, + "scalar": { + "name": "blockNumber", + "type": "BigInt", + "kind": 4 + } + }, + { + "type": "String", + "name": "blockHash", + "kind": 34, + "scalar": { + "name": "blockHash", + "type": "String", + "kind": 4 + } + }, + { + "type": "UInt32", + "name": "timestamp", + "kind": 34, + "scalar": { + "name": "timestamp", + "type": "UInt32", + "kind": 4 + } + }, + { + "type": "UInt32", + "name": "confirmations", + "required": true, + "kind": 34, + "scalar": { + "name": "confirmations", + "type": "UInt32", + "required": true, + "kind": 4 + } + }, + { + "type": "String", + "name": "raw", + "kind": 34, + "scalar": { + "name": "raw", + "type": "String", + "kind": 4 + } + }, + { + "type": "String", + "name": "r", + "kind": 34, + "scalar": { + "name": "r", + "type": "String", + "kind": 4 + } + }, + { + "type": "String", + "name": "s", + "kind": 34, + "scalar": { + "name": "s", + "type": "String", + "kind": 4 + } + }, + { + "type": "UInt32", + "name": "v", + "kind": 34, + "scalar": { + "name": "v", + "type": "UInt32", + "kind": 4 + } + }, + { + "type": "UInt32", + "name": "type", + "kind": 34, + "scalar": { + "name": "type", + "type": "UInt32", + "kind": 4 + } + }, + { + "type": "[Ethereum_Access]", + "name": "accessList", + "kind": 34, + "array": { + "name": "accessList", + "type": "[Ethereum_Access]", + "object": { + "name": "accessList", + "required": true, + "type": "Ethereum_Access", + "kind": 8192 + }, + "kind": 18, + "item": { + "name": "accessList", + "required": true, + "type": "Ethereum_Access", + "kind": 8192 + } + } + } + ] + }, + { + "type": "Ethereum_Access", + "uri": "wrap://ens/ethereum.polywrap.eth", + "namespace": "Ethereum", + "nativeType": "Access", + "kind": 1025, + "properties": [ + { + "type": "String", + "name": "address", + "required": true, + "kind": 34, + "scalar": { + "name": "address", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "[String]", + "name": "storageKeys", + "required": true, + "kind": 34, + "array": { + "name": "storageKeys", + "type": "[String]", + "required": true, + "scalar": { + "name": "storageKeys", + "type": "String", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "storageKeys", + "type": "String", + "required": true, + "kind": 4 + } + } + } + ] + } + ], + "importedModuleTypes": [ + { + "uri": "wrap://ens/ethereum.polywrap.eth", + "namespace": "Ethereum", + "nativeType": "Module", + "isInterface": false, + "type": "Ethereum_Module", + "kind": 256, + "methods": [ + { + "name": "callContractView", + "return": { + "type": "String", + "name": "callContractView", + "required": true, + "kind": 34, + "scalar": { + "name": "callContractView", + "type": "String", + "required": true, + "kind": 4 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "String", + "name": "address", + "required": true, + "kind": 34, + "scalar": { + "name": "address", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "String", + "name": "method", + "required": true, + "kind": 34, + "scalar": { + "name": "method", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "[String]", + "name": "args", + "kind": 34, + "array": { + "name": "args", + "type": "[String]", + "scalar": { + "name": "args", + "type": "String", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "args", + "type": "String", + "required": true, + "kind": 4 + } + } + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "name": "connection", + "type": "Ethereum_Connection", + "kind": 8192 + } + } + ] + }, + { + "name": "callContractStatic", + "return": { + "type": "Ethereum_StaticTxResult", + "name": "callContractStatic", + "required": true, + "kind": 34, + "object": { + "name": "callContractStatic", + "required": true, + "type": "Ethereum_StaticTxResult", + "kind": 8192 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "String", + "name": "address", + "required": true, + "kind": 34, + "scalar": { + "name": "address", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "String", + "name": "method", + "required": true, + "kind": 34, + "scalar": { + "name": "method", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "[String]", + "name": "args", + "kind": 34, + "array": { + "name": "args", + "type": "[String]", + "scalar": { + "name": "args", + "type": "String", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "args", + "type": "String", + "required": true, + "kind": 4 + } + } + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "name": "connection", + "type": "Ethereum_Connection", + "kind": 8192 + } + }, + { + "type": "Ethereum_TxOverrides", + "name": "txOverrides", + "kind": 34, + "object": { + "name": "txOverrides", + "type": "Ethereum_TxOverrides", + "kind": 8192 + } + } + ] + }, + { + "name": "getBalance", + "return": { + "type": "BigInt", + "name": "getBalance", + "required": true, + "kind": 34, + "scalar": { + "name": "getBalance", + "type": "BigInt", + "required": true, + "kind": 4 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "String", + "name": "address", + "required": true, + "kind": 34, + "scalar": { + "name": "address", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "BigInt", + "name": "blockTag", + "kind": 34, + "scalar": { + "name": "blockTag", + "type": "BigInt", + "kind": 4 + } + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "name": "connection", + "type": "Ethereum_Connection", + "kind": 8192 + } + } + ] + }, + { + "name": "encodeParams", + "return": { + "type": "String", + "name": "encodeParams", + "required": true, + "kind": 34, + "scalar": { + "name": "encodeParams", + "type": "String", + "required": true, + "kind": 4 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "[String]", + "name": "types", + "required": true, + "kind": 34, + "array": { + "name": "types", + "type": "[String]", + "required": true, + "scalar": { + "name": "types", + "type": "String", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "types", + "type": "String", + "required": true, + "kind": 4 + } + } + }, + { + "type": "[String]", + "name": "values", + "required": true, + "kind": 34, + "array": { + "name": "values", + "type": "[String]", + "required": true, + "scalar": { + "name": "values", + "type": "String", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "values", + "type": "String", + "required": true, + "kind": 4 + } + } + } + ] + }, + { + "name": "encodeFunction", + "return": { + "type": "String", + "name": "encodeFunction", + "required": true, + "kind": 34, + "scalar": { + "name": "encodeFunction", + "type": "String", + "required": true, + "kind": 4 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "String", + "name": "method", + "required": true, + "kind": 34, + "scalar": { + "name": "method", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "[String]", + "name": "args", + "kind": 34, + "array": { + "name": "args", + "type": "[String]", + "scalar": { + "name": "args", + "type": "String", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "args", + "type": "String", + "required": true, + "kind": 4 + } + } + } + ] + }, + { + "name": "solidityPack", + "return": { + "type": "String", + "name": "solidityPack", + "required": true, + "kind": 34, + "scalar": { + "name": "solidityPack", + "type": "String", + "required": true, + "kind": 4 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "[String]", + "name": "types", + "required": true, + "kind": 34, + "array": { + "name": "types", + "type": "[String]", + "required": true, + "scalar": { + "name": "types", + "type": "String", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "types", + "type": "String", + "required": true, + "kind": 4 + } + } + }, + { + "type": "[String]", + "name": "values", + "required": true, + "kind": 34, + "array": { + "name": "values", + "type": "[String]", + "required": true, + "scalar": { + "name": "values", + "type": "String", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "values", + "type": "String", + "required": true, + "kind": 4 + } + } + } + ] + }, + { + "name": "solidityKeccak256", + "return": { + "type": "String", + "name": "solidityKeccak256", + "required": true, + "kind": 34, + "scalar": { + "name": "solidityKeccak256", + "type": "String", + "required": true, + "kind": 4 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "[String]", + "name": "types", + "required": true, + "kind": 34, + "array": { + "name": "types", + "type": "[String]", + "required": true, + "scalar": { + "name": "types", + "type": "String", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "types", + "type": "String", + "required": true, + "kind": 4 + } + } + }, + { + "type": "[String]", + "name": "values", + "required": true, + "kind": 34, + "array": { + "name": "values", + "type": "[String]", + "required": true, + "scalar": { + "name": "values", + "type": "String", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "values", + "type": "String", + "required": true, + "kind": 4 + } + } + } + ] + }, + { + "name": "soliditySha256", + "return": { + "type": "String", + "name": "soliditySha256", + "required": true, + "kind": 34, + "scalar": { + "name": "soliditySha256", + "type": "String", + "required": true, + "kind": 4 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "[String]", + "name": "types", + "required": true, + "kind": 34, + "array": { + "name": "types", + "type": "[String]", + "required": true, + "scalar": { + "name": "types", + "type": "String", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "types", + "type": "String", + "required": true, + "kind": 4 + } + } + }, + { + "type": "[String]", + "name": "values", + "required": true, + "kind": 34, + "array": { + "name": "values", + "type": "[String]", + "required": true, + "scalar": { + "name": "values", + "type": "String", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "values", + "type": "String", + "required": true, + "kind": 4 + } + } + } + ] + }, + { + "name": "getSignerAddress", + "return": { + "type": "String", + "name": "getSignerAddress", + "required": true, + "kind": 34, + "scalar": { + "name": "getSignerAddress", + "type": "String", + "required": true, + "kind": 4 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "name": "connection", + "type": "Ethereum_Connection", + "kind": 8192 + } + } + ] + }, + { + "name": "getSignerBalance", + "return": { + "type": "BigInt", + "name": "getSignerBalance", + "required": true, + "kind": 34, + "scalar": { + "name": "getSignerBalance", + "type": "BigInt", + "required": true, + "kind": 4 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "BigInt", + "name": "blockTag", + "kind": 34, + "scalar": { + "name": "blockTag", + "type": "BigInt", + "kind": 4 + } + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "name": "connection", + "type": "Ethereum_Connection", + "kind": 8192 + } + } + ] + }, + { + "name": "getSignerTransactionCount", + "return": { + "type": "BigInt", + "name": "getSignerTransactionCount", + "required": true, + "kind": 34, + "scalar": { + "name": "getSignerTransactionCount", + "type": "BigInt", + "required": true, + "kind": 4 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "BigInt", + "name": "blockTag", + "kind": 34, + "scalar": { + "name": "blockTag", + "type": "BigInt", + "kind": 4 + } + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "name": "connection", + "type": "Ethereum_Connection", + "kind": 8192 + } + } + ] + }, + { + "name": "getGasPrice", + "return": { + "type": "BigInt", + "name": "getGasPrice", + "required": true, + "kind": 34, + "scalar": { + "name": "getGasPrice", + "type": "BigInt", + "required": true, + "kind": 4 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "name": "connection", + "type": "Ethereum_Connection", + "kind": 8192 + } + } + ] + }, + { + "name": "estimateTransactionGas", + "return": { + "type": "BigInt", + "name": "estimateTransactionGas", + "required": true, + "kind": 34, + "scalar": { + "name": "estimateTransactionGas", + "type": "BigInt", + "required": true, + "kind": 4 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "Ethereum_TxRequest", + "name": "tx", + "required": true, + "kind": 34, + "object": { + "name": "tx", + "required": true, + "type": "Ethereum_TxRequest", + "kind": 8192 + } + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "name": "connection", + "type": "Ethereum_Connection", + "kind": 8192 + } + } + ] + }, + { + "name": "estimateContractCallGas", + "return": { + "type": "BigInt", + "name": "estimateContractCallGas", + "required": true, + "kind": 34, + "scalar": { + "name": "estimateContractCallGas", + "type": "BigInt", + "required": true, + "kind": 4 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "String", + "name": "address", + "required": true, + "kind": 34, + "scalar": { + "name": "address", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "String", + "name": "method", + "required": true, + "kind": 34, + "scalar": { + "name": "method", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "[String]", + "name": "args", + "kind": 34, + "array": { + "name": "args", + "type": "[String]", + "scalar": { + "name": "args", + "type": "String", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "args", + "type": "String", + "required": true, + "kind": 4 + } + } + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "name": "connection", + "type": "Ethereum_Connection", + "kind": 8192 + } + }, + { + "type": "Ethereum_TxOverrides", + "name": "txOverrides", + "kind": 34, + "object": { + "name": "txOverrides", + "type": "Ethereum_TxOverrides", + "kind": 8192 + } + } + ] + }, + { + "name": "checkAddress", + "return": { + "type": "Boolean", + "name": "checkAddress", + "required": true, + "kind": 34, + "scalar": { + "name": "checkAddress", + "type": "Boolean", + "required": true, + "kind": 4 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "String", + "name": "address", + "required": true, + "kind": 34, + "scalar": { + "name": "address", + "type": "String", + "required": true, + "kind": 4 + } + } + ] + }, + { + "name": "toWei", + "return": { + "type": "BigInt", + "name": "toWei", + "required": true, + "kind": 34, + "scalar": { + "name": "toWei", + "type": "BigInt", + "required": true, + "kind": 4 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "String", + "name": "eth", + "required": true, + "kind": 34, + "scalar": { + "name": "eth", + "type": "String", + "required": true, + "kind": 4 + } + } + ] + }, + { + "name": "toEth", + "return": { + "type": "String", + "name": "toEth", + "required": true, + "kind": 34, + "scalar": { + "name": "toEth", + "type": "String", + "required": true, + "kind": 4 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "BigInt", + "name": "wei", + "required": true, + "kind": 34, + "scalar": { + "name": "wei", + "type": "BigInt", + "required": true, + "kind": 4 + } + } + ] + }, + { + "name": "awaitTransaction", + "return": { + "type": "Ethereum_TxReceipt", + "name": "awaitTransaction", + "required": true, + "kind": 34, + "object": { + "name": "awaitTransaction", + "required": true, + "type": "Ethereum_TxReceipt", + "kind": 8192 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "String", + "name": "txHash", + "required": true, + "kind": 34, + "scalar": { + "name": "txHash", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "UInt32", + "name": "confirmations", + "required": true, + "kind": 34, + "scalar": { + "name": "confirmations", + "type": "UInt32", + "required": true, + "kind": 4 + } + }, + { + "type": "UInt32", + "name": "timeout", + "required": true, + "kind": 34, + "scalar": { + "name": "timeout", + "type": "UInt32", + "required": true, + "kind": 4 + } + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "name": "connection", + "type": "Ethereum_Connection", + "kind": 8192 + } + } + ] + }, + { + "name": "waitForEvent", + "return": { + "type": "Ethereum_EventNotification", + "name": "waitForEvent", + "required": true, + "kind": 34, + "object": { + "name": "waitForEvent", + "required": true, + "type": "Ethereum_EventNotification", + "kind": 8192 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "String", + "name": "address", + "required": true, + "kind": 34, + "scalar": { + "name": "address", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "String", + "name": "event", + "required": true, + "kind": 34, + "scalar": { + "name": "event", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "[String]", + "name": "args", + "kind": 34, + "array": { + "name": "args", + "type": "[String]", + "scalar": { + "name": "args", + "type": "String", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "args", + "type": "String", + "required": true, + "kind": 4 + } + } + }, + { + "type": "UInt32", + "name": "timeout", + "kind": 34, + "scalar": { + "name": "timeout", + "type": "UInt32", + "kind": 4 + } + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "name": "connection", + "type": "Ethereum_Connection", + "kind": 8192 + } + } + ] + }, + { + "name": "getNetwork", + "return": { + "type": "Ethereum_Network", + "name": "getNetwork", + "required": true, + "kind": 34, + "object": { + "name": "getNetwork", + "required": true, + "type": "Ethereum_Network", + "kind": 8192 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "name": "connection", + "type": "Ethereum_Connection", + "kind": 8192 + } + } + ] + }, + { + "name": "requestAccounts", + "return": { + "type": "[String]", + "name": "requestAccounts", + "required": true, + "kind": 34, + "array": { + "type": "[String]", + "name": "requestAccounts", + "required": true, + "scalar": { + "name": "requestAccounts", + "type": "String", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "requestAccounts", + "type": "String", + "required": true, + "kind": 4 + } + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "name": "connection", + "type": "Ethereum_Connection", + "kind": 8192 + } + } + ] + }, + { + "name": "callContractMethod", + "return": { + "type": "Ethereum_TxResponse", + "name": "callContractMethod", + "required": true, + "kind": 34, + "object": { + "name": "callContractMethod", + "required": true, + "type": "Ethereum_TxResponse", + "kind": 8192 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "String", + "name": "address", + "required": true, + "kind": 34, + "scalar": { + "name": "address", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "String", + "name": "method", + "required": true, + "kind": 34, + "scalar": { + "name": "method", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "[String]", + "name": "args", + "kind": 34, + "array": { + "name": "args", + "type": "[String]", + "scalar": { + "name": "args", + "type": "String", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "args", + "type": "String", + "required": true, + "kind": 4 + } + } + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "name": "connection", + "type": "Ethereum_Connection", + "kind": 8192 + } + }, + { + "type": "Ethereum_TxOverrides", + "name": "txOverrides", + "kind": 34, + "object": { + "name": "txOverrides", + "type": "Ethereum_TxOverrides", + "kind": 8192 + } + } + ] + }, + { + "name": "callContractMethodAndWait", + "return": { + "type": "Ethereum_TxReceipt", + "name": "callContractMethodAndWait", + "required": true, + "kind": 34, + "object": { + "name": "callContractMethodAndWait", + "required": true, + "type": "Ethereum_TxReceipt", + "kind": 8192 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "String", + "name": "address", + "required": true, + "kind": 34, + "scalar": { + "name": "address", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "String", + "name": "method", + "required": true, + "kind": 34, + "scalar": { + "name": "method", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "[String]", + "name": "args", + "kind": 34, + "array": { + "name": "args", + "type": "[String]", + "scalar": { + "name": "args", + "type": "String", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "args", + "type": "String", + "required": true, + "kind": 4 + } + } + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "name": "connection", + "type": "Ethereum_Connection", + "kind": 8192 + } + }, + { + "type": "Ethereum_TxOverrides", + "name": "txOverrides", + "kind": 34, + "object": { + "name": "txOverrides", + "type": "Ethereum_TxOverrides", + "kind": 8192 + } + } + ] + }, + { + "name": "sendTransaction", + "return": { + "type": "Ethereum_TxResponse", + "name": "sendTransaction", + "required": true, + "kind": 34, + "object": { + "name": "sendTransaction", + "required": true, + "type": "Ethereum_TxResponse", + "kind": 8192 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "Ethereum_TxRequest", + "name": "tx", + "required": true, + "kind": 34, + "object": { + "name": "tx", + "required": true, + "type": "Ethereum_TxRequest", + "kind": 8192 + } + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "name": "connection", + "type": "Ethereum_Connection", + "kind": 8192 + } + } + ] + }, + { + "name": "sendTransactionAndWait", + "return": { + "type": "Ethereum_TxReceipt", + "name": "sendTransactionAndWait", + "required": true, + "kind": 34, + "object": { + "name": "sendTransactionAndWait", + "required": true, + "type": "Ethereum_TxReceipt", + "kind": 8192 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "Ethereum_TxRequest", + "name": "tx", + "required": true, + "kind": 34, + "object": { + "name": "tx", + "required": true, + "type": "Ethereum_TxRequest", + "kind": 8192 + } + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "name": "connection", + "type": "Ethereum_Connection", + "kind": 8192 + } + } + ] + }, + { + "name": "deployContract", + "return": { + "type": "String", + "name": "deployContract", + "required": true, + "kind": 34, + "scalar": { + "name": "deployContract", + "type": "String", + "required": true, + "kind": 4 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "String", + "name": "abi", + "required": true, + "kind": 34, + "scalar": { + "name": "abi", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "String", + "name": "bytecode", + "required": true, + "kind": 34, + "scalar": { + "name": "bytecode", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "[String]", + "name": "args", + "kind": 34, + "array": { + "name": "args", + "type": "[String]", + "scalar": { + "name": "args", + "type": "String", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "args", + "type": "String", + "required": true, + "kind": 4 + } + } + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "name": "connection", + "type": "Ethereum_Connection", + "kind": 8192 + } + } + ] + }, + { + "name": "signMessage", + "return": { + "type": "String", + "name": "signMessage", + "required": true, + "kind": 34, + "scalar": { + "name": "signMessage", + "type": "String", + "required": true, + "kind": 4 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "String", + "name": "message", + "required": true, + "kind": 34, + "scalar": { + "name": "message", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "name": "connection", + "type": "Ethereum_Connection", + "kind": 8192 + } + } + ] + }, + { + "name": "sendRPC", + "return": { + "type": "String", + "name": "sendRPC", + "kind": 34, + "scalar": { + "name": "sendRPC", + "type": "String", + "kind": 4 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "String", + "name": "method", + "required": true, + "kind": 34, + "scalar": { + "name": "method", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "[String]", + "name": "params", + "required": true, + "kind": 34, + "array": { + "name": "params", + "type": "[String]", + "required": true, + "scalar": { + "name": "params", + "type": "String", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "params", + "type": "String", + "required": true, + "kind": 4 + } + } + }, + { + "type": "Ethereum_Connection", + "name": "connection", + "kind": 34, + "object": { + "name": "connection", + "type": "Ethereum_Connection", + "kind": 8192 + } + } + ] + } + ] + } + ] +} \ No newline at end of file diff --git a/packages/schema/bind/src/sanity.json b/packages/schema/bind/src/sanity.json new file mode 100644 index 0000000000..aca9817d66 --- /dev/null +++ b/packages/schema/bind/src/sanity.json @@ -0,0 +1,2077 @@ +{ + "objectTypes": [ + { + "type": "CustomType", + "kind": 1, + "properties": [ + { + "type": "String", + "name": "str", + "required": true, + "kind": 34, + "scalar": { + "name": "str", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "String", + "name": "optStr", + "kind": 34, + "scalar": { + "name": "optStr", + "type": "String", + "kind": 4 + } + }, + { + "type": "UInt", + "name": "u", + "required": true, + "kind": 34, + "scalar": { + "name": "u", + "type": "UInt", + "required": true, + "kind": 4 + } + }, + { + "type": "UInt", + "name": "optU", + "kind": 34, + "scalar": { + "name": "optU", + "type": "UInt", + "kind": 4 + } + }, + { + "type": "UInt8", + "name": "u8", + "required": true, + "kind": 34, + "scalar": { + "name": "u8", + "type": "UInt8", + "required": true, + "kind": 4 + } + }, + { + "type": "UInt16", + "name": "u16", + "required": true, + "kind": 34, + "scalar": { + "name": "u16", + "type": "UInt16", + "required": true, + "kind": 4 + } + }, + { + "type": "UInt32", + "name": "u32", + "required": true, + "kind": 34, + "scalar": { + "name": "u32", + "type": "UInt32", + "required": true, + "kind": 4 + } + }, + { + "type": "Int", + "name": "i", + "required": true, + "kind": 34, + "scalar": { + "name": "i", + "type": "Int", + "required": true, + "kind": 4 + } + }, + { + "type": "Int8", + "name": "i8", + "required": true, + "kind": 34, + "scalar": { + "name": "i8", + "type": "Int8", + "required": true, + "kind": 4 + } + }, + { + "type": "Int16", + "name": "i16", + "required": true, + "kind": 34, + "scalar": { + "name": "i16", + "type": "Int16", + "required": true, + "kind": 4 + } + }, + { + "type": "Int32", + "name": "i32", + "required": true, + "kind": 34, + "scalar": { + "name": "i32", + "type": "Int32", + "required": true, + "kind": 4 + } + }, + { + "type": "BigInt", + "name": "bigint", + "required": true, + "kind": 34, + "scalar": { + "name": "bigint", + "type": "BigInt", + "required": true, + "kind": 4 + } + }, + { + "type": "BigInt", + "name": "optBigint", + "kind": 34, + "scalar": { + "name": "optBigint", + "type": "BigInt", + "kind": 4 + } + }, + { + "type": "BigNumber", + "name": "bignumber", + "required": true, + "kind": 34, + "scalar": { + "name": "bignumber", + "type": "BigNumber", + "required": true, + "kind": 4 + } + }, + { + "type": "BigNumber", + "name": "optBignumber", + "kind": 34, + "scalar": { + "name": "optBignumber", + "type": "BigNumber", + "kind": 4 + } + }, + { + "type": "JSON", + "name": "json", + "required": true, + "kind": 34, + "scalar": { + "name": "json", + "type": "JSON", + "required": true, + "kind": 4 + } + }, + { + "type": "JSON", + "name": "optJson", + "kind": 34, + "scalar": { + "name": "optJson", + "type": "JSON", + "kind": 4 + } + }, + { + "type": "Bytes", + "name": "bytes", + "required": true, + "kind": 34, + "scalar": { + "name": "bytes", + "type": "Bytes", + "required": true, + "kind": 4 + } + }, + { + "type": "Bytes", + "name": "optBytes", + "kind": 34, + "scalar": { + "name": "optBytes", + "type": "Bytes", + "kind": 4 + } + }, + { + "type": "Boolean", + "name": "boolean", + "required": true, + "kind": 34, + "scalar": { + "name": "boolean", + "type": "Boolean", + "required": true, + "kind": 4 + } + }, + { + "type": "Boolean", + "name": "optBoolean", + "kind": 34, + "scalar": { + "name": "optBoolean", + "type": "Boolean", + "kind": 4 + } + }, + { + "type": "[UInt]", + "name": "uArray", + "required": true, + "kind": 34, + "array": { + "name": "uArray", + "type": "[UInt]", + "required": true, + "scalar": { + "name": "uArray", + "type": "UInt", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "uArray", + "type": "UInt", + "required": true, + "kind": 4 + } + } + }, + { + "type": "[UInt]", + "name": "uOptArray", + "kind": 34, + "array": { + "name": "uOptArray", + "type": "[UInt]", + "scalar": { + "name": "uOptArray", + "type": "UInt", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "uOptArray", + "type": "UInt", + "required": true, + "kind": 4 + } + } + }, + { + "type": "[UInt]", + "name": "optUOptArray", + "kind": 34, + "array": { + "name": "optUOptArray", + "type": "[UInt]", + "scalar": { + "name": "optUOptArray", + "type": "UInt", + "kind": 4 + }, + "kind": 18, + "item": { + "name": "optUOptArray", + "type": "UInt", + "kind": 4 + } + } + }, + { + "type": "[String]", + "name": "optStrOptArray", + "kind": 34, + "array": { + "name": "optStrOptArray", + "type": "[String]", + "scalar": { + "name": "optStrOptArray", + "type": "String", + "kind": 4 + }, + "kind": 18, + "item": { + "name": "optStrOptArray", + "type": "String", + "kind": 4 + } + } + }, + { + "type": "[[UInt]]", + "name": "uArrayArray", + "required": true, + "kind": 34, + "array": { + "name": "uArrayArray", + "type": "[[UInt]]", + "required": true, + "array": { + "name": "uArrayArray", + "type": "[UInt]", + "required": true, + "scalar": { + "name": "uArrayArray", + "type": "UInt", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "uArrayArray", + "type": "UInt", + "required": true, + "kind": 4 + } + }, + "kind": 18, + "item": { + "name": "uArrayArray", + "type": "[UInt]", + "required": true, + "scalar": { + "name": "uArrayArray", + "type": "UInt", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "uArrayArray", + "type": "UInt", + "required": true, + "kind": 4 + } + } + } + }, + { + "type": "[[UInt32]]", + "name": "uOptArrayOptArray", + "required": true, + "kind": 34, + "array": { + "name": "uOptArrayOptArray", + "type": "[[UInt32]]", + "required": true, + "array": { + "name": "uOptArrayOptArray", + "type": "[UInt32]", + "scalar": { + "name": "uOptArrayOptArray", + "type": "UInt32", + "kind": 4 + }, + "kind": 18, + "item": { + "name": "uOptArrayOptArray", + "type": "UInt32", + "kind": 4 + } + }, + "kind": 18, + "item": { + "name": "uOptArrayOptArray", + "type": "[UInt32]", + "scalar": { + "name": "uOptArrayOptArray", + "type": "UInt32", + "kind": 4 + }, + "kind": 18, + "item": { + "name": "uOptArrayOptArray", + "type": "UInt32", + "kind": 4 + } + } + } + }, + { + "type": "[[[UInt32]]]", + "name": "uArrayOptArrayArray", + "required": true, + "kind": 34, + "array": { + "name": "uArrayOptArrayArray", + "type": "[[[UInt32]]]", + "required": true, + "array": { + "name": "uArrayOptArrayArray", + "type": "[[UInt32]]", + "array": { + "name": "uArrayOptArrayArray", + "type": "[UInt32]", + "required": true, + "scalar": { + "name": "uArrayOptArrayArray", + "type": "UInt32", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "uArrayOptArrayArray", + "type": "UInt32", + "required": true, + "kind": 4 + } + }, + "kind": 18, + "item": { + "name": "uArrayOptArrayArray", + "type": "[UInt32]", + "required": true, + "scalar": { + "name": "uArrayOptArrayArray", + "type": "UInt32", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "uArrayOptArrayArray", + "type": "UInt32", + "required": true, + "kind": 4 + } + } + }, + "kind": 18, + "item": { + "name": "uArrayOptArrayArray", + "type": "[[UInt32]]", + "array": { + "name": "uArrayOptArrayArray", + "type": "[UInt32]", + "required": true, + "scalar": { + "name": "uArrayOptArrayArray", + "type": "UInt32", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "uArrayOptArrayArray", + "type": "UInt32", + "required": true, + "kind": 4 + } + }, + "kind": 18, + "item": { + "name": "uArrayOptArrayArray", + "type": "[UInt32]", + "required": true, + "scalar": { + "name": "uArrayOptArrayArray", + "type": "UInt32", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "uArrayOptArrayArray", + "type": "UInt32", + "required": true, + "kind": 4 + } + } + } + } + }, + { + "type": "[[[[UInt32]]]]", + "name": "crazyArray", + "kind": 34, + "array": { + "name": "crazyArray", + "type": "[[[[UInt32]]]]", + "array": { + "name": "crazyArray", + "type": "[[[UInt32]]]", + "array": { + "name": "crazyArray", + "type": "[[UInt32]]", + "required": true, + "array": { + "name": "crazyArray", + "type": "[UInt32]", + "scalar": { + "name": "crazyArray", + "type": "UInt32", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "crazyArray", + "type": "UInt32", + "required": true, + "kind": 4 + } + }, + "kind": 18, + "item": { + "name": "crazyArray", + "type": "[UInt32]", + "scalar": { + "name": "crazyArray", + "type": "UInt32", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "crazyArray", + "type": "UInt32", + "required": true, + "kind": 4 + } + } + }, + "kind": 18, + "item": { + "name": "crazyArray", + "type": "[[UInt32]]", + "required": true, + "array": { + "name": "crazyArray", + "type": "[UInt32]", + "scalar": { + "name": "crazyArray", + "type": "UInt32", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "crazyArray", + "type": "UInt32", + "required": true, + "kind": 4 + } + }, + "kind": 18, + "item": { + "name": "crazyArray", + "type": "[UInt32]", + "scalar": { + "name": "crazyArray", + "type": "UInt32", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "crazyArray", + "type": "UInt32", + "required": true, + "kind": 4 + } + } + } + }, + "kind": 18, + "item": { + "name": "crazyArray", + "type": "[[[UInt32]]]", + "array": { + "name": "crazyArray", + "type": "[[UInt32]]", + "required": true, + "array": { + "name": "crazyArray", + "type": "[UInt32]", + "scalar": { + "name": "crazyArray", + "type": "UInt32", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "crazyArray", + "type": "UInt32", + "required": true, + "kind": 4 + } + }, + "kind": 18, + "item": { + "name": "crazyArray", + "type": "[UInt32]", + "scalar": { + "name": "crazyArray", + "type": "UInt32", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "crazyArray", + "type": "UInt32", + "required": true, + "kind": 4 + } + } + }, + "kind": 18, + "item": { + "name": "crazyArray", + "type": "[[UInt32]]", + "required": true, + "array": { + "name": "crazyArray", + "type": "[UInt32]", + "scalar": { + "name": "crazyArray", + "type": "UInt32", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "crazyArray", + "type": "UInt32", + "required": true, + "kind": 4 + } + }, + "kind": 18, + "item": { + "name": "crazyArray", + "type": "[UInt32]", + "scalar": { + "name": "crazyArray", + "type": "UInt32", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "crazyArray", + "type": "UInt32", + "required": true, + "kind": 4 + } + } + } + } + } + }, + { + "type": "AnotherType", + "name": "object", + "required": true, + "kind": 34, + "object": { + "name": "object", + "required": true, + "type": "AnotherType", + "kind": 8192 + } + }, + { + "type": "AnotherType", + "name": "optObject", + "kind": 34, + "object": { + "name": "optObject", + "type": "AnotherType", + "kind": 8192 + } + }, + { + "type": "[AnotherType]", + "name": "objectArray", + "required": true, + "kind": 34, + "array": { + "name": "objectArray", + "type": "[AnotherType]", + "required": true, + "object": { + "name": "objectArray", + "required": true, + "type": "AnotherType", + "kind": 8192 + }, + "kind": 18, + "item": { + "name": "objectArray", + "required": true, + "type": "AnotherType", + "kind": 8192 + } + } + }, + { + "type": "[AnotherType]", + "name": "optObjectArray", + "kind": 34, + "array": { + "name": "optObjectArray", + "type": "[AnotherType]", + "object": { + "name": "optObjectArray", + "type": "AnotherType", + "kind": 8192 + }, + "kind": 18, + "item": { + "name": "optObjectArray", + "type": "AnotherType", + "kind": 8192 + } + } + }, + { + "type": "CustomEnum", + "name": "en", + "required": true, + "kind": 34, + "enum": { + "name": "en", + "required": true, + "type": "CustomEnum", + "kind": 16384 + } + }, + { + "type": "CustomEnum", + "name": "optEnum", + "kind": 34, + "enum": { + "name": "optEnum", + "type": "CustomEnum", + "kind": 16384 + } + }, + { + "type": "[CustomEnum]", + "name": "enumArray", + "required": true, + "kind": 34, + "array": { + "name": "enumArray", + "type": "[CustomEnum]", + "required": true, + "enum": { + "name": "enumArray", + "required": true, + "type": "CustomEnum", + "kind": 16384 + }, + "kind": 18, + "item": { + "name": "enumArray", + "required": true, + "type": "CustomEnum", + "kind": 16384 + } + } + }, + { + "type": "[CustomEnum]", + "name": "optEnumArray", + "kind": 34, + "array": { + "name": "optEnumArray", + "type": "[CustomEnum]", + "enum": { + "name": "optEnumArray", + "type": "CustomEnum", + "kind": 16384 + }, + "kind": 18, + "item": { + "name": "optEnumArray", + "type": "CustomEnum", + "kind": 16384 + } + } + }, + { + "type": "Map", + "name": "map", + "map": { + "type": "Map", + "scalar": { + "name": "map", + "type": "Int", + "required": true, + "kind": 4 + }, + "kind": 262146, + "name": "map", + "key": { + "name": "map", + "type": "String", + "required": true, + "kind": 4 + }, + "value": { + "name": "map", + "type": "Int", + "required": true, + "kind": 4 + }, + "required": true + }, + "required": true, + "kind": 34 + }, + { + "type": "Map", + "name": "mapOfArr", + "map": { + "type": "Map", + "array": { + "name": "mapOfArr", + "type": "[Int]", + "item": { + "name": "mapOfArr", + "type": "Int", + "required": true, + "kind": 4 + }, + "required": true, + "scalar": { + "name": "mapOfArr", + "type": "Int", + "required": true, + "kind": 4 + }, + "kind": 18 + }, + "kind": 262146, + "name": "mapOfArr", + "key": { + "name": "mapOfArr", + "type": "String", + "required": true, + "kind": 4 + }, + "value": { + "name": "mapOfArr", + "type": "[Int]", + "item": { + "name": "mapOfArr", + "type": "Int", + "required": true, + "kind": 4 + }, + "required": true, + "scalar": { + "name": "mapOfArr", + "type": "Int", + "required": true, + "kind": 4 + }, + "kind": 18 + }, + "required": true + }, + "required": true, + "kind": 34 + }, + { + "type": "Map", + "name": "mapOfObj", + "map": { + "type": "Map", + "object": { + "name": "mapOfObj", + "required": true, + "type": "AnotherType", + "kind": 8192 + }, + "kind": 262146, + "name": "mapOfObj", + "key": { + "name": "mapOfObj", + "type": "String", + "required": true, + "kind": 4 + }, + "value": { + "name": "mapOfObj", + "required": true, + "type": "AnotherType", + "kind": 8192 + }, + "required": true + }, + "required": true, + "kind": 34 + }, + { + "type": "Map", + "name": "mapOfArrOfObj", + "map": { + "type": "Map", + "array": { + "name": "mapOfArrOfObj", + "type": "[AnotherType]", + "item": { + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType", + "kind": 8192 + }, + "required": true, + "object": { + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType", + "kind": 8192 + }, + "kind": 18 + }, + "kind": 262146, + "name": "mapOfArrOfObj", + "key": { + "name": "mapOfArrOfObj", + "type": "String", + "required": true, + "kind": 4 + }, + "value": { + "name": "mapOfArrOfObj", + "type": "[AnotherType]", + "item": { + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType", + "kind": 8192 + }, + "required": true, + "object": { + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType", + "kind": 8192 + }, + "kind": 18 + }, + "required": true + }, + "required": true, + "kind": 34 + } + ] + }, + { + "type": "AnotherType", + "kind": 1, + "properties": [ + { + "type": "String", + "name": "prop", + "kind": 34, + "scalar": { + "name": "prop", + "type": "String", + "kind": 4 + } + }, + { + "type": "CustomType", + "name": "circular", + "kind": 34, + "object": { + "name": "circular", + "type": "CustomType", + "kind": 8192 + } + }, + { + "type": "String", + "name": "const", + "kind": 34, + "scalar": { + "name": "const", + "type": "String", + "kind": 4 + } + } + ] + } + ], + "moduleType": { + "imports": [ + { + "type": "TestImport_Module" + }, + { + "type": "TestImport_Object" + }, + { + "type": "TestImport_AnotherObject" + }, + { + "type": "TestImport_Enum" + } + ], + "type": "Module", + "kind": 128, + "methods": [ + { + "name": "moduleMethod", + "return": { + "type": "Int", + "name": "moduleMethod", + "required": true, + "kind": 34, + "scalar": { + "name": "moduleMethod", + "type": "Int", + "required": true, + "kind": 4 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "String", + "name": "str", + "required": true, + "kind": 34, + "scalar": { + "name": "str", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "String", + "name": "optStr", + "kind": 34, + "scalar": { + "name": "optStr", + "type": "String", + "kind": 4 + } + }, + { + "type": "CustomEnum", + "name": "en", + "required": true, + "kind": 34, + "enum": { + "name": "en", + "required": true, + "type": "CustomEnum", + "kind": 16384 + } + }, + { + "type": "CustomEnum", + "name": "optEnum", + "kind": 34, + "enum": { + "name": "optEnum", + "type": "CustomEnum", + "kind": 16384 + } + }, + { + "type": "[CustomEnum]", + "name": "enumArray", + "required": true, + "kind": 34, + "array": { + "name": "enumArray", + "type": "[CustomEnum]", + "required": true, + "enum": { + "name": "enumArray", + "required": true, + "type": "CustomEnum", + "kind": 16384 + }, + "kind": 18, + "item": { + "name": "enumArray", + "required": true, + "type": "CustomEnum", + "kind": 16384 + } + } + }, + { + "type": "[CustomEnum]", + "name": "optEnumArray", + "kind": 34, + "array": { + "name": "optEnumArray", + "type": "[CustomEnum]", + "enum": { + "name": "optEnumArray", + "type": "CustomEnum", + "kind": 16384 + }, + "kind": 18, + "item": { + "name": "optEnumArray", + "type": "CustomEnum", + "kind": 16384 + } + } + }, + { + "type": "Map", + "name": "map", + "map": { + "type": "Map", + "scalar": { + "name": "map", + "type": "Int", + "required": true, + "kind": 4 + }, + "kind": 262146, + "name": "map", + "key": { + "name": "map", + "type": "String", + "required": true, + "kind": 4 + }, + "value": { + "name": "map", + "type": "Int", + "required": true, + "kind": 4 + }, + "required": true + }, + "required": true, + "kind": 34 + }, + { + "type": "Map", + "name": "mapOfArr", + "map": { + "type": "Map", + "array": { + "name": "mapOfArr", + "type": "[Int]", + "item": { + "name": "mapOfArr", + "type": "Int", + "required": true, + "kind": 4 + }, + "required": true, + "scalar": { + "name": "mapOfArr", + "type": "Int", + "required": true, + "kind": 4 + }, + "kind": 18 + }, + "kind": 262146, + "name": "mapOfArr", + "key": { + "name": "mapOfArr", + "type": "String", + "required": true, + "kind": 4 + }, + "value": { + "name": "mapOfArr", + "type": "[Int]", + "item": { + "name": "mapOfArr", + "type": "Int", + "required": true, + "kind": 4 + }, + "required": true, + "scalar": { + "name": "mapOfArr", + "type": "Int", + "required": true, + "kind": 4 + }, + "kind": 18 + }, + "required": true + }, + "required": true, + "kind": 34 + }, + { + "type": "Map", + "name": "mapOfObj", + "map": { + "type": "Map", + "object": { + "name": "mapOfObj", + "required": true, + "type": "AnotherType", + "kind": 8192 + }, + "kind": 262146, + "name": "mapOfObj", + "key": { + "name": "mapOfObj", + "type": "String", + "required": true, + "kind": 4 + }, + "value": { + "name": "mapOfObj", + "required": true, + "type": "AnotherType", + "kind": 8192 + }, + "required": true + }, + "required": true, + "kind": 34 + }, + { + "type": "Map", + "name": "mapOfArrOfObj", + "map": { + "type": "Map", + "array": { + "name": "mapOfArrOfObj", + "type": "[AnotherType]", + "item": { + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType", + "kind": 8192 + }, + "required": true, + "object": { + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType", + "kind": 8192 + }, + "kind": 18 + }, + "kind": 262146, + "name": "mapOfArrOfObj", + "key": { + "name": "mapOfArrOfObj", + "type": "String", + "required": true, + "kind": 4 + }, + "value": { + "name": "mapOfArrOfObj", + "type": "[AnotherType]", + "item": { + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType", + "kind": 8192 + }, + "required": true, + "object": { + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType", + "kind": 8192 + }, + "kind": 18 + }, + "required": true + }, + "required": true, + "kind": 34 + } + ] + }, + { + "name": "objectMethod", + "return": { + "type": "AnotherType", + "name": "objectMethod", + "kind": 34, + "object": { + "name": "objectMethod", + "type": "AnotherType", + "kind": 8192 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "env": { + "required": true + }, + "arguments": [ + { + "type": "AnotherType", + "name": "object", + "required": true, + "kind": 34, + "object": { + "name": "object", + "required": true, + "type": "AnotherType", + "kind": 8192 + } + }, + { + "type": "AnotherType", + "name": "optObject", + "kind": 34, + "object": { + "name": "optObject", + "type": "AnotherType", + "kind": 8192 + } + }, + { + "type": "[AnotherType]", + "name": "objectArray", + "required": true, + "kind": 34, + "array": { + "name": "objectArray", + "type": "[AnotherType]", + "required": true, + "object": { + "name": "objectArray", + "required": true, + "type": "AnotherType", + "kind": 8192 + }, + "kind": 18, + "item": { + "name": "objectArray", + "required": true, + "type": "AnotherType", + "kind": 8192 + } + } + }, + { + "type": "[AnotherType]", + "name": "optObjectArray", + "kind": 34, + "array": { + "name": "optObjectArray", + "type": "[AnotherType]", + "object": { + "name": "optObjectArray", + "type": "AnotherType", + "kind": 8192 + }, + "kind": 18, + "item": { + "name": "optObjectArray", + "type": "AnotherType", + "kind": 8192 + } + } + } + ] + }, + { + "name": "optionalEnvMethod", + "return": { + "type": "AnotherType", + "name": "optionalEnvMethod", + "kind": 34, + "object": { + "name": "optionalEnvMethod", + "type": "AnotherType", + "kind": 8192 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "env": { + "required": false + }, + "arguments": [ + { + "type": "AnotherType", + "name": "object", + "required": true, + "kind": 34, + "object": { + "name": "object", + "required": true, + "type": "AnotherType", + "kind": 8192 + } + }, + { + "type": "AnotherType", + "name": "optObject", + "kind": 34, + "object": { + "name": "optObject", + "type": "AnotherType", + "kind": 8192 + } + }, + { + "type": "[AnotherType]", + "name": "objectArray", + "required": true, + "kind": 34, + "array": { + "name": "objectArray", + "type": "[AnotherType]", + "required": true, + "object": { + "name": "objectArray", + "required": true, + "type": "AnotherType", + "kind": 8192 + }, + "kind": 18, + "item": { + "name": "objectArray", + "required": true, + "type": "AnotherType", + "kind": 8192 + } + } + }, + { + "type": "[AnotherType]", + "name": "optObjectArray", + "kind": 34, + "array": { + "name": "optObjectArray", + "type": "[AnotherType]", + "object": { + "name": "optObjectArray", + "type": "AnotherType", + "kind": 8192 + }, + "kind": 18, + "item": { + "name": "optObjectArray", + "type": "AnotherType", + "kind": 8192 + } + } + } + ] + } + ] + }, + "enumTypes": [ + { + "type": "CustomEnum", + "constants": [ + "STRING", + "BYTES" + ], + "kind": 8 + } + ], + "interfaceTypes": [ + { + "type": "TestImport", + "uri": "testimport.uri.eth", + "namespace": "TestImport", + "capabilities": { + "getImplementations": { + "enabled": true + } + }, + "kind": 32768, + "nativeType": "Interface" + } + ], + "importedObjectTypes": [ + { + "type": "TestImport_Object", + "uri": "testimport.uri.eth", + "namespace": "TestImport", + "nativeType": "Object", + "kind": 1025, + "properties": [ + { + "type": "TestImport_AnotherObject", + "name": "object", + "required": true, + "kind": 34, + "object": { + "name": "object", + "required": true, + "type": "TestImport_AnotherObject", + "kind": 8192 + } + }, + { + "type": "TestImport_AnotherObject", + "name": "optObject", + "kind": 34, + "object": { + "name": "optObject", + "type": "TestImport_AnotherObject", + "kind": 8192 + } + }, + { + "type": "[TestImport_AnotherObject]", + "name": "objectArray", + "required": true, + "kind": 34, + "array": { + "name": "objectArray", + "type": "[TestImport_AnotherObject]", + "required": true, + "object": { + "name": "objectArray", + "required": true, + "type": "TestImport_AnotherObject", + "kind": 8192 + }, + "kind": 18, + "item": { + "name": "objectArray", + "required": true, + "type": "TestImport_AnotherObject", + "kind": 8192 + } + } + }, + { + "type": "[TestImport_AnotherObject]", + "name": "optObjectArray", + "kind": 34, + "array": { + "name": "optObjectArray", + "type": "[TestImport_AnotherObject]", + "object": { + "name": "optObjectArray", + "type": "TestImport_AnotherObject", + "kind": 8192 + }, + "kind": 18, + "item": { + "name": "optObjectArray", + "type": "TestImport_AnotherObject", + "kind": 8192 + } + } + }, + { + "type": "TestImport_Enum", + "name": "en", + "required": true, + "kind": 34, + "enum": { + "name": "en", + "required": true, + "type": "TestImport_Enum", + "kind": 16384 + } + }, + { + "type": "TestImport_Enum", + "name": "optEnum", + "kind": 34, + "enum": { + "name": "optEnum", + "type": "TestImport_Enum", + "kind": 16384 + } + }, + { + "type": "[TestImport_Enum]", + "name": "enumArray", + "required": true, + "kind": 34, + "array": { + "name": "enumArray", + "type": "[TestImport_Enum]", + "required": true, + "enum": { + "name": "enumArray", + "required": true, + "type": "TestImport_Enum", + "kind": 16384 + }, + "kind": 18, + "item": { + "name": "enumArray", + "required": true, + "type": "TestImport_Enum", + "kind": 16384 + } + } + }, + { + "type": "[TestImport_Enum]", + "name": "optEnumArray", + "kind": 34, + "array": { + "name": "optEnumArray", + "type": "[TestImport_Enum]", + "enum": { + "name": "optEnumArray", + "type": "TestImport_Enum", + "kind": 16384 + }, + "kind": 18, + "item": { + "name": "optEnumArray", + "type": "TestImport_Enum", + "kind": 16384 + } + } + } + ] + }, + { + "type": "TestImport_AnotherObject", + "uri": "testimport.uri.eth", + "namespace": "TestImport", + "nativeType": "AnotherObject", + "kind": 1025, + "properties": [ + { + "type": "String", + "name": "prop", + "required": true, + "kind": 34, + "scalar": { + "name": "prop", + "type": "String", + "required": true, + "kind": 4 + } + } + ] + } + ], + "importedModuleTypes": [ + { + "uri": "testimport.uri.eth", + "namespace": "TestImport", + "nativeType": "Module", + "isInterface": true, + "type": "TestImport_Module", + "kind": 256, + "methods": [ + { + "name": "importedMethod", + "return": { + "type": "TestImport_Object", + "name": "importedMethod", + "kind": 34, + "object": { + "name": "importedMethod", + "type": "TestImport_Object", + "kind": 8192 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "env": { + "required": true + }, + "arguments": [ + { + "type": "String", + "name": "str", + "required": true, + "kind": 34, + "scalar": { + "name": "str", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "String", + "name": "optStr", + "kind": 34, + "scalar": { + "name": "optStr", + "type": "String", + "kind": 4 + } + }, + { + "type": "UInt", + "name": "u", + "required": true, + "kind": 34, + "scalar": { + "name": "u", + "type": "UInt", + "required": true, + "kind": 4 + } + }, + { + "type": "UInt", + "name": "optU", + "kind": 34, + "scalar": { + "name": "optU", + "type": "UInt", + "kind": 4 + } + }, + { + "type": "[[UInt]]", + "name": "uArrayArray", + "required": true, + "kind": 34, + "array": { + "name": "uArrayArray", + "type": "[[UInt]]", + "required": true, + "array": { + "name": "uArrayArray", + "type": "[UInt]", + "scalar": { + "name": "uArrayArray", + "type": "UInt", + "kind": 4 + }, + "kind": 18, + "item": { + "name": "uArrayArray", + "type": "UInt", + "kind": 4 + } + }, + "kind": 18, + "item": { + "name": "uArrayArray", + "type": "[UInt]", + "scalar": { + "name": "uArrayArray", + "type": "UInt", + "kind": 4 + }, + "kind": 18, + "item": { + "name": "uArrayArray", + "type": "UInt", + "kind": 4 + } + } + } + }, + { + "type": "TestImport_Object", + "name": "object", + "required": true, + "kind": 34, + "object": { + "name": "object", + "required": true, + "type": "TestImport_Object", + "kind": 8192 + } + }, + { + "type": "TestImport_Object", + "name": "optObject", + "kind": 34, + "object": { + "name": "optObject", + "type": "TestImport_Object", + "kind": 8192 + } + }, + { + "type": "[TestImport_Object]", + "name": "objectArray", + "required": true, + "kind": 34, + "array": { + "name": "objectArray", + "type": "[TestImport_Object]", + "required": true, + "object": { + "name": "objectArray", + "required": true, + "type": "TestImport_Object", + "kind": 8192 + }, + "kind": 18, + "item": { + "name": "objectArray", + "required": true, + "type": "TestImport_Object", + "kind": 8192 + } + } + }, + { + "type": "[TestImport_Object]", + "name": "optObjectArray", + "kind": 34, + "array": { + "name": "optObjectArray", + "type": "[TestImport_Object]", + "object": { + "name": "optObjectArray", + "type": "TestImport_Object", + "kind": 8192 + }, + "kind": 18, + "item": { + "name": "optObjectArray", + "type": "TestImport_Object", + "kind": 8192 + } + } + }, + { + "type": "TestImport_Enum", + "name": "en", + "required": true, + "kind": 34, + "enum": { + "name": "en", + "required": true, + "type": "TestImport_Enum", + "kind": 16384 + } + }, + { + "type": "TestImport_Enum", + "name": "optEnum", + "kind": 34, + "enum": { + "name": "optEnum", + "type": "TestImport_Enum", + "kind": 16384 + } + }, + { + "type": "[TestImport_Enum]", + "name": "enumArray", + "required": true, + "kind": 34, + "array": { + "name": "enumArray", + "type": "[TestImport_Enum]", + "required": true, + "enum": { + "name": "enumArray", + "required": true, + "type": "TestImport_Enum", + "kind": 16384 + }, + "kind": 18, + "item": { + "name": "enumArray", + "required": true, + "type": "TestImport_Enum", + "kind": 16384 + } + } + }, + { + "type": "[TestImport_Enum]", + "name": "optEnumArray", + "kind": 34, + "array": { + "name": "optEnumArray", + "type": "[TestImport_Enum]", + "enum": { + "name": "optEnumArray", + "type": "TestImport_Enum", + "kind": 16384 + }, + "kind": 18, + "item": { + "name": "optEnumArray", + "type": "TestImport_Enum", + "kind": 16384 + } + } + } + ] + }, + { + "name": "anotherMethod", + "return": { + "type": "Int32", + "name": "anotherMethod", + "required": true, + "kind": 34, + "scalar": { + "name": "anotherMethod", + "type": "Int32", + "required": true, + "kind": 4 + } + }, + "type": "Method", + "kind": 64, + "required": true, + "arguments": [ + { + "type": "[String]", + "name": "arg", + "required": true, + "kind": 34, + "array": { + "name": "arg", + "type": "[String]", + "required": true, + "scalar": { + "name": "arg", + "type": "String", + "required": true, + "kind": 4 + }, + "kind": 18, + "item": { + "name": "arg", + "type": "String", + "required": true, + "kind": 4 + } + } + } + ] + } + ] + } + ], + "importedEnumTypes": [ + { + "type": "TestImport_Enum", + "constants": [ + "STRING", + "BYTES" + ], + "uri": "testimport.uri.eth", + "namespace": "TestImport", + "nativeType": "Enum", + "kind": 520 + } + ], + "importedEnvTypes": [ + { + "uri": "testimport.uri.eth", + "namespace": "TestImport", + "nativeType": "Env", + "type": "TestImport_Env", + "kind": 524288, + "properties": [ + { + "type": "String", + "name": "enviroProp", + "required": true, + "kind": 34, + "scalar": { + "name": "enviroProp", + "type": "String", + "required": true, + "kind": 4 + } + } + ] + } + ], + "envType": { + "type": "Env", + "kind": 65536, + "properties": [ + { + "type": "String", + "name": "prop", + "required": true, + "kind": 34, + "scalar": { + "name": "prop", + "type": "String", + "required": true, + "kind": 4 + } + }, + { + "type": "String", + "name": "optProp", + "kind": 34, + "scalar": { + "name": "optProp", + "type": "String", + "kind": 4 + } + }, + { + "type": "Map", + "name": "optMap", + "map": { + "type": "Map", + "scalar": { + "name": "optMap", + "type": "Int", + "kind": 4 + }, + "kind": 262146, + "name": "optMap", + "key": { + "name": "optMap", + "type": "String", + "required": true, + "kind": 4 + }, + "value": { + "name": "optMap", + "type": "Int", + "kind": 4 + } + }, + "kind": 34 + } + ] + } +} \ No newline at end of file diff --git a/packages/schema/bind/src/types.ts b/packages/schema/bind/src/types.ts index 126ca3cda5..3ae6aa13dc 100644 --- a/packages/schema/bind/src/types.ts +++ b/packages/schema/bind/src/types.ts @@ -1,5 +1,5 @@ -import { WrapAbi } from "@polywrap/wrap-manifest-types-js"; import { OutputDirectory } from "@polywrap/os-js"; +import { WrapAbi } from "@polywrap/schema-parse"; export type BindLanguage = "wasm-as" | "wasm-rs" | "plugin-ts" | "app-ts"; @@ -12,7 +12,6 @@ export interface BindOptions { projectName: string; bindLanguage: BindLanguage; abi: WrapAbi; - schema: string; config?: Record; outputDirAbs: string; } diff --git a/packages/schema/compose/package.json b/packages/schema/compose/package.json index 0c671e3c29..c6db2425a2 100644 --- a/packages/schema/compose/package.json +++ b/packages/schema/compose/package.json @@ -30,6 +30,7 @@ "@types/mustache": "4.0.1", "@types/prettier": "2.6.0", "jest": "26.6.3", + "jest-diff": "28.1.3", "rimraf": "3.0.2", "ts-jest": "26.5.4", "ts-node": "8.10.2", diff --git a/packages/schema/compose/src/__tests__/index.ts b/packages/schema/compose/src/__tests__/index.ts index a385960a78..2ec585d1e0 100644 --- a/packages/schema/compose/src/__tests__/index.ts +++ b/packages/schema/compose/src/__tests__/index.ts @@ -1,9 +1,9 @@ -import { ComposerOutput, ComposerOptions, ComposerFilter } from ".."; +import { ComposerOptions } from ".."; import path from "path"; import { readdirSync, Dirent } from "fs"; -import { Abi } from "@polywrap/schema-parse"; +import { Abi, createAbi } from "@polywrap/schema-parse"; import { GetPathToComposeTestFiles, readFileIfExists, @@ -15,7 +15,8 @@ const root = GetPathToComposeTestFiles(); export interface TestCase { name: string; input: ComposerOptions; - output?: ComposerOutput; + abi: Abi; + schema: string | undefined; } type TestCases = { @@ -72,12 +73,19 @@ async function importCase( // Fetch the input schemas const moduleInput = readFileIfExists("input/module.graphql", directory); - // Fetch the output schemas - const moduleSchema = readFileIfExists("output/module.graphql", directory); + // Fetch the output abi const moduleAbi = await readNamedExportIfExists("abi", "output/module.ts", directory); - const resolveExternal = (uri: string): Promise => { - return Promise.resolve(readFileIfExists(`imports-ext/${uri}/schema.graphql`, directory) || ""); + // Fetch the output schema + const moduleSchema = readFileIfExists("output/module.graphql", directory); + + const resolveExternal = async (uri: string): Promise => { + let abi = createAbi() + const generatedAbi = await readNamedExportIfExists("abi", `imports-ext/${uri}/module.ts`, directory) + if (generatedAbi) { + abi = generatedAbi + } + return Promise.resolve(abi); }; const resolveLocal = (path: string): Promise => { @@ -100,21 +108,22 @@ async function importCase( external: resolveExternal, local: resolveLocal, }, - output: ComposerFilter.All }; - let output: ComposerOutput = { }; - - if (moduleSchema && moduleAbi) { - output = { - schema: moduleSchema, - abi: moduleAbi + if (moduleInput) { + input.schema = { + schema: moduleInput, + absolutePath: path.join( + directory, + "input/module.graphql" + ), }; } return { name, input, - output, + abi: moduleAbi as Abi, + schema: moduleSchema }; } diff --git a/packages/schema/compose/src/__tests__/test-cases.spec.ts b/packages/schema/compose/src/__tests__/test-cases.spec.ts index a2b3e4ce33..b6d9797022 100644 --- a/packages/schema/compose/src/__tests__/test-cases.spec.ts +++ b/packages/schema/compose/src/__tests__/test-cases.spec.ts @@ -1,7 +1,9 @@ -import { composeSchema } from "../"; +import { composeSchema, renderSchema } from "../"; import { fetchTestCases } from "./index"; -function removeFunctionProps(obj: unknown) { +import { diff } from "jest-diff"; + +function sanitizeObj(obj: unknown) { if (typeof obj !== "object") { return; } @@ -9,11 +11,14 @@ function removeFunctionProps(obj: unknown) { for (var i in obj) { if (!obj.hasOwnProperty(i)) continue; - const typeOf = typeof (obj as any)[i]; + const prop = (obj as any)[i]; + const typeOf = typeof prop; if (typeOf === "object") { - removeFunctionProps((obj as any)[i]); - } else if (typeOf == "function") { + sanitizeObj(prop); + } else if (typeOf === "function") { + delete (obj as any)[i]; + } else if (typeOf === "undefined") { delete (obj as any)[i]; } } @@ -23,7 +28,6 @@ function removeFunctionProps(obj: unknown) { describe("Polywrap Schema Composer Test Cases", () => { let cases = fetchTestCases(); - for (const test of cases) { it(`Case: ${test.name}`, async () => { const testCase = await test.promise; @@ -33,11 +37,24 @@ describe("Polywrap Schema Composer Test Cases", () => { } const result = await composeSchema(testCase.input); - removeFunctionProps(result); - if (testCase.output) { - expect(result).toMatchObject(testCase.output); + // Check result with output ABI + sanitizeObj(result); + sanitizeObj(testCase.abi); + expect(result).toMatchObject(testCase.abi); + + // Check rendered result schema with output schema + const resultSchema = renderSchema(result, true); + + if (testCase.schema) { + expect(diff(testCase.schema, resultSchema)) + .toContain("Compared values have no visual difference"); } + + // Check rendering between result ABI and output ABI + const testCaseSchema = renderSchema(testCase.abi, true); + expect(diff(testCaseSchema, resultSchema)) + .toContain("Compared values have no visual difference"); }); } }); diff --git a/packages/schema/compose/src/index.ts b/packages/schema/compose/src/index.ts index 47080ce9a3..57225dda95 100644 --- a/packages/schema/compose/src/index.ts +++ b/packages/schema/compose/src/index.ts @@ -1,4 +1,4 @@ -import { SchemaFile, SchemaResolvers } from "./types"; +import { SchemaFile, AbiResolvers } from "./types"; import { resolveImportsAndParseSchemas } from "./resolve"; import { renderSchema } from "./render"; @@ -7,45 +7,17 @@ import { WrapAbi } from "@polywrap/wrap-manifest-types-js"; export * from "./types"; export { renderSchema }; -export interface ComposerOutput { - schema?: string; - abi?: WrapAbi; -} - -export enum ComposerFilter { - Schema = 1 << 0, - Abi = 1 << 1, - All = Schema | Abi, -} - export interface ComposerOptions { schema: SchemaFile; - resolvers: SchemaResolvers; - output: ComposerFilter; + resolvers: AbiResolvers; } export async function composeSchema( options: ComposerOptions -): Promise { - const abi = await resolveImports(options.schema, options.resolvers); - - // Forming our output structure for the caller - const includeSchema = options.output & ComposerFilter.Schema; - const includeAbi = options.output & ComposerFilter.Abi; - - return { - schema: includeSchema ? renderSchema(abi, true) : undefined, - abi: includeAbi ? abi : undefined, - } as ComposerOutput; -} - -export async function resolveImports( - schema: SchemaFile, - resolvers: SchemaResolvers ): Promise { return await resolveImportsAndParseSchemas( - schema.schema, - schema.absolutePath, - resolvers + options.schema.schema, + options.schema.absolutePath, + options.resolvers ); } diff --git a/packages/schema/compose/src/render.ts b/packages/schema/compose/src/render.ts index f28c70a9c2..3f43a07e56 100644 --- a/packages/schema/compose/src/render.ts +++ b/packages/schema/compose/src/render.ts @@ -1,3 +1,4 @@ +/* eslint-disable @typescript-eslint/naming-convention, @typescript-eslint/no-explicit-any */ import { template as schemaTemplate } from "./templates/schema.mustache"; import { addHeader } from "./templates/header.mustache"; @@ -9,7 +10,8 @@ import { moduleCapabilities, addAnnotations, } from "@polywrap/schema-parse"; -import { WrapAbi } from "@polywrap/wrap-manifest-types-js"; +import { GenericDefinition, WrapAbi } from "@polywrap/wrap-manifest-types-js"; + // Remove mustache's built-in HTML escaping Mustache.escape = (value) => value; @@ -19,6 +21,14 @@ export function renderSchema(abi: WrapAbi, header: boolean): string { abi = transformAbi(abi, toGraphQLType); abi = transformAbi(abi, moduleCapabilities()); abi = transformAbi(abi, addAnnotations); + abi = transformAbi(abi, { + enter: { + GenericDefinition: (def: GenericDefinition) => { + const comment = (def as any).comment || null; + return { ...def, comment }; + }, + }, + }); let schema = Mustache.render(schemaTemplate, { abi, diff --git a/packages/schema/compose/src/resolve.ts b/packages/schema/compose/src/resolve.ts index 72dd70f733..79380fe340 100644 --- a/packages/schema/compose/src/resolve.ts +++ b/packages/schema/compose/src/resolve.ts @@ -5,14 +5,15 @@ import { ExternalImport, LocalImport, - SchemaResolver, - SchemaResolvers, + AbiResolvers, SYNTAX_REFERENCE, + AbiResolver, + SchemaResolver, } from "./types"; import { parseExternalImports, parseLocalImports, parseUse } from "./parse"; import { renderSchema } from "./render"; -import { addHeader } from "./templates/header.mustache"; import { checkDuplicateEnvProperties } from "./env"; +import { addHeader } from "./templates/header.mustache"; import { WrapAbi, @@ -129,7 +130,7 @@ export async function resolveUseStatements( export async function resolveImportsAndParseSchemas( schema: string, schemaPath: string, - resolvers: SchemaResolvers, + resolvers: AbiResolvers, noValidate = false ): Promise { const importKeywordCapture = /^#+["{3}]*import\s/gm; @@ -138,9 +139,9 @@ export async function resolveImportsAndParseSchemas( const keywords = [...schema.matchAll(importKeywordCapture)]; const externalImportStatements = [...schema.matchAll(externalImportCapture)]; - const localImportStatments = [...schema.matchAll(localImportCapture)]; + const localImportStatements = [...schema.matchAll(localImportCapture)]; const totalStatements = - externalImportStatements.length + localImportStatments.length; + externalImportStatements.length + localImportStatements.length; if (keywords.length !== totalStatements) { throw Error( @@ -163,11 +164,12 @@ export async function resolveImportsAndParseSchemas( ); const localImportsToResolve: LocalImport[] = parseLocalImports( - localImportStatments, + localImportStatements, schemaPath ); const subAbi: WrapAbi = { + version: "0.1", objectTypes: [], enumTypes: [], interfaceTypes: [], @@ -189,7 +191,6 @@ export async function resolveImportsAndParseSchemas( subAbi, resolvers ); - const capabilitiesByModule = await resolveUseStatements( schema, schemaPath, @@ -222,10 +223,8 @@ export async function resolveImportsAndParseSchemas( "$1" ); - // Parse the newly formed schema - const abi = parseSchema(newSchema, { noValidate }); - - return abi; + // Parse and return the newly formed schema + return parseSchema(newSchema, { noValidate }); } interface Namespaced { @@ -646,7 +645,7 @@ function resolveInterfaces( async function resolveExternalImports( importsToResolve: ExternalImport[], - resolveSchema: SchemaResolver, + resolveAbi: AbiResolver, abi: WrapAbi ): Promise { // Keep track of all imported object type names @@ -656,15 +655,12 @@ async function resolveExternalImports( const { uri, namespace, importedTypes } = importToResolve; // Resolve the schema - const schema = await resolveSchema(uri); + const extAbi = await resolveAbi(uri); - if (!schema) { - throw Error(`Unable to resolve schema at "${uri}"`); + if (!extAbi) { + throw Error(`Unable to resolve abi at "${uri}"`); } - // Parse the schema into Abi - const extAbi = parseSchema(schema); - const extTypesToImport = importedTypes; const starIdx = extTypesToImport.indexOf("*"); @@ -968,7 +964,7 @@ async function resolveLocalImports( importsToResolve: LocalImport[], resolveSchema: SchemaResolver, abi: WrapAbi, - resolvers: SchemaResolvers + resolvers: AbiResolvers ): Promise { for (const importToResolve of importsToResolve) { const { importedTypes, path } = importToResolve; diff --git a/packages/schema/compose/src/templates/schema.mustache.ts b/packages/schema/compose/src/templates/schema.mustache.ts index 440612736a..69803ae9ab 100644 --- a/packages/schema/compose/src/templates/schema.mustache.ts +++ b/packages/schema/compose/src/templates/schema.mustache.ts @@ -34,7 +34,7 @@ type {{type}}{{#interfaces.length}} implements{{#interfaces}} {{type}}{{^last}} {{/last}} {{/methods}} -}{{/methods.length}} +}{{/methods.length}}{{^methods.length}} { }{{/methods.length}} {{/moduleType}} {{#envType}}{{#comment}} @@ -66,7 +66,7 @@ type {{type}}{{#interfaces.length}} implements{{#interfaces}} {{type}}{{^last}} {{/comment}} {{name}}: {{toGraphQLType}} {{/properties}} -}{{/properties.length}} +}{{/properties.length}}{{^properties.length}} { }{{/properties.length}} {{/objectTypes}} {{#enumTypes}}{{#comment}} @@ -111,7 +111,7 @@ type {{type}}{{#interfaces.length}} implements{{#interfaces}} {{type}}{{^last}} {{/last}} {{/methods}} -}{{/methods.length}} +}{{/methods.length}}{{^methods.length}} { }{{/methods.length}} {{/importedModuleTypes}} ### Imported Modules END ### @@ -135,7 +135,7 @@ type {{type}}{{#interfaces.length}} implements{{#interfaces}} {{type}}{{^last}} {{/comment}} {{name}}: {{toGraphQLType}} {{/properties}} -}{{/properties.length}} +}{{/properties.length}}{{^properties.length}} { }{{/properties.length}} {{/importedObjectTypes}} diff --git a/packages/schema/compose/src/types.ts b/packages/schema/compose/src/types.ts index ef69c821c2..a24e15a5b7 100644 --- a/packages/schema/compose/src/types.ts +++ b/packages/schema/compose/src/types.ts @@ -1,14 +1,15 @@ -import { CapabilityType } from "@polywrap/schema-parse"; +import { Abi, CapabilityType } from "@polywrap/schema-parse"; export interface SchemaFile { schema: string; absolutePath: string; } -export type SchemaResolver = (uriOrPath: string) => Promise; +export type AbiResolver = (uri: string) => Promise; +export type SchemaResolver = (path: string) => Promise; -export interface SchemaResolvers { - external: SchemaResolver; +export interface AbiResolvers { + external: AbiResolver; local: SchemaResolver; } diff --git a/packages/schema/parse/src/__tests__/test-cases.spec.ts b/packages/schema/parse/src/__tests__/test-cases.spec.ts index fc06209eaa..a0b0775b55 100644 --- a/packages/schema/parse/src/__tests__/test-cases.spec.ts +++ b/packages/schema/parse/src/__tests__/test-cases.spec.ts @@ -13,7 +13,24 @@ describe("Polywrap Schema Parser Test Cases", () => { } const result = parseSchema(testCase.input); - expect(result).toMatchObject(testCase.output); + + const sort = (obj: any) => Object + .keys(obj) + .sort() + .reduce((map: any, key) => { + if (typeof obj[key] === "object") { + map[key] = sort(obj[key]); + + if (Array.isArray(obj[key])) { + map[key] = Object.values(map[key]); + } + } else { + map[key] = obj[key]; + } + return map + }, {}); + + expect(sort(result)).toMatchObject(sort(testCase.output)); }); } }); diff --git a/packages/schema/parse/src/__tests__/transforms.spec.ts b/packages/schema/parse/src/__tests__/transforms.spec.ts index 84195662dc..0883968e9d 100644 --- a/packages/schema/parse/src/__tests__/transforms.spec.ts +++ b/packages/schema/parse/src/__tests__/transforms.spec.ts @@ -74,6 +74,7 @@ describe("Polywrap Schema Abi Transformations", () => { transforms: [addFirstLast], }); const expected: WrapAbi = { + version: "0.1", objectTypes: [ { ...createObjectDefinition({ type: "MyType" }), @@ -279,6 +280,7 @@ describe("Polywrap Schema Abi Transformations", () => { ], }); const expected: WrapAbi = { + version: "0.1", objectTypes: [ { ...createObjectDefinition({ type: "MyType" }), diff --git a/packages/schema/parse/src/abi/definitions.ts b/packages/schema/parse/src/abi/definitions.ts index b0a7da7d51..2e5a815b2f 100644 --- a/packages/schema/parse/src/abi/definitions.ts +++ b/packages/schema/parse/src/abi/definitions.ts @@ -1,10 +1,4 @@ -import { - isMapKeyType, - isModuleType, - isScalarType, - MapKeyType, - ScalarType, -} from "./utils"; +import { isMapKeyType, isModuleType, isScalarType } from "./utils"; import { AnyDefinition, @@ -30,6 +24,7 @@ import { ScalarDefinition, UnresolvedObjectOrEnumRef, WithKind, + WithComment, } from "@polywrap/wrap-manifest-types-js"; export enum DefinitionKind { @@ -60,151 +55,98 @@ export function isKind(type: WithKind, kind: DefinitionKind): boolean { return (type.kind & kind) === kind; } -export function createGenericDefinition(args: { - type: string; - name?: string; - required?: boolean; -}): GenericDefinition { +export function createGenericDefinition( + args: Omit +): GenericDefinition { return { - type: args.type, - name: args.name, - required: args.required, + ...args, kind: DefinitionKind.Generic, }; } -export function createObjectDefinition(args: { - type: string; - name?: string; - required?: boolean; - properties?: PropertyDefinition[]; - interfaces?: InterfaceImplementedDefinition[]; - comment?: string; -}): ObjectDefinition { +export function createObjectDefinition( + args: Omit +): ObjectDefinition { return { - ...createGenericDefinition(args), - properties: args.properties, - interfaces: args.interfaces, - comment: args.comment, + ...args, kind: DefinitionKind.Object, }; } -export function createObjectRef(args: { - type: string; - name?: string; - required?: boolean; -}): ObjectRef { +export function createObjectRef(args: Omit): ObjectRef { return { - ...createGenericDefinition(args), + ...args, kind: DefinitionKind.ObjectRef, }; } -export function createAnyDefinition(args: { - type: string; - name?: string; - required?: boolean; - array?: ArrayDefinition; - map?: MapDefinition; - scalar?: ScalarDefinition; - object?: ObjectRef; - enum?: EnumRef; - unresolvedObjectOrEnum?: UnresolvedObjectOrEnumRef; -}): AnyDefinition { +export function createAnyDefinition( + args: Omit +): AnyDefinition { return { - ...createGenericDefinition(args), - array: args.array, - map: args.map, - scalar: args.scalar, - object: args.object, - enum: args.enum, - unresolvedObjectOrEnum: args.unresolvedObjectOrEnum, + ...args, kind: DefinitionKind.Any, }; } -export function createMapKeyDefinition(args: { - type: string; - name?: string; - required?: boolean; -}): MapKeyDefinition { +export function createMapKeyDefinition( + args: Omit +): MapKeyDefinition { if (!isMapKeyType(args.type)) { throw Error( `createMapKeyDefinition: Unrecognized Map key type provided "${args.type}"` ); } return { - ...createGenericDefinition(args), - type: args.type as MapKeyType, + ...args, kind: DefinitionKind.Scalar, }; } -export function createScalarDefinition(args: { - type: string; - name?: string; - required?: boolean; -}): ScalarDefinition { +export function createScalarDefinition( + args: Omit +): ScalarDefinition { if (!isScalarType(args.type)) { throw Error( `createScalarDefinition: Unrecognized scalar type provided "${args.type}"` ); } return { - ...createGenericDefinition(args), - type: args.type as ScalarType, + ...args, kind: DefinitionKind.Scalar, }; } -export function createEnumDefinition(args: { - type: string; - name?: string; - required?: boolean; - constants?: string[]; - comment?: string; -}): EnumDefinition { +export function createEnumDefinition( + args: Omit +): EnumDefinition { return { - ...createGenericDefinition(args), - type: args.type, + ...args, kind: DefinitionKind.Enum, - constants: args.constants, - comment: args.comment, }; } -export function createEnumRef(args: { - type: string; - name?: string; - required?: boolean; -}): EnumRef { +export function createEnumRef(args: Omit): EnumRef { return { - ...createGenericDefinition(args), + ...args, kind: DefinitionKind.EnumRef, }; } -export function createUnresolvedObjectOrEnumRef(args: { - type: string; - name?: string; - required?: boolean; -}): UnresolvedObjectOrEnumRef { +export function createUnresolvedObjectOrEnumRef( + args: Omit +): UnresolvedObjectOrEnumRef { return { - ...createGenericDefinition(args), - type: args.type, + ...args, kind: DefinitionKind.UnresolvedObjectOrEnum, }; } -export function createMapDefinition(args: { - type: string; - name?: string; - required?: boolean; - key?: MapKeyDefinition; - value?: GenericDefinition; -}): MapDefinition { +export function createMapDefinition( + args: Omit +): MapDefinition { return { + ...args, ...createAnyDefinition({ ...args, array: @@ -232,19 +174,15 @@ export function createMapDefinition(args: { ? (args.value as UnresolvedObjectOrEnumRef) : undefined, }), - key: args.key, - value: args.value, kind: DefinitionKind.Map, }; } -export function createArrayDefinition(args: { - type: string; - name?: string; - required?: boolean; - item?: GenericDefinition; -}): ArrayDefinition { +export function createArrayDefinition( + args: Omit +): ArrayDefinition { return { + ...args, ...createAnyDefinition({ ...args, array: @@ -272,167 +210,131 @@ export function createArrayDefinition(args: { ? (args.item as UnresolvedObjectOrEnumRef) : undefined, }), - item: args.item, kind: DefinitionKind.Array, }; } -export function createPropertyDefinition(args: { - type: string; - name?: string; - required?: boolean; - array?: ArrayDefinition; - map?: MapDefinition; - scalar?: ScalarDefinition; - object?: ObjectRef; - enum?: EnumRef; - comment?: string; -}): PropertyDefinition { +export function createPropertyDefinition( + args: Omit +): PropertyDefinition { return { - ...createAnyDefinition(args), - comment: args.comment, + ...args, kind: DefinitionKind.Property, }; } -export function createInterfaceImplementedDefinition(args: { - type: string; - name?: string; - required?: boolean; - array?: ArrayDefinition; - map?: MapDefinition; - scalar?: ScalarDefinition; - object?: ObjectDefinition; - enum?: EnumDefinition; -}): InterfaceImplementedDefinition { +export function createInterfaceImplementedDefinition( + args: Omit +): InterfaceImplementedDefinition { return { - ...createAnyDefinition(args), + ...args, kind: DefinitionKind.InterfaceImplemented, }; } -export function createArrayPropertyDefinition(args: { - type: string; - name?: string; - required?: boolean; - item?: GenericDefinition; - comment?: string; -}): PropertyDefinition { - return createPropertyDefinition({ - ...args, +export function createArrayPropertyDefinition( + args: Omit & WithComment +): PropertyDefinition { + const comment = args.comment; + delete args.comment; + const result = createPropertyDefinition({ + name: args.name, + type: args.type, + required: args.required, array: createArrayDefinition(args), }); + return comment ? { ...result, comment } : result; } -export function createMapPropertyDefinition(args: { - type: string; - name?: string; - required?: boolean; - key: MapKeyDefinition; - value?: GenericDefinition; - comment?: string; -}): PropertyDefinition { - return createPropertyDefinition({ - ...args, +export function createMapPropertyDefinition( + args: Omit & WithComment +): PropertyDefinition { + const comment = args.comment; + delete args.comment; + const result = createPropertyDefinition({ + name: args.name, + type: args.type, + required: args.required, map: createMapDefinition(args), }); + return comment ? { ...result, comment } : result; } -export function createScalarPropertyDefinition(args: { - type: ScalarDefinition["type"]; - name?: string; - required?: boolean; - comment?: string; -}): PropertyDefinition { - return createPropertyDefinition({ - ...args, +export function createScalarPropertyDefinition( + args: Omit & WithComment +): PropertyDefinition { + const comment = args.comment; + delete args.comment; + const result = createPropertyDefinition({ + name: args.name, + type: args.type, + required: args.required, scalar: createScalarDefinition(args), }); + return comment ? { ...result, comment } : result; } -export function createEnumPropertyDefinition(args: { - type: string; - name?: string; - required?: boolean; - constants?: string[]; - comment?: string; -}): PropertyDefinition { - return createPropertyDefinition({ - ...args, +export function createEnumPropertyDefinition( + args: Omit & WithComment +): PropertyDefinition { + const comment = args.comment; + delete args.comment; + const result = createPropertyDefinition({ + name: args.name, + type: args.type, + required: args.required, enum: createEnumRef(args), }); + return comment ? { ...result, comment } : result; } -export function createObjectPropertyDefinition(args: { - type: string; - name?: string; - required?: boolean; - properties?: PropertyDefinition[]; - comment?: string; -}): PropertyDefinition { - return createPropertyDefinition({ - ...args, +export function createObjectPropertyDefinition( + args: Omit & WithComment +): PropertyDefinition { + const comment = args.comment; + delete args.comment; + const result = createPropertyDefinition({ + name: args.name, + type: args.type, + required: args.required, object: createObjectRef(args), }); + return comment ? { ...result, comment } : result; } -export function createMethodDefinition(args: { - name: string; - arguments?: PropertyDefinition[]; - env?: { - required: boolean; - }; - return: PropertyDefinition; - comment?: string; -}): MethodDefinition { +export function createMethodDefinition( + args: Omit, "type"> +): MethodDefinition { return { + ...args, ...createGenericDefinition({ ...args, type: "Method", }), required: true, - arguments: args.arguments, - return: args.return, - comment: args.comment, kind: DefinitionKind.Method, }; } -export function createModuleDefinition(args: { - imports?: { type: ModuleDefinition["type"] }[]; - interfaces?: InterfaceImplementedDefinition[]; - required?: boolean; - comment?: string; -}): ModuleDefinition { +export function createModuleDefinition( + args: Omit, "type"> +): ModuleDefinition { return { + ...args, ...createGenericDefinition({ ...args, type: "Module", }), - methods: [], - imports: args.imports, - interfaces: args.interfaces, - comment: args.comment, kind: DefinitionKind.Module, }; } -export function createImportedEnumDefinition(args: { - type: string; - constants?: string[]; - name?: string; - required?: boolean; - uri: string; - namespace: string; - nativeType: string; - comment?: string; -}): ImportedEnumDefinition { +export function createImportedEnumDefinition( + args: Omit +): ImportedEnumDefinition { return { + ...args, ...createEnumDefinition(args), - uri: args.uri, - namespace: args.namespace, - nativeType: args.nativeType, - comment: args.comment, kind: DefinitionKind.ImportedEnum, }; } @@ -451,32 +353,20 @@ export function createCapability(args: { }; } -export function createInterfaceDefinition(args: { - type: string; - required?: boolean; - namespace: string; - uri: string; - capabilities: CapabilityDefinition; -}): InterfaceDefinition { +export function createInterfaceDefinition( + args: Omit, "nativeType"> +): InterfaceDefinition { return { + ...args, ...createGenericDefinition(args), - namespace: args.namespace, - uri: args.uri, nativeType: "Interface", - capabilities: args.capabilities, kind: DefinitionKind.Interface, }; } -export function createImportedModuleDefinition(args: { - required?: boolean; - uri: string; - namespace: string; - nativeType: string; - isInterface?: boolean; - interfaces?: InterfaceImplementedDefinition[]; - comment?: string; -}): ImportedModuleDefinition { +export function createImportedModuleDefinition( + args: Omit, "type"> +): ImportedModuleDefinition { if (!isModuleType(args.nativeType)) { throw Error( `createImportedModuleDefinition: Unrecognized module type provided "${args.nativeType}"` @@ -484,72 +374,44 @@ export function createImportedModuleDefinition(args: { } return { + ...args, ...createGenericDefinition({ ...args, type: `${args.namespace}_${args.nativeType}`, }), - methods: [], - uri: args.uri, - namespace: args.namespace, - nativeType: args.nativeType, - comment: args.comment, - isInterface: args.isInterface, kind: DefinitionKind.ImportedModule, }; } -export function createImportedObjectDefinition(args: { - type: string; - name?: string; - required?: boolean; - uri: string; - namespace: string; - nativeType: string; - interfaces?: InterfaceImplementedDefinition[]; - comment?: string; -}): ImportedObjectDefinition { +export function createImportedObjectDefinition( + args: Omit +): ImportedObjectDefinition { return { + ...args, ...createObjectDefinition(args), - uri: args.uri, - namespace: args.namespace, - nativeType: args.nativeType, - comment: args.comment, kind: DefinitionKind.ImportedObject, }; } -export function createEnvDefinition(args: { - name?: string; - required?: boolean; - properties?: PropertyDefinition[]; - interfaces?: InterfaceImplementedDefinition[]; - comment?: string; -}): EnvDefinition { +export function createEnvDefinition( + args: Omit, "type"> +): EnvDefinition { return { + ...args, ...createObjectDefinition({ ...args, type: "Env" }), kind: DefinitionKind.Env, }; } -export function createImportedEnvDefinition(args: { - type: string; - name?: string; - required?: boolean; - uri: string; - namespace: string; - nativeType: string; - interfaces?: InterfaceImplementedDefinition[]; - comment?: string; -}): ImportedEnvDefinition { +export function createImportedEnvDefinition( + args: Omit, "type"> +): ImportedEnvDefinition { return { + ...args, ...createObjectDefinition({ ...args, type: `${args.namespace}_Env`, }), - uri: args.uri, - namespace: args.namespace, - nativeType: args.nativeType, - comment: args.comment, kind: DefinitionKind.ImportedEnv, }; } diff --git a/packages/schema/parse/src/abi/index.ts b/packages/schema/parse/src/abi/index.ts index cfb2e27155..6ad712a5a4 100644 --- a/packages/schema/parse/src/abi/index.ts +++ b/packages/schema/parse/src/abi/index.ts @@ -7,6 +7,7 @@ export * from "./utils"; export function createAbi(): Abi { return { + version: "0.1", objectTypes: [], enumTypes: [], interfaceTypes: [], diff --git a/packages/schema/parse/src/extract/imported-env-types.ts b/packages/schema/parse/src/extract/imported-env-types.ts index 4dd8f681f7..276292d113 100644 --- a/packages/schema/parse/src/extract/imported-env-types.ts +++ b/packages/schema/parse/src/extract/imported-env-types.ts @@ -39,7 +39,6 @@ const visitorEnter = ( ); const importedType = createImportedEnvDefinition({ - type: node.name.value, uri: imported.uri, namespace: imported.namespace, nativeType: imported.nativeType, diff --git a/packages/schema/parse/src/extract/imported-module-types.ts b/packages/schema/parse/src/extract/imported-module-types.ts index 731f753acf..e29e5cf6ec 100644 --- a/packages/schema/parse/src/extract/imported-module-types.ts +++ b/packages/schema/parse/src/extract/imported-module-types.ts @@ -1,6 +1,5 @@ import { createImportedModuleDefinition, - createInterfaceImplementedDefinition, createMethodDefinition, createPropertyDefinition, } from ".."; @@ -45,16 +44,11 @@ const visitorEnter = ( node.directives.find((dir) => dir.name.value === "enabled_interface"); const isInterface = dir ? true : false; - const interfaces = node.interfaces?.map((x) => - createInterfaceImplementedDefinition({ type: x.name.value }) - ); - const importedType = createImportedModuleDefinition({ uri: imported.uri, namespace: imported.namespace, nativeType: imported.nativeType, isInterface: isInterface, - interfaces: interfaces?.length ? interfaces : undefined, comment: node.description?.value, }); importedModuleTypes.push(importedType); diff --git a/packages/schema/parse/src/extract/utils/map-utils.ts b/packages/schema/parse/src/extract/utils/map-utils.ts index 9e0d679163..cbc70f0efb 100644 --- a/packages/schema/parse/src/extract/utils/map-utils.ts +++ b/packages/schema/parse/src/extract/utils/map-utils.ts @@ -8,7 +8,11 @@ import { isScalarType, } from "../.."; -import { GenericDefinition } from "@polywrap/wrap-manifest-types-js"; +import { + GenericDefinition, + MapKeyDefinition, + ScalarDefinition, +} from "@polywrap/wrap-manifest-types-js"; type CurrentAbi = { currentType: string; @@ -115,7 +119,7 @@ const _parseMapType = ( if (isScalarType(currentType)) { return createScalarDefinition({ name: name, - type: currentType, + type: currentType as ScalarDefinition["type"], required: required, }); } @@ -162,7 +166,7 @@ const _parseMapType = ( name: name, key: createMapKeyDefinition({ name: name, - type: keyType, + type: keyType as MapKeyDefinition["type"], required: keyRequired, }), value: _parseMapType(rootType, valType, name), diff --git a/packages/schema/parse/src/extract/utils/property-utils.ts b/packages/schema/parse/src/extract/utils/property-utils.ts index 077e7b5737..2748c407d5 100644 --- a/packages/schema/parse/src/extract/utils/property-utils.ts +++ b/packages/schema/parse/src/extract/utils/property-utils.ts @@ -5,7 +5,10 @@ import { isScalarType, } from "../.."; -import { PropertyDefinition } from "@polywrap/wrap-manifest-types-js"; +import { + PropertyDefinition, + ScalarDefinition, +} from "@polywrap/wrap-manifest-types-js"; const toBoolean = (val: unknown) => !!val; @@ -20,7 +23,7 @@ export function setPropertyType( if (isScalarType(type.type)) { property.scalar = createScalarDefinition({ name: name, - type: type.type, + type: type.type as ScalarDefinition["type"], required: type.required, }); return; diff --git a/packages/schema/parse/src/index.ts b/packages/schema/parse/src/index.ts index 1ec67c4da4..43f84b99e3 100644 --- a/packages/schema/parse/src/index.ts +++ b/packages/schema/parse/src/index.ts @@ -51,6 +51,7 @@ export function parseSchema( } return { + version: "0.1", objectTypes: info.objectTypes?.length ? info.objectTypes : undefined, moduleType: info.moduleType ? info.moduleType : undefined, enumTypes: info.enumTypes?.length ? info.enumTypes : undefined, diff --git a/packages/schema/parse/src/validate/types.ts b/packages/schema/parse/src/validate/types.ts index ba01c4f721..908bbfd9c2 100644 --- a/packages/schema/parse/src/validate/types.ts +++ b/packages/schema/parse/src/validate/types.ts @@ -202,25 +202,24 @@ export const getPropertyTypesValidator = (): SchemaValidator => { }; export function getCircularDefinitionsValidator(): SchemaValidator { - const operationTypes: string[] = []; + const ignoreTypeNames: string[] = []; return { visitor: { enter: { ObjectTypeDefinition: (node: ObjectTypeDefinitionNode) => { - const isOperationType = operationTypeNames.some( - (name) => - node.name.value === name || node.name.value.endsWith(`_${name}`) - ); - if (isOperationType) { - operationTypes.push(node.name.value); + if ( + node.name.value === "Module" || + node.name.value.endsWith("_Module") + ) { + ignoreTypeNames.push(node.name.value); } }, }, }, cleanup: (documentNode: DocumentNode) => { const { cycleStrings, foundCycle } = getSchemaCycles(documentNode, { - ignoreTypeNames: operationTypes, + ignoreTypeNames, allowOnNullableFields: true, }); diff --git a/packages/templates/app/typescript-node/polywrap.app.yaml b/packages/templates/app/typescript-node/polywrap.app.yaml index 6bf878cdce..ea5e0dd6de 100644 --- a/packages/templates/app/typescript-node/polywrap.app.yaml +++ b/packages/templates/app/typescript-node/polywrap.app.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: Sample language: app/typescript schema: ./schema.graphql diff --git a/packages/templates/app/typescript-react/polywrap.app.yaml b/packages/templates/app/typescript-react/polywrap.app.yaml index 6bf878cdce..ea5e0dd6de 100644 --- a/packages/templates/app/typescript-react/polywrap.app.yaml +++ b/packages/templates/app/typescript-react/polywrap.app.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: Sample language: app/typescript schema: ./schema.graphql diff --git a/packages/templates/plugin/typescript/polywrap.plugin.yaml b/packages/templates/plugin/typescript/polywrap.plugin.yaml index 3a47e8d94c..55834783f7 100644 --- a/packages/templates/plugin/typescript/polywrap.plugin.yaml +++ b/packages/templates/plugin/typescript/polywrap.plugin.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: Sample language: plugin/typescript schema: ./src/schema.graphql diff --git a/packages/templates/plugin/typescript/src/index.ts b/packages/templates/plugin/typescript/src/index.ts index 4601141f95..57ae5b5643 100644 --- a/packages/templates/plugin/typescript/src/index.ts +++ b/packages/templates/plugin/typescript/src/index.ts @@ -20,7 +20,7 @@ export const samplePlugin: PluginFactory = ( ) => { return { factory: () => new SamplePlugin(config), - manifest, + manifest: manifest }; }; diff --git a/packages/templates/run-tests.ts b/packages/templates/run-tests.ts new file mode 100644 index 0000000000..9a19982078 --- /dev/null +++ b/packages/templates/run-tests.ts @@ -0,0 +1,109 @@ +import fs from "fs"; +import path from "path"; +import { execSync } from "child_process" + +const rootDir = __dirname; + +// Mapping of all project types (app, plugin, etc) to all supported languages +const projectLanguages: Record = {}; + +// Define the commands to run for each language +const languageTestCommands: Record = { + "typescript": [ + // Uncomment once wrap-man files has been removed + // "yarn build", + // "yarn test" + ], + "typescript-node": [ + // Uncomment when the helloworld wrapper has been deployed to polywrap.eth + // "yarn build", + // "yarn test" + ], + "typescript-react": [ + // Uncomment when the helloworld wrapper has been deployed to polywrap.eth + // "CI=false yarn build" + ], + "assemblyscript": [ + // Workflow tests fail in CI because cuelang is not installed + "yarn build", + "yarn test:e2e", + // "yarn test:workflow" + ], + "rust": [ + // Workflow tests fail in CI because cuelang is not installed + "yarn build", + "yarn test:e2e", + // "yarn test:workflow" + ], + "interface": [ + "yarn build" + ], + "docusaurus": [ + "yarn install --no-lockfile", + "yarn build" + ] +}; + +// Filter unnecessary directories +const filter = ["node_modules"]; + +// Populate all project types & languages by recursing 2 levels of directories +fs.readdirSync(rootDir, { withFileTypes: true }) + .filter(dirent => dirent.isDirectory() && filter.indexOf(dirent.name) === -1) + .map(dirent => dirent.name) + .forEach(projectType => + projectLanguages[projectType] = + fs.readdirSync(path.join(rootDir, projectType), { withFileTypes: true }) + .filter(dirent => dirent.isDirectory()) + .map(dirent => dirent.name) + ); + +// for each project + language +for (const projectType of Object.keys(projectLanguages)) { + for (const language of projectLanguages[projectType]) { + + // run the test commands at commands[language] + let commands = languageTestCommands[language]; + + // if nothing exists, try to match language as a substring + if (!commands) { + for (const testLanguage of Object.keys(languageTestCommands)) { + if (language.indexOf(testLanguage) > -1) { + commands = languageTestCommands[testLanguage]; + break; + } + } + } + + // if nothing exists, error + if (!commands) { + throw Error( + `Unknown project language ${projectType}/${language}, no test commands found. Please update this script's configuration.` + ); + } + + // run all commands + for (const command of commands) { + console.log(`run-tests: ${projectType}/${language} > ${command}`); + try { + const output = execSync( + command, { + cwd: path.join(rootDir, projectType, language) + } + ).toString(); + console.log(output); + } catch (e) { + if (e.stdout) { + e.stdout = e.stdout.toString(); + } + if (e.stderr) { + e.stderr = e.stderr.toString(); + } + console.error(`status: ${e.status}`); + console.error(`stdout: ${e.stdout}`); + console.error(`stderr: ${e.stderr}`); + throw e; + } + } + } +} diff --git a/packages/templates/wasm/assemblyscript/polywrap.yaml b/packages/templates/wasm/assemblyscript/polywrap.yaml index a5a23af409..2f28974b3b 100644 --- a/packages/templates/wasm/assemblyscript/polywrap.yaml +++ b/packages/templates/wasm/assemblyscript/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: template-wasm-as language: wasm/assemblyscript build: ./polywrap.build.yaml diff --git a/packages/templates/wasm/assemblyscript/src/__tests__/types/polywrap.app.yaml b/packages/templates/wasm/assemblyscript/src/__tests__/types/polywrap.app.yaml index 00530d8dd1..840729db91 100644 --- a/packages/templates/wasm/assemblyscript/src/__tests__/types/polywrap.app.yaml +++ b/packages/templates/wasm/assemblyscript/src/__tests__/types/polywrap.app.yaml @@ -1,7 +1,7 @@ -format: 0.1.0 +format: "0.2" name: sample-typescript-type-generation language: app/typescript schema: ./schema.graphql -import_redirects: +import_abis: - uri: "wrap://ens/sample.eth" - schema: "../../../build/schema.graphql" + abi: "../../../build/wrap.info" diff --git a/packages/templates/wasm/interface/polywrap.yaml b/packages/templates/wasm/interface/polywrap.yaml index 91b8ba2735..e8b2267ba4 100644 --- a/packages/templates/wasm/interface/polywrap.yaml +++ b/packages/templates/wasm/interface/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: TODO language: interface meta: ./polywrap.meta.yaml diff --git a/packages/templates/wasm/rust/polywrap.yaml b/packages/templates/wasm/rust/polywrap.yaml index a3478bc2dd..c9dcb3462a 100644 --- a/packages/templates/wasm/rust/polywrap.yaml +++ b/packages/templates/wasm/rust/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: template-wasm-rs language: wasm/rust build: ./polywrap.build.yaml diff --git a/packages/templates/wasm/rust/src/__tests__/types/polywrap.app.yaml b/packages/templates/wasm/rust/src/__tests__/types/polywrap.app.yaml index 00530d8dd1..840729db91 100644 --- a/packages/templates/wasm/rust/src/__tests__/types/polywrap.app.yaml +++ b/packages/templates/wasm/rust/src/__tests__/types/polywrap.app.yaml @@ -1,7 +1,7 @@ -format: 0.1.0 +format: "0.2" name: sample-typescript-type-generation language: app/typescript schema: ./schema.graphql -import_redirects: +import_abis: - uri: "wrap://ens/sample.eth" - schema: "../../../build/schema.graphql" + abi: "../../../build/wrap.info" diff --git a/packages/test-cases/cases/bind/sanity/output/app-ts/index.ts b/packages/test-cases/cases/bind/sanity/output/app-ts/index.ts index d0bb0ac74a..eea524d655 100644 --- a/packages/test-cases/cases/bind/sanity/output/app-ts/index.ts +++ b/packages/test-cases/cases/bind/sanity/output/app-ts/index.ts @@ -1,2 +1 @@ export * from "./types"; -export * from "./schema"; diff --git a/packages/test-cases/cases/bind/sanity/output/app-ts/schema.ts b/packages/test-cases/cases/bind/sanity/output/app-ts/schema.ts deleted file mode 100644 index a8001a379b..0000000000 --- a/packages/test-cases/cases/bind/sanity/output/app-ts/schema.ts +++ /dev/null @@ -1,215 +0,0 @@ -export const schema: string = `### Polywrap Header START ### -scalar UInt -scalar UInt8 -scalar UInt16 -scalar UInt32 -scalar Int -scalar Int8 -scalar Int16 -scalar Int32 -scalar Bytes -scalar BigInt -scalar BigNumber -scalar JSON -scalar Map - -directive @imported( - uri: String! - namespace: String! - nativeType: String! -) on OBJECT | ENUM - -directive @imports( - types: [String!]! -) on OBJECT - -directive @capability( - type: String! - uri: String! - namespace: String! -) repeatable on OBJECT - -directive @enabled_interface on OBJECT - -directive @annotate(type: String!) on FIELD - -### Polywrap Header END ### - -type Module @imports( - types: [ - "TestImport_Module", - "TestImport_Object", - "TestImport_AnotherObject", - "TestImport_Enum" - ] -) @capability( - type: "getImplementations", - uri: "testimport.uri.eth", - namespace: "TestImport" -) { - moduleMethod( - str: String! - optStr: String - en: CustomEnum! - optEnum: CustomEnum - enumArray: [CustomEnum!]! - optEnumArray: [CustomEnum] - map: Map! @annotate(type: "Map!") - mapOfArr: Map! @annotate(type: "Map!") - mapOfObj: Map! @annotate(type: "Map!") - mapOfArrOfObj: Map! @annotate(type: "Map!") - ): Int! - - objectMethod( - object: AnotherType! - optObject: AnotherType - objectArray: [AnotherType!]! - optObjectArray: [AnotherType] - ): AnotherType @env(required: true) - - optionalEnvMethod( - object: AnotherType! - optObject: AnotherType - objectArray: [AnotherType!]! - optObjectArray: [AnotherType] - ): AnotherType @env(required: false) -} - -type Env { - prop: String! - optProp: String - optMap: Map @annotate(type: "Map") -} - -type CustomType { - str: String! - optStr: String - u: UInt! - optU: UInt - u8: UInt8! - u16: UInt16! - u32: UInt32! - i: Int! - i8: Int8! - i16: Int16! - i32: Int32! - bigint: BigInt! - optBigint: BigInt - bignumber: BigNumber! - optBignumber: BigNumber - json: JSON! - optJson: JSON - bytes: Bytes! - optBytes: Bytes - boolean: Boolean! - optBoolean: Boolean - uArray: [UInt!]! - uOptArray: [UInt!] - optUOptArray: [UInt] - optStrOptArray: [String] - uArrayArray: [[UInt!]!]! - uOptArrayOptArray: [[UInt32]]! - uArrayOptArrayArray: [[[UInt32!]!]]! - crazyArray: [[[[UInt32!]]!]] - object: AnotherType! - optObject: AnotherType - objectArray: [AnotherType!]! - optObjectArray: [AnotherType] - en: CustomEnum! - optEnum: CustomEnum - enumArray: [CustomEnum!]! - optEnumArray: [CustomEnum] - map: Map! @annotate(type: "Map!") - mapOfArr: Map! @annotate(type: "Map!") - mapOfObj: Map! @annotate(type: "Map!") - mapOfArrOfObj: Map! @annotate(type: "Map!") -} - -type AnotherType { - prop: String - circular: CustomType - const: String -} - -enum CustomEnum { - STRING - BYTES -} - -### Imported Modules START ### - -type TestImport_Module @imported( - uri: "testimport.uri.eth", - namespace: "TestImport", - nativeType: "Module" -) @enabled_interface { - importedMethod( - str: String! - optStr: String - u: UInt! - optU: UInt - uArrayArray: [[UInt]]! - object: TestImport_Object! - optObject: TestImport_Object - objectArray: [TestImport_Object!]! - optObjectArray: [TestImport_Object] - en: TestImport_Enum! - optEnum: TestImport_Enum - enumArray: [TestImport_Enum!]! - optEnumArray: [TestImport_Enum] - ): TestImport_Object @env(required: true) - - anotherMethod( - arg: [String!]! - ): Int32! -} - -### Imported Modules END ### - -### Imported Objects START ### - -type TestImport_Object @imported( - uri: "testimport.uri.eth", - namespace: "TestImport", - nativeType: "Object" -) { - object: TestImport_AnotherObject! - optObject: TestImport_AnotherObject - objectArray: [TestImport_AnotherObject!]! - optObjectArray: [TestImport_AnotherObject] - en: TestImport_Enum! - optEnum: TestImport_Enum - enumArray: [TestImport_Enum!]! - optEnumArray: [TestImport_Enum] -} - -type TestImport_AnotherObject @imported( - uri: "testimport.uri.eth", - namespace: "TestImport", - nativeType: "AnotherObject" -) { - prop: String! -} - -enum TestImport_Enum @imported( - uri: "testimport.uri.eth", - namespace: "TestImport", - nativeType: "Enum" -) { - STRING - BYTES -} - -### Imported Objects END ### - -### Imported Envs START ### - -type TestImport_Env @imported( - uri: "testimport.uri.eth", - namespace: "TestImport", - nativeType: "Env" -) { - enviroProp: String! -} - -### Imported Envs END ###`; diff --git a/packages/test-cases/cases/bind/sanity/output/plugin-ts/index.ts b/packages/test-cases/cases/bind/sanity/output/plugin-ts/index.ts index f367d143d9..315871f96d 100644 --- a/packages/test-cases/cases/bind/sanity/output/plugin-ts/index.ts +++ b/packages/test-cases/cases/bind/sanity/output/plugin-ts/index.ts @@ -1,8 +1,7 @@ /// NOTE: This is an auto-generated file. /// All modifications will be overwritten. -export * from "./schema"; -export * from "./manifest"; +export * from "./wrap.info"; export * from "./module"; export * from "./types"; diff --git a/packages/test-cases/cases/bind/sanity/output/plugin-ts/manifest.ts b/packages/test-cases/cases/bind/sanity/output/plugin-ts/manifest.ts deleted file mode 100644 index 730cf8326f..0000000000 --- a/packages/test-cases/cases/bind/sanity/output/plugin-ts/manifest.ts +++ /dev/null @@ -1,15 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { schema } from "./"; - -// @ts-ignore -import { PluginPackageManifest, Uri } from "@polywrap/core-js"; - -export const manifest: PluginPackageManifest = { - schema, - implements: [ - ], -}; diff --git a/packages/test-cases/cases/bind/sanity/output/plugin-ts/schema.ts b/packages/test-cases/cases/bind/sanity/output/plugin-ts/schema.ts deleted file mode 100644 index dd7840e988..0000000000 --- a/packages/test-cases/cases/bind/sanity/output/plugin-ts/schema.ts +++ /dev/null @@ -1,218 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export const schema: string = `### Polywrap Header START ### -scalar UInt -scalar UInt8 -scalar UInt16 -scalar UInt32 -scalar Int -scalar Int8 -scalar Int16 -scalar Int32 -scalar Bytes -scalar BigInt -scalar BigNumber -scalar JSON -scalar Map - -directive @imported( - uri: String! - namespace: String! - nativeType: String! -) on OBJECT | ENUM - -directive @imports( - types: [String!]! -) on OBJECT - -directive @capability( - type: String! - uri: String! - namespace: String! -) repeatable on OBJECT - -directive @enabled_interface on OBJECT - -directive @annotate(type: String!) on FIELD - -### Polywrap Header END ### - -type Module @imports( - types: [ - "TestImport_Module", - "TestImport_Object", - "TestImport_AnotherObject", - "TestImport_Enum" - ] -) @capability( - type: "getImplementations", - uri: "testimport.uri.eth", - namespace: "TestImport" -) { - moduleMethod( - str: String! - optStr: String - en: CustomEnum! - optEnum: CustomEnum - enumArray: [CustomEnum!]! - optEnumArray: [CustomEnum] - map: Map! @annotate(type: "Map!") - mapOfArr: Map! @annotate(type: "Map!") - mapOfObj: Map! @annotate(type: "Map!") - mapOfArrOfObj: Map! @annotate(type: "Map!") - ): Int! - - objectMethod( - object: AnotherType! - optObject: AnotherType - objectArray: [AnotherType!]! - optObjectArray: [AnotherType] - ): AnotherType @env(required: true) - - optionalEnvMethod( - object: AnotherType! - optObject: AnotherType - objectArray: [AnotherType!]! - optObjectArray: [AnotherType] - ): AnotherType @env(required: false) -} - -type Env { - prop: String! - optProp: String - optMap: Map @annotate(type: "Map") -} - -type CustomType { - str: String! - optStr: String - u: UInt! - optU: UInt - u8: UInt8! - u16: UInt16! - u32: UInt32! - i: Int! - i8: Int8! - i16: Int16! - i32: Int32! - bigint: BigInt! - optBigint: BigInt - bignumber: BigNumber! - optBignumber: BigNumber - json: JSON! - optJson: JSON - bytes: Bytes! - optBytes: Bytes - boolean: Boolean! - optBoolean: Boolean - uArray: [UInt!]! - uOptArray: [UInt!] - optUOptArray: [UInt] - optStrOptArray: [String] - uArrayArray: [[UInt!]!]! - uOptArrayOptArray: [[UInt32]]! - uArrayOptArrayArray: [[[UInt32!]!]]! - crazyArray: [[[[UInt32!]]!]] - object: AnotherType! - optObject: AnotherType - objectArray: [AnotherType!]! - optObjectArray: [AnotherType] - en: CustomEnum! - optEnum: CustomEnum - enumArray: [CustomEnum!]! - optEnumArray: [CustomEnum] - map: Map! @annotate(type: "Map!") - mapOfArr: Map! @annotate(type: "Map!") - mapOfObj: Map! @annotate(type: "Map!") - mapOfArrOfObj: Map! @annotate(type: "Map!") -} - -type AnotherType { - prop: String - circular: CustomType - const: String -} - -enum CustomEnum { - STRING - BYTES -} - -### Imported Modules START ### - -type TestImport_Module @imported( - uri: "testimport.uri.eth", - namespace: "TestImport", - nativeType: "Module" -) @enabled_interface { - importedMethod( - str: String! - optStr: String - u: UInt! - optU: UInt - uArrayArray: [[UInt]]! - object: TestImport_Object! - optObject: TestImport_Object - objectArray: [TestImport_Object!]! - optObjectArray: [TestImport_Object] - en: TestImport_Enum! - optEnum: TestImport_Enum - enumArray: [TestImport_Enum!]! - optEnumArray: [TestImport_Enum] - ): TestImport_Object @env(required: true) - - anotherMethod( - arg: [String!]! - ): Int32! -} - -### Imported Modules END ### - -### Imported Objects START ### - -type TestImport_Object @imported( - uri: "testimport.uri.eth", - namespace: "TestImport", - nativeType: "Object" -) { - object: TestImport_AnotherObject! - optObject: TestImport_AnotherObject - objectArray: [TestImport_AnotherObject!]! - optObjectArray: [TestImport_AnotherObject] - en: TestImport_Enum! - optEnum: TestImport_Enum - enumArray: [TestImport_Enum!]! - optEnumArray: [TestImport_Enum] -} - -type TestImport_AnotherObject @imported( - uri: "testimport.uri.eth", - namespace: "TestImport", - nativeType: "AnotherObject" -) { - prop: String! -} - -enum TestImport_Enum @imported( - uri: "testimport.uri.eth", - namespace: "TestImport", - nativeType: "Enum" -) { - STRING - BYTES -} - -### Imported Objects END ### - -### Imported Envs START ### - -type TestImport_Env @imported( - uri: "testimport.uri.eth", - namespace: "TestImport", - nativeType: "Env" -) { - enviroProp: String! -} - -### Imported Envs END ###`; diff --git a/packages/test-cases/cases/bind/sanity/output/plugin-ts/wrap.info.ts b/packages/test-cases/cases/bind/sanity/output/plugin-ts/wrap.info.ts new file mode 100644 index 0000000000..fbe9e614f8 --- /dev/null +++ b/packages/test-cases/cases/bind/sanity/output/plugin-ts/wrap.info.ts @@ -0,0 +1,2087 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. +import { WrapManifest } from "@polywrap/wrap-manifest-types-js" + +export const manifest: WrapManifest = { + name: "Test", + type: "plugin", + version: "0.1", + abi: { + "enumTypes": [ + { + "constants": [ + "STRING", + "BYTES" + ], + "kind": 8, + "type": "CustomEnum" + } + ], + "envType": { + "kind": 65536, + "properties": [ + { + "kind": 34, + "name": "prop", + "required": true, + "scalar": { + "kind": 4, + "name": "prop", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "optProp", + "scalar": { + "kind": 4, + "name": "optProp", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "map": { + "key": { + "kind": 4, + "name": "optMap", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "optMap", + "scalar": { + "kind": 4, + "name": "optMap", + "type": "Int" + }, + "type": "Map", + "value": { + "kind": 4, + "name": "optMap", + "type": "Int" + } + }, + "name": "optMap", + "type": "Map" + } + ], + "type": "Env" + }, + "importedEnumTypes": [ + { + "constants": [ + "STRING", + "BYTES" + ], + "kind": 520, + "namespace": "TestImport", + "nativeType": "Enum", + "type": "TestImport_Enum", + "uri": "testimport.uri.eth" + } + ], + "importedEnvTypes": [ + { + "kind": 524288, + "namespace": "TestImport", + "nativeType": "Env", + "properties": [ + { + "kind": 34, + "name": "enviroProp", + "required": true, + "scalar": { + "kind": 4, + "name": "enviroProp", + "required": true, + "type": "String" + }, + "type": "String" + } + ], + "type": "TestImport_Env", + "uri": "testimport.uri.eth" + } + ], + "importedModuleTypes": [ + { + "isInterface": true, + "kind": 256, + "methods": [ + { + "arguments": [ + { + "kind": 34, + "name": "str", + "required": true, + "scalar": { + "kind": 4, + "name": "str", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "optStr", + "scalar": { + "kind": 4, + "name": "optStr", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "u", + "required": true, + "scalar": { + "kind": 4, + "name": "u", + "required": true, + "type": "UInt" + }, + "type": "UInt" + }, + { + "kind": 34, + "name": "optU", + "scalar": { + "kind": 4, + "name": "optU", + "type": "UInt" + }, + "type": "UInt" + }, + { + "array": { + "array": { + "item": { + "kind": 4, + "name": "uArrayArray", + "type": "UInt" + }, + "kind": 18, + "name": "uArrayArray", + "scalar": { + "kind": 4, + "name": "uArrayArray", + "type": "UInt" + }, + "type": "[UInt]" + }, + "item": { + "item": { + "kind": 4, + "name": "uArrayArray", + "type": "UInt" + }, + "kind": 18, + "name": "uArrayArray", + "scalar": { + "kind": 4, + "name": "uArrayArray", + "type": "UInt" + }, + "type": "[UInt]" + }, + "kind": 18, + "name": "uArrayArray", + "required": true, + "type": "[[UInt]]" + }, + "kind": 34, + "name": "uArrayArray", + "required": true, + "type": "[[UInt]]" + }, + { + "kind": 34, + "name": "object", + "object": { + "kind": 8192, + "name": "object", + "required": true, + "type": "TestImport_Object" + }, + "required": true, + "type": "TestImport_Object" + }, + { + "kind": 34, + "name": "optObject", + "object": { + "kind": 8192, + "name": "optObject", + "type": "TestImport_Object" + }, + "type": "TestImport_Object" + }, + { + "array": { + "item": { + "kind": 8192, + "name": "objectArray", + "required": true, + "type": "TestImport_Object" + }, + "kind": 18, + "name": "objectArray", + "object": { + "kind": 8192, + "name": "objectArray", + "required": true, + "type": "TestImport_Object" + }, + "required": true, + "type": "[TestImport_Object]" + }, + "kind": 34, + "name": "objectArray", + "required": true, + "type": "[TestImport_Object]" + }, + { + "array": { + "item": { + "kind": 8192, + "name": "optObjectArray", + "type": "TestImport_Object" + }, + "kind": 18, + "name": "optObjectArray", + "object": { + "kind": 8192, + "name": "optObjectArray", + "type": "TestImport_Object" + }, + "type": "[TestImport_Object]" + }, + "kind": 34, + "name": "optObjectArray", + "type": "[TestImport_Object]" + }, + { + "enum": { + "kind": 16384, + "name": "en", + "required": true, + "type": "TestImport_Enum" + }, + "kind": 34, + "name": "en", + "required": true, + "type": "TestImport_Enum" + }, + { + "enum": { + "kind": 16384, + "name": "optEnum", + "type": "TestImport_Enum" + }, + "kind": 34, + "name": "optEnum", + "type": "TestImport_Enum" + }, + { + "array": { + "enum": { + "kind": 16384, + "name": "enumArray", + "required": true, + "type": "TestImport_Enum" + }, + "item": { + "kind": 16384, + "name": "enumArray", + "required": true, + "type": "TestImport_Enum" + }, + "kind": 18, + "name": "enumArray", + "required": true, + "type": "[TestImport_Enum]" + }, + "kind": 34, + "name": "enumArray", + "required": true, + "type": "[TestImport_Enum]" + }, + { + "array": { + "enum": { + "kind": 16384, + "name": "optEnumArray", + "type": "TestImport_Enum" + }, + "item": { + "kind": 16384, + "name": "optEnumArray", + "type": "TestImport_Enum" + }, + "kind": 18, + "name": "optEnumArray", + "type": "[TestImport_Enum]" + }, + "kind": 34, + "name": "optEnumArray", + "type": "[TestImport_Enum]" + } + ], + "env": { + "required": true + }, + "kind": 64, + "name": "importedMethod", + "required": true, + "return": { + "kind": 34, + "name": "importedMethod", + "object": { + "kind": 8192, + "name": "importedMethod", + "type": "TestImport_Object" + }, + "type": "TestImport_Object" + }, + "type": "Method" + }, + { + "arguments": [ + { + "array": { + "item": { + "kind": 4, + "name": "arg", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "arg", + "required": true, + "scalar": { + "kind": 4, + "name": "arg", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "arg", + "required": true, + "type": "[String]" + } + ], + "kind": 64, + "name": "anotherMethod", + "required": true, + "return": { + "kind": 34, + "name": "anotherMethod", + "required": true, + "scalar": { + "kind": 4, + "name": "anotherMethod", + "required": true, + "type": "Int32" + }, + "type": "Int32" + }, + "type": "Method" + } + ], + "namespace": "TestImport", + "nativeType": "Module", + "type": "TestImport_Module", + "uri": "testimport.uri.eth" + } + ], + "importedObjectTypes": [ + { + "kind": 1025, + "namespace": "TestImport", + "nativeType": "Object", + "properties": [ + { + "kind": 34, + "name": "object", + "object": { + "kind": 8192, + "name": "object", + "required": true, + "type": "TestImport_AnotherObject" + }, + "required": true, + "type": "TestImport_AnotherObject" + }, + { + "kind": 34, + "name": "optObject", + "object": { + "kind": 8192, + "name": "optObject", + "type": "TestImport_AnotherObject" + }, + "type": "TestImport_AnotherObject" + }, + { + "array": { + "item": { + "kind": 8192, + "name": "objectArray", + "required": true, + "type": "TestImport_AnotherObject" + }, + "kind": 18, + "name": "objectArray", + "object": { + "kind": 8192, + "name": "objectArray", + "required": true, + "type": "TestImport_AnotherObject" + }, + "required": true, + "type": "[TestImport_AnotherObject]" + }, + "kind": 34, + "name": "objectArray", + "required": true, + "type": "[TestImport_AnotherObject]" + }, + { + "array": { + "item": { + "kind": 8192, + "name": "optObjectArray", + "type": "TestImport_AnotherObject" + }, + "kind": 18, + "name": "optObjectArray", + "object": { + "kind": 8192, + "name": "optObjectArray", + "type": "TestImport_AnotherObject" + }, + "type": "[TestImport_AnotherObject]" + }, + "kind": 34, + "name": "optObjectArray", + "type": "[TestImport_AnotherObject]" + }, + { + "enum": { + "kind": 16384, + "name": "en", + "required": true, + "type": "TestImport_Enum" + }, + "kind": 34, + "name": "en", + "required": true, + "type": "TestImport_Enum" + }, + { + "enum": { + "kind": 16384, + "name": "optEnum", + "type": "TestImport_Enum" + }, + "kind": 34, + "name": "optEnum", + "type": "TestImport_Enum" + }, + { + "array": { + "enum": { + "kind": 16384, + "name": "enumArray", + "required": true, + "type": "TestImport_Enum" + }, + "item": { + "kind": 16384, + "name": "enumArray", + "required": true, + "type": "TestImport_Enum" + }, + "kind": 18, + "name": "enumArray", + "required": true, + "type": "[TestImport_Enum]" + }, + "kind": 34, + "name": "enumArray", + "required": true, + "type": "[TestImport_Enum]" + }, + { + "array": { + "enum": { + "kind": 16384, + "name": "optEnumArray", + "type": "TestImport_Enum" + }, + "item": { + "kind": 16384, + "name": "optEnumArray", + "type": "TestImport_Enum" + }, + "kind": 18, + "name": "optEnumArray", + "type": "[TestImport_Enum]" + }, + "kind": 34, + "name": "optEnumArray", + "type": "[TestImport_Enum]" + } + ], + "type": "TestImport_Object", + "uri": "testimport.uri.eth" + }, + { + "kind": 1025, + "namespace": "TestImport", + "nativeType": "AnotherObject", + "properties": [ + { + "kind": 34, + "name": "prop", + "required": true, + "scalar": { + "kind": 4, + "name": "prop", + "required": true, + "type": "String" + }, + "type": "String" + } + ], + "type": "TestImport_AnotherObject", + "uri": "testimport.uri.eth" + } + ], + "interfaceTypes": [ + { + "capabilities": { + "getImplementations": { + "enabled": true + } + }, + "kind": 32768, + "namespace": "TestImport", + "nativeType": "Interface", + "type": "TestImport", + "uri": "testimport.uri.eth" + } + ], + "moduleType": { + "imports": [ + { + "type": "TestImport_Module" + }, + { + "type": "TestImport_Object" + }, + { + "type": "TestImport_AnotherObject" + }, + { + "type": "TestImport_Enum" + } + ], + "kind": 128, + "methods": [ + { + "arguments": [ + { + "kind": 34, + "name": "str", + "required": true, + "scalar": { + "kind": 4, + "name": "str", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "optStr", + "scalar": { + "kind": 4, + "name": "optStr", + "type": "String" + }, + "type": "String" + }, + { + "enum": { + "kind": 16384, + "name": "en", + "required": true, + "type": "CustomEnum" + }, + "kind": 34, + "name": "en", + "required": true, + "type": "CustomEnum" + }, + { + "enum": { + "kind": 16384, + "name": "optEnum", + "type": "CustomEnum" + }, + "kind": 34, + "name": "optEnum", + "type": "CustomEnum" + }, + { + "array": { + "enum": { + "kind": 16384, + "name": "enumArray", + "required": true, + "type": "CustomEnum" + }, + "item": { + "kind": 16384, + "name": "enumArray", + "required": true, + "type": "CustomEnum" + }, + "kind": 18, + "name": "enumArray", + "required": true, + "type": "[CustomEnum]" + }, + "kind": 34, + "name": "enumArray", + "required": true, + "type": "[CustomEnum]" + }, + { + "array": { + "enum": { + "kind": 16384, + "name": "optEnumArray", + "type": "CustomEnum" + }, + "item": { + "kind": 16384, + "name": "optEnumArray", + "type": "CustomEnum" + }, + "kind": 18, + "name": "optEnumArray", + "type": "[CustomEnum]" + }, + "kind": 34, + "name": "optEnumArray", + "type": "[CustomEnum]" + }, + { + "kind": 34, + "map": { + "key": { + "kind": 4, + "name": "map", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "map", + "required": true, + "scalar": { + "kind": 4, + "name": "map", + "required": true, + "type": "Int" + }, + "type": "Map", + "value": { + "kind": 4, + "name": "map", + "required": true, + "type": "Int" + } + }, + "name": "map", + "required": true, + "type": "Map" + }, + { + "kind": 34, + "map": { + "array": { + "item": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "Int" + }, + "kind": 18, + "name": "mapOfArr", + "required": true, + "scalar": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "Int" + }, + "type": "[Int]" + }, + "key": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "mapOfArr", + "required": true, + "type": "Map", + "value": { + "item": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "Int" + }, + "kind": 18, + "name": "mapOfArr", + "required": true, + "scalar": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "Int" + }, + "type": "[Int]" + } + }, + "name": "mapOfArr", + "required": true, + "type": "Map" + }, + { + "kind": 34, + "map": { + "key": { + "kind": 4, + "name": "mapOfObj", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "mapOfObj", + "object": { + "kind": 8192, + "name": "mapOfObj", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "Map", + "value": { + "kind": 8192, + "name": "mapOfObj", + "required": true, + "type": "AnotherType" + } + }, + "name": "mapOfObj", + "required": true, + "type": "Map" + }, + { + "kind": 34, + "map": { + "array": { + "item": { + "kind": 8192, + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType" + }, + "kind": 18, + "name": "mapOfArrOfObj", + "object": { + "kind": 8192, + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "[AnotherType]" + }, + "key": { + "kind": 4, + "name": "mapOfArrOfObj", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "mapOfArrOfObj", + "required": true, + "type": "Map", + "value": { + "item": { + "kind": 8192, + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType" + }, + "kind": 18, + "name": "mapOfArrOfObj", + "object": { + "kind": 8192, + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "[AnotherType]" + } + }, + "name": "mapOfArrOfObj", + "required": true, + "type": "Map" + } + ], + "kind": 64, + "name": "moduleMethod", + "required": true, + "return": { + "kind": 34, + "name": "moduleMethod", + "required": true, + "scalar": { + "kind": 4, + "name": "moduleMethod", + "required": true, + "type": "Int" + }, + "type": "Int" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "object", + "object": { + "kind": 8192, + "name": "object", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "AnotherType" + }, + { + "kind": 34, + "name": "optObject", + "object": { + "kind": 8192, + "name": "optObject", + "type": "AnotherType" + }, + "type": "AnotherType" + }, + { + "array": { + "item": { + "kind": 8192, + "name": "objectArray", + "required": true, + "type": "AnotherType" + }, + "kind": 18, + "name": "objectArray", + "object": { + "kind": 8192, + "name": "objectArray", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "[AnotherType]" + }, + "kind": 34, + "name": "objectArray", + "required": true, + "type": "[AnotherType]" + }, + { + "array": { + "item": { + "kind": 8192, + "name": "optObjectArray", + "type": "AnotherType" + }, + "kind": 18, + "name": "optObjectArray", + "object": { + "kind": 8192, + "name": "optObjectArray", + "type": "AnotherType" + }, + "type": "[AnotherType]" + }, + "kind": 34, + "name": "optObjectArray", + "type": "[AnotherType]" + } + ], + "env": { + "required": true + }, + "kind": 64, + "name": "objectMethod", + "required": true, + "return": { + "kind": 34, + "name": "objectMethod", + "object": { + "kind": 8192, + "name": "objectMethod", + "type": "AnotherType" + }, + "type": "AnotherType" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "object", + "object": { + "kind": 8192, + "name": "object", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "AnotherType" + }, + { + "kind": 34, + "name": "optObject", + "object": { + "kind": 8192, + "name": "optObject", + "type": "AnotherType" + }, + "type": "AnotherType" + }, + { + "array": { + "item": { + "kind": 8192, + "name": "objectArray", + "required": true, + "type": "AnotherType" + }, + "kind": 18, + "name": "objectArray", + "object": { + "kind": 8192, + "name": "objectArray", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "[AnotherType]" + }, + "kind": 34, + "name": "objectArray", + "required": true, + "type": "[AnotherType]" + }, + { + "array": { + "item": { + "kind": 8192, + "name": "optObjectArray", + "type": "AnotherType" + }, + "kind": 18, + "name": "optObjectArray", + "object": { + "kind": 8192, + "name": "optObjectArray", + "type": "AnotherType" + }, + "type": "[AnotherType]" + }, + "kind": 34, + "name": "optObjectArray", + "type": "[AnotherType]" + } + ], + "env": { + "required": false + }, + "kind": 64, + "name": "optionalEnvMethod", + "required": true, + "return": { + "kind": 34, + "name": "optionalEnvMethod", + "object": { + "kind": 8192, + "name": "optionalEnvMethod", + "type": "AnotherType" + }, + "type": "AnotherType" + }, + "type": "Method" + } + ], + "type": "Module" + }, + "objectTypes": [ + { + "kind": 1, + "properties": [ + { + "kind": 34, + "name": "str", + "required": true, + "scalar": { + "kind": 4, + "name": "str", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "optStr", + "scalar": { + "kind": 4, + "name": "optStr", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "u", + "required": true, + "scalar": { + "kind": 4, + "name": "u", + "required": true, + "type": "UInt" + }, + "type": "UInt" + }, + { + "kind": 34, + "name": "optU", + "scalar": { + "kind": 4, + "name": "optU", + "type": "UInt" + }, + "type": "UInt" + }, + { + "kind": 34, + "name": "u8", + "required": true, + "scalar": { + "kind": 4, + "name": "u8", + "required": true, + "type": "UInt8" + }, + "type": "UInt8" + }, + { + "kind": 34, + "name": "u16", + "required": true, + "scalar": { + "kind": 4, + "name": "u16", + "required": true, + "type": "UInt16" + }, + "type": "UInt16" + }, + { + "kind": 34, + "name": "u32", + "required": true, + "scalar": { + "kind": 4, + "name": "u32", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "i", + "required": true, + "scalar": { + "kind": 4, + "name": "i", + "required": true, + "type": "Int" + }, + "type": "Int" + }, + { + "kind": 34, + "name": "i8", + "required": true, + "scalar": { + "kind": 4, + "name": "i8", + "required": true, + "type": "Int8" + }, + "type": "Int8" + }, + { + "kind": 34, + "name": "i16", + "required": true, + "scalar": { + "kind": 4, + "name": "i16", + "required": true, + "type": "Int16" + }, + "type": "Int16" + }, + { + "kind": 34, + "name": "i32", + "required": true, + "scalar": { + "kind": 4, + "name": "i32", + "required": true, + "type": "Int32" + }, + "type": "Int32" + }, + { + "kind": 34, + "name": "bigint", + "required": true, + "scalar": { + "kind": 4, + "name": "bigint", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "optBigint", + "scalar": { + "kind": 4, + "name": "optBigint", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "bignumber", + "required": true, + "scalar": { + "kind": 4, + "name": "bignumber", + "required": true, + "type": "BigNumber" + }, + "type": "BigNumber" + }, + { + "kind": 34, + "name": "optBignumber", + "scalar": { + "kind": 4, + "name": "optBignumber", + "type": "BigNumber" + }, + "type": "BigNumber" + }, + { + "kind": 34, + "name": "json", + "required": true, + "scalar": { + "kind": 4, + "name": "json", + "required": true, + "type": "JSON" + }, + "type": "JSON" + }, + { + "kind": 34, + "name": "optJson", + "scalar": { + "kind": 4, + "name": "optJson", + "type": "JSON" + }, + "type": "JSON" + }, + { + "kind": 34, + "name": "bytes", + "required": true, + "scalar": { + "kind": 4, + "name": "bytes", + "required": true, + "type": "Bytes" + }, + "type": "Bytes" + }, + { + "kind": 34, + "name": "optBytes", + "scalar": { + "kind": 4, + "name": "optBytes", + "type": "Bytes" + }, + "type": "Bytes" + }, + { + "kind": 34, + "name": "boolean", + "required": true, + "scalar": { + "kind": 4, + "name": "boolean", + "required": true, + "type": "Boolean" + }, + "type": "Boolean" + }, + { + "kind": 34, + "name": "optBoolean", + "scalar": { + "kind": 4, + "name": "optBoolean", + "type": "Boolean" + }, + "type": "Boolean" + }, + { + "array": { + "item": { + "kind": 4, + "name": "uArray", + "required": true, + "type": "UInt" + }, + "kind": 18, + "name": "uArray", + "required": true, + "scalar": { + "kind": 4, + "name": "uArray", + "required": true, + "type": "UInt" + }, + "type": "[UInt]" + }, + "kind": 34, + "name": "uArray", + "required": true, + "type": "[UInt]" + }, + { + "array": { + "item": { + "kind": 4, + "name": "uOptArray", + "required": true, + "type": "UInt" + }, + "kind": 18, + "name": "uOptArray", + "scalar": { + "kind": 4, + "name": "uOptArray", + "required": true, + "type": "UInt" + }, + "type": "[UInt]" + }, + "kind": 34, + "name": "uOptArray", + "type": "[UInt]" + }, + { + "array": { + "item": { + "kind": 4, + "name": "optUOptArray", + "type": "UInt" + }, + "kind": 18, + "name": "optUOptArray", + "scalar": { + "kind": 4, + "name": "optUOptArray", + "type": "UInt" + }, + "type": "[UInt]" + }, + "kind": 34, + "name": "optUOptArray", + "type": "[UInt]" + }, + { + "array": { + "item": { + "kind": 4, + "name": "optStrOptArray", + "type": "String" + }, + "kind": 18, + "name": "optStrOptArray", + "scalar": { + "kind": 4, + "name": "optStrOptArray", + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "optStrOptArray", + "type": "[String]" + }, + { + "array": { + "array": { + "item": { + "kind": 4, + "name": "uArrayArray", + "required": true, + "type": "UInt" + }, + "kind": 18, + "name": "uArrayArray", + "required": true, + "scalar": { + "kind": 4, + "name": "uArrayArray", + "required": true, + "type": "UInt" + }, + "type": "[UInt]" + }, + "item": { + "item": { + "kind": 4, + "name": "uArrayArray", + "required": true, + "type": "UInt" + }, + "kind": 18, + "name": "uArrayArray", + "required": true, + "scalar": { + "kind": 4, + "name": "uArrayArray", + "required": true, + "type": "UInt" + }, + "type": "[UInt]" + }, + "kind": 18, + "name": "uArrayArray", + "required": true, + "type": "[[UInt]]" + }, + "kind": 34, + "name": "uArrayArray", + "required": true, + "type": "[[UInt]]" + }, + { + "array": { + "array": { + "item": { + "kind": 4, + "name": "uOptArrayOptArray", + "type": "UInt32" + }, + "kind": 18, + "name": "uOptArrayOptArray", + "scalar": { + "kind": 4, + "name": "uOptArrayOptArray", + "type": "UInt32" + }, + "type": "[UInt32]" + }, + "item": { + "item": { + "kind": 4, + "name": "uOptArrayOptArray", + "type": "UInt32" + }, + "kind": 18, + "name": "uOptArrayOptArray", + "scalar": { + "kind": 4, + "name": "uOptArrayOptArray", + "type": "UInt32" + }, + "type": "[UInt32]" + }, + "kind": 18, + "name": "uOptArrayOptArray", + "required": true, + "type": "[[UInt32]]" + }, + "kind": 34, + "name": "uOptArrayOptArray", + "required": true, + "type": "[[UInt32]]" + }, + { + "array": { + "array": { + "array": { + "item": { + "kind": 4, + "name": "uArrayOptArrayArray", + "required": true, + "type": "UInt32" + }, + "kind": 18, + "name": "uArrayOptArrayArray", + "required": true, + "scalar": { + "kind": 4, + "name": "uArrayOptArrayArray", + "required": true, + "type": "UInt32" + }, + "type": "[UInt32]" + }, + "item": { + "item": { + "kind": 4, + "name": "uArrayOptArrayArray", + "required": true, + "type": "UInt32" + }, + "kind": 18, + "name": "uArrayOptArrayArray", + "required": true, + "scalar": { + "kind": 4, + "name": "uArrayOptArrayArray", + "required": true, + "type": "UInt32" + }, + "type": "[UInt32]" + }, + "kind": 18, + "name": "uArrayOptArrayArray", + "type": "[[UInt32]]" + }, + "item": { + "array": { + "item": { + "kind": 4, + "name": "uArrayOptArrayArray", + "required": true, + "type": "UInt32" + }, + "kind": 18, + "name": "uArrayOptArrayArray", + "required": true, + "scalar": { + "kind": 4, + "name": "uArrayOptArrayArray", + "required": true, + "type": "UInt32" + }, + "type": "[UInt32]" + }, + "item": { + "item": { + "kind": 4, + "name": "uArrayOptArrayArray", + "required": true, + "type": "UInt32" + }, + "kind": 18, + "name": "uArrayOptArrayArray", + "required": true, + "scalar": { + "kind": 4, + "name": "uArrayOptArrayArray", + "required": true, + "type": "UInt32" + }, + "type": "[UInt32]" + }, + "kind": 18, + "name": "uArrayOptArrayArray", + "type": "[[UInt32]]" + }, + "kind": 18, + "name": "uArrayOptArrayArray", + "required": true, + "type": "[[[UInt32]]]" + }, + "kind": 34, + "name": "uArrayOptArrayArray", + "required": true, + "type": "[[[UInt32]]]" + }, + { + "array": { + "array": { + "array": { + "array": { + "item": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "kind": 18, + "name": "crazyArray", + "scalar": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "type": "[UInt32]" + }, + "item": { + "item": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "kind": 18, + "name": "crazyArray", + "scalar": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "type": "[UInt32]" + }, + "kind": 18, + "name": "crazyArray", + "required": true, + "type": "[[UInt32]]" + }, + "item": { + "array": { + "item": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "kind": 18, + "name": "crazyArray", + "scalar": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "type": "[UInt32]" + }, + "item": { + "item": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "kind": 18, + "name": "crazyArray", + "scalar": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "type": "[UInt32]" + }, + "kind": 18, + "name": "crazyArray", + "required": true, + "type": "[[UInt32]]" + }, + "kind": 18, + "name": "crazyArray", + "type": "[[[UInt32]]]" + }, + "item": { + "array": { + "array": { + "item": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "kind": 18, + "name": "crazyArray", + "scalar": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "type": "[UInt32]" + }, + "item": { + "item": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "kind": 18, + "name": "crazyArray", + "scalar": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "type": "[UInt32]" + }, + "kind": 18, + "name": "crazyArray", + "required": true, + "type": "[[UInt32]]" + }, + "item": { + "array": { + "item": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "kind": 18, + "name": "crazyArray", + "scalar": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "type": "[UInt32]" + }, + "item": { + "item": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "kind": 18, + "name": "crazyArray", + "scalar": { + "kind": 4, + "name": "crazyArray", + "required": true, + "type": "UInt32" + }, + "type": "[UInt32]" + }, + "kind": 18, + "name": "crazyArray", + "required": true, + "type": "[[UInt32]]" + }, + "kind": 18, + "name": "crazyArray", + "type": "[[[UInt32]]]" + }, + "kind": 18, + "name": "crazyArray", + "type": "[[[[UInt32]]]]" + }, + "kind": 34, + "name": "crazyArray", + "type": "[[[[UInt32]]]]" + }, + { + "kind": 34, + "name": "object", + "object": { + "kind": 8192, + "name": "object", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "AnotherType" + }, + { + "kind": 34, + "name": "optObject", + "object": { + "kind": 8192, + "name": "optObject", + "type": "AnotherType" + }, + "type": "AnotherType" + }, + { + "array": { + "item": { + "kind": 8192, + "name": "objectArray", + "required": true, + "type": "AnotherType" + }, + "kind": 18, + "name": "objectArray", + "object": { + "kind": 8192, + "name": "objectArray", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "[AnotherType]" + }, + "kind": 34, + "name": "objectArray", + "required": true, + "type": "[AnotherType]" + }, + { + "array": { + "item": { + "kind": 8192, + "name": "optObjectArray", + "type": "AnotherType" + }, + "kind": 18, + "name": "optObjectArray", + "object": { + "kind": 8192, + "name": "optObjectArray", + "type": "AnotherType" + }, + "type": "[AnotherType]" + }, + "kind": 34, + "name": "optObjectArray", + "type": "[AnotherType]" + }, + { + "enum": { + "kind": 16384, + "name": "en", + "required": true, + "type": "CustomEnum" + }, + "kind": 34, + "name": "en", + "required": true, + "type": "CustomEnum" + }, + { + "enum": { + "kind": 16384, + "name": "optEnum", + "type": "CustomEnum" + }, + "kind": 34, + "name": "optEnum", + "type": "CustomEnum" + }, + { + "array": { + "enum": { + "kind": 16384, + "name": "enumArray", + "required": true, + "type": "CustomEnum" + }, + "item": { + "kind": 16384, + "name": "enumArray", + "required": true, + "type": "CustomEnum" + }, + "kind": 18, + "name": "enumArray", + "required": true, + "type": "[CustomEnum]" + }, + "kind": 34, + "name": "enumArray", + "required": true, + "type": "[CustomEnum]" + }, + { + "array": { + "enum": { + "kind": 16384, + "name": "optEnumArray", + "type": "CustomEnum" + }, + "item": { + "kind": 16384, + "name": "optEnumArray", + "type": "CustomEnum" + }, + "kind": 18, + "name": "optEnumArray", + "type": "[CustomEnum]" + }, + "kind": 34, + "name": "optEnumArray", + "type": "[CustomEnum]" + }, + { + "kind": 34, + "map": { + "key": { + "kind": 4, + "name": "map", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "map", + "required": true, + "scalar": { + "kind": 4, + "name": "map", + "required": true, + "type": "Int" + }, + "type": "Map", + "value": { + "kind": 4, + "name": "map", + "required": true, + "type": "Int" + } + }, + "name": "map", + "required": true, + "type": "Map" + }, + { + "kind": 34, + "map": { + "array": { + "item": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "Int" + }, + "kind": 18, + "name": "mapOfArr", + "required": true, + "scalar": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "Int" + }, + "type": "[Int]" + }, + "key": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "mapOfArr", + "required": true, + "type": "Map", + "value": { + "item": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "Int" + }, + "kind": 18, + "name": "mapOfArr", + "required": true, + "scalar": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "Int" + }, + "type": "[Int]" + } + }, + "name": "mapOfArr", + "required": true, + "type": "Map" + }, + { + "kind": 34, + "map": { + "key": { + "kind": 4, + "name": "mapOfObj", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "mapOfObj", + "object": { + "kind": 8192, + "name": "mapOfObj", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "Map", + "value": { + "kind": 8192, + "name": "mapOfObj", + "required": true, + "type": "AnotherType" + } + }, + "name": "mapOfObj", + "required": true, + "type": "Map" + }, + { + "kind": 34, + "map": { + "array": { + "item": { + "kind": 8192, + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType" + }, + "kind": 18, + "name": "mapOfArrOfObj", + "object": { + "kind": 8192, + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "[AnotherType]" + }, + "key": { + "kind": 4, + "name": "mapOfArrOfObj", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "mapOfArrOfObj", + "required": true, + "type": "Map", + "value": { + "item": { + "kind": 8192, + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType" + }, + "kind": 18, + "name": "mapOfArrOfObj", + "object": { + "kind": 8192, + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "[AnotherType]" + } + }, + "name": "mapOfArrOfObj", + "required": true, + "type": "Map" + } + ], + "type": "CustomType" + }, + { + "kind": 1, + "properties": [ + { + "kind": 34, + "name": "prop", + "scalar": { + "kind": 4, + "name": "prop", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "circular", + "object": { + "kind": 8192, + "name": "circular", + "type": "CustomType" + }, + "type": "CustomType" + }, + { + "kind": 34, + "name": "const", + "scalar": { + "kind": 4, + "name": "const", + "type": "String" + }, + "type": "String" + } + ], + "type": "AnotherType" + } + ], + "version": "0.1" +} +} diff --git a/packages/test-cases/cases/cli/app/codegen/001-sanity/polywrap.app.yaml b/packages/test-cases/cases/cli/app/codegen/001-sanity/polywrap.app.yaml index e5be3185ca..3854cadc4a 100644 --- a/packages/test-cases/cases/cli/app/codegen/001-sanity/polywrap.app.yaml +++ b/packages/test-cases/cases/cli/app/codegen/001-sanity/polywrap.app.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: test-app language: app/typescript schema: ./schema.graphql diff --git a/packages/test-cases/cases/cli/app/codegen/002-with-plugin/polywrap.app.yaml b/packages/test-cases/cases/cli/app/codegen/002-with-plugin/polywrap.app.yaml index 1273135f2b..f14f431745 100644 --- a/packages/test-cases/cases/cli/app/codegen/002-with-plugin/polywrap.app.yaml +++ b/packages/test-cases/cases/cli/app/codegen/002-with-plugin/polywrap.app.yaml @@ -1,7 +1,7 @@ -format: 0.1.0 +format: "0.2" name: test-app language: app/typescript schema: ./schema.graphql -import_redirects: +import_abis: - uri: "wrap://ens/plugin.eth" - schema: "./../../../../../../js/plugins/http/build/schema.graphql" + abi: "./../../../../../../js/plugins/http/build/wrap.info" diff --git a/packages/test-cases/cases/cli/app/codegen/003-multi-import/polywrap.app.yaml b/packages/test-cases/cases/cli/app/codegen/003-multi-import/polywrap.app.yaml index 4ecbe3d26a..737280d0ae 100644 --- a/packages/test-cases/cases/cli/app/codegen/003-multi-import/polywrap.app.yaml +++ b/packages/test-cases/cases/cli/app/codegen/003-multi-import/polywrap.app.yaml @@ -1,9 +1,9 @@ -format: 0.1.0 +format: "0.2" name: test-app language: app/typescript schema: ./schema.graphql -import_redirects: +import_abis: - uri: "wrap://ens/ethereum.polywrap.eth" - schema: "./../../../../../../js/plugins/ethereum/build/schema.graphql" + abi: "./../../../../../../js/plugins/ethereum/build/wrap.info" - uri: "wrap://ipfs/QmVGwj3FtvhiErJ1wWbmRuHpvEQ3t1BPNESvEiMJM57p2y" - schema: "./../../../../../../js/plugins/logger/build/schema.graphql" + abi: "./../../../../../../js/plugins/logger/build/wrap.info" diff --git a/packages/test-cases/cases/cli/app/codegen/004-custom-config/config.ts b/packages/test-cases/cases/cli/app/codegen/004-custom-config/config.ts index a51cd93907..0fa0a5a83b 100644 --- a/packages/test-cases/cases/cli/app/codegen/004-custom-config/config.ts +++ b/packages/test-cases/cases/cli/app/codegen/004-custom-config/config.ts @@ -1,5 +1,6 @@ import { PolywrapClientConfig } from "@polywrap/client-js"; import { PluginModule } from "@polywrap/core-js"; +import { latestWrapManifestVersion, WrapManifest } from "@polywrap/wrap-manifest-types-js"; interface Config extends Record { val: number; @@ -20,16 +21,7 @@ class MockPlugin extends PluginModule { const mockPlugin = () => { return { factory: () => new MockPlugin({ val: 0 }), - manifest: { - schema: ` - type Module { - getData: Int! - setData(value: Int!): Boolean! - deployContract: String! - } - `, - implements: [], - }, + manifest: mockPluginManifest }; }; @@ -49,3 +41,86 @@ export function getClientConfig(defaultConfigs: Partial) { } return defaultConfigs; } + +export const mockPluginManifest: WrapManifest = { + name: "mock", + type: "plugin", + version: latestWrapManifestVersion, + abi: { + "version": "0.1", + "moduleType": { + "type": "Module", + "kind": 128, + "methods": [ + { + "type": "Method", + "name": "getData", + "required": true, + "kind": 64, + "return": { + "type": "Int", + "name": "getData", + "required": true, + "kind": 34, + "scalar": { + "type": "Int", + "name": "getData", + "required": true, + "kind": 4 + } + } + }, + { + "type": "Method", + "name": "setData", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "Int", + "name": "value", + "required": true, + "kind": 34, + "scalar": { + "type": "Int", + "name": "value", + "required": true, + "kind": 4 + } + } + ], + "return": { + "type": "Boolean", + "name": "setData", + "required": true, + "kind": 34, + "scalar": { + "type": "Boolean", + "name": "setData", + "required": true, + "kind": 4 + } + } + }, + { + "type": "Method", + "name": "deployContract", + "required": true, + "kind": 64, + "return": { + "type": "String", + "name": "deployContract", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "deployContract", + "required": true, + "kind": 4 + } + } + } + ] + } + } +} diff --git a/packages/test-cases/cases/cli/app/codegen/004-custom-config/polywrap.app.yaml b/packages/test-cases/cases/cli/app/codegen/004-custom-config/polywrap.app.yaml index e5be3185ca..3854cadc4a 100644 --- a/packages/test-cases/cases/cli/app/codegen/004-custom-config/polywrap.app.yaml +++ b/packages/test-cases/cases/cli/app/codegen/004-custom-config/polywrap.app.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: test-app language: app/typescript schema: ./schema.graphql diff --git a/packages/test-cases/cases/cli/app/codegen/005-custom-manifest-file/polywrap.custom.app.yaml b/packages/test-cases/cases/cli/app/codegen/005-custom-manifest-file/polywrap.custom.app.yaml index e5be3185ca..3854cadc4a 100644 --- a/packages/test-cases/cases/cli/app/codegen/005-custom-manifest-file/polywrap.custom.app.yaml +++ b/packages/test-cases/cases/cli/app/codegen/005-custom-manifest-file/polywrap.custom.app.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: test-app language: app/typescript schema: ./schema.graphql diff --git a/packages/test-cases/cases/cli/docgen/001-sanity/package.json b/packages/test-cases/cases/cli/docgen/001-sanity/package.json index 50cccdf499..0e7747dc4a 100644 --- a/packages/test-cases/cases/cli/docgen/001-sanity/package.json +++ b/packages/test-cases/cases/cli/docgen/001-sanity/package.json @@ -7,7 +7,7 @@ "build": "polywrap build" }, "dependencies": { - "@polywrap/wasm-as": "0.2.0" + "@polywrap/wasm-as": "0.3.0" }, "devDependencies": { "assemblyscript": "0.19.5" diff --git a/packages/test-cases/cases/cli/docgen/001-sanity/polywrap.yaml b/packages/test-cases/cases/cli/docgen/001-sanity/polywrap.yaml index 0c24cfe4f6..a4e446d3b1 100644 --- a/packages/test-cases/cases/cli/docgen/001-sanity/polywrap.yaml +++ b/packages/test-cases/cases/cli/docgen/001-sanity/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: test-project build: ./polywrap.build.yaml language: wasm/assemblyscript diff --git a/packages/test-cases/cases/cli/docgen/002-custom-config/config.ts b/packages/test-cases/cases/cli/docgen/002-custom-config/config.ts index a51cd93907..cd5b1b6220 100644 --- a/packages/test-cases/cases/cli/docgen/002-custom-config/config.ts +++ b/packages/test-cases/cases/cli/docgen/002-custom-config/config.ts @@ -1,5 +1,6 @@ import { PolywrapClientConfig } from "@polywrap/client-js"; import { PluginModule } from "@polywrap/core-js"; +import { latestWrapManifestVersion, WrapManifest } from "@polywrap/wrap-manifest-types-js"; interface Config extends Record { val: number; @@ -20,16 +21,7 @@ class MockPlugin extends PluginModule { const mockPlugin = () => { return { factory: () => new MockPlugin({ val: 0 }), - manifest: { - schema: ` - type Module { - getData: Int! - setData(value: Int!): Boolean! - deployContract: String! - } - `, - implements: [], - }, + manifest: mockPluginManifest }; }; @@ -49,3 +41,87 @@ export function getClientConfig(defaultConfigs: Partial) { } return defaultConfigs; } + +export const mockPluginManifest: WrapManifest = { + name: "mock", + type: "plugin", + version: latestWrapManifestVersion, + abi: { + "version": "0.1", + "moduleType": { + "type": "Module", + "kind": 128, + "methods": [ + { + "type": "Method", + "name": "getData", + "required": true, + "kind": 64, + "return": { + "type": "Int", + "name": "getData", + "required": true, + "kind": 34, + "scalar": { + "type": "Int", + "name": "getData", + "required": true, + "kind": 4 + } + } + }, + { + "type": "Method", + "name": "setData", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "Int", + "name": "value", + "required": true, + "kind": 34, + "scalar": { + "type": "Int", + "name": "value", + "required": true, + "kind": 4 + } + } + ], + "return": { + "type": "Boolean", + "name": "setData", + "required": true, + "kind": 34, + "scalar": { + "type": "Boolean", + "name": "setData", + "required": true, + "kind": 4 + } + } + }, + { + "type": "Method", + "name": "deployContract", + "required": true, + "kind": 64, + "return": { + "type": "String", + "name": "deployContract", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "deployContract", + "required": true, + "kind": 4 + } + } + } + ] + } + } +} + diff --git a/packages/test-cases/cases/cli/docgen/002-custom-config/package.json b/packages/test-cases/cases/cli/docgen/002-custom-config/package.json index 50cccdf499..0e7747dc4a 100644 --- a/packages/test-cases/cases/cli/docgen/002-custom-config/package.json +++ b/packages/test-cases/cases/cli/docgen/002-custom-config/package.json @@ -7,7 +7,7 @@ "build": "polywrap build" }, "dependencies": { - "@polywrap/wasm-as": "0.2.0" + "@polywrap/wasm-as": "0.3.0" }, "devDependencies": { "assemblyscript": "0.19.5" diff --git a/packages/test-cases/cases/cli/docgen/002-custom-config/polywrap.yaml b/packages/test-cases/cases/cli/docgen/002-custom-config/polywrap.yaml index 0c24cfe4f6..a4e446d3b1 100644 --- a/packages/test-cases/cases/cli/docgen/002-custom-config/polywrap.yaml +++ b/packages/test-cases/cases/cli/docgen/002-custom-config/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: test-project build: ./polywrap.build.yaml language: wasm/assemblyscript diff --git a/packages/test-cases/cases/cli/docgen/003-custom-manifest-file/package.json b/packages/test-cases/cases/cli/docgen/003-custom-manifest-file/package.json index 50cccdf499..0e7747dc4a 100644 --- a/packages/test-cases/cases/cli/docgen/003-custom-manifest-file/package.json +++ b/packages/test-cases/cases/cli/docgen/003-custom-manifest-file/package.json @@ -7,7 +7,7 @@ "build": "polywrap build" }, "dependencies": { - "@polywrap/wasm-as": "0.2.0" + "@polywrap/wasm-as": "0.3.0" }, "devDependencies": { "assemblyscript": "0.19.5" diff --git a/packages/test-cases/cases/cli/docgen/003-custom-manifest-file/polywrap.custom.yaml b/packages/test-cases/cases/cli/docgen/003-custom-manifest-file/polywrap.custom.yaml index 0c24cfe4f6..a4e446d3b1 100644 --- a/packages/test-cases/cases/cli/docgen/003-custom-manifest-file/polywrap.custom.yaml +++ b/packages/test-cases/cases/cli/docgen/003-custom-manifest-file/polywrap.custom.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: test-project build: ./polywrap.build.yaml language: wasm/assemblyscript diff --git a/packages/test-cases/cases/cli/docgen/004-app/polywrap.app.yaml b/packages/test-cases/cases/cli/docgen/004-app/polywrap.app.yaml index e9d6f43335..a4a7aa5802 100644 --- a/packages/test-cases/cases/cli/docgen/004-app/polywrap.app.yaml +++ b/packages/test-cases/cases/cli/docgen/004-app/polywrap.app.yaml @@ -1,9 +1,9 @@ -format: 0.1.0 +format: "0.2" name: test-app language: app/typescript schema: ./schema.graphql -import_redirects: +import_abis: - uri: "wrap://ens/ethereum.polywrap.eth" - schema: "./../../../../../js/plugins/ethereum/build/schema.graphql" + abi: "./../../../../../js/plugins/ethereum/build/wrap.info" - uri: "wrap://ipfs/QmVGwj3FtvhiErJ1wWbmRuHpvEQ3t1BPNESvEiMJM57p2y" - schema: "./../../../../../js/plugins/logger/build/schema.graphql" + abi: "./../../../../../js/plugins/logger/build/wrap.info" diff --git a/packages/test-cases/cases/cli/docgen/005-wasm/package.json b/packages/test-cases/cases/cli/docgen/005-wasm/package.json index 52c8a2560f..0e7747dc4a 100644 --- a/packages/test-cases/cases/cli/docgen/005-wasm/package.json +++ b/packages/test-cases/cases/cli/docgen/005-wasm/package.json @@ -7,7 +7,7 @@ "build": "polywrap build" }, "dependencies": { - "@polywrap/wasm-as": "0.1.0" + "@polywrap/wasm-as": "0.3.0" }, "devDependencies": { "assemblyscript": "0.19.5" diff --git a/packages/test-cases/cases/cli/docgen/005-wasm/polywrap.yaml b/packages/test-cases/cases/cli/docgen/005-wasm/polywrap.yaml index 0c24cfe4f6..a4e446d3b1 100644 --- a/packages/test-cases/cases/cli/docgen/005-wasm/polywrap.yaml +++ b/packages/test-cases/cases/cli/docgen/005-wasm/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: test-project build: ./polywrap.build.yaml language: wasm/assemblyscript diff --git a/packages/test-cases/cases/cli/docgen/006-plugin/polywrap.plugin.yaml b/packages/test-cases/cases/cli/docgen/006-plugin/polywrap.plugin.yaml index 7a95fddd10..b6e429cf4e 100644 --- a/packages/test-cases/cases/cli/docgen/006-plugin/polywrap.plugin.yaml +++ b/packages/test-cases/cases/cli/docgen/006-plugin/polywrap.plugin.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: Test language: plugin/typescript schema: ./schema.graphql diff --git a/packages/test-cases/cases/cli/docgen/007-docusaurus/polywrap.yaml b/packages/test-cases/cases/cli/docgen/007-docusaurus/polywrap.yaml index 0c24cfe4f6..a4e446d3b1 100644 --- a/packages/test-cases/cases/cli/docgen/007-docusaurus/polywrap.yaml +++ b/packages/test-cases/cases/cli/docgen/007-docusaurus/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: test-project build: ./polywrap.build.yaml language: wasm/assemblyscript diff --git a/packages/test-cases/cases/cli/docgen/008-jsdoc/polywrap.yaml b/packages/test-cases/cases/cli/docgen/008-jsdoc/polywrap.yaml index 211f925f4f..b4f64cde3d 100644 --- a/packages/test-cases/cases/cli/docgen/008-jsdoc/polywrap.yaml +++ b/packages/test-cases/cases/cli/docgen/008-jsdoc/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: test-project build: ./polywrap.build.yaml language: wasm/assemblyscript diff --git a/packages/test-cases/cases/cli/docgen/009-schema/polywrap.yaml b/packages/test-cases/cases/cli/docgen/009-schema/polywrap.yaml index 211f925f4f..b4f64cde3d 100644 --- a/packages/test-cases/cases/cli/docgen/009-schema/polywrap.yaml +++ b/packages/test-cases/cases/cli/docgen/009-schema/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: test-project build: ./polywrap.build.yaml language: wasm/assemblyscript diff --git a/packages/test-cases/cases/cli/docgen/009-schema/schema.graphql b/packages/test-cases/cases/cli/docgen/009-schema/schema.graphql index b0d85780b9..47f526f13a 100644 --- a/packages/test-cases/cases/cli/docgen/009-schema/schema.graphql +++ b/packages/test-cases/cases/cli/docgen/009-schema/schema.graphql @@ -1,35 +1,35 @@ #import { Module } into Ethereum from "ens/ethereum.polywrap.eth" type Module { - method( - str: String! - optStr: String - ): Object! + method( + str: String! + optStr: String + ): Object! } type Object { - u: UInt! - array: [Boolean!]! - bytes: Bytes + u: UInt! + array: [Boolean!]! + bytes: Bytes } """Test Comment""" type Object2 { - """Test Comment""" - u: UInt! - """Test Comment""" - array: [Boolean!]! - """Test Comment""" - bytes: Bytes + """Test Comment""" + u: UInt! + """Test Comment""" + array: [Boolean!]! + """Test Comment""" + bytes: Bytes } type Object3 { - u: UInt! - array: [Boolean!]! - bytes: Bytes + u: UInt! + array: [Boolean!]! + bytes: Bytes } enum test { - ARG1, - ARG2 + ARG1, + ARG2 } diff --git a/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/build-artifacts/polywrap.plugin.json b/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/build-artifacts/polywrap.plugin.json deleted file mode 100644 index 020adca63c..0000000000 --- a/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/build-artifacts/polywrap.plugin.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "format": "0.1.0", - "name": "Test", - "language": "plugin/typescript", - "schema": "./schema.graphql", - "module": "./src/index.ts" -} \ No newline at end of file diff --git a/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/build-artifacts/schema.graphql b/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/build-artifacts/schema.graphql deleted file mode 100644 index f897f36cce..0000000000 --- a/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/build-artifacts/schema.graphql +++ /dev/null @@ -1,386 +0,0 @@ -### Polywrap Header START ### -scalar UInt -scalar UInt8 -scalar UInt16 -scalar UInt32 -scalar Int -scalar Int8 -scalar Int16 -scalar Int32 -scalar Bytes -scalar BigInt -scalar BigNumber -scalar JSON -scalar Map - -directive @imported( - uri: String! - namespace: String! - nativeType: String! -) on OBJECT | ENUM - -directive @imports( - types: [String!]! -) on OBJECT - -directive @capability( - type: String! - uri: String! - namespace: String! -) repeatable on OBJECT - -directive @enabled_interface on OBJECT - -directive @annotate(type: String!) on FIELD - -directive @env(required: Boolean!) on FIELD_DEFINITION - -### Polywrap Header END ### - -type Module @imports( - types: [ - "Ethereum_Module", - "Ethereum_Connection", - "Ethereum_TxOverrides", - "Ethereum_StaticTxResult", - "Ethereum_TxRequest", - "Ethereum_TxReceipt", - "Ethereum_Log", - "Ethereum_EventNotification", - "Ethereum_Network", - "Ethereum_TxResponse", - "Ethereum_Access" - ] -) { - methodOne( - str: String! - optStr: String - ): Object! - - methodTwo( - arg: UInt32! - ): String! -} - -type Env { - arg1: String! -} - -type Object { - u: UInt! - array: [Boolean!]! - bytes: Bytes -} - -### Imported Modules START ### - -type Ethereum_Module @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Module" -) { - callContractView( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - ): String! - - callContractStatic( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): Ethereum_StaticTxResult! - - getBalance( - address: String! - blockTag: BigInt - connection: Ethereum_Connection - ): BigInt! - - encodeParams( - types: [String!]! - values: [String!]! - ): String! - - encodeFunction( - method: String! - args: [String!] - ): String! - - solidityPack( - types: [String!]! - values: [String!]! - ): String! - - solidityKeccak256( - types: [String!]! - values: [String!]! - ): String! - - soliditySha256( - types: [String!]! - values: [String!]! - ): String! - - getSignerAddress( - connection: Ethereum_Connection - ): String! - - getSignerBalance( - blockTag: BigInt - connection: Ethereum_Connection - ): BigInt! - - getSignerTransactionCount( - blockTag: BigInt - connection: Ethereum_Connection - ): BigInt! - - getGasPrice( - connection: Ethereum_Connection - ): BigInt! - - estimateTransactionGas( - tx: Ethereum_TxRequest! - connection: Ethereum_Connection - ): BigInt! - - estimateContractCallGas( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): BigInt! - - checkAddress( - address: String! - ): Boolean! - - toWei( - eth: String! - ): BigInt! - - toEth( - wei: BigInt! - ): String! - - awaitTransaction( - txHash: String! - confirmations: UInt32! - timeout: UInt32! - connection: Ethereum_Connection - ): Ethereum_TxReceipt! - - waitForEvent( - address: String! - event: String! - args: [String!] - timeout: UInt32 - connection: Ethereum_Connection - ): Ethereum_EventNotification! - - getNetwork( - connection: Ethereum_Connection - ): Ethereum_Network! - - requestAccounts( - connection: Ethereum_Connection - ): [String!]! - - callContractMethod( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): Ethereum_TxResponse! - - callContractMethodAndWait( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): Ethereum_TxReceipt! - - sendTransaction( - tx: Ethereum_TxRequest! - connection: Ethereum_Connection - ): Ethereum_TxResponse! - - sendTransactionAndWait( - tx: Ethereum_TxRequest! - connection: Ethereum_Connection - ): Ethereum_TxReceipt! - - deployContract( - abi: String! - bytecode: String! - args: [String!] - connection: Ethereum_Connection - ): String! - - signMessage( - message: String! - connection: Ethereum_Connection - ): String! - - sendRPC( - method: String! - params: [String!]! - connection: Ethereum_Connection - ): String -} - -### Imported Modules END ### - -### Imported Objects START ### - -type Ethereum_Connection @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Connection" -) { - node: String - networkNameOrChainId: String -} - -type Ethereum_TxOverrides @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxOverrides" -) { - gasLimit: BigInt - gasPrice: BigInt - value: BigInt -} - -type Ethereum_StaticTxResult @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "StaticTxResult" -) { - result: String! - error: Boolean! -} - -type Ethereum_TxRequest @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxRequest" -) { - to: String - from: String - nonce: UInt32 - gasLimit: BigInt - gasPrice: BigInt - data: String - value: BigInt - chainId: BigInt - type: UInt32 -} - -type Ethereum_TxReceipt @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxReceipt" -) { - to: String! - from: String! - contractAddress: String! - transactionIndex: UInt32! - root: String - gasUsed: BigInt! - logsBloom: String! - transactionHash: String! - logs: [Ethereum_Log!]! - blockNumber: BigInt! - blockHash: String! - confirmations: UInt32! - cumulativeGasUsed: BigInt! - effectiveGasPrice: BigInt! - byzantium: Boolean! - type: UInt32! - status: UInt32 -} - -type Ethereum_Log @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Log" -) { - blockNumber: BigInt! - blockHash: String! - transactionIndex: UInt32! - removed: Boolean! - address: String! - data: String! - topics: [String!]! - transactionHash: String! - logIndex: UInt32! -} - -type Ethereum_EventNotification @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "EventNotification" -) { - data: String! - address: String! - log: Ethereum_Log! -} - -type Ethereum_Network @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Network" -) { - name: String! - chainId: BigInt! - ensAddress: String -} - -type Ethereum_TxResponse @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxResponse" -) { - hash: String! - to: String - from: String! - nonce: UInt32! - gasLimit: BigInt! - gasPrice: BigInt - data: String! - value: BigInt! - chainId: BigInt! - blockNumber: BigInt - blockHash: String - timestamp: UInt32 - confirmations: UInt32! - raw: String - r: String - s: String - v: UInt32 - type: UInt32 - accessList: [Ethereum_Access!] -} - -type Ethereum_Access @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Access" -) { - address: String! - storageKeys: [String!]! -} - -### Imported Objects END ### - -### Imported Envs START ### - -### Imported Envs END ### diff --git a/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/build-artifacts/wrap.info b/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/build-artifacts/wrap.info new file mode 100644 index 0000000000..d79a2831a2 Binary files /dev/null and b/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/build-artifacts/wrap.info differ diff --git a/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/stdout.json b/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/stdout.json index d9b77bbc00..d1dc098fa5 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/stdout.json +++ b/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/stdout.json @@ -2,7 +2,7 @@ "stdout": [ "Manifest loaded from ./polywrap.plugin.yaml", "Generate types", - "Manifest written to ./build/polywrap.plugin.json" + "Manifest written to ./build/wrap.info" ], "exitCode": 0 } diff --git a/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/index.ts b/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/index.ts index f367d143d9..315871f96d 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/index.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/index.ts @@ -1,8 +1,7 @@ /// NOTE: This is an auto-generated file. /// All modifications will be overwritten. -export * from "./schema"; -export * from "./manifest"; +export * from "./wrap.info"; export * from "./module"; export * from "./types"; diff --git a/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/manifest.ts b/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/manifest.ts deleted file mode 100644 index 730cf8326f..0000000000 --- a/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/manifest.ts +++ /dev/null @@ -1,15 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { schema } from "./"; - -// @ts-ignore -import { PluginPackageManifest, Uri } from "@polywrap/core-js"; - -export const manifest: PluginPackageManifest = { - schema, - implements: [ - ], -}; diff --git a/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/schema.ts b/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/schema.ts deleted file mode 100644 index d4cd2b562d..0000000000 --- a/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/schema.ts +++ /dev/null @@ -1,390 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export const schema: string = `### Polywrap Header START ### -scalar UInt -scalar UInt8 -scalar UInt16 -scalar UInt32 -scalar Int -scalar Int8 -scalar Int16 -scalar Int32 -scalar Bytes -scalar BigInt -scalar BigNumber -scalar JSON -scalar Map - -directive @imported( - uri: String! - namespace: String! - nativeType: String! -) on OBJECT | ENUM - -directive @imports( - types: [String!]! -) on OBJECT - -directive @capability( - type: String! - uri: String! - namespace: String! -) repeatable on OBJECT - -directive @enabled_interface on OBJECT - -directive @annotate(type: String!) on FIELD - -directive @env(required: Boolean!) on FIELD_DEFINITION - -### Polywrap Header END ### - -type Module @imports( - types: [ - "Ethereum_Module", - "Ethereum_Connection", - "Ethereum_TxOverrides", - "Ethereum_StaticTxResult", - "Ethereum_TxRequest", - "Ethereum_TxReceipt", - "Ethereum_Log", - "Ethereum_EventNotification", - "Ethereum_Network", - "Ethereum_TxResponse", - "Ethereum_Access" - ] -) { - methodOne( - str: String! - optStr: String - ): Object! - - methodTwo( - arg: UInt32! - ): String! -} - -type Env { - arg1: String! -} - -type Object { - u: UInt! - array: [Boolean!]! - bytes: Bytes -} - -### Imported Modules START ### - -type Ethereum_Module @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Module" -) { - callContractView( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - ): String! - - callContractStatic( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): Ethereum_StaticTxResult! - - getBalance( - address: String! - blockTag: BigInt - connection: Ethereum_Connection - ): BigInt! - - encodeParams( - types: [String!]! - values: [String!]! - ): String! - - encodeFunction( - method: String! - args: [String!] - ): String! - - solidityPack( - types: [String!]! - values: [String!]! - ): String! - - solidityKeccak256( - types: [String!]! - values: [String!]! - ): String! - - soliditySha256( - types: [String!]! - values: [String!]! - ): String! - - getSignerAddress( - connection: Ethereum_Connection - ): String! - - getSignerBalance( - blockTag: BigInt - connection: Ethereum_Connection - ): BigInt! - - getSignerTransactionCount( - blockTag: BigInt - connection: Ethereum_Connection - ): BigInt! - - getGasPrice( - connection: Ethereum_Connection - ): BigInt! - - estimateTransactionGas( - tx: Ethereum_TxRequest! - connection: Ethereum_Connection - ): BigInt! - - estimateContractCallGas( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): BigInt! - - checkAddress( - address: String! - ): Boolean! - - toWei( - eth: String! - ): BigInt! - - toEth( - wei: BigInt! - ): String! - - awaitTransaction( - txHash: String! - confirmations: UInt32! - timeout: UInt32! - connection: Ethereum_Connection - ): Ethereum_TxReceipt! - - waitForEvent( - address: String! - event: String! - args: [String!] - timeout: UInt32 - connection: Ethereum_Connection - ): Ethereum_EventNotification! - - getNetwork( - connection: Ethereum_Connection - ): Ethereum_Network! - - requestAccounts( - connection: Ethereum_Connection - ): [String!]! - - callContractMethod( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): Ethereum_TxResponse! - - callContractMethodAndWait( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): Ethereum_TxReceipt! - - sendTransaction( - tx: Ethereum_TxRequest! - connection: Ethereum_Connection - ): Ethereum_TxResponse! - - sendTransactionAndWait( - tx: Ethereum_TxRequest! - connection: Ethereum_Connection - ): Ethereum_TxReceipt! - - deployContract( - abi: String! - bytecode: String! - args: [String!] - connection: Ethereum_Connection - ): String! - - signMessage( - message: String! - connection: Ethereum_Connection - ): String! - - sendRPC( - method: String! - params: [String!]! - connection: Ethereum_Connection - ): String -} - -### Imported Modules END ### - -### Imported Objects START ### - -type Ethereum_Connection @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Connection" -) { - node: String - networkNameOrChainId: String -} - -type Ethereum_TxOverrides @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxOverrides" -) { - gasLimit: BigInt - gasPrice: BigInt - value: BigInt -} - -type Ethereum_StaticTxResult @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "StaticTxResult" -) { - result: String! - error: Boolean! -} - -type Ethereum_TxRequest @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxRequest" -) { - to: String - from: String - nonce: UInt32 - gasLimit: BigInt - gasPrice: BigInt - data: String - value: BigInt - chainId: BigInt - type: UInt32 -} - -type Ethereum_TxReceipt @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxReceipt" -) { - to: String! - from: String! - contractAddress: String! - transactionIndex: UInt32! - root: String - gasUsed: BigInt! - logsBloom: String! - transactionHash: String! - logs: [Ethereum_Log!]! - blockNumber: BigInt! - blockHash: String! - confirmations: UInt32! - cumulativeGasUsed: BigInt! - effectiveGasPrice: BigInt! - byzantium: Boolean! - type: UInt32! - status: UInt32 -} - -type Ethereum_Log @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Log" -) { - blockNumber: BigInt! - blockHash: String! - transactionIndex: UInt32! - removed: Boolean! - address: String! - data: String! - topics: [String!]! - transactionHash: String! - logIndex: UInt32! -} - -type Ethereum_EventNotification @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "EventNotification" -) { - data: String! - address: String! - log: Ethereum_Log! -} - -type Ethereum_Network @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Network" -) { - name: String! - chainId: BigInt! - ensAddress: String -} - -type Ethereum_TxResponse @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxResponse" -) { - hash: String! - to: String - from: String! - nonce: UInt32! - gasLimit: BigInt! - gasPrice: BigInt - data: String! - value: BigInt! - chainId: BigInt! - blockNumber: BigInt - blockHash: String - timestamp: UInt32 - confirmations: UInt32! - raw: String - r: String - s: String - v: UInt32 - type: UInt32 - accessList: [Ethereum_Access!] -} - -type Ethereum_Access @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Access" -) { - address: String! - storageKeys: [String!]! -} - -### Imported Objects END ### - -### Imported Envs START ### - -### Imported Envs END ### -`; diff --git a/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/wrap.info.ts b/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/wrap.info.ts new file mode 100644 index 0000000000..80f300e7ad --- /dev/null +++ b/packages/test-cases/cases/cli/plugin/codegen/001-sanity/expected/wrap/wrap.info.ts @@ -0,0 +1,2689 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. +import { WrapManifest } from "@polywrap/wrap-manifest-types-js" + +export const manifest: WrapManifest = { + name: "Test", + type: "plugin", + version: "0.1", + abi: { + "envType": { + "kind": 65536, + "properties": [ + { + "kind": 34, + "name": "arg1", + "required": true, + "scalar": { + "kind": 4, + "name": "arg1", + "required": true, + "type": "String" + }, + "type": "String" + } + ], + "type": "Env" + }, + "importedModuleTypes": [ + { + "isInterface": false, + "kind": 256, + "methods": [ + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "callContractView", + "required": true, + "return": { + "kind": 34, + "name": "callContractView", + "required": true, + "scalar": { + "kind": 4, + "name": "callContractView", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + }, + { + "kind": 34, + "name": "txOverrides", + "object": { + "kind": 8192, + "name": "txOverrides", + "type": "Ethereum_TxOverrides" + }, + "type": "Ethereum_TxOverrides" + } + ], + "kind": 64, + "name": "callContractStatic", + "required": true, + "return": { + "kind": 34, + "name": "callContractStatic", + "object": { + "kind": 8192, + "name": "callContractStatic", + "required": true, + "type": "Ethereum_StaticTxResult" + }, + "required": true, + "type": "Ethereum_StaticTxResult" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "blockTag", + "scalar": { + "kind": 4, + "name": "blockTag", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "getBalance", + "required": true, + "return": { + "kind": 34, + "name": "getBalance", + "required": true, + "scalar": { + "kind": 4, + "name": "getBalance", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "array": { + "item": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "types", + "required": true, + "scalar": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "types", + "required": true, + "type": "[String]" + }, + { + "array": { + "item": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "values", + "required": true, + "scalar": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "values", + "required": true, + "type": "[String]" + } + ], + "kind": 64, + "name": "encodeParams", + "required": true, + "return": { + "kind": 34, + "name": "encodeParams", + "required": true, + "scalar": { + "kind": 4, + "name": "encodeParams", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + } + ], + "kind": 64, + "name": "encodeFunction", + "required": true, + "return": { + "kind": 34, + "name": "encodeFunction", + "required": true, + "scalar": { + "kind": 4, + "name": "encodeFunction", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "array": { + "item": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "types", + "required": true, + "scalar": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "types", + "required": true, + "type": "[String]" + }, + { + "array": { + "item": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "values", + "required": true, + "scalar": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "values", + "required": true, + "type": "[String]" + } + ], + "kind": 64, + "name": "solidityPack", + "required": true, + "return": { + "kind": 34, + "name": "solidityPack", + "required": true, + "scalar": { + "kind": 4, + "name": "solidityPack", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "array": { + "item": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "types", + "required": true, + "scalar": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "types", + "required": true, + "type": "[String]" + }, + { + "array": { + "item": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "values", + "required": true, + "scalar": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "values", + "required": true, + "type": "[String]" + } + ], + "kind": 64, + "name": "solidityKeccak256", + "required": true, + "return": { + "kind": 34, + "name": "solidityKeccak256", + "required": true, + "scalar": { + "kind": 4, + "name": "solidityKeccak256", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "array": { + "item": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "types", + "required": true, + "scalar": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "types", + "required": true, + "type": "[String]" + }, + { + "array": { + "item": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "values", + "required": true, + "scalar": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "values", + "required": true, + "type": "[String]" + } + ], + "kind": 64, + "name": "soliditySha256", + "required": true, + "return": { + "kind": 34, + "name": "soliditySha256", + "required": true, + "scalar": { + "kind": 4, + "name": "soliditySha256", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "getSignerAddress", + "required": true, + "return": { + "kind": 34, + "name": "getSignerAddress", + "required": true, + "scalar": { + "kind": 4, + "name": "getSignerAddress", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "blockTag", + "scalar": { + "kind": 4, + "name": "blockTag", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "getSignerBalance", + "required": true, + "return": { + "kind": 34, + "name": "getSignerBalance", + "required": true, + "scalar": { + "kind": 4, + "name": "getSignerBalance", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "blockTag", + "scalar": { + "kind": 4, + "name": "blockTag", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "getSignerTransactionCount", + "required": true, + "return": { + "kind": 34, + "name": "getSignerTransactionCount", + "required": true, + "scalar": { + "kind": 4, + "name": "getSignerTransactionCount", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "getGasPrice", + "required": true, + "return": { + "kind": 34, + "name": "getGasPrice", + "required": true, + "scalar": { + "kind": 4, + "name": "getGasPrice", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "tx", + "object": { + "kind": 8192, + "name": "tx", + "required": true, + "type": "Ethereum_TxRequest" + }, + "required": true, + "type": "Ethereum_TxRequest" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "estimateTransactionGas", + "required": true, + "return": { + "kind": 34, + "name": "estimateTransactionGas", + "required": true, + "scalar": { + "kind": 4, + "name": "estimateTransactionGas", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + }, + { + "kind": 34, + "name": "txOverrides", + "object": { + "kind": 8192, + "name": "txOverrides", + "type": "Ethereum_TxOverrides" + }, + "type": "Ethereum_TxOverrides" + } + ], + "kind": 64, + "name": "estimateContractCallGas", + "required": true, + "return": { + "kind": 34, + "name": "estimateContractCallGas", + "required": true, + "scalar": { + "kind": 4, + "name": "estimateContractCallGas", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + } + ], + "kind": 64, + "name": "checkAddress", + "required": true, + "return": { + "kind": 34, + "name": "checkAddress", + "required": true, + "scalar": { + "kind": 4, + "name": "checkAddress", + "required": true, + "type": "Boolean" + }, + "type": "Boolean" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "eth", + "required": true, + "scalar": { + "kind": 4, + "name": "eth", + "required": true, + "type": "String" + }, + "type": "String" + } + ], + "kind": 64, + "name": "toWei", + "required": true, + "return": { + "kind": 34, + "name": "toWei", + "required": true, + "scalar": { + "kind": 4, + "name": "toWei", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "wei", + "required": true, + "scalar": { + "kind": 4, + "name": "wei", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + } + ], + "kind": 64, + "name": "toEth", + "required": true, + "return": { + "kind": 34, + "name": "toEth", + "required": true, + "scalar": { + "kind": 4, + "name": "toEth", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "txHash", + "required": true, + "scalar": { + "kind": 4, + "name": "txHash", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "confirmations", + "required": true, + "scalar": { + "kind": 4, + "name": "confirmations", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "timeout", + "required": true, + "scalar": { + "kind": 4, + "name": "timeout", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "awaitTransaction", + "required": true, + "return": { + "kind": 34, + "name": "awaitTransaction", + "object": { + "kind": 8192, + "name": "awaitTransaction", + "required": true, + "type": "Ethereum_TxReceipt" + }, + "required": true, + "type": "Ethereum_TxReceipt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "event", + "required": true, + "scalar": { + "kind": 4, + "name": "event", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + }, + { + "kind": 34, + "name": "timeout", + "scalar": { + "kind": 4, + "name": "timeout", + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "waitForEvent", + "required": true, + "return": { + "kind": 34, + "name": "waitForEvent", + "object": { + "kind": 8192, + "name": "waitForEvent", + "required": true, + "type": "Ethereum_EventNotification" + }, + "required": true, + "type": "Ethereum_EventNotification" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "getNetwork", + "required": true, + "return": { + "kind": 34, + "name": "getNetwork", + "object": { + "kind": 8192, + "name": "getNetwork", + "required": true, + "type": "Ethereum_Network" + }, + "required": true, + "type": "Ethereum_Network" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "requestAccounts", + "required": true, + "return": { + "array": { + "item": { + "kind": 4, + "name": "requestAccounts", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "requestAccounts", + "required": true, + "scalar": { + "kind": 4, + "name": "requestAccounts", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "requestAccounts", + "required": true, + "type": "[String]" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + }, + { + "kind": 34, + "name": "txOverrides", + "object": { + "kind": 8192, + "name": "txOverrides", + "type": "Ethereum_TxOverrides" + }, + "type": "Ethereum_TxOverrides" + } + ], + "kind": 64, + "name": "callContractMethod", + "required": true, + "return": { + "kind": 34, + "name": "callContractMethod", + "object": { + "kind": 8192, + "name": "callContractMethod", + "required": true, + "type": "Ethereum_TxResponse" + }, + "required": true, + "type": "Ethereum_TxResponse" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + }, + { + "kind": 34, + "name": "txOverrides", + "object": { + "kind": 8192, + "name": "txOverrides", + "type": "Ethereum_TxOverrides" + }, + "type": "Ethereum_TxOverrides" + } + ], + "kind": 64, + "name": "callContractMethodAndWait", + "required": true, + "return": { + "kind": 34, + "name": "callContractMethodAndWait", + "object": { + "kind": 8192, + "name": "callContractMethodAndWait", + "required": true, + "type": "Ethereum_TxReceipt" + }, + "required": true, + "type": "Ethereum_TxReceipt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "tx", + "object": { + "kind": 8192, + "name": "tx", + "required": true, + "type": "Ethereum_TxRequest" + }, + "required": true, + "type": "Ethereum_TxRequest" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "sendTransaction", + "required": true, + "return": { + "kind": 34, + "name": "sendTransaction", + "object": { + "kind": 8192, + "name": "sendTransaction", + "required": true, + "type": "Ethereum_TxResponse" + }, + "required": true, + "type": "Ethereum_TxResponse" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "tx", + "object": { + "kind": 8192, + "name": "tx", + "required": true, + "type": "Ethereum_TxRequest" + }, + "required": true, + "type": "Ethereum_TxRequest" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "sendTransactionAndWait", + "required": true, + "return": { + "kind": 34, + "name": "sendTransactionAndWait", + "object": { + "kind": 8192, + "name": "sendTransactionAndWait", + "required": true, + "type": "Ethereum_TxReceipt" + }, + "required": true, + "type": "Ethereum_TxReceipt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "abi", + "required": true, + "scalar": { + "kind": 4, + "name": "abi", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "bytecode", + "required": true, + "scalar": { + "kind": 4, + "name": "bytecode", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "deployContract", + "required": true, + "return": { + "kind": 34, + "name": "deployContract", + "required": true, + "scalar": { + "kind": 4, + "name": "deployContract", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "message", + "required": true, + "scalar": { + "kind": 4, + "name": "message", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "signMessage", + "required": true, + "return": { + "kind": 34, + "name": "signMessage", + "required": true, + "scalar": { + "kind": 4, + "name": "signMessage", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "params", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "params", + "required": true, + "scalar": { + "kind": 4, + "name": "params", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "params", + "required": true, + "type": "[String]" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "sendRPC", + "required": true, + "return": { + "kind": 34, + "name": "sendRPC", + "scalar": { + "kind": 4, + "name": "sendRPC", + "type": "String" + }, + "type": "String" + }, + "type": "Method" + } + ], + "namespace": "Ethereum", + "nativeType": "Module", + "type": "Ethereum_Module", + "uri": "ens/ethereum.polywrap.eth" + } + ], + "importedObjectTypes": [ + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "Connection", + "properties": [ + { + "kind": 34, + "name": "node", + "scalar": { + "kind": 4, + "name": "node", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "networkNameOrChainId", + "scalar": { + "kind": 4, + "name": "networkNameOrChainId", + "type": "String" + }, + "type": "String" + } + ], + "type": "Ethereum_Connection", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "TxOverrides", + "properties": [ + { + "kind": 34, + "name": "gasLimit", + "scalar": { + "kind": 4, + "name": "gasLimit", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "gasPrice", + "scalar": { + "kind": 4, + "name": "gasPrice", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "value", + "scalar": { + "kind": 4, + "name": "value", + "type": "BigInt" + }, + "type": "BigInt" + } + ], + "type": "Ethereum_TxOverrides", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "StaticTxResult", + "properties": [ + { + "kind": 34, + "name": "result", + "required": true, + "scalar": { + "kind": 4, + "name": "result", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "error", + "required": true, + "scalar": { + "kind": 4, + "name": "error", + "required": true, + "type": "Boolean" + }, + "type": "Boolean" + } + ], + "type": "Ethereum_StaticTxResult", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "TxRequest", + "properties": [ + { + "kind": 34, + "name": "to", + "scalar": { + "kind": 4, + "name": "to", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "from", + "scalar": { + "kind": 4, + "name": "from", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "nonce", + "scalar": { + "kind": 4, + "name": "nonce", + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "gasLimit", + "scalar": { + "kind": 4, + "name": "gasLimit", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "gasPrice", + "scalar": { + "kind": 4, + "name": "gasPrice", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "data", + "scalar": { + "kind": 4, + "name": "data", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "value", + "scalar": { + "kind": 4, + "name": "value", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "chainId", + "scalar": { + "kind": 4, + "name": "chainId", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "type", + "scalar": { + "kind": 4, + "name": "type", + "type": "UInt32" + }, + "type": "UInt32" + } + ], + "type": "Ethereum_TxRequest", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "TxReceipt", + "properties": [ + { + "kind": 34, + "name": "to", + "required": true, + "scalar": { + "kind": 4, + "name": "to", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "from", + "required": true, + "scalar": { + "kind": 4, + "name": "from", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "contractAddress", + "required": true, + "scalar": { + "kind": 4, + "name": "contractAddress", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "transactionIndex", + "required": true, + "scalar": { + "kind": 4, + "name": "transactionIndex", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "root", + "scalar": { + "kind": 4, + "name": "root", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "gasUsed", + "required": true, + "scalar": { + "kind": 4, + "name": "gasUsed", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "logsBloom", + "required": true, + "scalar": { + "kind": 4, + "name": "logsBloom", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "transactionHash", + "required": true, + "scalar": { + "kind": 4, + "name": "transactionHash", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 8192, + "name": "logs", + "required": true, + "type": "Ethereum_Log" + }, + "kind": 18, + "name": "logs", + "object": { + "kind": 8192, + "name": "logs", + "required": true, + "type": "Ethereum_Log" + }, + "required": true, + "type": "[Ethereum_Log]" + }, + "kind": 34, + "name": "logs", + "required": true, + "type": "[Ethereum_Log]" + }, + { + "kind": 34, + "name": "blockNumber", + "required": true, + "scalar": { + "kind": 4, + "name": "blockNumber", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "blockHash", + "required": true, + "scalar": { + "kind": 4, + "name": "blockHash", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "confirmations", + "required": true, + "scalar": { + "kind": 4, + "name": "confirmations", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "cumulativeGasUsed", + "required": true, + "scalar": { + "kind": 4, + "name": "cumulativeGasUsed", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "effectiveGasPrice", + "required": true, + "scalar": { + "kind": 4, + "name": "effectiveGasPrice", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "byzantium", + "required": true, + "scalar": { + "kind": 4, + "name": "byzantium", + "required": true, + "type": "Boolean" + }, + "type": "Boolean" + }, + { + "kind": 34, + "name": "type", + "required": true, + "scalar": { + "kind": 4, + "name": "type", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "status", + "scalar": { + "kind": 4, + "name": "status", + "type": "UInt32" + }, + "type": "UInt32" + } + ], + "type": "Ethereum_TxReceipt", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "Log", + "properties": [ + { + "kind": 34, + "name": "blockNumber", + "required": true, + "scalar": { + "kind": 4, + "name": "blockNumber", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "blockHash", + "required": true, + "scalar": { + "kind": 4, + "name": "blockHash", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "transactionIndex", + "required": true, + "scalar": { + "kind": 4, + "name": "transactionIndex", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "removed", + "required": true, + "scalar": { + "kind": 4, + "name": "removed", + "required": true, + "type": "Boolean" + }, + "type": "Boolean" + }, + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "data", + "required": true, + "scalar": { + "kind": 4, + "name": "data", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "topics", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "topics", + "required": true, + "scalar": { + "kind": 4, + "name": "topics", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "topics", + "required": true, + "type": "[String]" + }, + { + "kind": 34, + "name": "transactionHash", + "required": true, + "scalar": { + "kind": 4, + "name": "transactionHash", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "logIndex", + "required": true, + "scalar": { + "kind": 4, + "name": "logIndex", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + } + ], + "type": "Ethereum_Log", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "EventNotification", + "properties": [ + { + "kind": 34, + "name": "data", + "required": true, + "scalar": { + "kind": 4, + "name": "data", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "log", + "object": { + "kind": 8192, + "name": "log", + "required": true, + "type": "Ethereum_Log" + }, + "required": true, + "type": "Ethereum_Log" + } + ], + "type": "Ethereum_EventNotification", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "Network", + "properties": [ + { + "kind": 34, + "name": "name", + "required": true, + "scalar": { + "kind": 4, + "name": "name", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "chainId", + "required": true, + "scalar": { + "kind": 4, + "name": "chainId", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "ensAddress", + "scalar": { + "kind": 4, + "name": "ensAddress", + "type": "String" + }, + "type": "String" + } + ], + "type": "Ethereum_Network", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "TxResponse", + "properties": [ + { + "kind": 34, + "name": "hash", + "required": true, + "scalar": { + "kind": 4, + "name": "hash", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "to", + "scalar": { + "kind": 4, + "name": "to", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "from", + "required": true, + "scalar": { + "kind": 4, + "name": "from", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "nonce", + "required": true, + "scalar": { + "kind": 4, + "name": "nonce", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "gasLimit", + "required": true, + "scalar": { + "kind": 4, + "name": "gasLimit", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "gasPrice", + "scalar": { + "kind": 4, + "name": "gasPrice", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "data", + "required": true, + "scalar": { + "kind": 4, + "name": "data", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "value", + "required": true, + "scalar": { + "kind": 4, + "name": "value", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "chainId", + "required": true, + "scalar": { + "kind": 4, + "name": "chainId", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "blockNumber", + "scalar": { + "kind": 4, + "name": "blockNumber", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "blockHash", + "scalar": { + "kind": 4, + "name": "blockHash", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "timestamp", + "scalar": { + "kind": 4, + "name": "timestamp", + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "confirmations", + "required": true, + "scalar": { + "kind": 4, + "name": "confirmations", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "raw", + "scalar": { + "kind": 4, + "name": "raw", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "r", + "scalar": { + "kind": 4, + "name": "r", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "s", + "scalar": { + "kind": 4, + "name": "s", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "v", + "scalar": { + "kind": 4, + "name": "v", + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "type", + "scalar": { + "kind": 4, + "name": "type", + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "array": { + "item": { + "kind": 8192, + "name": "accessList", + "required": true, + "type": "Ethereum_Access" + }, + "kind": 18, + "name": "accessList", + "object": { + "kind": 8192, + "name": "accessList", + "required": true, + "type": "Ethereum_Access" + }, + "type": "[Ethereum_Access]" + }, + "kind": 34, + "name": "accessList", + "type": "[Ethereum_Access]" + } + ], + "type": "Ethereum_TxResponse", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "Access", + "properties": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "storageKeys", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "storageKeys", + "required": true, + "scalar": { + "kind": 4, + "name": "storageKeys", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "storageKeys", + "required": true, + "type": "[String]" + } + ], + "type": "Ethereum_Access", + "uri": "ens/ethereum.polywrap.eth" + } + ], + "moduleType": { + "imports": [ + { + "type": "Ethereum_Module" + }, + { + "type": "Ethereum_Connection" + }, + { + "type": "Ethereum_TxOverrides" + }, + { + "type": "Ethereum_StaticTxResult" + }, + { + "type": "Ethereum_TxRequest" + }, + { + "type": "Ethereum_TxReceipt" + }, + { + "type": "Ethereum_Log" + }, + { + "type": "Ethereum_EventNotification" + }, + { + "type": "Ethereum_Network" + }, + { + "type": "Ethereum_TxResponse" + }, + { + "type": "Ethereum_Access" + } + ], + "kind": 128, + "methods": [ + { + "arguments": [ + { + "kind": 34, + "name": "str", + "required": true, + "scalar": { + "kind": 4, + "name": "str", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "optStr", + "scalar": { + "kind": 4, + "name": "optStr", + "type": "String" + }, + "type": "String" + } + ], + "kind": 64, + "name": "methodOne", + "required": true, + "return": { + "kind": 34, + "name": "methodOne", + "object": { + "kind": 8192, + "name": "methodOne", + "required": true, + "type": "Object" + }, + "required": true, + "type": "Object" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "arg", + "required": true, + "scalar": { + "kind": 4, + "name": "arg", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + } + ], + "kind": 64, + "name": "methodTwo", + "required": true, + "return": { + "kind": 34, + "name": "methodTwo", + "required": true, + "scalar": { + "kind": 4, + "name": "methodTwo", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + } + ], + "type": "Module" + }, + "objectTypes": [ + { + "kind": 1, + "properties": [ + { + "kind": 34, + "name": "u", + "required": true, + "scalar": { + "kind": 4, + "name": "u", + "required": true, + "type": "UInt" + }, + "type": "UInt" + }, + { + "array": { + "item": { + "kind": 4, + "name": "array", + "required": true, + "type": "Boolean" + }, + "kind": 18, + "name": "array", + "required": true, + "scalar": { + "kind": 4, + "name": "array", + "required": true, + "type": "Boolean" + }, + "type": "[Boolean]" + }, + "kind": 34, + "name": "array", + "required": true, + "type": "[Boolean]" + }, + { + "kind": 34, + "name": "bytes", + "scalar": { + "kind": 4, + "name": "bytes", + "type": "Bytes" + }, + "type": "Bytes" + } + ], + "type": "Object" + } + ], + "version": "0.1" +} +} diff --git a/packages/test-cases/cases/cli/plugin/codegen/001-sanity/polywrap.plugin.yaml b/packages/test-cases/cases/cli/plugin/codegen/001-sanity/polywrap.plugin.yaml index 7a95fddd10..b6e429cf4e 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/001-sanity/polywrap.plugin.yaml +++ b/packages/test-cases/cases/cli/plugin/codegen/001-sanity/polywrap.plugin.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: Test language: plugin/typescript schema: ./schema.graphql diff --git a/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/build-artifacts/polywrap.plugin.json b/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/build-artifacts/polywrap.plugin.json deleted file mode 100644 index 020adca63c..0000000000 --- a/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/build-artifacts/polywrap.plugin.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "format": "0.1.0", - "name": "Test", - "language": "plugin/typescript", - "schema": "./schema.graphql", - "module": "./src/index.ts" -} \ No newline at end of file diff --git a/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/build-artifacts/schema.graphql b/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/build-artifacts/schema.graphql deleted file mode 100644 index 5159ad8241..0000000000 --- a/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/build-artifacts/schema.graphql +++ /dev/null @@ -1,382 +0,0 @@ -### Polywrap Header START ### -scalar UInt -scalar UInt8 -scalar UInt16 -scalar UInt32 -scalar Int -scalar Int8 -scalar Int16 -scalar Int32 -scalar Bytes -scalar BigInt -scalar BigNumber -scalar JSON -scalar Map - -directive @imported( - uri: String! - namespace: String! - nativeType: String! -) on OBJECT | ENUM - -directive @imports( - types: [String!]! -) on OBJECT - -directive @capability( - type: String! - uri: String! - namespace: String! -) repeatable on OBJECT - -directive @enabled_interface on OBJECT - -directive @annotate(type: String!) on FIELD - -directive @env(required: Boolean!) on FIELD_DEFINITION - -### Polywrap Header END ### - -type Module @imports( - types: [ - "Ethereum_Module", - "Ethereum_Connection", - "Ethereum_TxOverrides", - "Ethereum_StaticTxResult", - "Ethereum_TxRequest", - "Ethereum_TxReceipt", - "Ethereum_Log", - "Ethereum_EventNotification", - "Ethereum_Network", - "Ethereum_TxResponse", - "Ethereum_Access" - ] -) { - method( - str: String! - optStr: String - ): Object! -} - -type Env { - arg1: String! -} - -type Object { - u: UInt! - array: [Boolean!]! - bytes: Bytes -} - -### Imported Modules START ### - -type Ethereum_Module @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Module" -) { - callContractView( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - ): String! - - callContractStatic( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): Ethereum_StaticTxResult! - - getBalance( - address: String! - blockTag: BigInt - connection: Ethereum_Connection - ): BigInt! - - encodeParams( - types: [String!]! - values: [String!]! - ): String! - - encodeFunction( - method: String! - args: [String!] - ): String! - - solidityPack( - types: [String!]! - values: [String!]! - ): String! - - solidityKeccak256( - types: [String!]! - values: [String!]! - ): String! - - soliditySha256( - types: [String!]! - values: [String!]! - ): String! - - getSignerAddress( - connection: Ethereum_Connection - ): String! - - getSignerBalance( - blockTag: BigInt - connection: Ethereum_Connection - ): BigInt! - - getSignerTransactionCount( - blockTag: BigInt - connection: Ethereum_Connection - ): BigInt! - - getGasPrice( - connection: Ethereum_Connection - ): BigInt! - - estimateTransactionGas( - tx: Ethereum_TxRequest! - connection: Ethereum_Connection - ): BigInt! - - estimateContractCallGas( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): BigInt! - - checkAddress( - address: String! - ): Boolean! - - toWei( - eth: String! - ): BigInt! - - toEth( - wei: BigInt! - ): String! - - awaitTransaction( - txHash: String! - confirmations: UInt32! - timeout: UInt32! - connection: Ethereum_Connection - ): Ethereum_TxReceipt! - - waitForEvent( - address: String! - event: String! - args: [String!] - timeout: UInt32 - connection: Ethereum_Connection - ): Ethereum_EventNotification! - - getNetwork( - connection: Ethereum_Connection - ): Ethereum_Network! - - requestAccounts( - connection: Ethereum_Connection - ): [String!]! - - callContractMethod( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): Ethereum_TxResponse! - - callContractMethodAndWait( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): Ethereum_TxReceipt! - - sendTransaction( - tx: Ethereum_TxRequest! - connection: Ethereum_Connection - ): Ethereum_TxResponse! - - sendTransactionAndWait( - tx: Ethereum_TxRequest! - connection: Ethereum_Connection - ): Ethereum_TxReceipt! - - deployContract( - abi: String! - bytecode: String! - args: [String!] - connection: Ethereum_Connection - ): String! - - signMessage( - message: String! - connection: Ethereum_Connection - ): String! - - sendRPC( - method: String! - params: [String!]! - connection: Ethereum_Connection - ): String -} - -### Imported Modules END ### - -### Imported Objects START ### - -type Ethereum_Connection @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Connection" -) { - node: String - networkNameOrChainId: String -} - -type Ethereum_TxOverrides @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxOverrides" -) { - gasLimit: BigInt - gasPrice: BigInt - value: BigInt -} - -type Ethereum_StaticTxResult @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "StaticTxResult" -) { - result: String! - error: Boolean! -} - -type Ethereum_TxRequest @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxRequest" -) { - to: String - from: String - nonce: UInt32 - gasLimit: BigInt - gasPrice: BigInt - data: String - value: BigInt - chainId: BigInt - type: UInt32 -} - -type Ethereum_TxReceipt @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxReceipt" -) { - to: String! - from: String! - contractAddress: String! - transactionIndex: UInt32! - root: String - gasUsed: BigInt! - logsBloom: String! - transactionHash: String! - logs: [Ethereum_Log!]! - blockNumber: BigInt! - blockHash: String! - confirmations: UInt32! - cumulativeGasUsed: BigInt! - effectiveGasPrice: BigInt! - byzantium: Boolean! - type: UInt32! - status: UInt32 -} - -type Ethereum_Log @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Log" -) { - blockNumber: BigInt! - blockHash: String! - transactionIndex: UInt32! - removed: Boolean! - address: String! - data: String! - topics: [String!]! - transactionHash: String! - logIndex: UInt32! -} - -type Ethereum_EventNotification @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "EventNotification" -) { - data: String! - address: String! - log: Ethereum_Log! -} - -type Ethereum_Network @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Network" -) { - name: String! - chainId: BigInt! - ensAddress: String -} - -type Ethereum_TxResponse @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxResponse" -) { - hash: String! - to: String - from: String! - nonce: UInt32! - gasLimit: BigInt! - gasPrice: BigInt - data: String! - value: BigInt! - chainId: BigInt! - blockNumber: BigInt - blockHash: String - timestamp: UInt32 - confirmations: UInt32! - raw: String - r: String - s: String - v: UInt32 - type: UInt32 - accessList: [Ethereum_Access!] -} - -type Ethereum_Access @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Access" -) { - address: String! - storageKeys: [String!]! -} - -### Imported Objects END ### - -### Imported Envs START ### - -### Imported Envs END ### diff --git a/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/build-artifacts/wrap.info b/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/build-artifacts/wrap.info new file mode 100644 index 0000000000..26683c026c Binary files /dev/null and b/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/build-artifacts/wrap.info differ diff --git a/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/stdout.json b/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/stdout.json index d9b77bbc00..d1dc098fa5 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/stdout.json +++ b/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/stdout.json @@ -2,7 +2,7 @@ "stdout": [ "Manifest loaded from ./polywrap.plugin.yaml", "Generate types", - "Manifest written to ./build/polywrap.plugin.json" + "Manifest written to ./build/wrap.info" ], "exitCode": 0 } diff --git a/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/index.ts b/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/index.ts index f367d143d9..315871f96d 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/index.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/index.ts @@ -1,8 +1,7 @@ /// NOTE: This is an auto-generated file. /// All modifications will be overwritten. -export * from "./schema"; -export * from "./manifest"; +export * from "./wrap.info"; export * from "./module"; export * from "./types"; diff --git a/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/manifest.ts b/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/manifest.ts deleted file mode 100644 index 730cf8326f..0000000000 --- a/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/manifest.ts +++ /dev/null @@ -1,15 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { schema } from "./"; - -// @ts-ignore -import { PluginPackageManifest, Uri } from "@polywrap/core-js"; - -export const manifest: PluginPackageManifest = { - schema, - implements: [ - ], -}; diff --git a/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/schema.ts b/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/schema.ts deleted file mode 100644 index 31d4894bef..0000000000 --- a/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/schema.ts +++ /dev/null @@ -1,386 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export const schema: string = `### Polywrap Header START ### -scalar UInt -scalar UInt8 -scalar UInt16 -scalar UInt32 -scalar Int -scalar Int8 -scalar Int16 -scalar Int32 -scalar Bytes -scalar BigInt -scalar BigNumber -scalar JSON -scalar Map - -directive @imported( - uri: String! - namespace: String! - nativeType: String! -) on OBJECT | ENUM - -directive @imports( - types: [String!]! -) on OBJECT - -directive @capability( - type: String! - uri: String! - namespace: String! -) repeatable on OBJECT - -directive @enabled_interface on OBJECT - -directive @annotate(type: String!) on FIELD - -directive @env(required: Boolean!) on FIELD_DEFINITION - -### Polywrap Header END ### - -type Module @imports( - types: [ - "Ethereum_Module", - "Ethereum_Connection", - "Ethereum_TxOverrides", - "Ethereum_StaticTxResult", - "Ethereum_TxRequest", - "Ethereum_TxReceipt", - "Ethereum_Log", - "Ethereum_EventNotification", - "Ethereum_Network", - "Ethereum_TxResponse", - "Ethereum_Access" - ] -) { - method( - str: String! - optStr: String - ): Object! -} - -type Env { - arg1: String! -} - -type Object { - u: UInt! - array: [Boolean!]! - bytes: Bytes -} - -### Imported Modules START ### - -type Ethereum_Module @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Module" -) { - callContractView( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - ): String! - - callContractStatic( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): Ethereum_StaticTxResult! - - getBalance( - address: String! - blockTag: BigInt - connection: Ethereum_Connection - ): BigInt! - - encodeParams( - types: [String!]! - values: [String!]! - ): String! - - encodeFunction( - method: String! - args: [String!] - ): String! - - solidityPack( - types: [String!]! - values: [String!]! - ): String! - - solidityKeccak256( - types: [String!]! - values: [String!]! - ): String! - - soliditySha256( - types: [String!]! - values: [String!]! - ): String! - - getSignerAddress( - connection: Ethereum_Connection - ): String! - - getSignerBalance( - blockTag: BigInt - connection: Ethereum_Connection - ): BigInt! - - getSignerTransactionCount( - blockTag: BigInt - connection: Ethereum_Connection - ): BigInt! - - getGasPrice( - connection: Ethereum_Connection - ): BigInt! - - estimateTransactionGas( - tx: Ethereum_TxRequest! - connection: Ethereum_Connection - ): BigInt! - - estimateContractCallGas( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): BigInt! - - checkAddress( - address: String! - ): Boolean! - - toWei( - eth: String! - ): BigInt! - - toEth( - wei: BigInt! - ): String! - - awaitTransaction( - txHash: String! - confirmations: UInt32! - timeout: UInt32! - connection: Ethereum_Connection - ): Ethereum_TxReceipt! - - waitForEvent( - address: String! - event: String! - args: [String!] - timeout: UInt32 - connection: Ethereum_Connection - ): Ethereum_EventNotification! - - getNetwork( - connection: Ethereum_Connection - ): Ethereum_Network! - - requestAccounts( - connection: Ethereum_Connection - ): [String!]! - - callContractMethod( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): Ethereum_TxResponse! - - callContractMethodAndWait( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): Ethereum_TxReceipt! - - sendTransaction( - tx: Ethereum_TxRequest! - connection: Ethereum_Connection - ): Ethereum_TxResponse! - - sendTransactionAndWait( - tx: Ethereum_TxRequest! - connection: Ethereum_Connection - ): Ethereum_TxReceipt! - - deployContract( - abi: String! - bytecode: String! - args: [String!] - connection: Ethereum_Connection - ): String! - - signMessage( - message: String! - connection: Ethereum_Connection - ): String! - - sendRPC( - method: String! - params: [String!]! - connection: Ethereum_Connection - ): String -} - -### Imported Modules END ### - -### Imported Objects START ### - -type Ethereum_Connection @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Connection" -) { - node: String - networkNameOrChainId: String -} - -type Ethereum_TxOverrides @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxOverrides" -) { - gasLimit: BigInt - gasPrice: BigInt - value: BigInt -} - -type Ethereum_StaticTxResult @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "StaticTxResult" -) { - result: String! - error: Boolean! -} - -type Ethereum_TxRequest @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxRequest" -) { - to: String - from: String - nonce: UInt32 - gasLimit: BigInt - gasPrice: BigInt - data: String - value: BigInt - chainId: BigInt - type: UInt32 -} - -type Ethereum_TxReceipt @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxReceipt" -) { - to: String! - from: String! - contractAddress: String! - transactionIndex: UInt32! - root: String - gasUsed: BigInt! - logsBloom: String! - transactionHash: String! - logs: [Ethereum_Log!]! - blockNumber: BigInt! - blockHash: String! - confirmations: UInt32! - cumulativeGasUsed: BigInt! - effectiveGasPrice: BigInt! - byzantium: Boolean! - type: UInt32! - status: UInt32 -} - -type Ethereum_Log @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Log" -) { - blockNumber: BigInt! - blockHash: String! - transactionIndex: UInt32! - removed: Boolean! - address: String! - data: String! - topics: [String!]! - transactionHash: String! - logIndex: UInt32! -} - -type Ethereum_EventNotification @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "EventNotification" -) { - data: String! - address: String! - log: Ethereum_Log! -} - -type Ethereum_Network @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Network" -) { - name: String! - chainId: BigInt! - ensAddress: String -} - -type Ethereum_TxResponse @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxResponse" -) { - hash: String! - to: String - from: String! - nonce: UInt32! - gasLimit: BigInt! - gasPrice: BigInt - data: String! - value: BigInt! - chainId: BigInt! - blockNumber: BigInt - blockHash: String - timestamp: UInt32 - confirmations: UInt32! - raw: String - r: String - s: String - v: UInt32 - type: UInt32 - accessList: [Ethereum_Access!] -} - -type Ethereum_Access @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Access" -) { - address: String! - storageKeys: [String!]! -} - -### Imported Objects END ### - -### Imported Envs START ### - -### Imported Envs END ### -`; diff --git a/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/wrap.info.ts b/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/wrap.info.ts new file mode 100644 index 0000000000..e042ae0328 --- /dev/null +++ b/packages/test-cases/cases/cli/plugin/codegen/002-single-module/expected/wrap/wrap.info.ts @@ -0,0 +1,2657 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. +import { WrapManifest } from "@polywrap/wrap-manifest-types-js" + +export const manifest: WrapManifest = { + name: "Test", + type: "plugin", + version: "0.1", + abi: { + "envType": { + "kind": 65536, + "properties": [ + { + "kind": 34, + "name": "arg1", + "required": true, + "scalar": { + "kind": 4, + "name": "arg1", + "required": true, + "type": "String" + }, + "type": "String" + } + ], + "type": "Env" + }, + "importedModuleTypes": [ + { + "isInterface": false, + "kind": 256, + "methods": [ + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "callContractView", + "required": true, + "return": { + "kind": 34, + "name": "callContractView", + "required": true, + "scalar": { + "kind": 4, + "name": "callContractView", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + }, + { + "kind": 34, + "name": "txOverrides", + "object": { + "kind": 8192, + "name": "txOverrides", + "type": "Ethereum_TxOverrides" + }, + "type": "Ethereum_TxOverrides" + } + ], + "kind": 64, + "name": "callContractStatic", + "required": true, + "return": { + "kind": 34, + "name": "callContractStatic", + "object": { + "kind": 8192, + "name": "callContractStatic", + "required": true, + "type": "Ethereum_StaticTxResult" + }, + "required": true, + "type": "Ethereum_StaticTxResult" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "blockTag", + "scalar": { + "kind": 4, + "name": "blockTag", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "getBalance", + "required": true, + "return": { + "kind": 34, + "name": "getBalance", + "required": true, + "scalar": { + "kind": 4, + "name": "getBalance", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "array": { + "item": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "types", + "required": true, + "scalar": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "types", + "required": true, + "type": "[String]" + }, + { + "array": { + "item": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "values", + "required": true, + "scalar": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "values", + "required": true, + "type": "[String]" + } + ], + "kind": 64, + "name": "encodeParams", + "required": true, + "return": { + "kind": 34, + "name": "encodeParams", + "required": true, + "scalar": { + "kind": 4, + "name": "encodeParams", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + } + ], + "kind": 64, + "name": "encodeFunction", + "required": true, + "return": { + "kind": 34, + "name": "encodeFunction", + "required": true, + "scalar": { + "kind": 4, + "name": "encodeFunction", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "array": { + "item": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "types", + "required": true, + "scalar": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "types", + "required": true, + "type": "[String]" + }, + { + "array": { + "item": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "values", + "required": true, + "scalar": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "values", + "required": true, + "type": "[String]" + } + ], + "kind": 64, + "name": "solidityPack", + "required": true, + "return": { + "kind": 34, + "name": "solidityPack", + "required": true, + "scalar": { + "kind": 4, + "name": "solidityPack", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "array": { + "item": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "types", + "required": true, + "scalar": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "types", + "required": true, + "type": "[String]" + }, + { + "array": { + "item": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "values", + "required": true, + "scalar": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "values", + "required": true, + "type": "[String]" + } + ], + "kind": 64, + "name": "solidityKeccak256", + "required": true, + "return": { + "kind": 34, + "name": "solidityKeccak256", + "required": true, + "scalar": { + "kind": 4, + "name": "solidityKeccak256", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "array": { + "item": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "types", + "required": true, + "scalar": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "types", + "required": true, + "type": "[String]" + }, + { + "array": { + "item": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "values", + "required": true, + "scalar": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "values", + "required": true, + "type": "[String]" + } + ], + "kind": 64, + "name": "soliditySha256", + "required": true, + "return": { + "kind": 34, + "name": "soliditySha256", + "required": true, + "scalar": { + "kind": 4, + "name": "soliditySha256", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "getSignerAddress", + "required": true, + "return": { + "kind": 34, + "name": "getSignerAddress", + "required": true, + "scalar": { + "kind": 4, + "name": "getSignerAddress", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "blockTag", + "scalar": { + "kind": 4, + "name": "blockTag", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "getSignerBalance", + "required": true, + "return": { + "kind": 34, + "name": "getSignerBalance", + "required": true, + "scalar": { + "kind": 4, + "name": "getSignerBalance", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "blockTag", + "scalar": { + "kind": 4, + "name": "blockTag", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "getSignerTransactionCount", + "required": true, + "return": { + "kind": 34, + "name": "getSignerTransactionCount", + "required": true, + "scalar": { + "kind": 4, + "name": "getSignerTransactionCount", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "getGasPrice", + "required": true, + "return": { + "kind": 34, + "name": "getGasPrice", + "required": true, + "scalar": { + "kind": 4, + "name": "getGasPrice", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "tx", + "object": { + "kind": 8192, + "name": "tx", + "required": true, + "type": "Ethereum_TxRequest" + }, + "required": true, + "type": "Ethereum_TxRequest" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "estimateTransactionGas", + "required": true, + "return": { + "kind": 34, + "name": "estimateTransactionGas", + "required": true, + "scalar": { + "kind": 4, + "name": "estimateTransactionGas", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + }, + { + "kind": 34, + "name": "txOverrides", + "object": { + "kind": 8192, + "name": "txOverrides", + "type": "Ethereum_TxOverrides" + }, + "type": "Ethereum_TxOverrides" + } + ], + "kind": 64, + "name": "estimateContractCallGas", + "required": true, + "return": { + "kind": 34, + "name": "estimateContractCallGas", + "required": true, + "scalar": { + "kind": 4, + "name": "estimateContractCallGas", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + } + ], + "kind": 64, + "name": "checkAddress", + "required": true, + "return": { + "kind": 34, + "name": "checkAddress", + "required": true, + "scalar": { + "kind": 4, + "name": "checkAddress", + "required": true, + "type": "Boolean" + }, + "type": "Boolean" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "eth", + "required": true, + "scalar": { + "kind": 4, + "name": "eth", + "required": true, + "type": "String" + }, + "type": "String" + } + ], + "kind": 64, + "name": "toWei", + "required": true, + "return": { + "kind": 34, + "name": "toWei", + "required": true, + "scalar": { + "kind": 4, + "name": "toWei", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "wei", + "required": true, + "scalar": { + "kind": 4, + "name": "wei", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + } + ], + "kind": 64, + "name": "toEth", + "required": true, + "return": { + "kind": 34, + "name": "toEth", + "required": true, + "scalar": { + "kind": 4, + "name": "toEth", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "txHash", + "required": true, + "scalar": { + "kind": 4, + "name": "txHash", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "confirmations", + "required": true, + "scalar": { + "kind": 4, + "name": "confirmations", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "timeout", + "required": true, + "scalar": { + "kind": 4, + "name": "timeout", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "awaitTransaction", + "required": true, + "return": { + "kind": 34, + "name": "awaitTransaction", + "object": { + "kind": 8192, + "name": "awaitTransaction", + "required": true, + "type": "Ethereum_TxReceipt" + }, + "required": true, + "type": "Ethereum_TxReceipt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "event", + "required": true, + "scalar": { + "kind": 4, + "name": "event", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + }, + { + "kind": 34, + "name": "timeout", + "scalar": { + "kind": 4, + "name": "timeout", + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "waitForEvent", + "required": true, + "return": { + "kind": 34, + "name": "waitForEvent", + "object": { + "kind": 8192, + "name": "waitForEvent", + "required": true, + "type": "Ethereum_EventNotification" + }, + "required": true, + "type": "Ethereum_EventNotification" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "getNetwork", + "required": true, + "return": { + "kind": 34, + "name": "getNetwork", + "object": { + "kind": 8192, + "name": "getNetwork", + "required": true, + "type": "Ethereum_Network" + }, + "required": true, + "type": "Ethereum_Network" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "requestAccounts", + "required": true, + "return": { + "array": { + "item": { + "kind": 4, + "name": "requestAccounts", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "requestAccounts", + "required": true, + "scalar": { + "kind": 4, + "name": "requestAccounts", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "requestAccounts", + "required": true, + "type": "[String]" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + }, + { + "kind": 34, + "name": "txOverrides", + "object": { + "kind": 8192, + "name": "txOverrides", + "type": "Ethereum_TxOverrides" + }, + "type": "Ethereum_TxOverrides" + } + ], + "kind": 64, + "name": "callContractMethod", + "required": true, + "return": { + "kind": 34, + "name": "callContractMethod", + "object": { + "kind": 8192, + "name": "callContractMethod", + "required": true, + "type": "Ethereum_TxResponse" + }, + "required": true, + "type": "Ethereum_TxResponse" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + }, + { + "kind": 34, + "name": "txOverrides", + "object": { + "kind": 8192, + "name": "txOverrides", + "type": "Ethereum_TxOverrides" + }, + "type": "Ethereum_TxOverrides" + } + ], + "kind": 64, + "name": "callContractMethodAndWait", + "required": true, + "return": { + "kind": 34, + "name": "callContractMethodAndWait", + "object": { + "kind": 8192, + "name": "callContractMethodAndWait", + "required": true, + "type": "Ethereum_TxReceipt" + }, + "required": true, + "type": "Ethereum_TxReceipt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "tx", + "object": { + "kind": 8192, + "name": "tx", + "required": true, + "type": "Ethereum_TxRequest" + }, + "required": true, + "type": "Ethereum_TxRequest" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "sendTransaction", + "required": true, + "return": { + "kind": 34, + "name": "sendTransaction", + "object": { + "kind": 8192, + "name": "sendTransaction", + "required": true, + "type": "Ethereum_TxResponse" + }, + "required": true, + "type": "Ethereum_TxResponse" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "tx", + "object": { + "kind": 8192, + "name": "tx", + "required": true, + "type": "Ethereum_TxRequest" + }, + "required": true, + "type": "Ethereum_TxRequest" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "sendTransactionAndWait", + "required": true, + "return": { + "kind": 34, + "name": "sendTransactionAndWait", + "object": { + "kind": 8192, + "name": "sendTransactionAndWait", + "required": true, + "type": "Ethereum_TxReceipt" + }, + "required": true, + "type": "Ethereum_TxReceipt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "abi", + "required": true, + "scalar": { + "kind": 4, + "name": "abi", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "bytecode", + "required": true, + "scalar": { + "kind": 4, + "name": "bytecode", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "deployContract", + "required": true, + "return": { + "kind": 34, + "name": "deployContract", + "required": true, + "scalar": { + "kind": 4, + "name": "deployContract", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "message", + "required": true, + "scalar": { + "kind": 4, + "name": "message", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "signMessage", + "required": true, + "return": { + "kind": 34, + "name": "signMessage", + "required": true, + "scalar": { + "kind": 4, + "name": "signMessage", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "params", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "params", + "required": true, + "scalar": { + "kind": 4, + "name": "params", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "params", + "required": true, + "type": "[String]" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "sendRPC", + "required": true, + "return": { + "kind": 34, + "name": "sendRPC", + "scalar": { + "kind": 4, + "name": "sendRPC", + "type": "String" + }, + "type": "String" + }, + "type": "Method" + } + ], + "namespace": "Ethereum", + "nativeType": "Module", + "type": "Ethereum_Module", + "uri": "ens/ethereum.polywrap.eth" + } + ], + "importedObjectTypes": [ + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "Connection", + "properties": [ + { + "kind": 34, + "name": "node", + "scalar": { + "kind": 4, + "name": "node", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "networkNameOrChainId", + "scalar": { + "kind": 4, + "name": "networkNameOrChainId", + "type": "String" + }, + "type": "String" + } + ], + "type": "Ethereum_Connection", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "TxOverrides", + "properties": [ + { + "kind": 34, + "name": "gasLimit", + "scalar": { + "kind": 4, + "name": "gasLimit", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "gasPrice", + "scalar": { + "kind": 4, + "name": "gasPrice", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "value", + "scalar": { + "kind": 4, + "name": "value", + "type": "BigInt" + }, + "type": "BigInt" + } + ], + "type": "Ethereum_TxOverrides", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "StaticTxResult", + "properties": [ + { + "kind": 34, + "name": "result", + "required": true, + "scalar": { + "kind": 4, + "name": "result", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "error", + "required": true, + "scalar": { + "kind": 4, + "name": "error", + "required": true, + "type": "Boolean" + }, + "type": "Boolean" + } + ], + "type": "Ethereum_StaticTxResult", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "TxRequest", + "properties": [ + { + "kind": 34, + "name": "to", + "scalar": { + "kind": 4, + "name": "to", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "from", + "scalar": { + "kind": 4, + "name": "from", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "nonce", + "scalar": { + "kind": 4, + "name": "nonce", + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "gasLimit", + "scalar": { + "kind": 4, + "name": "gasLimit", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "gasPrice", + "scalar": { + "kind": 4, + "name": "gasPrice", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "data", + "scalar": { + "kind": 4, + "name": "data", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "value", + "scalar": { + "kind": 4, + "name": "value", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "chainId", + "scalar": { + "kind": 4, + "name": "chainId", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "type", + "scalar": { + "kind": 4, + "name": "type", + "type": "UInt32" + }, + "type": "UInt32" + } + ], + "type": "Ethereum_TxRequest", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "TxReceipt", + "properties": [ + { + "kind": 34, + "name": "to", + "required": true, + "scalar": { + "kind": 4, + "name": "to", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "from", + "required": true, + "scalar": { + "kind": 4, + "name": "from", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "contractAddress", + "required": true, + "scalar": { + "kind": 4, + "name": "contractAddress", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "transactionIndex", + "required": true, + "scalar": { + "kind": 4, + "name": "transactionIndex", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "root", + "scalar": { + "kind": 4, + "name": "root", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "gasUsed", + "required": true, + "scalar": { + "kind": 4, + "name": "gasUsed", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "logsBloom", + "required": true, + "scalar": { + "kind": 4, + "name": "logsBloom", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "transactionHash", + "required": true, + "scalar": { + "kind": 4, + "name": "transactionHash", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 8192, + "name": "logs", + "required": true, + "type": "Ethereum_Log" + }, + "kind": 18, + "name": "logs", + "object": { + "kind": 8192, + "name": "logs", + "required": true, + "type": "Ethereum_Log" + }, + "required": true, + "type": "[Ethereum_Log]" + }, + "kind": 34, + "name": "logs", + "required": true, + "type": "[Ethereum_Log]" + }, + { + "kind": 34, + "name": "blockNumber", + "required": true, + "scalar": { + "kind": 4, + "name": "blockNumber", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "blockHash", + "required": true, + "scalar": { + "kind": 4, + "name": "blockHash", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "confirmations", + "required": true, + "scalar": { + "kind": 4, + "name": "confirmations", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "cumulativeGasUsed", + "required": true, + "scalar": { + "kind": 4, + "name": "cumulativeGasUsed", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "effectiveGasPrice", + "required": true, + "scalar": { + "kind": 4, + "name": "effectiveGasPrice", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "byzantium", + "required": true, + "scalar": { + "kind": 4, + "name": "byzantium", + "required": true, + "type": "Boolean" + }, + "type": "Boolean" + }, + { + "kind": 34, + "name": "type", + "required": true, + "scalar": { + "kind": 4, + "name": "type", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "status", + "scalar": { + "kind": 4, + "name": "status", + "type": "UInt32" + }, + "type": "UInt32" + } + ], + "type": "Ethereum_TxReceipt", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "Log", + "properties": [ + { + "kind": 34, + "name": "blockNumber", + "required": true, + "scalar": { + "kind": 4, + "name": "blockNumber", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "blockHash", + "required": true, + "scalar": { + "kind": 4, + "name": "blockHash", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "transactionIndex", + "required": true, + "scalar": { + "kind": 4, + "name": "transactionIndex", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "removed", + "required": true, + "scalar": { + "kind": 4, + "name": "removed", + "required": true, + "type": "Boolean" + }, + "type": "Boolean" + }, + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "data", + "required": true, + "scalar": { + "kind": 4, + "name": "data", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "topics", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "topics", + "required": true, + "scalar": { + "kind": 4, + "name": "topics", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "topics", + "required": true, + "type": "[String]" + }, + { + "kind": 34, + "name": "transactionHash", + "required": true, + "scalar": { + "kind": 4, + "name": "transactionHash", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "logIndex", + "required": true, + "scalar": { + "kind": 4, + "name": "logIndex", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + } + ], + "type": "Ethereum_Log", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "EventNotification", + "properties": [ + { + "kind": 34, + "name": "data", + "required": true, + "scalar": { + "kind": 4, + "name": "data", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "log", + "object": { + "kind": 8192, + "name": "log", + "required": true, + "type": "Ethereum_Log" + }, + "required": true, + "type": "Ethereum_Log" + } + ], + "type": "Ethereum_EventNotification", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "Network", + "properties": [ + { + "kind": 34, + "name": "name", + "required": true, + "scalar": { + "kind": 4, + "name": "name", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "chainId", + "required": true, + "scalar": { + "kind": 4, + "name": "chainId", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "ensAddress", + "scalar": { + "kind": 4, + "name": "ensAddress", + "type": "String" + }, + "type": "String" + } + ], + "type": "Ethereum_Network", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "TxResponse", + "properties": [ + { + "kind": 34, + "name": "hash", + "required": true, + "scalar": { + "kind": 4, + "name": "hash", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "to", + "scalar": { + "kind": 4, + "name": "to", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "from", + "required": true, + "scalar": { + "kind": 4, + "name": "from", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "nonce", + "required": true, + "scalar": { + "kind": 4, + "name": "nonce", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "gasLimit", + "required": true, + "scalar": { + "kind": 4, + "name": "gasLimit", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "gasPrice", + "scalar": { + "kind": 4, + "name": "gasPrice", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "data", + "required": true, + "scalar": { + "kind": 4, + "name": "data", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "value", + "required": true, + "scalar": { + "kind": 4, + "name": "value", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "chainId", + "required": true, + "scalar": { + "kind": 4, + "name": "chainId", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "blockNumber", + "scalar": { + "kind": 4, + "name": "blockNumber", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "blockHash", + "scalar": { + "kind": 4, + "name": "blockHash", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "timestamp", + "scalar": { + "kind": 4, + "name": "timestamp", + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "confirmations", + "required": true, + "scalar": { + "kind": 4, + "name": "confirmations", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "raw", + "scalar": { + "kind": 4, + "name": "raw", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "r", + "scalar": { + "kind": 4, + "name": "r", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "s", + "scalar": { + "kind": 4, + "name": "s", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "v", + "scalar": { + "kind": 4, + "name": "v", + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "type", + "scalar": { + "kind": 4, + "name": "type", + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "array": { + "item": { + "kind": 8192, + "name": "accessList", + "required": true, + "type": "Ethereum_Access" + }, + "kind": 18, + "name": "accessList", + "object": { + "kind": 8192, + "name": "accessList", + "required": true, + "type": "Ethereum_Access" + }, + "type": "[Ethereum_Access]" + }, + "kind": 34, + "name": "accessList", + "type": "[Ethereum_Access]" + } + ], + "type": "Ethereum_TxResponse", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "Access", + "properties": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "storageKeys", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "storageKeys", + "required": true, + "scalar": { + "kind": 4, + "name": "storageKeys", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "storageKeys", + "required": true, + "type": "[String]" + } + ], + "type": "Ethereum_Access", + "uri": "ens/ethereum.polywrap.eth" + } + ], + "moduleType": { + "imports": [ + { + "type": "Ethereum_Module" + }, + { + "type": "Ethereum_Connection" + }, + { + "type": "Ethereum_TxOverrides" + }, + { + "type": "Ethereum_StaticTxResult" + }, + { + "type": "Ethereum_TxRequest" + }, + { + "type": "Ethereum_TxReceipt" + }, + { + "type": "Ethereum_Log" + }, + { + "type": "Ethereum_EventNotification" + }, + { + "type": "Ethereum_Network" + }, + { + "type": "Ethereum_TxResponse" + }, + { + "type": "Ethereum_Access" + } + ], + "kind": 128, + "methods": [ + { + "arguments": [ + { + "kind": 34, + "name": "str", + "required": true, + "scalar": { + "kind": 4, + "name": "str", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "optStr", + "scalar": { + "kind": 4, + "name": "optStr", + "type": "String" + }, + "type": "String" + } + ], + "kind": 64, + "name": "method", + "required": true, + "return": { + "kind": 34, + "name": "method", + "object": { + "kind": 8192, + "name": "method", + "required": true, + "type": "Object" + }, + "required": true, + "type": "Object" + }, + "type": "Method" + } + ], + "type": "Module" + }, + "objectTypes": [ + { + "kind": 1, + "properties": [ + { + "kind": 34, + "name": "u", + "required": true, + "scalar": { + "kind": 4, + "name": "u", + "required": true, + "type": "UInt" + }, + "type": "UInt" + }, + { + "array": { + "item": { + "kind": 4, + "name": "array", + "required": true, + "type": "Boolean" + }, + "kind": 18, + "name": "array", + "required": true, + "scalar": { + "kind": 4, + "name": "array", + "required": true, + "type": "Boolean" + }, + "type": "[Boolean]" + }, + "kind": 34, + "name": "array", + "required": true, + "type": "[Boolean]" + }, + { + "kind": 34, + "name": "bytes", + "scalar": { + "kind": 4, + "name": "bytes", + "type": "Bytes" + }, + "type": "Bytes" + } + ], + "type": "Object" + } + ], + "version": "0.1" +} +} diff --git a/packages/test-cases/cases/cli/plugin/codegen/002-single-module/polywrap.plugin.yaml b/packages/test-cases/cases/cli/plugin/codegen/002-single-module/polywrap.plugin.yaml index 7a95fddd10..b6e429cf4e 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/002-single-module/polywrap.plugin.yaml +++ b/packages/test-cases/cases/cli/plugin/codegen/002-single-module/polywrap.plugin.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: Test language: plugin/typescript schema: ./schema.graphql diff --git a/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/build-artifacts/polywrap.plugin.json b/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/build-artifacts/polywrap.plugin.json deleted file mode 100644 index 020adca63c..0000000000 --- a/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/build-artifacts/polywrap.plugin.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "format": "0.1.0", - "name": "Test", - "language": "plugin/typescript", - "schema": "./schema.graphql", - "module": "./src/index.ts" -} \ No newline at end of file diff --git a/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/build-artifacts/wrap.info b/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/build-artifacts/wrap.info new file mode 100644 index 0000000000..75835848cf Binary files /dev/null and b/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/build-artifacts/wrap.info differ diff --git a/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/stdout.json b/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/stdout.json index d9b77bbc00..d1dc098fa5 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/stdout.json +++ b/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/stdout.json @@ -2,7 +2,7 @@ "stdout": [ "Manifest loaded from ./polywrap.plugin.yaml", "Generate types", - "Manifest written to ./build/polywrap.plugin.json" + "Manifest written to ./build/wrap.info" ], "exitCode": 0 } diff --git a/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/wrap/index.ts b/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/wrap/index.ts index f367d143d9..315871f96d 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/wrap/index.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/wrap/index.ts @@ -1,8 +1,7 @@ /// NOTE: This is an auto-generated file. /// All modifications will be overwritten. -export * from "./schema"; -export * from "./manifest"; +export * from "./wrap.info"; export * from "./module"; export * from "./types"; diff --git a/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/wrap/manifest.ts b/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/wrap/manifest.ts deleted file mode 100644 index 730cf8326f..0000000000 --- a/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/wrap/manifest.ts +++ /dev/null @@ -1,15 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { schema } from "./"; - -// @ts-ignore -import { PluginPackageManifest, Uri } from "@polywrap/core-js"; - -export const manifest: PluginPackageManifest = { - schema, - implements: [ - ], -}; diff --git a/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/wrap/schema.ts b/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/wrap/schema.ts deleted file mode 100644 index 13ceb96ba1..0000000000 --- a/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/wrap/schema.ts +++ /dev/null @@ -1,64 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export const schema: string = `### Polywrap Header START ### -scalar UInt -scalar UInt8 -scalar UInt16 -scalar UInt32 -scalar Int -scalar Int8 -scalar Int16 -scalar Int32 -scalar Bytes -scalar BigInt -scalar BigNumber -scalar JSON -scalar Map - -directive @imported( - uri: String! - namespace: String! - nativeType: String! -) on OBJECT | ENUM - -directive @imports( - types: [String!]! -) on OBJECT - -directive @capability( - type: String! - uri: String! - namespace: String! -) repeatable on OBJECT - -directive @enabled_interface on OBJECT - -directive @annotate(type: String!) on FIELD - -directive @env(required: Boolean!) on FIELD_DEFINITION - -### Polywrap Header END ### - -type Module { - method( - str: String! - ): String! -} - -type Env { - arg1: String! -} - -### Imported Modules START ### - -### Imported Modules END ### - -### Imported Objects START ### - -### Imported Objects END ### - -### Imported Envs START ### - -### Imported Envs END ### -`; diff --git a/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/wrap/wrap.info.ts b/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/wrap/wrap.info.ts new file mode 100644 index 0000000000..6518f6e3cc --- /dev/null +++ b/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/wrap/wrap.info.ts @@ -0,0 +1,68 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. +import { WrapManifest } from "@polywrap/wrap-manifest-types-js" + +export const manifest: WrapManifest = { + name: "Test", + type: "plugin", + version: "0.1", + abi: { + "envType": { + "kind": 65536, + "properties": [ + { + "kind": 34, + "name": "arg1", + "required": true, + "scalar": { + "kind": 4, + "name": "arg1", + "required": true, + "type": "String" + }, + "type": "String" + } + ], + "type": "Env" + }, + "moduleType": { + "kind": 128, + "methods": [ + { + "arguments": [ + { + "kind": 34, + "name": "str", + "required": true, + "scalar": { + "kind": 4, + "name": "str", + "required": true, + "type": "String" + }, + "type": "String" + } + ], + "kind": 64, + "name": "method", + "required": true, + "return": { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + } + ], + "type": "Module" + }, + "version": "0.1" +} +} diff --git a/packages/test-cases/cases/cli/plugin/codegen/003-env/polywrap.plugin.yaml b/packages/test-cases/cases/cli/plugin/codegen/003-env/polywrap.plugin.yaml index 7a95fddd10..b6e429cf4e 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/003-env/polywrap.plugin.yaml +++ b/packages/test-cases/cases/cli/plugin/codegen/003-env/polywrap.plugin.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: Test language: plugin/typescript schema: ./schema.graphql diff --git a/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/build-artifacts/polywrap.plugin.json b/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/build-artifacts/polywrap.plugin.json deleted file mode 100644 index 020adca63c..0000000000 --- a/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/build-artifacts/polywrap.plugin.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "format": "0.1.0", - "name": "Test", - "language": "plugin/typescript", - "schema": "./schema.graphql", - "module": "./src/index.ts" -} \ No newline at end of file diff --git a/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/build-artifacts/schema.graphql b/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/build-artifacts/schema.graphql deleted file mode 100644 index 5b0a33e479..0000000000 --- a/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/build-artifacts/schema.graphql +++ /dev/null @@ -1,60 +0,0 @@ -### Polywrap Header START ### -scalar UInt -scalar UInt8 -scalar UInt16 -scalar UInt32 -scalar Int -scalar Int8 -scalar Int16 -scalar Int32 -scalar Bytes -scalar BigInt -scalar BigNumber -scalar JSON -scalar Map - -directive @imported( - uri: String! - namespace: String! - nativeType: String! -) on OBJECT | ENUM - -directive @imports( - types: [String!]! -) on OBJECT - -directive @capability( - type: String! - uri: String! - namespace: String! -) repeatable on OBJECT - -directive @enabled_interface on OBJECT - -directive @annotate(type: String!) on FIELD - -directive @env(required: Boolean!) on FIELD_DEFINITION - -### Polywrap Header END ### - -type Module { - method( - str: String! - ): String! -} - -type Env { - queryArg: String! -} - -### Imported Modules START ### - -### Imported Modules END ### - -### Imported Objects START ### - -### Imported Objects END ### - -### Imported Envs START ### - -### Imported Envs END ### diff --git a/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/build-artifacts/wrap.info b/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/build-artifacts/wrap.info new file mode 100644 index 0000000000..dc0e0cc356 Binary files /dev/null and b/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/build-artifacts/wrap.info differ diff --git a/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/stdout.json b/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/stdout.json index d9b77bbc00..d1dc098fa5 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/stdout.json +++ b/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/stdout.json @@ -2,7 +2,7 @@ "stdout": [ "Manifest loaded from ./polywrap.plugin.yaml", "Generate types", - "Manifest written to ./build/polywrap.plugin.json" + "Manifest written to ./build/wrap.info" ], "exitCode": 0 } diff --git a/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/wrap/index.ts b/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/wrap/index.ts index f367d143d9..315871f96d 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/wrap/index.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/wrap/index.ts @@ -1,8 +1,7 @@ /// NOTE: This is an auto-generated file. /// All modifications will be overwritten. -export * from "./schema"; -export * from "./manifest"; +export * from "./wrap.info"; export * from "./module"; export * from "./types"; diff --git a/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/wrap/manifest.ts b/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/wrap/manifest.ts deleted file mode 100644 index 730cf8326f..0000000000 --- a/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/wrap/manifest.ts +++ /dev/null @@ -1,15 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { schema } from "./"; - -// @ts-ignore -import { PluginPackageManifest, Uri } from "@polywrap/core-js"; - -export const manifest: PluginPackageManifest = { - schema, - implements: [ - ], -}; diff --git a/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/wrap/schema.ts b/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/wrap/schema.ts deleted file mode 100644 index 3606d92e34..0000000000 --- a/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/wrap/schema.ts +++ /dev/null @@ -1,64 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export const schema: string = `### Polywrap Header START ### -scalar UInt -scalar UInt8 -scalar UInt16 -scalar UInt32 -scalar Int -scalar Int8 -scalar Int16 -scalar Int32 -scalar Bytes -scalar BigInt -scalar BigNumber -scalar JSON -scalar Map - -directive @imported( - uri: String! - namespace: String! - nativeType: String! -) on OBJECT | ENUM - -directive @imports( - types: [String!]! -) on OBJECT - -directive @capability( - type: String! - uri: String! - namespace: String! -) repeatable on OBJECT - -directive @enabled_interface on OBJECT - -directive @annotate(type: String!) on FIELD - -directive @env(required: Boolean!) on FIELD_DEFINITION - -### Polywrap Header END ### - -type Module { - method( - str: String! - ): String! -} - -type Env { - queryArg: String! -} - -### Imported Modules START ### - -### Imported Modules END ### - -### Imported Objects START ### - -### Imported Objects END ### - -### Imported Envs START ### - -### Imported Envs END ### -`; diff --git a/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/wrap/wrap.info.ts b/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/wrap/wrap.info.ts new file mode 100644 index 0000000000..9e3fbbf09c --- /dev/null +++ b/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/expected/wrap/wrap.info.ts @@ -0,0 +1,68 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. +import { WrapManifest } from "@polywrap/wrap-manifest-types-js" + +export const manifest: WrapManifest = { + name: "Test", + type: "plugin", + version: "0.1", + abi: { + "envType": { + "kind": 65536, + "properties": [ + { + "kind": 34, + "name": "queryArg", + "required": true, + "scalar": { + "kind": 4, + "name": "queryArg", + "required": true, + "type": "String" + }, + "type": "String" + } + ], + "type": "Env" + }, + "moduleType": { + "kind": 128, + "methods": [ + { + "arguments": [ + { + "kind": 34, + "name": "str", + "required": true, + "scalar": { + "kind": 4, + "name": "str", + "required": true, + "type": "String" + }, + "type": "String" + } + ], + "kind": 64, + "name": "method", + "required": true, + "return": { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + } + ], + "type": "Module" + }, + "version": "0.1" +} +} diff --git a/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/polywrap.plugin.yaml b/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/polywrap.plugin.yaml index 7a95fddd10..b6e429cf4e 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/polywrap.plugin.yaml +++ b/packages/test-cases/cases/cli/plugin/codegen/004-env-sanitization/polywrap.plugin.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: Test language: plugin/typescript schema: ./schema.graphql diff --git a/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/build-artifacts/polywrap.plugin.json b/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/build-artifacts/polywrap.plugin.json deleted file mode 100644 index 020adca63c..0000000000 --- a/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/build-artifacts/polywrap.plugin.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "format": "0.1.0", - "name": "Test", - "language": "plugin/typescript", - "schema": "./schema.graphql", - "module": "./src/index.ts" -} \ No newline at end of file diff --git a/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/build-artifacts/schema.graphql b/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/build-artifacts/schema.graphql deleted file mode 100644 index f897f36cce..0000000000 --- a/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/build-artifacts/schema.graphql +++ /dev/null @@ -1,386 +0,0 @@ -### Polywrap Header START ### -scalar UInt -scalar UInt8 -scalar UInt16 -scalar UInt32 -scalar Int -scalar Int8 -scalar Int16 -scalar Int32 -scalar Bytes -scalar BigInt -scalar BigNumber -scalar JSON -scalar Map - -directive @imported( - uri: String! - namespace: String! - nativeType: String! -) on OBJECT | ENUM - -directive @imports( - types: [String!]! -) on OBJECT - -directive @capability( - type: String! - uri: String! - namespace: String! -) repeatable on OBJECT - -directive @enabled_interface on OBJECT - -directive @annotate(type: String!) on FIELD - -directive @env(required: Boolean!) on FIELD_DEFINITION - -### Polywrap Header END ### - -type Module @imports( - types: [ - "Ethereum_Module", - "Ethereum_Connection", - "Ethereum_TxOverrides", - "Ethereum_StaticTxResult", - "Ethereum_TxRequest", - "Ethereum_TxReceipt", - "Ethereum_Log", - "Ethereum_EventNotification", - "Ethereum_Network", - "Ethereum_TxResponse", - "Ethereum_Access" - ] -) { - methodOne( - str: String! - optStr: String - ): Object! - - methodTwo( - arg: UInt32! - ): String! -} - -type Env { - arg1: String! -} - -type Object { - u: UInt! - array: [Boolean!]! - bytes: Bytes -} - -### Imported Modules START ### - -type Ethereum_Module @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Module" -) { - callContractView( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - ): String! - - callContractStatic( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): Ethereum_StaticTxResult! - - getBalance( - address: String! - blockTag: BigInt - connection: Ethereum_Connection - ): BigInt! - - encodeParams( - types: [String!]! - values: [String!]! - ): String! - - encodeFunction( - method: String! - args: [String!] - ): String! - - solidityPack( - types: [String!]! - values: [String!]! - ): String! - - solidityKeccak256( - types: [String!]! - values: [String!]! - ): String! - - soliditySha256( - types: [String!]! - values: [String!]! - ): String! - - getSignerAddress( - connection: Ethereum_Connection - ): String! - - getSignerBalance( - blockTag: BigInt - connection: Ethereum_Connection - ): BigInt! - - getSignerTransactionCount( - blockTag: BigInt - connection: Ethereum_Connection - ): BigInt! - - getGasPrice( - connection: Ethereum_Connection - ): BigInt! - - estimateTransactionGas( - tx: Ethereum_TxRequest! - connection: Ethereum_Connection - ): BigInt! - - estimateContractCallGas( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): BigInt! - - checkAddress( - address: String! - ): Boolean! - - toWei( - eth: String! - ): BigInt! - - toEth( - wei: BigInt! - ): String! - - awaitTransaction( - txHash: String! - confirmations: UInt32! - timeout: UInt32! - connection: Ethereum_Connection - ): Ethereum_TxReceipt! - - waitForEvent( - address: String! - event: String! - args: [String!] - timeout: UInt32 - connection: Ethereum_Connection - ): Ethereum_EventNotification! - - getNetwork( - connection: Ethereum_Connection - ): Ethereum_Network! - - requestAccounts( - connection: Ethereum_Connection - ): [String!]! - - callContractMethod( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): Ethereum_TxResponse! - - callContractMethodAndWait( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): Ethereum_TxReceipt! - - sendTransaction( - tx: Ethereum_TxRequest! - connection: Ethereum_Connection - ): Ethereum_TxResponse! - - sendTransactionAndWait( - tx: Ethereum_TxRequest! - connection: Ethereum_Connection - ): Ethereum_TxReceipt! - - deployContract( - abi: String! - bytecode: String! - args: [String!] - connection: Ethereum_Connection - ): String! - - signMessage( - message: String! - connection: Ethereum_Connection - ): String! - - sendRPC( - method: String! - params: [String!]! - connection: Ethereum_Connection - ): String -} - -### Imported Modules END ### - -### Imported Objects START ### - -type Ethereum_Connection @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Connection" -) { - node: String - networkNameOrChainId: String -} - -type Ethereum_TxOverrides @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxOverrides" -) { - gasLimit: BigInt - gasPrice: BigInt - value: BigInt -} - -type Ethereum_StaticTxResult @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "StaticTxResult" -) { - result: String! - error: Boolean! -} - -type Ethereum_TxRequest @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxRequest" -) { - to: String - from: String - nonce: UInt32 - gasLimit: BigInt - gasPrice: BigInt - data: String - value: BigInt - chainId: BigInt - type: UInt32 -} - -type Ethereum_TxReceipt @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxReceipt" -) { - to: String! - from: String! - contractAddress: String! - transactionIndex: UInt32! - root: String - gasUsed: BigInt! - logsBloom: String! - transactionHash: String! - logs: [Ethereum_Log!]! - blockNumber: BigInt! - blockHash: String! - confirmations: UInt32! - cumulativeGasUsed: BigInt! - effectiveGasPrice: BigInt! - byzantium: Boolean! - type: UInt32! - status: UInt32 -} - -type Ethereum_Log @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Log" -) { - blockNumber: BigInt! - blockHash: String! - transactionIndex: UInt32! - removed: Boolean! - address: String! - data: String! - topics: [String!]! - transactionHash: String! - logIndex: UInt32! -} - -type Ethereum_EventNotification @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "EventNotification" -) { - data: String! - address: String! - log: Ethereum_Log! -} - -type Ethereum_Network @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Network" -) { - name: String! - chainId: BigInt! - ensAddress: String -} - -type Ethereum_TxResponse @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxResponse" -) { - hash: String! - to: String - from: String! - nonce: UInt32! - gasLimit: BigInt! - gasPrice: BigInt - data: String! - value: BigInt! - chainId: BigInt! - blockNumber: BigInt - blockHash: String - timestamp: UInt32 - confirmations: UInt32! - raw: String - r: String - s: String - v: UInt32 - type: UInt32 - accessList: [Ethereum_Access!] -} - -type Ethereum_Access @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Access" -) { - address: String! - storageKeys: [String!]! -} - -### Imported Objects END ### - -### Imported Envs START ### - -### Imported Envs END ### diff --git a/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/build-artifacts/wrap.info b/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/build-artifacts/wrap.info new file mode 100644 index 0000000000..d79a2831a2 Binary files /dev/null and b/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/build-artifacts/wrap.info differ diff --git a/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/stdout.json b/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/stdout.json index d9b77bbc00..d1dc098fa5 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/stdout.json +++ b/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/stdout.json @@ -2,7 +2,7 @@ "stdout": [ "Manifest loaded from ./polywrap.plugin.yaml", "Generate types", - "Manifest written to ./build/polywrap.plugin.json" + "Manifest written to ./build/wrap.info" ], "exitCode": 0 } diff --git a/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/index.ts b/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/index.ts index f367d143d9..315871f96d 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/index.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/index.ts @@ -1,8 +1,7 @@ /// NOTE: This is an auto-generated file. /// All modifications will be overwritten. -export * from "./schema"; -export * from "./manifest"; +export * from "./wrap.info"; export * from "./module"; export * from "./types"; diff --git a/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/manifest.ts b/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/manifest.ts deleted file mode 100644 index 730cf8326f..0000000000 --- a/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/manifest.ts +++ /dev/null @@ -1,15 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { schema } from "./"; - -// @ts-ignore -import { PluginPackageManifest, Uri } from "@polywrap/core-js"; - -export const manifest: PluginPackageManifest = { - schema, - implements: [ - ], -}; diff --git a/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/schema.ts b/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/schema.ts deleted file mode 100644 index d4cd2b562d..0000000000 --- a/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/schema.ts +++ /dev/null @@ -1,390 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export const schema: string = `### Polywrap Header START ### -scalar UInt -scalar UInt8 -scalar UInt16 -scalar UInt32 -scalar Int -scalar Int8 -scalar Int16 -scalar Int32 -scalar Bytes -scalar BigInt -scalar BigNumber -scalar JSON -scalar Map - -directive @imported( - uri: String! - namespace: String! - nativeType: String! -) on OBJECT | ENUM - -directive @imports( - types: [String!]! -) on OBJECT - -directive @capability( - type: String! - uri: String! - namespace: String! -) repeatable on OBJECT - -directive @enabled_interface on OBJECT - -directive @annotate(type: String!) on FIELD - -directive @env(required: Boolean!) on FIELD_DEFINITION - -### Polywrap Header END ### - -type Module @imports( - types: [ - "Ethereum_Module", - "Ethereum_Connection", - "Ethereum_TxOverrides", - "Ethereum_StaticTxResult", - "Ethereum_TxRequest", - "Ethereum_TxReceipt", - "Ethereum_Log", - "Ethereum_EventNotification", - "Ethereum_Network", - "Ethereum_TxResponse", - "Ethereum_Access" - ] -) { - methodOne( - str: String! - optStr: String - ): Object! - - methodTwo( - arg: UInt32! - ): String! -} - -type Env { - arg1: String! -} - -type Object { - u: UInt! - array: [Boolean!]! - bytes: Bytes -} - -### Imported Modules START ### - -type Ethereum_Module @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Module" -) { - callContractView( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - ): String! - - callContractStatic( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): Ethereum_StaticTxResult! - - getBalance( - address: String! - blockTag: BigInt - connection: Ethereum_Connection - ): BigInt! - - encodeParams( - types: [String!]! - values: [String!]! - ): String! - - encodeFunction( - method: String! - args: [String!] - ): String! - - solidityPack( - types: [String!]! - values: [String!]! - ): String! - - solidityKeccak256( - types: [String!]! - values: [String!]! - ): String! - - soliditySha256( - types: [String!]! - values: [String!]! - ): String! - - getSignerAddress( - connection: Ethereum_Connection - ): String! - - getSignerBalance( - blockTag: BigInt - connection: Ethereum_Connection - ): BigInt! - - getSignerTransactionCount( - blockTag: BigInt - connection: Ethereum_Connection - ): BigInt! - - getGasPrice( - connection: Ethereum_Connection - ): BigInt! - - estimateTransactionGas( - tx: Ethereum_TxRequest! - connection: Ethereum_Connection - ): BigInt! - - estimateContractCallGas( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): BigInt! - - checkAddress( - address: String! - ): Boolean! - - toWei( - eth: String! - ): BigInt! - - toEth( - wei: BigInt! - ): String! - - awaitTransaction( - txHash: String! - confirmations: UInt32! - timeout: UInt32! - connection: Ethereum_Connection - ): Ethereum_TxReceipt! - - waitForEvent( - address: String! - event: String! - args: [String!] - timeout: UInt32 - connection: Ethereum_Connection - ): Ethereum_EventNotification! - - getNetwork( - connection: Ethereum_Connection - ): Ethereum_Network! - - requestAccounts( - connection: Ethereum_Connection - ): [String!]! - - callContractMethod( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): Ethereum_TxResponse! - - callContractMethodAndWait( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): Ethereum_TxReceipt! - - sendTransaction( - tx: Ethereum_TxRequest! - connection: Ethereum_Connection - ): Ethereum_TxResponse! - - sendTransactionAndWait( - tx: Ethereum_TxRequest! - connection: Ethereum_Connection - ): Ethereum_TxReceipt! - - deployContract( - abi: String! - bytecode: String! - args: [String!] - connection: Ethereum_Connection - ): String! - - signMessage( - message: String! - connection: Ethereum_Connection - ): String! - - sendRPC( - method: String! - params: [String!]! - connection: Ethereum_Connection - ): String -} - -### Imported Modules END ### - -### Imported Objects START ### - -type Ethereum_Connection @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Connection" -) { - node: String - networkNameOrChainId: String -} - -type Ethereum_TxOverrides @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxOverrides" -) { - gasLimit: BigInt - gasPrice: BigInt - value: BigInt -} - -type Ethereum_StaticTxResult @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "StaticTxResult" -) { - result: String! - error: Boolean! -} - -type Ethereum_TxRequest @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxRequest" -) { - to: String - from: String - nonce: UInt32 - gasLimit: BigInt - gasPrice: BigInt - data: String - value: BigInt - chainId: BigInt - type: UInt32 -} - -type Ethereum_TxReceipt @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxReceipt" -) { - to: String! - from: String! - contractAddress: String! - transactionIndex: UInt32! - root: String - gasUsed: BigInt! - logsBloom: String! - transactionHash: String! - logs: [Ethereum_Log!]! - blockNumber: BigInt! - blockHash: String! - confirmations: UInt32! - cumulativeGasUsed: BigInt! - effectiveGasPrice: BigInt! - byzantium: Boolean! - type: UInt32! - status: UInt32 -} - -type Ethereum_Log @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Log" -) { - blockNumber: BigInt! - blockHash: String! - transactionIndex: UInt32! - removed: Boolean! - address: String! - data: String! - topics: [String!]! - transactionHash: String! - logIndex: UInt32! -} - -type Ethereum_EventNotification @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "EventNotification" -) { - data: String! - address: String! - log: Ethereum_Log! -} - -type Ethereum_Network @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Network" -) { - name: String! - chainId: BigInt! - ensAddress: String -} - -type Ethereum_TxResponse @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxResponse" -) { - hash: String! - to: String - from: String! - nonce: UInt32! - gasLimit: BigInt! - gasPrice: BigInt - data: String! - value: BigInt! - chainId: BigInt! - blockNumber: BigInt - blockHash: String - timestamp: UInt32 - confirmations: UInt32! - raw: String - r: String - s: String - v: UInt32 - type: UInt32 - accessList: [Ethereum_Access!] -} - -type Ethereum_Access @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Access" -) { - address: String! - storageKeys: [String!]! -} - -### Imported Objects END ### - -### Imported Envs START ### - -### Imported Envs END ### -`; diff --git a/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/wrap.info.ts b/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/wrap.info.ts new file mode 100644 index 0000000000..80f300e7ad --- /dev/null +++ b/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/expected/wrap/wrap.info.ts @@ -0,0 +1,2689 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. +import { WrapManifest } from "@polywrap/wrap-manifest-types-js" + +export const manifest: WrapManifest = { + name: "Test", + type: "plugin", + version: "0.1", + abi: { + "envType": { + "kind": 65536, + "properties": [ + { + "kind": 34, + "name": "arg1", + "required": true, + "scalar": { + "kind": 4, + "name": "arg1", + "required": true, + "type": "String" + }, + "type": "String" + } + ], + "type": "Env" + }, + "importedModuleTypes": [ + { + "isInterface": false, + "kind": 256, + "methods": [ + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "callContractView", + "required": true, + "return": { + "kind": 34, + "name": "callContractView", + "required": true, + "scalar": { + "kind": 4, + "name": "callContractView", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + }, + { + "kind": 34, + "name": "txOverrides", + "object": { + "kind": 8192, + "name": "txOverrides", + "type": "Ethereum_TxOverrides" + }, + "type": "Ethereum_TxOverrides" + } + ], + "kind": 64, + "name": "callContractStatic", + "required": true, + "return": { + "kind": 34, + "name": "callContractStatic", + "object": { + "kind": 8192, + "name": "callContractStatic", + "required": true, + "type": "Ethereum_StaticTxResult" + }, + "required": true, + "type": "Ethereum_StaticTxResult" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "blockTag", + "scalar": { + "kind": 4, + "name": "blockTag", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "getBalance", + "required": true, + "return": { + "kind": 34, + "name": "getBalance", + "required": true, + "scalar": { + "kind": 4, + "name": "getBalance", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "array": { + "item": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "types", + "required": true, + "scalar": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "types", + "required": true, + "type": "[String]" + }, + { + "array": { + "item": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "values", + "required": true, + "scalar": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "values", + "required": true, + "type": "[String]" + } + ], + "kind": 64, + "name": "encodeParams", + "required": true, + "return": { + "kind": 34, + "name": "encodeParams", + "required": true, + "scalar": { + "kind": 4, + "name": "encodeParams", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + } + ], + "kind": 64, + "name": "encodeFunction", + "required": true, + "return": { + "kind": 34, + "name": "encodeFunction", + "required": true, + "scalar": { + "kind": 4, + "name": "encodeFunction", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "array": { + "item": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "types", + "required": true, + "scalar": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "types", + "required": true, + "type": "[String]" + }, + { + "array": { + "item": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "values", + "required": true, + "scalar": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "values", + "required": true, + "type": "[String]" + } + ], + "kind": 64, + "name": "solidityPack", + "required": true, + "return": { + "kind": 34, + "name": "solidityPack", + "required": true, + "scalar": { + "kind": 4, + "name": "solidityPack", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "array": { + "item": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "types", + "required": true, + "scalar": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "types", + "required": true, + "type": "[String]" + }, + { + "array": { + "item": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "values", + "required": true, + "scalar": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "values", + "required": true, + "type": "[String]" + } + ], + "kind": 64, + "name": "solidityKeccak256", + "required": true, + "return": { + "kind": 34, + "name": "solidityKeccak256", + "required": true, + "scalar": { + "kind": 4, + "name": "solidityKeccak256", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "array": { + "item": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "types", + "required": true, + "scalar": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "types", + "required": true, + "type": "[String]" + }, + { + "array": { + "item": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "values", + "required": true, + "scalar": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "values", + "required": true, + "type": "[String]" + } + ], + "kind": 64, + "name": "soliditySha256", + "required": true, + "return": { + "kind": 34, + "name": "soliditySha256", + "required": true, + "scalar": { + "kind": 4, + "name": "soliditySha256", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "getSignerAddress", + "required": true, + "return": { + "kind": 34, + "name": "getSignerAddress", + "required": true, + "scalar": { + "kind": 4, + "name": "getSignerAddress", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "blockTag", + "scalar": { + "kind": 4, + "name": "blockTag", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "getSignerBalance", + "required": true, + "return": { + "kind": 34, + "name": "getSignerBalance", + "required": true, + "scalar": { + "kind": 4, + "name": "getSignerBalance", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "blockTag", + "scalar": { + "kind": 4, + "name": "blockTag", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "getSignerTransactionCount", + "required": true, + "return": { + "kind": 34, + "name": "getSignerTransactionCount", + "required": true, + "scalar": { + "kind": 4, + "name": "getSignerTransactionCount", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "getGasPrice", + "required": true, + "return": { + "kind": 34, + "name": "getGasPrice", + "required": true, + "scalar": { + "kind": 4, + "name": "getGasPrice", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "tx", + "object": { + "kind": 8192, + "name": "tx", + "required": true, + "type": "Ethereum_TxRequest" + }, + "required": true, + "type": "Ethereum_TxRequest" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "estimateTransactionGas", + "required": true, + "return": { + "kind": 34, + "name": "estimateTransactionGas", + "required": true, + "scalar": { + "kind": 4, + "name": "estimateTransactionGas", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + }, + { + "kind": 34, + "name": "txOverrides", + "object": { + "kind": 8192, + "name": "txOverrides", + "type": "Ethereum_TxOverrides" + }, + "type": "Ethereum_TxOverrides" + } + ], + "kind": 64, + "name": "estimateContractCallGas", + "required": true, + "return": { + "kind": 34, + "name": "estimateContractCallGas", + "required": true, + "scalar": { + "kind": 4, + "name": "estimateContractCallGas", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + } + ], + "kind": 64, + "name": "checkAddress", + "required": true, + "return": { + "kind": 34, + "name": "checkAddress", + "required": true, + "scalar": { + "kind": 4, + "name": "checkAddress", + "required": true, + "type": "Boolean" + }, + "type": "Boolean" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "eth", + "required": true, + "scalar": { + "kind": 4, + "name": "eth", + "required": true, + "type": "String" + }, + "type": "String" + } + ], + "kind": 64, + "name": "toWei", + "required": true, + "return": { + "kind": 34, + "name": "toWei", + "required": true, + "scalar": { + "kind": 4, + "name": "toWei", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "wei", + "required": true, + "scalar": { + "kind": 4, + "name": "wei", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + } + ], + "kind": 64, + "name": "toEth", + "required": true, + "return": { + "kind": 34, + "name": "toEth", + "required": true, + "scalar": { + "kind": 4, + "name": "toEth", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "txHash", + "required": true, + "scalar": { + "kind": 4, + "name": "txHash", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "confirmations", + "required": true, + "scalar": { + "kind": 4, + "name": "confirmations", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "timeout", + "required": true, + "scalar": { + "kind": 4, + "name": "timeout", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "awaitTransaction", + "required": true, + "return": { + "kind": 34, + "name": "awaitTransaction", + "object": { + "kind": 8192, + "name": "awaitTransaction", + "required": true, + "type": "Ethereum_TxReceipt" + }, + "required": true, + "type": "Ethereum_TxReceipt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "event", + "required": true, + "scalar": { + "kind": 4, + "name": "event", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + }, + { + "kind": 34, + "name": "timeout", + "scalar": { + "kind": 4, + "name": "timeout", + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "waitForEvent", + "required": true, + "return": { + "kind": 34, + "name": "waitForEvent", + "object": { + "kind": 8192, + "name": "waitForEvent", + "required": true, + "type": "Ethereum_EventNotification" + }, + "required": true, + "type": "Ethereum_EventNotification" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "getNetwork", + "required": true, + "return": { + "kind": 34, + "name": "getNetwork", + "object": { + "kind": 8192, + "name": "getNetwork", + "required": true, + "type": "Ethereum_Network" + }, + "required": true, + "type": "Ethereum_Network" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "requestAccounts", + "required": true, + "return": { + "array": { + "item": { + "kind": 4, + "name": "requestAccounts", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "requestAccounts", + "required": true, + "scalar": { + "kind": 4, + "name": "requestAccounts", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "requestAccounts", + "required": true, + "type": "[String]" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + }, + { + "kind": 34, + "name": "txOverrides", + "object": { + "kind": 8192, + "name": "txOverrides", + "type": "Ethereum_TxOverrides" + }, + "type": "Ethereum_TxOverrides" + } + ], + "kind": 64, + "name": "callContractMethod", + "required": true, + "return": { + "kind": 34, + "name": "callContractMethod", + "object": { + "kind": 8192, + "name": "callContractMethod", + "required": true, + "type": "Ethereum_TxResponse" + }, + "required": true, + "type": "Ethereum_TxResponse" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + }, + { + "kind": 34, + "name": "txOverrides", + "object": { + "kind": 8192, + "name": "txOverrides", + "type": "Ethereum_TxOverrides" + }, + "type": "Ethereum_TxOverrides" + } + ], + "kind": 64, + "name": "callContractMethodAndWait", + "required": true, + "return": { + "kind": 34, + "name": "callContractMethodAndWait", + "object": { + "kind": 8192, + "name": "callContractMethodAndWait", + "required": true, + "type": "Ethereum_TxReceipt" + }, + "required": true, + "type": "Ethereum_TxReceipt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "tx", + "object": { + "kind": 8192, + "name": "tx", + "required": true, + "type": "Ethereum_TxRequest" + }, + "required": true, + "type": "Ethereum_TxRequest" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "sendTransaction", + "required": true, + "return": { + "kind": 34, + "name": "sendTransaction", + "object": { + "kind": 8192, + "name": "sendTransaction", + "required": true, + "type": "Ethereum_TxResponse" + }, + "required": true, + "type": "Ethereum_TxResponse" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "tx", + "object": { + "kind": 8192, + "name": "tx", + "required": true, + "type": "Ethereum_TxRequest" + }, + "required": true, + "type": "Ethereum_TxRequest" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "sendTransactionAndWait", + "required": true, + "return": { + "kind": 34, + "name": "sendTransactionAndWait", + "object": { + "kind": 8192, + "name": "sendTransactionAndWait", + "required": true, + "type": "Ethereum_TxReceipt" + }, + "required": true, + "type": "Ethereum_TxReceipt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "abi", + "required": true, + "scalar": { + "kind": 4, + "name": "abi", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "bytecode", + "required": true, + "scalar": { + "kind": 4, + "name": "bytecode", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "deployContract", + "required": true, + "return": { + "kind": 34, + "name": "deployContract", + "required": true, + "scalar": { + "kind": 4, + "name": "deployContract", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "message", + "required": true, + "scalar": { + "kind": 4, + "name": "message", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "signMessage", + "required": true, + "return": { + "kind": 34, + "name": "signMessage", + "required": true, + "scalar": { + "kind": 4, + "name": "signMessage", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "params", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "params", + "required": true, + "scalar": { + "kind": 4, + "name": "params", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "params", + "required": true, + "type": "[String]" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "sendRPC", + "required": true, + "return": { + "kind": 34, + "name": "sendRPC", + "scalar": { + "kind": 4, + "name": "sendRPC", + "type": "String" + }, + "type": "String" + }, + "type": "Method" + } + ], + "namespace": "Ethereum", + "nativeType": "Module", + "type": "Ethereum_Module", + "uri": "ens/ethereum.polywrap.eth" + } + ], + "importedObjectTypes": [ + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "Connection", + "properties": [ + { + "kind": 34, + "name": "node", + "scalar": { + "kind": 4, + "name": "node", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "networkNameOrChainId", + "scalar": { + "kind": 4, + "name": "networkNameOrChainId", + "type": "String" + }, + "type": "String" + } + ], + "type": "Ethereum_Connection", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "TxOverrides", + "properties": [ + { + "kind": 34, + "name": "gasLimit", + "scalar": { + "kind": 4, + "name": "gasLimit", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "gasPrice", + "scalar": { + "kind": 4, + "name": "gasPrice", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "value", + "scalar": { + "kind": 4, + "name": "value", + "type": "BigInt" + }, + "type": "BigInt" + } + ], + "type": "Ethereum_TxOverrides", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "StaticTxResult", + "properties": [ + { + "kind": 34, + "name": "result", + "required": true, + "scalar": { + "kind": 4, + "name": "result", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "error", + "required": true, + "scalar": { + "kind": 4, + "name": "error", + "required": true, + "type": "Boolean" + }, + "type": "Boolean" + } + ], + "type": "Ethereum_StaticTxResult", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "TxRequest", + "properties": [ + { + "kind": 34, + "name": "to", + "scalar": { + "kind": 4, + "name": "to", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "from", + "scalar": { + "kind": 4, + "name": "from", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "nonce", + "scalar": { + "kind": 4, + "name": "nonce", + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "gasLimit", + "scalar": { + "kind": 4, + "name": "gasLimit", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "gasPrice", + "scalar": { + "kind": 4, + "name": "gasPrice", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "data", + "scalar": { + "kind": 4, + "name": "data", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "value", + "scalar": { + "kind": 4, + "name": "value", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "chainId", + "scalar": { + "kind": 4, + "name": "chainId", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "type", + "scalar": { + "kind": 4, + "name": "type", + "type": "UInt32" + }, + "type": "UInt32" + } + ], + "type": "Ethereum_TxRequest", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "TxReceipt", + "properties": [ + { + "kind": 34, + "name": "to", + "required": true, + "scalar": { + "kind": 4, + "name": "to", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "from", + "required": true, + "scalar": { + "kind": 4, + "name": "from", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "contractAddress", + "required": true, + "scalar": { + "kind": 4, + "name": "contractAddress", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "transactionIndex", + "required": true, + "scalar": { + "kind": 4, + "name": "transactionIndex", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "root", + "scalar": { + "kind": 4, + "name": "root", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "gasUsed", + "required": true, + "scalar": { + "kind": 4, + "name": "gasUsed", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "logsBloom", + "required": true, + "scalar": { + "kind": 4, + "name": "logsBloom", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "transactionHash", + "required": true, + "scalar": { + "kind": 4, + "name": "transactionHash", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 8192, + "name": "logs", + "required": true, + "type": "Ethereum_Log" + }, + "kind": 18, + "name": "logs", + "object": { + "kind": 8192, + "name": "logs", + "required": true, + "type": "Ethereum_Log" + }, + "required": true, + "type": "[Ethereum_Log]" + }, + "kind": 34, + "name": "logs", + "required": true, + "type": "[Ethereum_Log]" + }, + { + "kind": 34, + "name": "blockNumber", + "required": true, + "scalar": { + "kind": 4, + "name": "blockNumber", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "blockHash", + "required": true, + "scalar": { + "kind": 4, + "name": "blockHash", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "confirmations", + "required": true, + "scalar": { + "kind": 4, + "name": "confirmations", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "cumulativeGasUsed", + "required": true, + "scalar": { + "kind": 4, + "name": "cumulativeGasUsed", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "effectiveGasPrice", + "required": true, + "scalar": { + "kind": 4, + "name": "effectiveGasPrice", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "byzantium", + "required": true, + "scalar": { + "kind": 4, + "name": "byzantium", + "required": true, + "type": "Boolean" + }, + "type": "Boolean" + }, + { + "kind": 34, + "name": "type", + "required": true, + "scalar": { + "kind": 4, + "name": "type", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "status", + "scalar": { + "kind": 4, + "name": "status", + "type": "UInt32" + }, + "type": "UInt32" + } + ], + "type": "Ethereum_TxReceipt", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "Log", + "properties": [ + { + "kind": 34, + "name": "blockNumber", + "required": true, + "scalar": { + "kind": 4, + "name": "blockNumber", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "blockHash", + "required": true, + "scalar": { + "kind": 4, + "name": "blockHash", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "transactionIndex", + "required": true, + "scalar": { + "kind": 4, + "name": "transactionIndex", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "removed", + "required": true, + "scalar": { + "kind": 4, + "name": "removed", + "required": true, + "type": "Boolean" + }, + "type": "Boolean" + }, + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "data", + "required": true, + "scalar": { + "kind": 4, + "name": "data", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "topics", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "topics", + "required": true, + "scalar": { + "kind": 4, + "name": "topics", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "topics", + "required": true, + "type": "[String]" + }, + { + "kind": 34, + "name": "transactionHash", + "required": true, + "scalar": { + "kind": 4, + "name": "transactionHash", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "logIndex", + "required": true, + "scalar": { + "kind": 4, + "name": "logIndex", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + } + ], + "type": "Ethereum_Log", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "EventNotification", + "properties": [ + { + "kind": 34, + "name": "data", + "required": true, + "scalar": { + "kind": 4, + "name": "data", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "log", + "object": { + "kind": 8192, + "name": "log", + "required": true, + "type": "Ethereum_Log" + }, + "required": true, + "type": "Ethereum_Log" + } + ], + "type": "Ethereum_EventNotification", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "Network", + "properties": [ + { + "kind": 34, + "name": "name", + "required": true, + "scalar": { + "kind": 4, + "name": "name", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "chainId", + "required": true, + "scalar": { + "kind": 4, + "name": "chainId", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "ensAddress", + "scalar": { + "kind": 4, + "name": "ensAddress", + "type": "String" + }, + "type": "String" + } + ], + "type": "Ethereum_Network", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "TxResponse", + "properties": [ + { + "kind": 34, + "name": "hash", + "required": true, + "scalar": { + "kind": 4, + "name": "hash", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "to", + "scalar": { + "kind": 4, + "name": "to", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "from", + "required": true, + "scalar": { + "kind": 4, + "name": "from", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "nonce", + "required": true, + "scalar": { + "kind": 4, + "name": "nonce", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "gasLimit", + "required": true, + "scalar": { + "kind": 4, + "name": "gasLimit", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "gasPrice", + "scalar": { + "kind": 4, + "name": "gasPrice", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "data", + "required": true, + "scalar": { + "kind": 4, + "name": "data", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "value", + "required": true, + "scalar": { + "kind": 4, + "name": "value", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "chainId", + "required": true, + "scalar": { + "kind": 4, + "name": "chainId", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "blockNumber", + "scalar": { + "kind": 4, + "name": "blockNumber", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "blockHash", + "scalar": { + "kind": 4, + "name": "blockHash", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "timestamp", + "scalar": { + "kind": 4, + "name": "timestamp", + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "confirmations", + "required": true, + "scalar": { + "kind": 4, + "name": "confirmations", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "raw", + "scalar": { + "kind": 4, + "name": "raw", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "r", + "scalar": { + "kind": 4, + "name": "r", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "s", + "scalar": { + "kind": 4, + "name": "s", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "v", + "scalar": { + "kind": 4, + "name": "v", + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "type", + "scalar": { + "kind": 4, + "name": "type", + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "array": { + "item": { + "kind": 8192, + "name": "accessList", + "required": true, + "type": "Ethereum_Access" + }, + "kind": 18, + "name": "accessList", + "object": { + "kind": 8192, + "name": "accessList", + "required": true, + "type": "Ethereum_Access" + }, + "type": "[Ethereum_Access]" + }, + "kind": 34, + "name": "accessList", + "type": "[Ethereum_Access]" + } + ], + "type": "Ethereum_TxResponse", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "Access", + "properties": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "storageKeys", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "storageKeys", + "required": true, + "scalar": { + "kind": 4, + "name": "storageKeys", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "storageKeys", + "required": true, + "type": "[String]" + } + ], + "type": "Ethereum_Access", + "uri": "ens/ethereum.polywrap.eth" + } + ], + "moduleType": { + "imports": [ + { + "type": "Ethereum_Module" + }, + { + "type": "Ethereum_Connection" + }, + { + "type": "Ethereum_TxOverrides" + }, + { + "type": "Ethereum_StaticTxResult" + }, + { + "type": "Ethereum_TxRequest" + }, + { + "type": "Ethereum_TxReceipt" + }, + { + "type": "Ethereum_Log" + }, + { + "type": "Ethereum_EventNotification" + }, + { + "type": "Ethereum_Network" + }, + { + "type": "Ethereum_TxResponse" + }, + { + "type": "Ethereum_Access" + } + ], + "kind": 128, + "methods": [ + { + "arguments": [ + { + "kind": 34, + "name": "str", + "required": true, + "scalar": { + "kind": 4, + "name": "str", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "optStr", + "scalar": { + "kind": 4, + "name": "optStr", + "type": "String" + }, + "type": "String" + } + ], + "kind": 64, + "name": "methodOne", + "required": true, + "return": { + "kind": 34, + "name": "methodOne", + "object": { + "kind": 8192, + "name": "methodOne", + "required": true, + "type": "Object" + }, + "required": true, + "type": "Object" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "arg", + "required": true, + "scalar": { + "kind": 4, + "name": "arg", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + } + ], + "kind": 64, + "name": "methodTwo", + "required": true, + "return": { + "kind": 34, + "name": "methodTwo", + "required": true, + "scalar": { + "kind": 4, + "name": "methodTwo", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + } + ], + "type": "Module" + }, + "objectTypes": [ + { + "kind": 1, + "properties": [ + { + "kind": 34, + "name": "u", + "required": true, + "scalar": { + "kind": 4, + "name": "u", + "required": true, + "type": "UInt" + }, + "type": "UInt" + }, + { + "array": { + "item": { + "kind": 4, + "name": "array", + "required": true, + "type": "Boolean" + }, + "kind": 18, + "name": "array", + "required": true, + "scalar": { + "kind": 4, + "name": "array", + "required": true, + "type": "Boolean" + }, + "type": "[Boolean]" + }, + "kind": 34, + "name": "array", + "required": true, + "type": "[Boolean]" + }, + { + "kind": 34, + "name": "bytes", + "scalar": { + "kind": 4, + "name": "bytes", + "type": "Bytes" + }, + "type": "Bytes" + } + ], + "type": "Object" + } + ], + "version": "0.1" +} +} diff --git a/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/polywrap.plugin.yaml b/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/polywrap.plugin.yaml index 7a95fddd10..b6e429cf4e 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/polywrap.plugin.yaml +++ b/packages/test-cases/cases/cli/plugin/codegen/005-custom-config/polywrap.plugin.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: Test language: plugin/typescript schema: ./schema.graphql diff --git a/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/build-artifacts/polywrap.plugin.json b/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/build-artifacts/polywrap.plugin.json deleted file mode 100644 index 020adca63c..0000000000 --- a/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/build-artifacts/polywrap.plugin.json +++ /dev/null @@ -1,7 +0,0 @@ -{ - "format": "0.1.0", - "name": "Test", - "language": "plugin/typescript", - "schema": "./schema.graphql", - "module": "./src/index.ts" -} \ No newline at end of file diff --git a/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/build-artifacts/schema.graphql b/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/build-artifacts/schema.graphql deleted file mode 100644 index f897f36cce..0000000000 --- a/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/build-artifacts/schema.graphql +++ /dev/null @@ -1,386 +0,0 @@ -### Polywrap Header START ### -scalar UInt -scalar UInt8 -scalar UInt16 -scalar UInt32 -scalar Int -scalar Int8 -scalar Int16 -scalar Int32 -scalar Bytes -scalar BigInt -scalar BigNumber -scalar JSON -scalar Map - -directive @imported( - uri: String! - namespace: String! - nativeType: String! -) on OBJECT | ENUM - -directive @imports( - types: [String!]! -) on OBJECT - -directive @capability( - type: String! - uri: String! - namespace: String! -) repeatable on OBJECT - -directive @enabled_interface on OBJECT - -directive @annotate(type: String!) on FIELD - -directive @env(required: Boolean!) on FIELD_DEFINITION - -### Polywrap Header END ### - -type Module @imports( - types: [ - "Ethereum_Module", - "Ethereum_Connection", - "Ethereum_TxOverrides", - "Ethereum_StaticTxResult", - "Ethereum_TxRequest", - "Ethereum_TxReceipt", - "Ethereum_Log", - "Ethereum_EventNotification", - "Ethereum_Network", - "Ethereum_TxResponse", - "Ethereum_Access" - ] -) { - methodOne( - str: String! - optStr: String - ): Object! - - methodTwo( - arg: UInt32! - ): String! -} - -type Env { - arg1: String! -} - -type Object { - u: UInt! - array: [Boolean!]! - bytes: Bytes -} - -### Imported Modules START ### - -type Ethereum_Module @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Module" -) { - callContractView( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - ): String! - - callContractStatic( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): Ethereum_StaticTxResult! - - getBalance( - address: String! - blockTag: BigInt - connection: Ethereum_Connection - ): BigInt! - - encodeParams( - types: [String!]! - values: [String!]! - ): String! - - encodeFunction( - method: String! - args: [String!] - ): String! - - solidityPack( - types: [String!]! - values: [String!]! - ): String! - - solidityKeccak256( - types: [String!]! - values: [String!]! - ): String! - - soliditySha256( - types: [String!]! - values: [String!]! - ): String! - - getSignerAddress( - connection: Ethereum_Connection - ): String! - - getSignerBalance( - blockTag: BigInt - connection: Ethereum_Connection - ): BigInt! - - getSignerTransactionCount( - blockTag: BigInt - connection: Ethereum_Connection - ): BigInt! - - getGasPrice( - connection: Ethereum_Connection - ): BigInt! - - estimateTransactionGas( - tx: Ethereum_TxRequest! - connection: Ethereum_Connection - ): BigInt! - - estimateContractCallGas( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): BigInt! - - checkAddress( - address: String! - ): Boolean! - - toWei( - eth: String! - ): BigInt! - - toEth( - wei: BigInt! - ): String! - - awaitTransaction( - txHash: String! - confirmations: UInt32! - timeout: UInt32! - connection: Ethereum_Connection - ): Ethereum_TxReceipt! - - waitForEvent( - address: String! - event: String! - args: [String!] - timeout: UInt32 - connection: Ethereum_Connection - ): Ethereum_EventNotification! - - getNetwork( - connection: Ethereum_Connection - ): Ethereum_Network! - - requestAccounts( - connection: Ethereum_Connection - ): [String!]! - - callContractMethod( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): Ethereum_TxResponse! - - callContractMethodAndWait( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): Ethereum_TxReceipt! - - sendTransaction( - tx: Ethereum_TxRequest! - connection: Ethereum_Connection - ): Ethereum_TxResponse! - - sendTransactionAndWait( - tx: Ethereum_TxRequest! - connection: Ethereum_Connection - ): Ethereum_TxReceipt! - - deployContract( - abi: String! - bytecode: String! - args: [String!] - connection: Ethereum_Connection - ): String! - - signMessage( - message: String! - connection: Ethereum_Connection - ): String! - - sendRPC( - method: String! - params: [String!]! - connection: Ethereum_Connection - ): String -} - -### Imported Modules END ### - -### Imported Objects START ### - -type Ethereum_Connection @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Connection" -) { - node: String - networkNameOrChainId: String -} - -type Ethereum_TxOverrides @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxOverrides" -) { - gasLimit: BigInt - gasPrice: BigInt - value: BigInt -} - -type Ethereum_StaticTxResult @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "StaticTxResult" -) { - result: String! - error: Boolean! -} - -type Ethereum_TxRequest @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxRequest" -) { - to: String - from: String - nonce: UInt32 - gasLimit: BigInt - gasPrice: BigInt - data: String - value: BigInt - chainId: BigInt - type: UInt32 -} - -type Ethereum_TxReceipt @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxReceipt" -) { - to: String! - from: String! - contractAddress: String! - transactionIndex: UInt32! - root: String - gasUsed: BigInt! - logsBloom: String! - transactionHash: String! - logs: [Ethereum_Log!]! - blockNumber: BigInt! - blockHash: String! - confirmations: UInt32! - cumulativeGasUsed: BigInt! - effectiveGasPrice: BigInt! - byzantium: Boolean! - type: UInt32! - status: UInt32 -} - -type Ethereum_Log @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Log" -) { - blockNumber: BigInt! - blockHash: String! - transactionIndex: UInt32! - removed: Boolean! - address: String! - data: String! - topics: [String!]! - transactionHash: String! - logIndex: UInt32! -} - -type Ethereum_EventNotification @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "EventNotification" -) { - data: String! - address: String! - log: Ethereum_Log! -} - -type Ethereum_Network @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Network" -) { - name: String! - chainId: BigInt! - ensAddress: String -} - -type Ethereum_TxResponse @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxResponse" -) { - hash: String! - to: String - from: String! - nonce: UInt32! - gasLimit: BigInt! - gasPrice: BigInt - data: String! - value: BigInt! - chainId: BigInt! - blockNumber: BigInt - blockHash: String - timestamp: UInt32 - confirmations: UInt32! - raw: String - r: String - s: String - v: UInt32 - type: UInt32 - accessList: [Ethereum_Access!] -} - -type Ethereum_Access @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Access" -) { - address: String! - storageKeys: [String!]! -} - -### Imported Objects END ### - -### Imported Envs START ### - -### Imported Envs END ### diff --git a/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/build-artifacts/wrap.info b/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/build-artifacts/wrap.info new file mode 100644 index 0000000000..d79a2831a2 Binary files /dev/null and b/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/build-artifacts/wrap.info differ diff --git a/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/stdout.json b/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/stdout.json index acdb608c56..effa84caf8 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/stdout.json +++ b/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/stdout.json @@ -2,7 +2,7 @@ "stdout": [ "Manifest loaded from ./polywrap.custom.plugin.yaml", "Generate types", - "Manifest written to ./build/polywrap.plugin.json" + "Manifest written to ./build/wrap.info" ], "exitCode": 0 } diff --git a/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/index.ts b/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/index.ts index f367d143d9..315871f96d 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/index.ts +++ b/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/index.ts @@ -1,8 +1,7 @@ /// NOTE: This is an auto-generated file. /// All modifications will be overwritten. -export * from "./schema"; -export * from "./manifest"; +export * from "./wrap.info"; export * from "./module"; export * from "./types"; diff --git a/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/manifest.ts b/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/manifest.ts deleted file mode 100644 index 730cf8326f..0000000000 --- a/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/manifest.ts +++ /dev/null @@ -1,15 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -/* eslint-disable @typescript-eslint/no-unused-vars */ - -import { schema } from "./"; - -// @ts-ignore -import { PluginPackageManifest, Uri } from "@polywrap/core-js"; - -export const manifest: PluginPackageManifest = { - schema, - implements: [ - ], -}; diff --git a/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/schema.ts b/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/schema.ts deleted file mode 100644 index d4cd2b562d..0000000000 --- a/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/schema.ts +++ /dev/null @@ -1,390 +0,0 @@ -/// NOTE: This is an auto-generated file. -/// All modifications will be overwritten. - -export const schema: string = `### Polywrap Header START ### -scalar UInt -scalar UInt8 -scalar UInt16 -scalar UInt32 -scalar Int -scalar Int8 -scalar Int16 -scalar Int32 -scalar Bytes -scalar BigInt -scalar BigNumber -scalar JSON -scalar Map - -directive @imported( - uri: String! - namespace: String! - nativeType: String! -) on OBJECT | ENUM - -directive @imports( - types: [String!]! -) on OBJECT - -directive @capability( - type: String! - uri: String! - namespace: String! -) repeatable on OBJECT - -directive @enabled_interface on OBJECT - -directive @annotate(type: String!) on FIELD - -directive @env(required: Boolean!) on FIELD_DEFINITION - -### Polywrap Header END ### - -type Module @imports( - types: [ - "Ethereum_Module", - "Ethereum_Connection", - "Ethereum_TxOverrides", - "Ethereum_StaticTxResult", - "Ethereum_TxRequest", - "Ethereum_TxReceipt", - "Ethereum_Log", - "Ethereum_EventNotification", - "Ethereum_Network", - "Ethereum_TxResponse", - "Ethereum_Access" - ] -) { - methodOne( - str: String! - optStr: String - ): Object! - - methodTwo( - arg: UInt32! - ): String! -} - -type Env { - arg1: String! -} - -type Object { - u: UInt! - array: [Boolean!]! - bytes: Bytes -} - -### Imported Modules START ### - -type Ethereum_Module @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Module" -) { - callContractView( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - ): String! - - callContractStatic( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): Ethereum_StaticTxResult! - - getBalance( - address: String! - blockTag: BigInt - connection: Ethereum_Connection - ): BigInt! - - encodeParams( - types: [String!]! - values: [String!]! - ): String! - - encodeFunction( - method: String! - args: [String!] - ): String! - - solidityPack( - types: [String!]! - values: [String!]! - ): String! - - solidityKeccak256( - types: [String!]! - values: [String!]! - ): String! - - soliditySha256( - types: [String!]! - values: [String!]! - ): String! - - getSignerAddress( - connection: Ethereum_Connection - ): String! - - getSignerBalance( - blockTag: BigInt - connection: Ethereum_Connection - ): BigInt! - - getSignerTransactionCount( - blockTag: BigInt - connection: Ethereum_Connection - ): BigInt! - - getGasPrice( - connection: Ethereum_Connection - ): BigInt! - - estimateTransactionGas( - tx: Ethereum_TxRequest! - connection: Ethereum_Connection - ): BigInt! - - estimateContractCallGas( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): BigInt! - - checkAddress( - address: String! - ): Boolean! - - toWei( - eth: String! - ): BigInt! - - toEth( - wei: BigInt! - ): String! - - awaitTransaction( - txHash: String! - confirmations: UInt32! - timeout: UInt32! - connection: Ethereum_Connection - ): Ethereum_TxReceipt! - - waitForEvent( - address: String! - event: String! - args: [String!] - timeout: UInt32 - connection: Ethereum_Connection - ): Ethereum_EventNotification! - - getNetwork( - connection: Ethereum_Connection - ): Ethereum_Network! - - requestAccounts( - connection: Ethereum_Connection - ): [String!]! - - callContractMethod( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): Ethereum_TxResponse! - - callContractMethodAndWait( - address: String! - method: String! - args: [String!] - connection: Ethereum_Connection - txOverrides: Ethereum_TxOverrides - ): Ethereum_TxReceipt! - - sendTransaction( - tx: Ethereum_TxRequest! - connection: Ethereum_Connection - ): Ethereum_TxResponse! - - sendTransactionAndWait( - tx: Ethereum_TxRequest! - connection: Ethereum_Connection - ): Ethereum_TxReceipt! - - deployContract( - abi: String! - bytecode: String! - args: [String!] - connection: Ethereum_Connection - ): String! - - signMessage( - message: String! - connection: Ethereum_Connection - ): String! - - sendRPC( - method: String! - params: [String!]! - connection: Ethereum_Connection - ): String -} - -### Imported Modules END ### - -### Imported Objects START ### - -type Ethereum_Connection @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Connection" -) { - node: String - networkNameOrChainId: String -} - -type Ethereum_TxOverrides @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxOverrides" -) { - gasLimit: BigInt - gasPrice: BigInt - value: BigInt -} - -type Ethereum_StaticTxResult @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "StaticTxResult" -) { - result: String! - error: Boolean! -} - -type Ethereum_TxRequest @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxRequest" -) { - to: String - from: String - nonce: UInt32 - gasLimit: BigInt - gasPrice: BigInt - data: String - value: BigInt - chainId: BigInt - type: UInt32 -} - -type Ethereum_TxReceipt @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxReceipt" -) { - to: String! - from: String! - contractAddress: String! - transactionIndex: UInt32! - root: String - gasUsed: BigInt! - logsBloom: String! - transactionHash: String! - logs: [Ethereum_Log!]! - blockNumber: BigInt! - blockHash: String! - confirmations: UInt32! - cumulativeGasUsed: BigInt! - effectiveGasPrice: BigInt! - byzantium: Boolean! - type: UInt32! - status: UInt32 -} - -type Ethereum_Log @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Log" -) { - blockNumber: BigInt! - blockHash: String! - transactionIndex: UInt32! - removed: Boolean! - address: String! - data: String! - topics: [String!]! - transactionHash: String! - logIndex: UInt32! -} - -type Ethereum_EventNotification @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "EventNotification" -) { - data: String! - address: String! - log: Ethereum_Log! -} - -type Ethereum_Network @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Network" -) { - name: String! - chainId: BigInt! - ensAddress: String -} - -type Ethereum_TxResponse @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "TxResponse" -) { - hash: String! - to: String - from: String! - nonce: UInt32! - gasLimit: BigInt! - gasPrice: BigInt - data: String! - value: BigInt! - chainId: BigInt! - blockNumber: BigInt - blockHash: String - timestamp: UInt32 - confirmations: UInt32! - raw: String - r: String - s: String - v: UInt32 - type: UInt32 - accessList: [Ethereum_Access!] -} - -type Ethereum_Access @imported( - uri: "ens/ethereum.polywrap.eth", - namespace: "Ethereum", - nativeType: "Access" -) { - address: String! - storageKeys: [String!]! -} - -### Imported Objects END ### - -### Imported Envs START ### - -### Imported Envs END ### -`; diff --git a/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/wrap.info.ts b/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/wrap.info.ts new file mode 100644 index 0000000000..80f300e7ad --- /dev/null +++ b/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/expected/wrap/wrap.info.ts @@ -0,0 +1,2689 @@ +/// NOTE: This is an auto-generated file. +/// All modifications will be overwritten. +import { WrapManifest } from "@polywrap/wrap-manifest-types-js" + +export const manifest: WrapManifest = { + name: "Test", + type: "plugin", + version: "0.1", + abi: { + "envType": { + "kind": 65536, + "properties": [ + { + "kind": 34, + "name": "arg1", + "required": true, + "scalar": { + "kind": 4, + "name": "arg1", + "required": true, + "type": "String" + }, + "type": "String" + } + ], + "type": "Env" + }, + "importedModuleTypes": [ + { + "isInterface": false, + "kind": 256, + "methods": [ + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "callContractView", + "required": true, + "return": { + "kind": 34, + "name": "callContractView", + "required": true, + "scalar": { + "kind": 4, + "name": "callContractView", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + }, + { + "kind": 34, + "name": "txOverrides", + "object": { + "kind": 8192, + "name": "txOverrides", + "type": "Ethereum_TxOverrides" + }, + "type": "Ethereum_TxOverrides" + } + ], + "kind": 64, + "name": "callContractStatic", + "required": true, + "return": { + "kind": 34, + "name": "callContractStatic", + "object": { + "kind": 8192, + "name": "callContractStatic", + "required": true, + "type": "Ethereum_StaticTxResult" + }, + "required": true, + "type": "Ethereum_StaticTxResult" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "blockTag", + "scalar": { + "kind": 4, + "name": "blockTag", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "getBalance", + "required": true, + "return": { + "kind": 34, + "name": "getBalance", + "required": true, + "scalar": { + "kind": 4, + "name": "getBalance", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "array": { + "item": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "types", + "required": true, + "scalar": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "types", + "required": true, + "type": "[String]" + }, + { + "array": { + "item": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "values", + "required": true, + "scalar": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "values", + "required": true, + "type": "[String]" + } + ], + "kind": 64, + "name": "encodeParams", + "required": true, + "return": { + "kind": 34, + "name": "encodeParams", + "required": true, + "scalar": { + "kind": 4, + "name": "encodeParams", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + } + ], + "kind": 64, + "name": "encodeFunction", + "required": true, + "return": { + "kind": 34, + "name": "encodeFunction", + "required": true, + "scalar": { + "kind": 4, + "name": "encodeFunction", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "array": { + "item": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "types", + "required": true, + "scalar": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "types", + "required": true, + "type": "[String]" + }, + { + "array": { + "item": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "values", + "required": true, + "scalar": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "values", + "required": true, + "type": "[String]" + } + ], + "kind": 64, + "name": "solidityPack", + "required": true, + "return": { + "kind": 34, + "name": "solidityPack", + "required": true, + "scalar": { + "kind": 4, + "name": "solidityPack", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "array": { + "item": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "types", + "required": true, + "scalar": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "types", + "required": true, + "type": "[String]" + }, + { + "array": { + "item": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "values", + "required": true, + "scalar": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "values", + "required": true, + "type": "[String]" + } + ], + "kind": 64, + "name": "solidityKeccak256", + "required": true, + "return": { + "kind": 34, + "name": "solidityKeccak256", + "required": true, + "scalar": { + "kind": 4, + "name": "solidityKeccak256", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "array": { + "item": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "types", + "required": true, + "scalar": { + "kind": 4, + "name": "types", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "types", + "required": true, + "type": "[String]" + }, + { + "array": { + "item": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "values", + "required": true, + "scalar": { + "kind": 4, + "name": "values", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "values", + "required": true, + "type": "[String]" + } + ], + "kind": 64, + "name": "soliditySha256", + "required": true, + "return": { + "kind": 34, + "name": "soliditySha256", + "required": true, + "scalar": { + "kind": 4, + "name": "soliditySha256", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "getSignerAddress", + "required": true, + "return": { + "kind": 34, + "name": "getSignerAddress", + "required": true, + "scalar": { + "kind": 4, + "name": "getSignerAddress", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "blockTag", + "scalar": { + "kind": 4, + "name": "blockTag", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "getSignerBalance", + "required": true, + "return": { + "kind": 34, + "name": "getSignerBalance", + "required": true, + "scalar": { + "kind": 4, + "name": "getSignerBalance", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "blockTag", + "scalar": { + "kind": 4, + "name": "blockTag", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "getSignerTransactionCount", + "required": true, + "return": { + "kind": 34, + "name": "getSignerTransactionCount", + "required": true, + "scalar": { + "kind": 4, + "name": "getSignerTransactionCount", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "getGasPrice", + "required": true, + "return": { + "kind": 34, + "name": "getGasPrice", + "required": true, + "scalar": { + "kind": 4, + "name": "getGasPrice", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "tx", + "object": { + "kind": 8192, + "name": "tx", + "required": true, + "type": "Ethereum_TxRequest" + }, + "required": true, + "type": "Ethereum_TxRequest" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "estimateTransactionGas", + "required": true, + "return": { + "kind": 34, + "name": "estimateTransactionGas", + "required": true, + "scalar": { + "kind": 4, + "name": "estimateTransactionGas", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + }, + { + "kind": 34, + "name": "txOverrides", + "object": { + "kind": 8192, + "name": "txOverrides", + "type": "Ethereum_TxOverrides" + }, + "type": "Ethereum_TxOverrides" + } + ], + "kind": 64, + "name": "estimateContractCallGas", + "required": true, + "return": { + "kind": 34, + "name": "estimateContractCallGas", + "required": true, + "scalar": { + "kind": 4, + "name": "estimateContractCallGas", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + } + ], + "kind": 64, + "name": "checkAddress", + "required": true, + "return": { + "kind": 34, + "name": "checkAddress", + "required": true, + "scalar": { + "kind": 4, + "name": "checkAddress", + "required": true, + "type": "Boolean" + }, + "type": "Boolean" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "eth", + "required": true, + "scalar": { + "kind": 4, + "name": "eth", + "required": true, + "type": "String" + }, + "type": "String" + } + ], + "kind": 64, + "name": "toWei", + "required": true, + "return": { + "kind": 34, + "name": "toWei", + "required": true, + "scalar": { + "kind": 4, + "name": "toWei", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "wei", + "required": true, + "scalar": { + "kind": 4, + "name": "wei", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + } + ], + "kind": 64, + "name": "toEth", + "required": true, + "return": { + "kind": 34, + "name": "toEth", + "required": true, + "scalar": { + "kind": 4, + "name": "toEth", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "txHash", + "required": true, + "scalar": { + "kind": 4, + "name": "txHash", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "confirmations", + "required": true, + "scalar": { + "kind": 4, + "name": "confirmations", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "timeout", + "required": true, + "scalar": { + "kind": 4, + "name": "timeout", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "awaitTransaction", + "required": true, + "return": { + "kind": 34, + "name": "awaitTransaction", + "object": { + "kind": 8192, + "name": "awaitTransaction", + "required": true, + "type": "Ethereum_TxReceipt" + }, + "required": true, + "type": "Ethereum_TxReceipt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "event", + "required": true, + "scalar": { + "kind": 4, + "name": "event", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + }, + { + "kind": 34, + "name": "timeout", + "scalar": { + "kind": 4, + "name": "timeout", + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "waitForEvent", + "required": true, + "return": { + "kind": 34, + "name": "waitForEvent", + "object": { + "kind": 8192, + "name": "waitForEvent", + "required": true, + "type": "Ethereum_EventNotification" + }, + "required": true, + "type": "Ethereum_EventNotification" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "getNetwork", + "required": true, + "return": { + "kind": 34, + "name": "getNetwork", + "object": { + "kind": 8192, + "name": "getNetwork", + "required": true, + "type": "Ethereum_Network" + }, + "required": true, + "type": "Ethereum_Network" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "requestAccounts", + "required": true, + "return": { + "array": { + "item": { + "kind": 4, + "name": "requestAccounts", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "requestAccounts", + "required": true, + "scalar": { + "kind": 4, + "name": "requestAccounts", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "requestAccounts", + "required": true, + "type": "[String]" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + }, + { + "kind": 34, + "name": "txOverrides", + "object": { + "kind": 8192, + "name": "txOverrides", + "type": "Ethereum_TxOverrides" + }, + "type": "Ethereum_TxOverrides" + } + ], + "kind": 64, + "name": "callContractMethod", + "required": true, + "return": { + "kind": 34, + "name": "callContractMethod", + "object": { + "kind": 8192, + "name": "callContractMethod", + "required": true, + "type": "Ethereum_TxResponse" + }, + "required": true, + "type": "Ethereum_TxResponse" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + }, + { + "kind": 34, + "name": "txOverrides", + "object": { + "kind": 8192, + "name": "txOverrides", + "type": "Ethereum_TxOverrides" + }, + "type": "Ethereum_TxOverrides" + } + ], + "kind": 64, + "name": "callContractMethodAndWait", + "required": true, + "return": { + "kind": 34, + "name": "callContractMethodAndWait", + "object": { + "kind": 8192, + "name": "callContractMethodAndWait", + "required": true, + "type": "Ethereum_TxReceipt" + }, + "required": true, + "type": "Ethereum_TxReceipt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "tx", + "object": { + "kind": 8192, + "name": "tx", + "required": true, + "type": "Ethereum_TxRequest" + }, + "required": true, + "type": "Ethereum_TxRequest" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "sendTransaction", + "required": true, + "return": { + "kind": 34, + "name": "sendTransaction", + "object": { + "kind": 8192, + "name": "sendTransaction", + "required": true, + "type": "Ethereum_TxResponse" + }, + "required": true, + "type": "Ethereum_TxResponse" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "tx", + "object": { + "kind": 8192, + "name": "tx", + "required": true, + "type": "Ethereum_TxRequest" + }, + "required": true, + "type": "Ethereum_TxRequest" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "sendTransactionAndWait", + "required": true, + "return": { + "kind": 34, + "name": "sendTransactionAndWait", + "object": { + "kind": 8192, + "name": "sendTransactionAndWait", + "required": true, + "type": "Ethereum_TxReceipt" + }, + "required": true, + "type": "Ethereum_TxReceipt" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "abi", + "required": true, + "scalar": { + "kind": 4, + "name": "abi", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "bytecode", + "required": true, + "scalar": { + "kind": 4, + "name": "bytecode", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "args", + "scalar": { + "kind": 4, + "name": "args", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "args", + "type": "[String]" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "deployContract", + "required": true, + "return": { + "kind": 34, + "name": "deployContract", + "required": true, + "scalar": { + "kind": 4, + "name": "deployContract", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "message", + "required": true, + "scalar": { + "kind": 4, + "name": "message", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "signMessage", + "required": true, + "return": { + "kind": 34, + "name": "signMessage", + "required": true, + "scalar": { + "kind": 4, + "name": "signMessage", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "method", + "required": true, + "scalar": { + "kind": 4, + "name": "method", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "params", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "params", + "required": true, + "scalar": { + "kind": 4, + "name": "params", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "params", + "required": true, + "type": "[String]" + }, + { + "kind": 34, + "name": "connection", + "object": { + "kind": 8192, + "name": "connection", + "type": "Ethereum_Connection" + }, + "type": "Ethereum_Connection" + } + ], + "kind": 64, + "name": "sendRPC", + "required": true, + "return": { + "kind": 34, + "name": "sendRPC", + "scalar": { + "kind": 4, + "name": "sendRPC", + "type": "String" + }, + "type": "String" + }, + "type": "Method" + } + ], + "namespace": "Ethereum", + "nativeType": "Module", + "type": "Ethereum_Module", + "uri": "ens/ethereum.polywrap.eth" + } + ], + "importedObjectTypes": [ + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "Connection", + "properties": [ + { + "kind": 34, + "name": "node", + "scalar": { + "kind": 4, + "name": "node", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "networkNameOrChainId", + "scalar": { + "kind": 4, + "name": "networkNameOrChainId", + "type": "String" + }, + "type": "String" + } + ], + "type": "Ethereum_Connection", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "TxOverrides", + "properties": [ + { + "kind": 34, + "name": "gasLimit", + "scalar": { + "kind": 4, + "name": "gasLimit", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "gasPrice", + "scalar": { + "kind": 4, + "name": "gasPrice", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "value", + "scalar": { + "kind": 4, + "name": "value", + "type": "BigInt" + }, + "type": "BigInt" + } + ], + "type": "Ethereum_TxOverrides", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "StaticTxResult", + "properties": [ + { + "kind": 34, + "name": "result", + "required": true, + "scalar": { + "kind": 4, + "name": "result", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "error", + "required": true, + "scalar": { + "kind": 4, + "name": "error", + "required": true, + "type": "Boolean" + }, + "type": "Boolean" + } + ], + "type": "Ethereum_StaticTxResult", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "TxRequest", + "properties": [ + { + "kind": 34, + "name": "to", + "scalar": { + "kind": 4, + "name": "to", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "from", + "scalar": { + "kind": 4, + "name": "from", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "nonce", + "scalar": { + "kind": 4, + "name": "nonce", + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "gasLimit", + "scalar": { + "kind": 4, + "name": "gasLimit", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "gasPrice", + "scalar": { + "kind": 4, + "name": "gasPrice", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "data", + "scalar": { + "kind": 4, + "name": "data", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "value", + "scalar": { + "kind": 4, + "name": "value", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "chainId", + "scalar": { + "kind": 4, + "name": "chainId", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "type", + "scalar": { + "kind": 4, + "name": "type", + "type": "UInt32" + }, + "type": "UInt32" + } + ], + "type": "Ethereum_TxRequest", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "TxReceipt", + "properties": [ + { + "kind": 34, + "name": "to", + "required": true, + "scalar": { + "kind": 4, + "name": "to", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "from", + "required": true, + "scalar": { + "kind": 4, + "name": "from", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "contractAddress", + "required": true, + "scalar": { + "kind": 4, + "name": "contractAddress", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "transactionIndex", + "required": true, + "scalar": { + "kind": 4, + "name": "transactionIndex", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "root", + "scalar": { + "kind": 4, + "name": "root", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "gasUsed", + "required": true, + "scalar": { + "kind": 4, + "name": "gasUsed", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "logsBloom", + "required": true, + "scalar": { + "kind": 4, + "name": "logsBloom", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "transactionHash", + "required": true, + "scalar": { + "kind": 4, + "name": "transactionHash", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 8192, + "name": "logs", + "required": true, + "type": "Ethereum_Log" + }, + "kind": 18, + "name": "logs", + "object": { + "kind": 8192, + "name": "logs", + "required": true, + "type": "Ethereum_Log" + }, + "required": true, + "type": "[Ethereum_Log]" + }, + "kind": 34, + "name": "logs", + "required": true, + "type": "[Ethereum_Log]" + }, + { + "kind": 34, + "name": "blockNumber", + "required": true, + "scalar": { + "kind": 4, + "name": "blockNumber", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "blockHash", + "required": true, + "scalar": { + "kind": 4, + "name": "blockHash", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "confirmations", + "required": true, + "scalar": { + "kind": 4, + "name": "confirmations", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "cumulativeGasUsed", + "required": true, + "scalar": { + "kind": 4, + "name": "cumulativeGasUsed", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "effectiveGasPrice", + "required": true, + "scalar": { + "kind": 4, + "name": "effectiveGasPrice", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "byzantium", + "required": true, + "scalar": { + "kind": 4, + "name": "byzantium", + "required": true, + "type": "Boolean" + }, + "type": "Boolean" + }, + { + "kind": 34, + "name": "type", + "required": true, + "scalar": { + "kind": 4, + "name": "type", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "status", + "scalar": { + "kind": 4, + "name": "status", + "type": "UInt32" + }, + "type": "UInt32" + } + ], + "type": "Ethereum_TxReceipt", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "Log", + "properties": [ + { + "kind": 34, + "name": "blockNumber", + "required": true, + "scalar": { + "kind": 4, + "name": "blockNumber", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "blockHash", + "required": true, + "scalar": { + "kind": 4, + "name": "blockHash", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "transactionIndex", + "required": true, + "scalar": { + "kind": 4, + "name": "transactionIndex", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "removed", + "required": true, + "scalar": { + "kind": 4, + "name": "removed", + "required": true, + "type": "Boolean" + }, + "type": "Boolean" + }, + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "data", + "required": true, + "scalar": { + "kind": 4, + "name": "data", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "topics", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "topics", + "required": true, + "scalar": { + "kind": 4, + "name": "topics", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "topics", + "required": true, + "type": "[String]" + }, + { + "kind": 34, + "name": "transactionHash", + "required": true, + "scalar": { + "kind": 4, + "name": "transactionHash", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "logIndex", + "required": true, + "scalar": { + "kind": 4, + "name": "logIndex", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + } + ], + "type": "Ethereum_Log", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "EventNotification", + "properties": [ + { + "kind": 34, + "name": "data", + "required": true, + "scalar": { + "kind": 4, + "name": "data", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "log", + "object": { + "kind": 8192, + "name": "log", + "required": true, + "type": "Ethereum_Log" + }, + "required": true, + "type": "Ethereum_Log" + } + ], + "type": "Ethereum_EventNotification", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "Network", + "properties": [ + { + "kind": 34, + "name": "name", + "required": true, + "scalar": { + "kind": 4, + "name": "name", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "chainId", + "required": true, + "scalar": { + "kind": 4, + "name": "chainId", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "ensAddress", + "scalar": { + "kind": 4, + "name": "ensAddress", + "type": "String" + }, + "type": "String" + } + ], + "type": "Ethereum_Network", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "TxResponse", + "properties": [ + { + "kind": 34, + "name": "hash", + "required": true, + "scalar": { + "kind": 4, + "name": "hash", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "to", + "scalar": { + "kind": 4, + "name": "to", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "from", + "required": true, + "scalar": { + "kind": 4, + "name": "from", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "nonce", + "required": true, + "scalar": { + "kind": 4, + "name": "nonce", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "gasLimit", + "required": true, + "scalar": { + "kind": 4, + "name": "gasLimit", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "gasPrice", + "scalar": { + "kind": 4, + "name": "gasPrice", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "data", + "required": true, + "scalar": { + "kind": 4, + "name": "data", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "value", + "required": true, + "scalar": { + "kind": 4, + "name": "value", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "chainId", + "required": true, + "scalar": { + "kind": 4, + "name": "chainId", + "required": true, + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "blockNumber", + "scalar": { + "kind": 4, + "name": "blockNumber", + "type": "BigInt" + }, + "type": "BigInt" + }, + { + "kind": 34, + "name": "blockHash", + "scalar": { + "kind": 4, + "name": "blockHash", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "timestamp", + "scalar": { + "kind": 4, + "name": "timestamp", + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "confirmations", + "required": true, + "scalar": { + "kind": 4, + "name": "confirmations", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "raw", + "scalar": { + "kind": 4, + "name": "raw", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "r", + "scalar": { + "kind": 4, + "name": "r", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "s", + "scalar": { + "kind": 4, + "name": "s", + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "v", + "scalar": { + "kind": 4, + "name": "v", + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "kind": 34, + "name": "type", + "scalar": { + "kind": 4, + "name": "type", + "type": "UInt32" + }, + "type": "UInt32" + }, + { + "array": { + "item": { + "kind": 8192, + "name": "accessList", + "required": true, + "type": "Ethereum_Access" + }, + "kind": 18, + "name": "accessList", + "object": { + "kind": 8192, + "name": "accessList", + "required": true, + "type": "Ethereum_Access" + }, + "type": "[Ethereum_Access]" + }, + "kind": 34, + "name": "accessList", + "type": "[Ethereum_Access]" + } + ], + "type": "Ethereum_TxResponse", + "uri": "ens/ethereum.polywrap.eth" + }, + { + "kind": 1025, + "namespace": "Ethereum", + "nativeType": "Access", + "properties": [ + { + "kind": 34, + "name": "address", + "required": true, + "scalar": { + "kind": 4, + "name": "address", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "array": { + "item": { + "kind": 4, + "name": "storageKeys", + "required": true, + "type": "String" + }, + "kind": 18, + "name": "storageKeys", + "required": true, + "scalar": { + "kind": 4, + "name": "storageKeys", + "required": true, + "type": "String" + }, + "type": "[String]" + }, + "kind": 34, + "name": "storageKeys", + "required": true, + "type": "[String]" + } + ], + "type": "Ethereum_Access", + "uri": "ens/ethereum.polywrap.eth" + } + ], + "moduleType": { + "imports": [ + { + "type": "Ethereum_Module" + }, + { + "type": "Ethereum_Connection" + }, + { + "type": "Ethereum_TxOverrides" + }, + { + "type": "Ethereum_StaticTxResult" + }, + { + "type": "Ethereum_TxRequest" + }, + { + "type": "Ethereum_TxReceipt" + }, + { + "type": "Ethereum_Log" + }, + { + "type": "Ethereum_EventNotification" + }, + { + "type": "Ethereum_Network" + }, + { + "type": "Ethereum_TxResponse" + }, + { + "type": "Ethereum_Access" + } + ], + "kind": 128, + "methods": [ + { + "arguments": [ + { + "kind": 34, + "name": "str", + "required": true, + "scalar": { + "kind": 4, + "name": "str", + "required": true, + "type": "String" + }, + "type": "String" + }, + { + "kind": 34, + "name": "optStr", + "scalar": { + "kind": 4, + "name": "optStr", + "type": "String" + }, + "type": "String" + } + ], + "kind": 64, + "name": "methodOne", + "required": true, + "return": { + "kind": 34, + "name": "methodOne", + "object": { + "kind": 8192, + "name": "methodOne", + "required": true, + "type": "Object" + }, + "required": true, + "type": "Object" + }, + "type": "Method" + }, + { + "arguments": [ + { + "kind": 34, + "name": "arg", + "required": true, + "scalar": { + "kind": 4, + "name": "arg", + "required": true, + "type": "UInt32" + }, + "type": "UInt32" + } + ], + "kind": 64, + "name": "methodTwo", + "required": true, + "return": { + "kind": 34, + "name": "methodTwo", + "required": true, + "scalar": { + "kind": 4, + "name": "methodTwo", + "required": true, + "type": "String" + }, + "type": "String" + }, + "type": "Method" + } + ], + "type": "Module" + }, + "objectTypes": [ + { + "kind": 1, + "properties": [ + { + "kind": 34, + "name": "u", + "required": true, + "scalar": { + "kind": 4, + "name": "u", + "required": true, + "type": "UInt" + }, + "type": "UInt" + }, + { + "array": { + "item": { + "kind": 4, + "name": "array", + "required": true, + "type": "Boolean" + }, + "kind": 18, + "name": "array", + "required": true, + "scalar": { + "kind": 4, + "name": "array", + "required": true, + "type": "Boolean" + }, + "type": "[Boolean]" + }, + "kind": 34, + "name": "array", + "required": true, + "type": "[Boolean]" + }, + { + "kind": 34, + "name": "bytes", + "scalar": { + "kind": 4, + "name": "bytes", + "type": "Bytes" + }, + "type": "Bytes" + } + ], + "type": "Object" + } + ], + "version": "0.1" +} +} diff --git a/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/polywrap.custom.plugin.yaml b/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/polywrap.custom.plugin.yaml index 7a95fddd10..b6e429cf4e 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/polywrap.custom.plugin.yaml +++ b/packages/test-cases/cases/cli/plugin/codegen/006-custom-manifest-file/polywrap.custom.plugin.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: Test language: plugin/typescript schema: ./schema.graphql diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/001-sanity/package.json b/packages/test-cases/cases/cli/wasm/build-cmd/001-sanity/package.json index 52c8a2560f..0e7747dc4a 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/001-sanity/package.json +++ b/packages/test-cases/cases/cli/wasm/build-cmd/001-sanity/package.json @@ -7,7 +7,7 @@ "build": "polywrap build" }, "dependencies": { - "@polywrap/wasm-as": "0.1.0" + "@polywrap/wasm-as": "0.3.0" }, "devDependencies": { "assemblyscript": "0.19.5" diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/001-sanity/polywrap.yaml b/packages/test-cases/cases/cli/wasm/build-cmd/001-sanity/polywrap.yaml index f592ca6e23..590906cbea 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/001-sanity/polywrap.yaml +++ b/packages/test-cases/cases/cli/wasm/build-cmd/001-sanity/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: test-project build: ./polywrap.build.yaml language: wasm/assemblyscript diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/002-invalid-manifest-1/polywrap.yaml b/packages/test-cases/cases/cli/wasm/build-cmd/002-invalid-manifest-1/polywrap.yaml index db3654bc09..3afc0df5c9 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/002-invalid-manifest-1/polywrap.yaml +++ b/packages/test-cases/cases/cli/wasm/build-cmd/002-invalid-manifest-1/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: invalid-manifest language: wasm/assemblyscript schema: ./src/wrong/schema.graphql diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/003-invalid-manifest-2/polywrap.yaml b/packages/test-cases/cases/cli/wasm/build-cmd/003-invalid-manifest-2/polywrap.yaml index 7031610bc6..9c1e40efde 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/003-invalid-manifest-2/polywrap.yaml +++ b/packages/test-cases/cases/cli/wasm/build-cmd/003-invalid-manifest-2/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: invalid-manifest-2 language: wasm/assemblyscript wrong: foo diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/004-default-build/package.json b/packages/test-cases/cases/cli/wasm/build-cmd/004-default-build/package.json index 52c8a2560f..0e7747dc4a 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/004-default-build/package.json +++ b/packages/test-cases/cases/cli/wasm/build-cmd/004-default-build/package.json @@ -7,7 +7,7 @@ "build": "polywrap build" }, "dependencies": { - "@polywrap/wasm-as": "0.1.0" + "@polywrap/wasm-as": "0.3.0" }, "devDependencies": { "assemblyscript": "0.19.5" diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/004-default-build/polywrap.yaml b/packages/test-cases/cases/cli/wasm/build-cmd/004-default-build/polywrap.yaml index b55c7431a8..20fca1fac8 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/004-default-build/polywrap.yaml +++ b/packages/test-cases/cases/cli/wasm/build-cmd/004-default-build/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: test-project language: wasm/assemblyscript build: ./polywrap.build.yaml diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/005-default-dockerfile/package.json b/packages/test-cases/cases/cli/wasm/build-cmd/005-default-dockerfile/package.json index 52c8a2560f..0e7747dc4a 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/005-default-dockerfile/package.json +++ b/packages/test-cases/cases/cli/wasm/build-cmd/005-default-dockerfile/package.json @@ -7,7 +7,7 @@ "build": "polywrap build" }, "dependencies": { - "@polywrap/wasm-as": "0.1.0" + "@polywrap/wasm-as": "0.3.0" }, "devDependencies": { "assemblyscript": "0.19.5" diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/005-default-dockerfile/polywrap.yaml b/packages/test-cases/cases/cli/wasm/build-cmd/005-default-dockerfile/polywrap.yaml index 2b9c714c82..f28419a3d3 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/005-default-dockerfile/polywrap.yaml +++ b/packages/test-cases/cases/cli/wasm/build-cmd/005-default-dockerfile/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: default-dockerfile language: wasm/assemblyscript build: ./polywrap.build.yaml diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/006-custom-dockerfile/package.json b/packages/test-cases/cases/cli/wasm/build-cmd/006-custom-dockerfile/package.json index 52c8a2560f..0e7747dc4a 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/006-custom-dockerfile/package.json +++ b/packages/test-cases/cases/cli/wasm/build-cmd/006-custom-dockerfile/package.json @@ -7,7 +7,7 @@ "build": "polywrap build" }, "dependencies": { - "@polywrap/wasm-as": "0.1.0" + "@polywrap/wasm-as": "0.3.0" }, "devDependencies": { "assemblyscript": "0.19.5" diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/006-custom-dockerfile/polywrap.yaml b/packages/test-cases/cases/cli/wasm/build-cmd/006-custom-dockerfile/polywrap.yaml index f65b294e8d..8be93af27b 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/006-custom-dockerfile/polywrap.yaml +++ b/packages/test-cases/cases/cli/wasm/build-cmd/006-custom-dockerfile/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: custom-dockerfile language: wasm/assemblyscript build: ./polywrap.build.yaml diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/007-linked-packages/package.json b/packages/test-cases/cases/cli/wasm/build-cmd/007-linked-packages/package.json index 52c8a2560f..0e7747dc4a 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/007-linked-packages/package.json +++ b/packages/test-cases/cases/cli/wasm/build-cmd/007-linked-packages/package.json @@ -7,7 +7,7 @@ "build": "polywrap build" }, "dependencies": { - "@polywrap/wasm-as": "0.1.0" + "@polywrap/wasm-as": "0.3.0" }, "devDependencies": { "assemblyscript": "0.19.5" diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/007-linked-packages/polywrap.yaml b/packages/test-cases/cases/cli/wasm/build-cmd/007-linked-packages/polywrap.yaml index b3305629d3..d90c7a5f68 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/007-linked-packages/polywrap.yaml +++ b/packages/test-cases/cases/cli/wasm/build-cmd/007-linked-packages/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: linked-packages language: wasm/assemblyscript build: ./polywrap.build.yaml diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/008-metadata/package.json b/packages/test-cases/cases/cli/wasm/build-cmd/008-metadata/package.json index 52c8a2560f..0e7747dc4a 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/008-metadata/package.json +++ b/packages/test-cases/cases/cli/wasm/build-cmd/008-metadata/package.json @@ -7,7 +7,7 @@ "build": "polywrap build" }, "dependencies": { - "@polywrap/wasm-as": "0.1.0" + "@polywrap/wasm-as": "0.3.0" }, "devDependencies": { "assemblyscript": "0.19.5" diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/008-metadata/polywrap.yaml b/packages/test-cases/cases/cli/wasm/build-cmd/008-metadata/polywrap.yaml index acba98475d..f9049f08c4 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/008-metadata/polywrap.yaml +++ b/packages/test-cases/cases/cli/wasm/build-cmd/008-metadata/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: test-project language: wasm/assemblyscript meta: ./polywrap.meta.yaml diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/009-docker-buildx/package.json b/packages/test-cases/cases/cli/wasm/build-cmd/009-docker-buildx/package.json index a896acb449..c04e004f93 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/009-docker-buildx/package.json +++ b/packages/test-cases/cases/cli/wasm/build-cmd/009-docker-buildx/package.json @@ -7,7 +7,7 @@ "build": "polywrap build" }, "dependencies": { - "@polywrap/wasm-as": "0.1.0" + "@polywrap/wasm-as": "0.3.0" }, "devDependencies": { "assemblyscript": "0.19.1" diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/009-docker-buildx/polywrap.yaml b/packages/test-cases/cases/cli/wasm/build-cmd/009-docker-buildx/polywrap.yaml index 8668808a7f..80eada2659 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/009-docker-buildx/polywrap.yaml +++ b/packages/test-cases/cases/cli/wasm/build-cmd/009-docker-buildx/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: test-project build: ./polywrap.build.yaml language: wasm/assemblyscript diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/010-custom-config/config.ts b/packages/test-cases/cases/cli/wasm/build-cmd/010-custom-config/config.ts index a51cd93907..bf5ec3d50d 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/010-custom-config/config.ts +++ b/packages/test-cases/cases/cli/wasm/build-cmd/010-custom-config/config.ts @@ -21,13 +21,115 @@ const mockPlugin = () => { return { factory: () => new MockPlugin({ val: 0 }), manifest: { - schema: ` - type Module { - getData: Int! - setData(value: Int!): Boolean! - deployContract: String! + abi: { + "objectTypes": [], + "enumTypes": [], + "interfaceTypes": [], + "importedObjectTypes": [], + "importedModuleTypes": [], + "importedEnumTypes": [], + "importedEnvTypes": [], + "moduleType": { + "type": "Module", + "name": null, + "required": null, + "kind": 128, + "methods": [ + { + "type": "Method", + "name": "getData", + "required": true, + "kind": 64, + "arguments": [], + "return": { + "type": "Int", + "name": "getData", + "required": true, + "kind": 34, + "array": null, + "map": null, + "scalar": { + "type": "Int", + "name": "getData", + "required": true, + "kind": 4 + }, + "object": null, + "enum": null, + "unresolvedObjectOrEnum": null + } + }, + { + "type": "Method", + "name": "setData", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "Int", + "name": "value", + "required": true, + "kind": 34, + "array": null, + "map": null, + "scalar": { + "type": "Int", + "name": "value", + "required": true, + "kind": 4 + }, + "object": null, + "enum": null, + "unresolvedObjectOrEnum": null + } + ], + "return": { + "type": "Boolean", + "name": "setData", + "required": true, + "kind": 34, + "array": null, + "map": null, + "scalar": { + "type": "Boolean", + "name": "setData", + "required": true, + "kind": 4 + }, + "object": null, + "enum": null, + "unresolvedObjectOrEnum": null + } + }, + { + "type": "Method", + "name": "deployContract", + "required": true, + "kind": 64, + "arguments": [], + "return": { + "type": "String", + "name": "deployContract", + "required": true, + "kind": 34, + "array": null, + "map": null, + "scalar": { + "type": "String", + "name": "deployContract", + "required": true, + "kind": 4 + }, + "object": null, + "enum": null, + "unresolvedObjectOrEnum": null + } + } + ], + "imports": [], + "interfaces": [] } - `, + }, implements: [], }, }; diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/010-custom-config/package.json b/packages/test-cases/cases/cli/wasm/build-cmd/010-custom-config/package.json index 52c8a2560f..0e7747dc4a 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/010-custom-config/package.json +++ b/packages/test-cases/cases/cli/wasm/build-cmd/010-custom-config/package.json @@ -7,7 +7,7 @@ "build": "polywrap build" }, "dependencies": { - "@polywrap/wasm-as": "0.1.0" + "@polywrap/wasm-as": "0.3.0" }, "devDependencies": { "assemblyscript": "0.19.5" diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/010-custom-config/polywrap.build.yaml b/packages/test-cases/cases/cli/wasm/build-cmd/010-custom-config/polywrap.build.yaml index 3edf63339a..5b7b10a7c5 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/010-custom-config/polywrap.build.yaml +++ b/packages/test-cases/cases/cli/wasm/build-cmd/010-custom-config/polywrap.build.yaml @@ -1,6 +1,6 @@ format: 0.1.0 config: - node_version: "14.16.0" + node_version: "16.13.0" linked_packages: - name: "@polywrap/wasm-as" path: ../../../../../../wasm/as diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/010-custom-config/polywrap.yaml b/packages/test-cases/cases/cli/wasm/build-cmd/010-custom-config/polywrap.yaml index f592ca6e23..590906cbea 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/010-custom-config/polywrap.yaml +++ b/packages/test-cases/cases/cli/wasm/build-cmd/010-custom-config/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: test-project build: ./polywrap.build.yaml language: wasm/assemblyscript diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/011-custom-config/package.json b/packages/test-cases/cases/cli/wasm/build-cmd/011-custom-config/package.json index 52c8a2560f..0e7747dc4a 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/011-custom-config/package.json +++ b/packages/test-cases/cases/cli/wasm/build-cmd/011-custom-config/package.json @@ -7,7 +7,7 @@ "build": "polywrap build" }, "dependencies": { - "@polywrap/wasm-as": "0.1.0" + "@polywrap/wasm-as": "0.3.0" }, "devDependencies": { "assemblyscript": "0.19.5" diff --git a/packages/test-cases/cases/cli/wasm/build-cmd/011-custom-config/polywrap.custom.yaml b/packages/test-cases/cases/cli/wasm/build-cmd/011-custom-config/polywrap.custom.yaml index 13216cba67..bdad36f5f2 100644 --- a/packages/test-cases/cases/cli/wasm/build-cmd/011-custom-config/polywrap.custom.yaml +++ b/packages/test-cases/cases/cli/wasm/build-cmd/011-custom-config/polywrap.custom.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: test-project build: ./polywrap.custom.build.yaml language: wasm/assemblyscript diff --git a/packages/test-cases/cases/cli/wasm/codegen/001-sanity/package.json b/packages/test-cases/cases/cli/wasm/codegen/001-sanity/package.json index 52c8a2560f..0e7747dc4a 100644 --- a/packages/test-cases/cases/cli/wasm/codegen/001-sanity/package.json +++ b/packages/test-cases/cases/cli/wasm/codegen/001-sanity/package.json @@ -7,7 +7,7 @@ "build": "polywrap build" }, "dependencies": { - "@polywrap/wasm-as": "0.1.0" + "@polywrap/wasm-as": "0.3.0" }, "devDependencies": { "assemblyscript": "0.19.5" diff --git a/packages/test-cases/cases/cli/wasm/codegen/001-sanity/polywrap.yaml b/packages/test-cases/cases/cli/wasm/codegen/001-sanity/polywrap.yaml index 0c24cfe4f6..a4e446d3b1 100644 --- a/packages/test-cases/cases/cli/wasm/codegen/001-sanity/polywrap.yaml +++ b/packages/test-cases/cases/cli/wasm/codegen/001-sanity/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: test-project build: ./polywrap.build.yaml language: wasm/assemblyscript diff --git a/packages/test-cases/cases/cli/wasm/codegen/002-invalid-codegen-script/package.json b/packages/test-cases/cases/cli/wasm/codegen/002-invalid-codegen-script/package.json index 52c8a2560f..0e7747dc4a 100644 --- a/packages/test-cases/cases/cli/wasm/codegen/002-invalid-codegen-script/package.json +++ b/packages/test-cases/cases/cli/wasm/codegen/002-invalid-codegen-script/package.json @@ -7,7 +7,7 @@ "build": "polywrap build" }, "dependencies": { - "@polywrap/wasm-as": "0.1.0" + "@polywrap/wasm-as": "0.3.0" }, "devDependencies": { "assemblyscript": "0.19.5" diff --git a/packages/test-cases/cases/cli/wasm/codegen/002-invalid-codegen-script/polywrap.yaml b/packages/test-cases/cases/cli/wasm/codegen/002-invalid-codegen-script/polywrap.yaml index 0c24cfe4f6..a4e446d3b1 100644 --- a/packages/test-cases/cases/cli/wasm/codegen/002-invalid-codegen-script/polywrap.yaml +++ b/packages/test-cases/cases/cli/wasm/codegen/002-invalid-codegen-script/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: test-project build: ./polywrap.build.yaml language: wasm/assemblyscript diff --git a/packages/test-cases/cases/cli/wasm/codegen/003-codegen-script/package.json b/packages/test-cases/cases/cli/wasm/codegen/003-codegen-script/package.json index 52c8a2560f..0e7747dc4a 100644 --- a/packages/test-cases/cases/cli/wasm/codegen/003-codegen-script/package.json +++ b/packages/test-cases/cases/cli/wasm/codegen/003-codegen-script/package.json @@ -7,7 +7,7 @@ "build": "polywrap build" }, "dependencies": { - "@polywrap/wasm-as": "0.1.0" + "@polywrap/wasm-as": "0.3.0" }, "devDependencies": { "assemblyscript": "0.19.5" diff --git a/packages/test-cases/cases/cli/wasm/codegen/003-codegen-script/polywrap.yaml b/packages/test-cases/cases/cli/wasm/codegen/003-codegen-script/polywrap.yaml index 0c24cfe4f6..a4e446d3b1 100644 --- a/packages/test-cases/cases/cli/wasm/codegen/003-codegen-script/polywrap.yaml +++ b/packages/test-cases/cases/cli/wasm/codegen/003-codegen-script/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: test-project build: ./polywrap.build.yaml language: wasm/assemblyscript diff --git a/packages/test-cases/cases/cli/wasm/codegen/004-custom-config/config.ts b/packages/test-cases/cases/cli/wasm/codegen/004-custom-config/config.ts index a51cd93907..a98f365a7e 100644 --- a/packages/test-cases/cases/cli/wasm/codegen/004-custom-config/config.ts +++ b/packages/test-cases/cases/cli/wasm/codegen/004-custom-config/config.ts @@ -1,5 +1,6 @@ import { PolywrapClientConfig } from "@polywrap/client-js"; import { PluginModule } from "@polywrap/core-js"; +import { latestWrapManifestVersion, WrapManifest, WrapAbi } from "@polywrap/wrap-manifest-types-js"; interface Config extends Record { val: number; @@ -21,15 +22,11 @@ const mockPlugin = () => { return { factory: () => new MockPlugin({ val: 0 }), manifest: { - schema: ` - type Module { - getData: Int! - setData(value: Int!): Boolean! - deployContract: String! - } - `, - implements: [], - }, + name: "mock", + type: "plugin", + version: latestWrapManifestVersion, + abi + } as WrapManifest }; }; @@ -49,3 +46,83 @@ export function getClientConfig(defaultConfigs: Partial) { } return defaultConfigs; } + +const abi: WrapAbi = { + version: "0.1", + "moduleType": { + "type": "Module", + "kind": 128, + "methods": [ + { + "type": "Method", + "name": "getData", + "required": true, + "kind": 64, + "arguments": [], + "return": { + "type": "Int", + "name": "getData", + "required": true, + "kind": 34, + "scalar": { + "type": "Int", + "name": "getData", + "required": true, + "kind": 4 + } + } + }, + { + "type": "Method", + "name": "setData", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "Int", + "name": "value", + "required": true, + "kind": 34, + "scalar": { + "type": "Int", + "name": "value", + "required": true, + "kind": 4 + } + } + ], + "return": { + "type": "Boolean", + "name": "setData", + "required": true, + "kind": 34, + "scalar": { + "type": "Boolean", + "name": "setData", + "required": true, + "kind": 4 + } + } + }, + { + "type": "Method", + "name": "deployContract", + "required": true, + "kind": 64, + "arguments": [], + "return": { + "type": "String", + "name": "deployContract", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "deployContract", + "required": true, + "kind": 4 + } + } + } + ] + } +}; diff --git a/packages/test-cases/cases/cli/wasm/codegen/004-custom-config/package.json b/packages/test-cases/cases/cli/wasm/codegen/004-custom-config/package.json index 52c8a2560f..0e7747dc4a 100644 --- a/packages/test-cases/cases/cli/wasm/codegen/004-custom-config/package.json +++ b/packages/test-cases/cases/cli/wasm/codegen/004-custom-config/package.json @@ -7,7 +7,7 @@ "build": "polywrap build" }, "dependencies": { - "@polywrap/wasm-as": "0.1.0" + "@polywrap/wasm-as": "0.3.0" }, "devDependencies": { "assemblyscript": "0.19.5" diff --git a/packages/test-cases/cases/cli/wasm/codegen/004-custom-config/polywrap.yaml b/packages/test-cases/cases/cli/wasm/codegen/004-custom-config/polywrap.yaml index 0c24cfe4f6..a4e446d3b1 100644 --- a/packages/test-cases/cases/cli/wasm/codegen/004-custom-config/polywrap.yaml +++ b/packages/test-cases/cases/cli/wasm/codegen/004-custom-config/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: test-project build: ./polywrap.build.yaml language: wasm/assemblyscript diff --git a/packages/test-cases/cases/cli/wasm/codegen/005-custom-manifest-file/package.json b/packages/test-cases/cases/cli/wasm/codegen/005-custom-manifest-file/package.json index 52c8a2560f..0e7747dc4a 100644 --- a/packages/test-cases/cases/cli/wasm/codegen/005-custom-manifest-file/package.json +++ b/packages/test-cases/cases/cli/wasm/codegen/005-custom-manifest-file/package.json @@ -7,7 +7,7 @@ "build": "polywrap build" }, "dependencies": { - "@polywrap/wasm-as": "0.1.0" + "@polywrap/wasm-as": "0.3.0" }, "devDependencies": { "assemblyscript": "0.19.5" diff --git a/packages/test-cases/cases/cli/wasm/codegen/005-custom-manifest-file/polywrap.custom.yaml b/packages/test-cases/cases/cli/wasm/codegen/005-custom-manifest-file/polywrap.custom.yaml index 0c24cfe4f6..a4e446d3b1 100644 --- a/packages/test-cases/cases/cli/wasm/codegen/005-custom-manifest-file/polywrap.custom.yaml +++ b/packages/test-cases/cases/cli/wasm/codegen/005-custom-manifest-file/polywrap.custom.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: test-project build: ./polywrap.build.yaml language: wasm/assemblyscript diff --git a/packages/test-cases/cases/cli/wasm/deploy/001-sanity/package.json b/packages/test-cases/cases/cli/wasm/deploy/001-sanity/package.json index f639e16666..bf7ab87b59 100644 --- a/packages/test-cases/cases/cli/wasm/deploy/001-sanity/package.json +++ b/packages/test-cases/cases/cli/wasm/deploy/001-sanity/package.json @@ -10,7 +10,7 @@ "test:env:down": "polywrap infra down --modules=eth-ens-ipfs" }, "dependencies": { - "@polywrap/wasm-as": "0.1.0" + "@polywrap/wasm-as": "0.3.0" }, "devDependencies": { "assemblyscript": "0.19.5" diff --git a/packages/test-cases/cases/cli/wasm/deploy/001-sanity/polywrap.yaml b/packages/test-cases/cases/cli/wasm/deploy/001-sanity/polywrap.yaml index 26f3072adb..1d42835e0a 100644 --- a/packages/test-cases/cases/cli/wasm/deploy/001-sanity/polywrap.yaml +++ b/packages/test-cases/cases/cli/wasm/deploy/001-sanity/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: deploy-sanity build: ./polywrap.build.yaml deploy: ./polywrap.deploy.yaml diff --git a/packages/test-cases/cases/cli/wasm/deploy/002-no-ext/package.json b/packages/test-cases/cases/cli/wasm/deploy/002-no-ext/package.json index f639e16666..bf7ab87b59 100644 --- a/packages/test-cases/cases/cli/wasm/deploy/002-no-ext/package.json +++ b/packages/test-cases/cases/cli/wasm/deploy/002-no-ext/package.json @@ -10,7 +10,7 @@ "test:env:down": "polywrap infra down --modules=eth-ens-ipfs" }, "dependencies": { - "@polywrap/wasm-as": "0.1.0" + "@polywrap/wasm-as": "0.3.0" }, "devDependencies": { "assemblyscript": "0.19.5" diff --git a/packages/test-cases/cases/cli/wasm/deploy/002-no-ext/polywrap.yaml b/packages/test-cases/cases/cli/wasm/deploy/002-no-ext/polywrap.yaml index 8306e2b6c6..484acd7b4b 100644 --- a/packages/test-cases/cases/cli/wasm/deploy/002-no-ext/polywrap.yaml +++ b/packages/test-cases/cases/cli/wasm/deploy/002-no-ext/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: deploy-no-ext build: ./polywrap.build.yaml deploy: ./polywrap.deploy.yaml diff --git a/packages/test-cases/cases/cli/wasm/deploy/003-invalid-config/package.json b/packages/test-cases/cases/cli/wasm/deploy/003-invalid-config/package.json index f639e16666..bf7ab87b59 100644 --- a/packages/test-cases/cases/cli/wasm/deploy/003-invalid-config/package.json +++ b/packages/test-cases/cases/cli/wasm/deploy/003-invalid-config/package.json @@ -10,7 +10,7 @@ "test:env:down": "polywrap infra down --modules=eth-ens-ipfs" }, "dependencies": { - "@polywrap/wasm-as": "0.1.0" + "@polywrap/wasm-as": "0.3.0" }, "devDependencies": { "assemblyscript": "0.19.5" diff --git a/packages/test-cases/cases/cli/wasm/deploy/003-invalid-config/polywrap.yaml b/packages/test-cases/cases/cli/wasm/deploy/003-invalid-config/polywrap.yaml index fe2805234c..2070b84594 100644 --- a/packages/test-cases/cases/cli/wasm/deploy/003-invalid-config/polywrap.yaml +++ b/packages/test-cases/cases/cli/wasm/deploy/003-invalid-config/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: deploy-invalid-config build: ./polywrap.build.yaml deploy: ./polywrap.deploy.yaml diff --git a/packages/test-cases/cases/cli/wasm/deploy/004-fail-between/package.json b/packages/test-cases/cases/cli/wasm/deploy/004-fail-between/package.json index f639e16666..bf7ab87b59 100644 --- a/packages/test-cases/cases/cli/wasm/deploy/004-fail-between/package.json +++ b/packages/test-cases/cases/cli/wasm/deploy/004-fail-between/package.json @@ -10,7 +10,7 @@ "test:env:down": "polywrap infra down --modules=eth-ens-ipfs" }, "dependencies": { - "@polywrap/wasm-as": "0.1.0" + "@polywrap/wasm-as": "0.3.0" }, "devDependencies": { "assemblyscript": "0.19.5" diff --git a/packages/test-cases/cases/cli/wasm/deploy/004-fail-between/polywrap.yaml b/packages/test-cases/cases/cli/wasm/deploy/004-fail-between/polywrap.yaml index 696c9d158b..968619229e 100644 --- a/packages/test-cases/cases/cli/wasm/deploy/004-fail-between/polywrap.yaml +++ b/packages/test-cases/cases/cli/wasm/deploy/004-fail-between/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: deploy-fail-between build: ./polywrap.build.yaml deploy: ./polywrap.deploy.yaml diff --git a/packages/test-cases/cases/cli/wasm/deploy/005-non-loaded-env-var/package.json b/packages/test-cases/cases/cli/wasm/deploy/005-non-loaded-env-var/package.json index 5c877fcae9..602fd33423 100644 --- a/packages/test-cases/cases/cli/wasm/deploy/005-non-loaded-env-var/package.json +++ b/packages/test-cases/cases/cli/wasm/deploy/005-non-loaded-env-var/package.json @@ -10,7 +10,7 @@ "test:env:down": "polywrap test-env down" }, "dependencies": { - "@polywrap/wasm-as": "0.1.0" + "@polywrap/wasm-as": "0.3.0" }, "devDependencies": { "assemblyscript": "0.19.5" diff --git a/packages/test-cases/cases/cli/wasm/deploy/005-non-loaded-env-var/polywrap.yaml b/packages/test-cases/cases/cli/wasm/deploy/005-non-loaded-env-var/polywrap.yaml index 26f3072adb..1d42835e0a 100644 --- a/packages/test-cases/cases/cli/wasm/deploy/005-non-loaded-env-var/polywrap.yaml +++ b/packages/test-cases/cases/cli/wasm/deploy/005-non-loaded-env-var/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: deploy-sanity build: ./polywrap.build.yaml deploy: ./polywrap.deploy.yaml diff --git a/packages/test-cases/cases/cli/wasm/run/client-async-config.ts b/packages/test-cases/cases/cli/wasm/run/client-async-config.ts index e0e08021cc..cceab278c6 100644 --- a/packages/test-cases/cases/cli/wasm/run/client-async-config.ts +++ b/packages/test-cases/cases/cli/wasm/run/client-async-config.ts @@ -1,5 +1,6 @@ import { PolywrapClientConfig } from "@polywrap/client-js"; import { PluginModule } from "@polywrap/core-js"; +import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; interface Config extends Record { val: number; @@ -19,10 +20,7 @@ class MockPlugin extends PluginModule { const mockPlugin = () => { return { factory: () => new MockPlugin({ val: 0 }), - manifest: { - schema: ``, - implements: [], - }, + manifest: {} as WrapManifest, }; }; diff --git a/packages/test-cases/cases/cli/wasm/run/client-config.ts b/packages/test-cases/cases/cli/wasm/run/client-config.ts index 297db8741e..886f2a3acb 100644 --- a/packages/test-cases/cases/cli/wasm/run/client-config.ts +++ b/packages/test-cases/cases/cli/wasm/run/client-config.ts @@ -1,5 +1,6 @@ import { PolywrapClientConfig } from "@polywrap/client-js"; import { PluginModule } from "@polywrap/core-js"; +import { WrapManifest } from "@polywrap/wrap-manifest-types-js"; interface Config extends Record { val: number; @@ -20,10 +21,7 @@ class MockPlugin extends PluginModule { const mockPlugin = () => { return { factory: () => new MockPlugin({ val: 0 }), - manifest: { - schema: ``, - implements: [], - }, + manifest: {} as WrapManifest, }; }; diff --git a/packages/test-cases/cases/cli/wasm/run/package.json b/packages/test-cases/cases/cli/wasm/run/package.json index 37970cba1f..e10de07a89 100644 --- a/packages/test-cases/cases/cli/wasm/run/package.json +++ b/packages/test-cases/cases/cli/wasm/run/package.json @@ -10,7 +10,7 @@ "test:env:down": "polywrap infra down --modules=eth-ens-ipfs" }, "dependencies": { - "@polywrap/wasm-as": "0.1.0" + "@polywrap/wasm-as": "0.3.0" }, "devDependencies": { "assemblyscript": "0.19.5", diff --git a/packages/test-cases/cases/cli/wasm/run/polywrap.yaml b/packages/test-cases/cases/cli/wasm/run/polywrap.yaml index 8e66aadd1e..7b9c439434 100644 --- a/packages/test-cases/cases/cli/wasm/run/polywrap.yaml +++ b/packages/test-cases/cases/cli/wasm/run/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: test-project build: ./polywrap.build.yaml deploy: ./polywrap.deploy.yaml diff --git a/packages/test-cases/cases/compose/001-local-imports/00-sanity/output/module.ts b/packages/test-cases/cases/compose/001-local-imports/00-sanity/output/module.ts index 4553903bf3..2849cdb99a 100644 --- a/packages/test-cases/cases/compose/001-local-imports/00-sanity/output/module.ts +++ b/packages/test-cases/cases/compose/001-local-imports/00-sanity/output/module.ts @@ -14,6 +14,7 @@ import { } from "@polywrap/schema-parse"; export const abi: WrapAbi = { + version: "0.1", moduleType: { ...createModuleDefinition({}), diff --git a/packages/test-cases/cases/compose/001-local-imports/01-nested-objects/output/module.ts b/packages/test-cases/cases/compose/001-local-imports/01-nested-objects/output/module.ts index 908a79b451..fe8481a554 100644 --- a/packages/test-cases/cases/compose/001-local-imports/01-nested-objects/output/module.ts +++ b/packages/test-cases/cases/compose/001-local-imports/01-nested-objects/output/module.ts @@ -8,6 +8,7 @@ import { } from "@polywrap/schema-parse"; export const abi: WrapAbi = { + version: "0.1", objectTypes: [ { ...createObjectDefinition({ diff --git a/packages/test-cases/cases/compose/001-local-imports/02-recursive/output/module.ts b/packages/test-cases/cases/compose/001-local-imports/02-recursive/output/module.ts index 009ef90883..f26d7581ed 100644 --- a/packages/test-cases/cases/compose/001-local-imports/02-recursive/output/module.ts +++ b/packages/test-cases/cases/compose/001-local-imports/02-recursive/output/module.ts @@ -8,6 +8,7 @@ import { } from "@polywrap/schema-parse"; export const abi: WrapAbi = { + version: "0.1", objectTypes: [ { ...createObjectDefinition({ diff --git a/packages/test-cases/cases/compose/001-local-imports/03-wild-card/output/module.ts b/packages/test-cases/cases/compose/001-local-imports/03-wild-card/output/module.ts index b48c222e32..9d599927f9 100644 --- a/packages/test-cases/cases/compose/001-local-imports/03-wild-card/output/module.ts +++ b/packages/test-cases/cases/compose/001-local-imports/03-wild-card/output/module.ts @@ -15,6 +15,7 @@ import { } from "@polywrap/schema-parse"; export const abi: WrapAbi = { + version: "0.1", objectTypes: [ { ...createObjectDefinition({ type: "CustomModuleType" }), diff --git a/packages/test-cases/cases/compose/002-external-imports/00-sanity/imports-ext/external.eth/module.ts b/packages/test-cases/cases/compose/002-external-imports/00-sanity/imports-ext/external.eth/module.ts new file mode 100644 index 0000000000..2494fc621e --- /dev/null +++ b/packages/test-cases/cases/compose/002-external-imports/00-sanity/imports-ext/external.eth/module.ts @@ -0,0 +1,125 @@ +import { WrapAbi } from "@polywrap/schema-parse"; + +export const abi: WrapAbi = { + version: "0.1", + "objectTypes": [ + { + "type": "ExternalType", + "kind": 1, + "properties": [ + { + "type": "String", + "name": "str", + "kind": 34, + "scalar": { + "type": "String", + "name": "str", + "kind": 4 + } + } + ], + "interfaces": [] + } + ], + "enumTypes": [], + "interfaceTypes": [], + "importedObjectTypes": [], + "importedModuleTypes": [], + "importedEnumTypes": [], + "importedEnvTypes": [], + "envType": { + "type": "Env", + "kind": 65536, + "properties": [ + { + "type": "ExternalType", + "name": "externalProp", + "kind": 34, + "object": { + "type": "ExternalType", + "name": "externalProp", + "kind": 8192 + } + } + ], + "interfaces": [] + }, + "moduleType": { + "type": "Module", + "kind": 128, + "methods": [ + { + "type": "Method", + "name": "envMethod", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "String", + "name": "arg", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "arg", + "required": true, + "kind": 4 + } + } + ], + "return": { + "type": "String", + "name": "envMethod", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "envMethod", + "required": true, + "kind": 4 + } + }, + "env": { + "required": true + } + }, + { + "type": "Method", + "name": "optEnvMethod", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "String", + "name": "arg", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "arg", + "required": true, + "kind": 4 + } + } + ], + "return": { + "type": "String", + "name": "optEnvMethod", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "optEnvMethod", + "required": true, + "kind": 4 + } + }, + "env": { + "required": false + } + } + ], + "imports": [], + "interfaces": [] + } +}; diff --git a/packages/test-cases/cases/compose/002-external-imports/00-sanity/imports-ext/external.eth/schema.graphql b/packages/test-cases/cases/compose/002-external-imports/00-sanity/imports-ext/external.eth/schema.graphql deleted file mode 100644 index 7c634dea11..0000000000 --- a/packages/test-cases/cases/compose/002-external-imports/00-sanity/imports-ext/external.eth/schema.graphql +++ /dev/null @@ -1,46 +0,0 @@ -### Polywrap Header START ### -scalar UInt -scalar UInt8 -scalar UInt16 -scalar UInt32 -scalar Int -scalar Int8 -scalar Int16 -scalar Int32 -scalar Bytes -scalar BigInt -scalar BigNumber -scalar JSON -scalar Map - -directive @imported( - uri: String! - namespace: String! - nativeType: String! -) on OBJECT | ENUM - -directive @imports( - types: [String!]! -) on OBJECT - -directive @env(required: Boolean!) on FIELD_DEFINITION - -### Polywrap Header END ### - -type ExternalType { - str: String -} - -type Env { - externalProp: ExternalType -} - -type Module { - envMethod( - arg: String! - ): String! @env(required: true) - - optEnvMethod( - arg: String! - ): String! @env(required: false) -} \ No newline at end of file diff --git a/packages/test-cases/cases/compose/002-external-imports/00-sanity/output/module.ts b/packages/test-cases/cases/compose/002-external-imports/00-sanity/output/module.ts index d57605ae12..16abf085ad 100644 --- a/packages/test-cases/cases/compose/002-external-imports/00-sanity/output/module.ts +++ b/packages/test-cases/cases/compose/002-external-imports/00-sanity/output/module.ts @@ -10,42 +10,36 @@ import { } from "@polywrap/schema-parse"; export const abi: WrapAbi = { - moduleType: { - ...createModuleDefinition({}), - imports: [ - { type: "Namespace_ExternalType" }, - { type: "Namespace_Env" }, - { type: "Namespace_Module" } - ], - methods: [ - { - ...createMethodDefinition({ - name: "method", - return: createObjectPropertyDefinition({ - name: "method", - type: "Namespace_ExternalType", - }), - }), - }, - ], - }, + version: "0.1", + moduleType: createModuleDefinition({ + imports: [ + { type: "Namespace_ExternalType" }, + { type: "Namespace_Env" }, + { type: "Namespace_Module" } + ], + methods: [ + createMethodDefinition({ + name: "method", + return: createObjectPropertyDefinition({ + name: "method", + type: "Namespace_ExternalType", + }) + }) + ] + }), importedModuleTypes: [ - { - ...createImportedModuleDefinition({ - uri: "external.eth", - namespace: "Namespace", - isInterface: false, - nativeType: "Module", - }), + createImportedModuleDefinition({ + uri: "external.eth", + namespace: "Namespace", + isInterface: false, + nativeType: "Module", methods: [ - { - ...createMethodDefinition({ + createMethodDefinition({ + name: "envMethod", + return: createScalarPropertyDefinition({ name: "envMethod", - return: createScalarPropertyDefinition({ - name: "envMethod", - type: "String", - required: true, - }), + type: "String", + required: true, }), arguments: [ createScalarPropertyDefinition({ @@ -54,15 +48,16 @@ export const abi: WrapAbi = { required: true, }), ], - }, - { - ...createMethodDefinition({ + env: { + required: true + } + }), + createMethodDefinition({ + name: "optEnvMethod", + return: createScalarPropertyDefinition({ name: "optEnvMethod", - return: createScalarPropertyDefinition({ - name: "optEnvMethod", - type: "String", - required: true, - }), + type: "String", + required: true, }), arguments: [ createScalarPropertyDefinition({ @@ -71,40 +66,38 @@ export const abi: WrapAbi = { required: true, }), ], - }, - ], - } + env: { + required: false + } + }), + ] + }) ], importedObjectTypes: [ - { - ...createImportedObjectDefinition({ - uri: "external.eth", - namespace: "Namespace", - nativeType: "ExternalType", - type: "Namespace_ExternalType" - }), + createImportedObjectDefinition({ + uri: "external.eth", + namespace: "Namespace", + nativeType: "ExternalType", + type: "Namespace_ExternalType", properties: [ createScalarPropertyDefinition({ name: "str", type: "String" }) ], - }, + }), ], importedEnvTypes: [ - { - ...createImportedEnvDefinition({ - uri: "external.eth", - namespace: "Namespace", - nativeType: "Env", - type: "Namespace_Env" - }), + createImportedEnvDefinition({ + uri: "external.eth", + namespace: "Namespace", + nativeType: "Env", properties: [ createObjectPropertyDefinition({ name: "externalProp", type: "Namespace_ExternalType" }) - ], - }, + ] + }) ] }; diff --git a/packages/test-cases/cases/compose/002-external-imports/01-with-duplicate-local-type/imports-ext/external.eth/module.ts b/packages/test-cases/cases/compose/002-external-imports/01-with-duplicate-local-type/imports-ext/external.eth/module.ts new file mode 100644 index 0000000000..ee83f0ffc9 --- /dev/null +++ b/packages/test-cases/cases/compose/002-external-imports/01-with-duplicate-local-type/imports-ext/external.eth/module.ts @@ -0,0 +1,24 @@ +import { WrapAbi } from "@polywrap/schema-parse"; + +export const abi: WrapAbi = { + version: "0.1", + "objectTypes": [ + { + "type": "ExternalType", + "kind": 1, + "properties": [ + { + "type": "String", + "name": "str", + "kind": 34, + "scalar": { + "type": "String", + "name": "str", + "kind": 4 + } + } + ], + "interfaces": [] + } + ] +}; diff --git a/packages/test-cases/cases/compose/002-external-imports/01-with-duplicate-local-type/imports-ext/external.eth/schema.graphql b/packages/test-cases/cases/compose/002-external-imports/01-with-duplicate-local-type/imports-ext/external.eth/schema.graphql deleted file mode 100644 index ec7d0a26d7..0000000000 --- a/packages/test-cases/cases/compose/002-external-imports/01-with-duplicate-local-type/imports-ext/external.eth/schema.graphql +++ /dev/null @@ -1,32 +0,0 @@ -### Polywrap Header START ### -scalar UInt -scalar UInt8 -scalar UInt16 -scalar UInt32 -scalar Int -scalar Int8 -scalar Int16 -scalar Int32 -scalar Bytes -scalar BigInt -scalar BigNumber -scalar JSON -scalar Map - -directive @imported( - uri: String! - namespace: String! - nativeType: String! -) on OBJECT | ENUM - -directive @imports( - types: [String!]! -) on OBJECT - -directive @env(required: Boolean!) on FIELD_DEFINITION - -### Polywrap Header END ### - -type ExternalType { - str: String -} diff --git a/packages/test-cases/cases/compose/002-external-imports/01-with-duplicate-local-type/output/module.ts b/packages/test-cases/cases/compose/002-external-imports/01-with-duplicate-local-type/output/module.ts index ab36c68b0f..8c22e4c868 100644 --- a/packages/test-cases/cases/compose/002-external-imports/01-with-duplicate-local-type/output/module.ts +++ b/packages/test-cases/cases/compose/002-external-imports/01-with-duplicate-local-type/output/module.ts @@ -9,6 +9,7 @@ import { } from "@polywrap/schema-parse"; export const abi: WrapAbi = { + version: "0.1", objectTypes: [ { ...createObjectDefinition({ type: "LocalType" }), diff --git a/packages/test-cases/cases/compose/002-external-imports/02-wild-card/imports-ext/external.eth/module.ts b/packages/test-cases/cases/compose/002-external-imports/02-wild-card/imports-ext/external.eth/module.ts new file mode 100644 index 0000000000..2c56ed5e42 --- /dev/null +++ b/packages/test-cases/cases/compose/002-external-imports/02-wild-card/imports-ext/external.eth/module.ts @@ -0,0 +1,131 @@ +import { WrapAbi } from "@polywrap/schema-parse"; + +export const abi: WrapAbi = { + version: "0.1", + "objectTypes": [ + { + "type": "ExternalType", + "kind": 1, + "properties": [ + { + "type": "String", + "name": "str", + "kind": 34, + "scalar": { + "type": "String", + "name": "str", + "kind": 4 + } + } + ] + }, + { + "type": "ExternalType2", + "kind": 1, + "properties": [ + { + "type": "UInt32", + "name": "foo", + "kind": 34, + "scalar": { + "type": "UInt32", + "name": "foo", + "kind": 4 + } + } + ] + } + ], + "envType": { + "type": "Env", + "kind": 65536, + "properties": [ + { + "type": "ExternalType", + "name": "externalProp", + "kind": 34, + "object": { + "type": "ExternalType", + "name": "externalProp", + "kind": 8192 + } + } + ] + }, + "moduleType": { + "type": "Module", + "kind": 128, + "methods": [ + { + "type": "Method", + "name": "envMethod", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "String", + "name": "arg", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "arg", + "required": true, + "kind": 4 + } + } + ], + "return": { + "type": "String", + "name": "envMethod", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "envMethod", + "required": true, + "kind": 4 + } + }, + "env": { + "required": true + } + }, + { + "type": "Method", + "name": "optEnvMethod", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "String", + "name": "arg", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "arg", + "required": true, + "kind": 4 + } + } + ], + "return": { + "type": "String", + "name": "optEnvMethod", + "required": true, + "kind": 34, + "scalar": { + "type": "String", + "name": "optEnvMethod", + "required": true, + "kind": 4 + } + }, + "env": { + "required": false + } + } + ] + } +}; diff --git a/packages/test-cases/cases/compose/002-external-imports/02-wild-card/imports-ext/external.eth/schema.graphql b/packages/test-cases/cases/compose/002-external-imports/02-wild-card/imports-ext/external.eth/schema.graphql deleted file mode 100644 index 2733f7ee2f..0000000000 --- a/packages/test-cases/cases/compose/002-external-imports/02-wild-card/imports-ext/external.eth/schema.graphql +++ /dev/null @@ -1,44 +0,0 @@ -### Polywrap Header START ### -scalar UInt -scalar UInt8 -scalar UInt16 -scalar UInt32 -scalar Int -scalar Int8 -scalar Int16 -scalar Int32 -scalar Bytes -scalar BigInt -scalar BigNumber -scalar JSON - -directive @imported( - uri: String! - namespace: String! - nativeType: String! -) on OBJECT | ENUM - -directive @imports( - types: [String!]! -) on OBJECT - -directive @env(required: Boolean!) on FIELD_DEFINITION - -### Polywrap Header END ### - -type ExternalType { - str: String -} - -type ExternalType2 { - foo: UInt32 -} - -type Env { - externalProp: ExternalType -} - -type Module { - envMethod(arg: String!): String! @env(required: true) - optEnvMethod(arg: String!): String! @env(required: false) -} \ No newline at end of file diff --git a/packages/test-cases/cases/compose/002-external-imports/02-wild-card/output/module.ts b/packages/test-cases/cases/compose/002-external-imports/02-wild-card/output/module.ts index 3e0ad04e90..5194a70377 100644 --- a/packages/test-cases/cases/compose/002-external-imports/02-wild-card/output/module.ts +++ b/packages/test-cases/cases/compose/002-external-imports/02-wild-card/output/module.ts @@ -10,44 +10,37 @@ import { } from "@polywrap/schema-parse"; export const abi: WrapAbi = { - moduleType: - { - ...createModuleDefinition({}), - imports: [ - { type: "Namespace_ExternalType" }, - { type: "Namespace_ExternalType2" }, - { type: "Namespace_Module" }, - { type: "Namespace_Env" }, - ], - methods: [ - { - ...createMethodDefinition({ - name: "method", - return: createObjectPropertyDefinition({ - name: "method", - type: "Namespace_ExternalType", - }), - }), - }, - ], - }, - importedModuleTypes: [ - { - ...createImportedModuleDefinition({ - uri: "external.eth", - namespace: "Namespace", - isInterface: false, - nativeType: "Module", + version: "0.1", + moduleType: createModuleDefinition({ + imports: [ + { type: "Namespace_ExternalType" }, + { type: "Namespace_ExternalType2" }, + { type: "Namespace_Module" }, + { type: "Namespace_Env" }, + ], + methods: [ + createMethodDefinition({ + name: "method", + return: createObjectPropertyDefinition({ + name: "method", + type: "Namespace_ExternalType", + }), }), + ], + }), + importedModuleTypes: [ + createImportedModuleDefinition({ + uri: "external.eth", + namespace: "Namespace", + isInterface: false, + nativeType: "Module", methods: [ - { - ...createMethodDefinition({ + createMethodDefinition({ + name: "envMethod", + return: createScalarPropertyDefinition({ name: "envMethod", - return: createScalarPropertyDefinition({ - name: "envMethod", - type: "String", - required: true, - }), + type: "String", + required: true, }), arguments: [ createScalarPropertyDefinition({ @@ -56,15 +49,16 @@ export const abi: WrapAbi = { required: true, }), ], - }, - { - ...createMethodDefinition({ + env: { + required: true, + }, + }), + createMethodDefinition({ + name: "optEnvMethod", + return: createScalarPropertyDefinition({ name: "optEnvMethod", - return: createScalarPropertyDefinition({ - name: "optEnvMethod", - type: "String", - required: true, - }), + type: "String", + required: true, }), arguments: [ createScalarPropertyDefinition({ @@ -73,54 +67,50 @@ export const abi: WrapAbi = { required: true, }), ], - }, + env: { + required: false, + }, + }), ], - } + }), ], importedObjectTypes: [ - { - ...createImportedObjectDefinition({ - uri: "external.eth", - namespace: "Namespace", - nativeType: "ExternalType", - type: "Namespace_ExternalType" - }), + createImportedObjectDefinition({ + uri: "external.eth", + namespace: "Namespace", + nativeType: "ExternalType", + type: "Namespace_ExternalType", properties: [ createScalarPropertyDefinition({ name: "str", type: "String" }) ], - }, - { - ...createImportedObjectDefinition({ - uri: "external.eth", - namespace: "Namespace", - nativeType: "ExternalType2", - type: "Namespace_ExternalType2" - }), + }), + createImportedObjectDefinition({ + uri: "external.eth", + namespace: "Namespace", + nativeType: "ExternalType2", + type: "Namespace_ExternalType2", properties: [ createScalarPropertyDefinition({ name: "foo", type: "UInt32" }) ], - }, + }), ], importedEnvTypes: [ - { - ...createImportedEnvDefinition({ - uri: "external.eth", - namespace: "Namespace", - nativeType: "Env", - type: "Namespace_Env" - }), + createImportedEnvDefinition({ + uri: "external.eth", + namespace: "Namespace", + nativeType: "Env", properties: [ createObjectPropertyDefinition({ name: "externalProp", type: "Namespace_ExternalType" }) ], - }, + }), ] }; diff --git a/packages/test-cases/cases/compose/002-external-imports/03-with-duplicate-namespace/imports-ext/external.eth/module.ts b/packages/test-cases/cases/compose/002-external-imports/03-with-duplicate-namespace/imports-ext/external.eth/module.ts new file mode 100644 index 0000000000..0f8b390790 --- /dev/null +++ b/packages/test-cases/cases/compose/002-external-imports/03-with-duplicate-namespace/imports-ext/external.eth/module.ts @@ -0,0 +1,184 @@ +import { WrapAbi } from "@polywrap/wrap-manifest-types-js"; + +export const abi: WrapAbi = { + version: "0.1", + objectTypes: [], + enumTypes: [], + interfaceTypes: [], + importedObjectTypes: [ + { + type: "Ipfs_Options", + kind: 1025, + properties: [ + { + type: "UInt32", + name: "timeout", + kind: 34, + scalar: { + type: "UInt32", + name: "timeout", + kind: 4, + }, + comment: + " Timeout (in ms) for the operation.\nFallback providers are used if timeout is reached.", + }, + { + type: "String", + name: "provider", + kind: 34, + scalar: { + type: "String", + name: "provider", + kind: 4, + }, + comment: "The IPFS provider to be used", + }, + { + type: "Boolean", + name: "disableParallelRequests", + kind: 34, + scalar: { + type: "Boolean", + name: "disableParallelRequests", + kind: 4, + }, + comment: + "Disable querying providers in parallel when resolving URIs", + }, + ], + interfaces: [], + uri: "ens/ipfs.polywrap.eth", + namespace: "Ipfs", + nativeType: "Options", + }, + { + type: "Ipfs_ResolveResult", + kind: 1025, + properties: [ + { + type: "String", + name: "cid", + required: true, + kind: 34, + scalar: { type: "String", name: "cid", required: true, kind: 4 }, + }, + { + type: "String", + name: "provider", + required: true, + kind: 34, + scalar: { + type: "String", + name: "provider", + required: true, + kind: 4, + }, + }, + ], + interfaces: [], + uri: "ens/ipfs.polywrap.eth", + namespace: "Ipfs", + nativeType: "ResolveResult", + }, + ], + importedModuleTypes: [ + { + type: "Ipfs_Module", + kind: 256, + methods: [ + { + type: "Method", + name: "cat", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "cid", + required: true, + kind: 34, + scalar: { + type: "String", + name: "cid", + required: true, + kind: 4, + }, + }, + { + type: "Ipfs_Options", + name: "options", + kind: 34, + object: { + type: "Ipfs_Options", + name: "options", + kind: 8192, + }, + }, + ], + return: { + type: "Bytes", + name: "cat", + required: true, + kind: 34, + scalar: { type: "Bytes", name: "cat", required: true, kind: 4 }, + }, + }, + ], + uri: "ens/ipfs.polywrap.eth", + namespace: "Ipfs", + nativeType: "Module", + isInterface: false, + }, + ], + importedEnumTypes: [], + importedEnvTypes: [], + moduleType: { + type: "Module", + kind: 128, + methods: [ + { + type: "Method", + name: "cat", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "cid", + required: true, + kind: 34, + scalar: { type: "String", name: "cid", required: true, kind: 4 }, + }, + { + type: "Ipfs_Options", + name: "options", + kind: 34, + object: { + type: "Ipfs_Options", + name: "options", + kind: 8192, + }, + }, + ], + return: { + type: "Bytes", + name: "cat", + required: true, + kind: 34, + scalar: { type: "Bytes", name: "cat", required: true, kind: 4 }, + }, + }, + ], + imports: [ + { type: "Ipfs_Module" }, + { type: "Ipfs_Options" }, + { type: "Ipfs_ResolveResult" }, + ], + interfaces: [ + { + type: "Ipfs_Module", + kind: 2048, + }, + ], + }, +}; diff --git a/packages/test-cases/cases/compose/002-external-imports/03-with-duplicate-namespace/input/module.graphql b/packages/test-cases/cases/compose/002-external-imports/03-with-duplicate-namespace/input/module.graphql new file mode 100644 index 0000000000..6550603247 --- /dev/null +++ b/packages/test-cases/cases/compose/002-external-imports/03-with-duplicate-namespace/input/module.graphql @@ -0,0 +1,4 @@ +#import { Module } into Ipfs from "external.eth" + +type Module implements Ipfs_Module { +} diff --git a/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/build-artifacts/schema.graphql b/packages/test-cases/cases/compose/002-external-imports/03-with-duplicate-namespace/output/module.graphql similarity index 51% rename from packages/test-cases/cases/cli/plugin/codegen/003-env/expected/build-artifacts/schema.graphql rename to packages/test-cases/cases/compose/002-external-imports/03-with-duplicate-namespace/output/module.graphql index 649d1f54b9..d26490c34a 100644 --- a/packages/test-cases/cases/cli/plugin/codegen/003-env/expected/build-artifacts/schema.graphql +++ b/packages/test-cases/cases/compose/002-external-imports/03-with-duplicate-namespace/output/module.graphql @@ -37,22 +37,55 @@ directive @env(required: Boolean!) on FIELD_DEFINITION ### Polywrap Header END ### -type Module { - method( - str: String! - ): String! -} - -type Env { - arg1: String! +type Module implements Ipfs_Module @imports( + types: [ + "Ipfs_Module", + "Ipfs_Ipfs_Options" + ] +) { + cat( + cid: String! + options: Ipfs_Ipfs_Options + ): Bytes! } ### Imported Modules START ### +type Ipfs_Module @imported( + uri: "external.eth", + namespace: "Ipfs", + nativeType: "Module" +) { + cat( + cid: String! + options: Ipfs_Ipfs_Options + ): Bytes! +} + ### Imported Modules END ### ### Imported Objects START ### +type Ipfs_Ipfs_Options @imported( + uri: "external.eth", + namespace: "Ipfs", + nativeType: "Ipfs_Options" +) { + """ + Timeout (in ms) for the operation. +Fallback providers are used if timeout is reached. + """ + timeout: UInt32 + """ + The IPFS provider to be used + """ + provider: String + """ + Disable querying providers in parallel when resolving URIs + """ + disableParallelRequests: Boolean +} + ### Imported Objects END ### ### Imported Envs START ### diff --git a/packages/test-cases/cases/compose/002-external-imports/03-with-duplicate-namespace/output/module.ts b/packages/test-cases/cases/compose/002-external-imports/03-with-duplicate-namespace/output/module.ts new file mode 100644 index 0000000000..0d6f620440 --- /dev/null +++ b/packages/test-cases/cases/compose/002-external-imports/03-with-duplicate-namespace/output/module.ts @@ -0,0 +1,150 @@ +import { + WrapAbi, +} from "@polywrap/schema-parse"; + +export const abi: WrapAbi = { + version: "0.1", + moduleType: { + type: "Module", + kind: 128, + methods: [ + { + type: "Method", + name: "cat", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "cid", + required: true, + kind: 34, + scalar: { type: "String", name: "cid", required: true, kind: 4 }, + }, + { + type: "Ipfs_Ipfs_Options", + name: "options", + kind: 34, + object: { + type: "Ipfs_Ipfs_Options", + name: "options", + kind: 8192, + }, + }, + ], + return: { + type: "Bytes", + name: "cat", + required: true, + kind: 34, + scalar: { type: "Bytes", name: "cat", required: true, kind: 4 }, + }, + }, + ], + imports: [ + { type: "Ipfs_Module" }, + { type: "Ipfs_Ipfs_Options" } + ], + interfaces: [ + { + type: "Ipfs_Module", + kind: 2048, + }, + ], + }, + importedObjectTypes: [ + { + type: "Ipfs_Ipfs_Options", + kind: 1025, + properties: [ + { + type: "UInt32", + name: "timeout", + kind: 34, + scalar: { + type: "UInt32", + name: "timeout", + kind: 4, + }, + comment: + " Timeout (in ms) for the operation.\nFallback providers are used if timeout is reached.", + }, + { + type: "String", + name: "provider", + kind: 34, + scalar: { + type: "String", + name: "provider", + kind: 4, + }, + comment: "The IPFS provider to be used", + }, + { + type: "Boolean", + name: "disableParallelRequests", + kind: 34, + scalar: { + type: "Boolean", + name: "disableParallelRequests", + kind: 4, + }, + comment: + "Disable querying providers in parallel when resolving URIs", + }, + ], + uri: "external.eth", + namespace: "Ipfs", + nativeType: "Ipfs_Options", + }, + ], + importedModuleTypes: [ + { + type: "Ipfs_Module", + kind: 256, + methods: [ + { + type: "Method", + name: "cat", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "cid", + required: true, + kind: 34, + scalar: { + type: "String", + name: "cid", + required: true, + kind: 4, + }, + }, + { + type: "Ipfs_Ipfs_Options", + name: "options", + kind: 34, + object: { + type: "Ipfs_Ipfs_Options", + name: "options", + kind: 8192, + }, + }, + ], + return: { + type: "Bytes", + name: "cat", + required: true, + kind: 34, + scalar: { type: "Bytes", name: "cat", required: true, kind: 4 }, + }, + }, + ], + uri: "external.eth", + namespace: "Ipfs", + nativeType: "Module", + isInterface: false, + }, + ] +}; diff --git a/packages/test-cases/cases/compose/003-inheritance/01-sanity/output/module.ts b/packages/test-cases/cases/compose/003-inheritance/01-sanity/output/module.ts index 573b4fa073..ea117cc1b4 100644 --- a/packages/test-cases/cases/compose/003-inheritance/01-sanity/output/module.ts +++ b/packages/test-cases/cases/compose/003-inheritance/01-sanity/output/module.ts @@ -9,6 +9,7 @@ import { } from "@polywrap/schema-parse"; export const abi: WrapAbi = { + version: "0.1", objectTypes: [ { ...createObjectDefinition({ type: "BaseType1" }), diff --git a/packages/test-cases/cases/compose/004-empty-types/00-sanity/output/module.graphql b/packages/test-cases/cases/compose/004-empty-types/00-sanity/output/module.graphql index be279a378b..f120768f14 100644 --- a/packages/test-cases/cases/compose/004-empty-types/00-sanity/output/module.graphql +++ b/packages/test-cases/cases/compose/004-empty-types/00-sanity/output/module.graphql @@ -37,9 +37,9 @@ directive @env(required: Boolean!) on FIELD_DEFINITION ### Polywrap Header END ### -type Module +type Module { } -type CustomType +type CustomType { } ### Imported Modules START ### diff --git a/packages/test-cases/cases/compose/004-empty-types/00-sanity/output/module.ts b/packages/test-cases/cases/compose/004-empty-types/00-sanity/output/module.ts index a62e7bd747..78a428f684 100644 --- a/packages/test-cases/cases/compose/004-empty-types/00-sanity/output/module.ts +++ b/packages/test-cases/cases/compose/004-empty-types/00-sanity/output/module.ts @@ -5,6 +5,7 @@ import { } from "@polywrap/schema-parse"; export const abi: WrapAbi = { + version: "0.1", objectTypes: [ { ...createObjectDefinition({ diff --git a/packages/test-cases/cases/compose/004-empty-types/01-inherited/output/module.graphql b/packages/test-cases/cases/compose/004-empty-types/01-inherited/output/module.graphql index 69e079704a..7b97c504c8 100644 --- a/packages/test-cases/cases/compose/004-empty-types/01-inherited/output/module.graphql +++ b/packages/test-cases/cases/compose/004-empty-types/01-inherited/output/module.graphql @@ -41,9 +41,9 @@ type Module { method: DerivedType } -type BaseType +type BaseType { } -type DerivedType implements BaseType +type DerivedType implements BaseType { } ### Imported Modules START ### diff --git a/packages/test-cases/cases/compose/004-empty-types/01-inherited/output/module.ts b/packages/test-cases/cases/compose/004-empty-types/01-inherited/output/module.ts index 7a0d637a8e..994df26943 100644 --- a/packages/test-cases/cases/compose/004-empty-types/01-inherited/output/module.ts +++ b/packages/test-cases/cases/compose/004-empty-types/01-inherited/output/module.ts @@ -8,6 +8,7 @@ import { } from "@polywrap/schema-parse"; export const abi: WrapAbi = { + version: "0.1", objectTypes: [ { ...createObjectDefinition({ diff --git a/packages/test-cases/cases/compose/004-empty-types/02-imported-inherited/output/module.graphql b/packages/test-cases/cases/compose/004-empty-types/02-imported-inherited/output/module.graphql index ecac203949..252733d296 100644 --- a/packages/test-cases/cases/compose/004-empty-types/02-imported-inherited/output/module.graphql +++ b/packages/test-cases/cases/compose/004-empty-types/02-imported-inherited/output/module.graphql @@ -43,13 +43,13 @@ type Module { method2: ImportedDerivedType } -type BaseType +type BaseType { } -type DerivedType implements BaseType +type DerivedType implements BaseType { } -type ImportedDerivedType implements ImportedBaseType +type ImportedDerivedType implements ImportedBaseType { } -type ImportedBaseType +type ImportedBaseType { } ### Imported Modules START ### diff --git a/packages/test-cases/cases/compose/004-empty-types/02-imported-inherited/output/module.ts b/packages/test-cases/cases/compose/004-empty-types/02-imported-inherited/output/module.ts index f1695fe734..7e88fcc764 100644 --- a/packages/test-cases/cases/compose/004-empty-types/02-imported-inherited/output/module.ts +++ b/packages/test-cases/cases/compose/004-empty-types/02-imported-inherited/output/module.ts @@ -8,6 +8,7 @@ import { } from "@polywrap/schema-parse"; export const abi: WrapAbi = { + version: "0.1", objectTypes: [ { ...createObjectDefinition({ diff --git a/packages/test-cases/cases/compose/004-empty-types/03-external-import/imports-ext/external.eth/module.ts b/packages/test-cases/cases/compose/004-empty-types/03-external-import/imports-ext/external.eth/module.ts new file mode 100644 index 0000000000..cf2161498c --- /dev/null +++ b/packages/test-cases/cases/compose/004-empty-types/03-external-import/imports-ext/external.eth/module.ts @@ -0,0 +1,9 @@ +import { WrapAbi } from "@polywrap/schema-parse"; + +export const abi: WrapAbi = { + version: "0.1", + "moduleType": { + "type": "Module", + "kind": 128 + } +}; diff --git a/packages/test-cases/cases/compose/004-empty-types/03-external-import/imports-ext/external.eth/schema.graphql b/packages/test-cases/cases/compose/004-empty-types/03-external-import/imports-ext/external.eth/schema.graphql deleted file mode 100644 index 38deeb5b7e..0000000000 --- a/packages/test-cases/cases/compose/004-empty-types/03-external-import/imports-ext/external.eth/schema.graphql +++ /dev/null @@ -1,30 +0,0 @@ -### Polywrap Header START ### -scalar UInt -scalar UInt8 -scalar UInt16 -scalar UInt32 -scalar Int -scalar Int8 -scalar Int16 -scalar Int32 -scalar Bytes -scalar BigInt -scalar BigNumber -scalar JSON -scalar Map - -directive @imported( - uri: String! - namespace: String! - nativeType: String! -) on OBJECT | ENUM - -directive @imports( - types: [String!]! -) on OBJECT - -directive @env(required: Boolean!) on FIELD_DEFINITION - -### Polywrap Header END ### - -type Module diff --git a/packages/test-cases/cases/compose/004-empty-types/03-external-import/output/module.graphql b/packages/test-cases/cases/compose/004-empty-types/03-external-import/output/module.graphql index 19a1c9e5f6..1b14bbed88 100644 --- a/packages/test-cases/cases/compose/004-empty-types/03-external-import/output/module.graphql +++ b/packages/test-cases/cases/compose/004-empty-types/03-external-import/output/module.graphql @@ -41,7 +41,7 @@ type Module implements Namespace_Module @imports( types: [ "Namespace_Module" ] -) +) { } ### Imported Modules START ### @@ -49,7 +49,7 @@ type Namespace_Module @imported( uri: "external.eth", namespace: "Namespace", nativeType: "Module" -) +) { } ### Imported Modules END ### diff --git a/packages/test-cases/cases/compose/004-empty-types/03-external-import/output/module.ts b/packages/test-cases/cases/compose/004-empty-types/03-external-import/output/module.ts index be1b18df37..279d08529d 100644 --- a/packages/test-cases/cases/compose/004-empty-types/03-external-import/output/module.ts +++ b/packages/test-cases/cases/compose/004-empty-types/03-external-import/output/module.ts @@ -6,6 +6,7 @@ import { } from "@polywrap/schema-parse"; export const abi: WrapAbi = { + version: "0.1", moduleType: { ...createModuleDefinition({}), diff --git a/packages/test-cases/cases/compose/004-empty-types/04-external-import-inherited/imports-ext/base.eth/module.ts b/packages/test-cases/cases/compose/004-empty-types/04-external-import-inherited/imports-ext/base.eth/module.ts new file mode 100644 index 0000000000..9d09003fec --- /dev/null +++ b/packages/test-cases/cases/compose/004-empty-types/04-external-import-inherited/imports-ext/base.eth/module.ts @@ -0,0 +1,21 @@ +import { WrapAbi } from "@polywrap/schema-parse"; + +export const abi: WrapAbi = { + version: "0.1", + "objectTypes": [ + { + "type": "ImportedBaseType", + "kind": 1 + }, + { + "type": "ImportedDerivedType", + "kind": 1, + "interfaces": [ + { + "type": "ImportedBaseType", + "kind": 2048 + } + ] + } + ] +}; diff --git a/packages/test-cases/cases/compose/004-empty-types/04-external-import-inherited/imports-ext/base.eth/schema.graphql b/packages/test-cases/cases/compose/004-empty-types/04-external-import-inherited/imports-ext/base.eth/schema.graphql deleted file mode 100644 index f9df7fec1d..0000000000 --- a/packages/test-cases/cases/compose/004-empty-types/04-external-import-inherited/imports-ext/base.eth/schema.graphql +++ /dev/null @@ -1,32 +0,0 @@ -### Polywrap Header START ### -scalar UInt -scalar UInt8 -scalar UInt16 -scalar UInt32 -scalar Int -scalar Int8 -scalar Int16 -scalar Int32 -scalar Bytes -scalar BigInt -scalar BigNumber -scalar JSON -scalar Map - -directive @imported( - uri: String! - namespace: String! - nativeType: String! -) on OBJECT | ENUM - -directive @imports( - types: [String!]! -) on OBJECT - -directive @env(required: Boolean!) on FIELD_DEFINITION - -### Polywrap Header END ### - -type ImportedBaseType - -type ImportedDerivedType implements ImportedBaseType \ No newline at end of file diff --git a/packages/test-cases/cases/compose/004-empty-types/04-external-import-inherited/imports-ext/derived.eth/module.ts b/packages/test-cases/cases/compose/004-empty-types/04-external-import-inherited/imports-ext/derived.eth/module.ts new file mode 100644 index 0000000000..9d09003fec --- /dev/null +++ b/packages/test-cases/cases/compose/004-empty-types/04-external-import-inherited/imports-ext/derived.eth/module.ts @@ -0,0 +1,21 @@ +import { WrapAbi } from "@polywrap/schema-parse"; + +export const abi: WrapAbi = { + version: "0.1", + "objectTypes": [ + { + "type": "ImportedBaseType", + "kind": 1 + }, + { + "type": "ImportedDerivedType", + "kind": 1, + "interfaces": [ + { + "type": "ImportedBaseType", + "kind": 2048 + } + ] + } + ] +}; diff --git a/packages/test-cases/cases/compose/004-empty-types/04-external-import-inherited/imports-ext/derived.eth/schema.graphql b/packages/test-cases/cases/compose/004-empty-types/04-external-import-inherited/imports-ext/derived.eth/schema.graphql deleted file mode 100644 index f9df7fec1d..0000000000 --- a/packages/test-cases/cases/compose/004-empty-types/04-external-import-inherited/imports-ext/derived.eth/schema.graphql +++ /dev/null @@ -1,32 +0,0 @@ -### Polywrap Header START ### -scalar UInt -scalar UInt8 -scalar UInt16 -scalar UInt32 -scalar Int -scalar Int8 -scalar Int16 -scalar Int32 -scalar Bytes -scalar BigInt -scalar BigNumber -scalar JSON -scalar Map - -directive @imported( - uri: String! - namespace: String! - nativeType: String! -) on OBJECT | ENUM - -directive @imports( - types: [String!]! -) on OBJECT - -directive @env(required: Boolean!) on FIELD_DEFINITION - -### Polywrap Header END ### - -type ImportedBaseType - -type ImportedDerivedType implements ImportedBaseType \ No newline at end of file diff --git a/packages/test-cases/cases/compose/004-empty-types/04-external-import-inherited/output/module.graphql b/packages/test-cases/cases/compose/004-empty-types/04-external-import-inherited/output/module.graphql index 7c5f6090f9..38882757a3 100644 --- a/packages/test-cases/cases/compose/004-empty-types/04-external-import-inherited/output/module.graphql +++ b/packages/test-cases/cases/compose/004-empty-types/04-external-import-inherited/output/module.graphql @@ -49,7 +49,7 @@ type Module @imports( method2: CustomType } -type CustomType implements Base_ImportedBaseType +type CustomType implements Base_ImportedBaseType { } ### Imported Modules START ### @@ -61,19 +61,19 @@ type Base_ImportedBaseType @imported( uri: "base.eth", namespace: "Base", nativeType: "ImportedBaseType" -) +) { } type Derived_ImportedDerivedType implements Derived_ImportedBaseType @imported( uri: "derived.eth", namespace: "Derived", nativeType: "ImportedDerivedType" -) +) { } type Derived_ImportedBaseType @imported( uri: "derived.eth", namespace: "Derived", nativeType: "ImportedBaseType" -) +) { } ### Imported Objects END ### diff --git a/packages/test-cases/cases/compose/004-empty-types/04-external-import-inherited/output/module.ts b/packages/test-cases/cases/compose/004-empty-types/04-external-import-inherited/output/module.ts index e5f5d3503e..8120a5a334 100644 --- a/packages/test-cases/cases/compose/004-empty-types/04-external-import-inherited/output/module.ts +++ b/packages/test-cases/cases/compose/004-empty-types/04-external-import-inherited/output/module.ts @@ -9,6 +9,7 @@ import { } from "@polywrap/schema-parse"; export const abi: WrapAbi = { + version: "0.1", objectTypes: [ { ...createObjectDefinition({ diff --git a/packages/test-cases/cases/compose/005-map-types/00-sanity/output/module.ts b/packages/test-cases/cases/compose/005-map-types/00-sanity/output/module.ts index 69e060ca28..c7812a4a44 100644 --- a/packages/test-cases/cases/compose/005-map-types/00-sanity/output/module.ts +++ b/packages/test-cases/cases/compose/005-map-types/00-sanity/output/module.ts @@ -11,253 +11,224 @@ import { } from "@polywrap/schema-parse"; export const abi: WrapAbi = { + version: "0.1", objectTypes: [ - { - ...createObjectDefinition({ - type: "SimpleType", - }), + createObjectDefinition({ + type: "SimpleType", properties: [ - { - ...createMapPropertyDefinition({ + createMapPropertyDefinition({ + name: "requiredMap", + type: "Map", + key: createMapKeyDefinition({ name: "requiredMap", - type: "Map", - key: createMapKeyDefinition({ - name: "requiredMap", - type: "String", - required: true, - }), - value: createScalarDefinition({ - name: "requiredMap", + type: "String", + required: true, + }), + value: createScalarDefinition({ + name: "requiredMap", + type: "Int", + required: true, + }), + required: true, + }), + createMapPropertyDefinition({ + name: "optionalMap", + type: "Map", + key: createMapKeyDefinition({ + name: "optionalMap", + type: "String", + required: true, + }), + value: createScalarDefinition({ + name: "optionalMap", + type: "Int", + required: true, + }), + }), + createMapPropertyDefinition({ + name: "optionalValueMap", + type: "Map", + key: createMapKeyDefinition({ + name: "optionalValueMap", + type: "String", + required: true, + }), + value: createScalarDefinition({ + name: "optionalValueMap", + type: "Int", + }), + }), + createMapPropertyDefinition({ + name: "optionalKeyMap", + type: "Map", + key: createMapKeyDefinition({ + name: "optionalKeyMap", + type: "String", + required: true, + }), + value: createScalarDefinition({ + name: "optionalKeyMap", + type: "Int", + required: true, + }), + required: true, + }), + ], + }), + createObjectDefinition({ + type: "RecursiveType", + properties: [ + createMapPropertyDefinition({ + name: "mapOfValueArr", + type: "Map", + key: createMapKeyDefinition({ + name: "mapOfValueArr", + type: "String", + required: true, + }), + value: createArrayDefinition({ + name: "mapOfValueArr", + type: "[Int]", + item: createScalarDefinition({ + name: "mapOfValueArr", type: "Int", required: true, }), required: true, }), - }, - { - ...createMapPropertyDefinition({ - name: "optionalMap", + required: true, + }), + createMapPropertyDefinition({ + name: "mapOfMap", + type: "Map>", + key: createMapKeyDefinition({ + name: "mapOfMap", + type: "String", + required: true, + }), + value: createMapDefinition({ + name: "mapOfMap", type: "Map", key: createMapKeyDefinition({ - name: "optionalMap", + name: "mapOfMap", type: "String", required: true, }), value: createScalarDefinition({ - name: "optionalMap", + name: "mapOfMap", type: "Int", required: true, }), + required: true, }), - }, - { - ...createMapPropertyDefinition({ - name: "optionalValueMap", + required: true + }), + ], + }), + ], + moduleType: createModuleDefinition({ + methods: [ + createMethodDefinition({ + name: "requiredMapArgs", + return: createMapPropertyDefinition({ + name: "requiredMapArgs", + type: "Map", + key: createMapKeyDefinition({ + name: "requiredMapArgs", + type: "String", + required: true, + }), + value: createScalarDefinition({ + name: "requiredMapArgs", + type: "Int", + required: true, + }), + required: true, + }), + arguments: [ + createMapPropertyDefinition({ + name: "map", type: "Map", key: createMapKeyDefinition({ - name: "optionalValueMap", + name: "map", type: "String", required: true, }), value: createScalarDefinition({ - name: "optionalValueMap", + name: "map", type: "Int", + required: true, }), + required: true, }), - }, - { - ...createMapPropertyDefinition({ - name: "optionalKeyMap", + ], + }), + createMethodDefinition({ + name: "optionalMapArgs", + return: createMapPropertyDefinition({ + name: "optionalMapArgs", + type: "Map", + key: createMapKeyDefinition({ + name: "optionalMapArgs", + type: "String", + required: true, + }), + value: createScalarDefinition({ + name: "optionalMapArgs", + type: "Int", + required: true, + }), + }), + arguments: [ + createMapPropertyDefinition({ + name: "map", type: "Map", key: createMapKeyDefinition({ - name: "optionalKeyMap", + name: "map", type: "String", required: true, }), value: createScalarDefinition({ - name: "optionalKeyMap", + name: "map", type: "Int", required: true, }), - required: true, }), - }, - ], - }, - { - ...createObjectDefinition({ - type: "RecursiveType", + ], }), - properties: [ - { - ...createMapPropertyDefinition({ - name: "mapOfValueArr", - type: "Map", - key: createMapKeyDefinition({ - name: "mapOfValueArr", - type: "String", - required: true, - }), - value: createArrayDefinition({ - name: "mapOfValueArr", - type: "[Int]", - item: createScalarDefinition({ - name: "mapOfValueArr", - type: "Int", - required: true, - }), - required: true, - }), + createMethodDefinition({ + name: "optionalValueArgs", + return: createMapPropertyDefinition({ + name: "optionalValueArgs", + type: "Map", + key: createMapKeyDefinition({ + name: "optionalValueArgs", + type: "String", required: true, }), - }, - { - ...createMapPropertyDefinition({ - name: "mapOfMap", - type: "Map>", + value: createScalarDefinition({ + name: "optionalValueArgs", + type: "Int", + }), + required: true, + }), + arguments: [ + createMapPropertyDefinition({ + name: "map", + type: "Map", key: createMapKeyDefinition({ - name: "mapOfMap", + name: "map", type: "String", required: true, }), - value: createMapDefinition({ - name: "mapOfMap", - type: "Map", - key: createMapKeyDefinition({ - name: "mapOfMap", - type: "String", - required: true, - }), - value: createScalarDefinition({ - name: "mapOfMap", - type: "Int", - required: true, - }), - required: true, - }), - required: true - }), - }, - ], - }, - ], - moduleType: - { - ...createModuleDefinition({}), - methods: [ - { - ...createMethodDefinition({ - name: "requiredMapArgs", - return: createMapPropertyDefinition({ - name: "requiredMapArgs", - type: "Map", - key: createMapKeyDefinition({ - name: "requiredMapArgs", - type: "String", - required: true, - }), - value: createScalarDefinition({ - name: "requiredMapArgs", - type: "Int", - required: true, - }), - required: true, - }), - arguments: [ - { - ...createMapPropertyDefinition({ - name: "map", - type: "Map", - key: createMapKeyDefinition({ - name: "map", - type: "String", - required: true, - }), - value: createScalarDefinition({ - name: "map", - type: "Int", - required: true, - }), - required: true, - }), - }, - ], - }), - }, - { - ...createMethodDefinition({ - name: "optionalMapArgs", - return: createMapPropertyDefinition({ - name: "optionalMapArgs", - type: "Map", - key: createMapKeyDefinition({ - name: "optionalMapArgs", - type: "String", - required: true, - }), - value: createScalarDefinition({ - name: "optionalMapArgs", - type: "Int", - required: true, - }), - }), - arguments: [ - { - ...createMapPropertyDefinition({ - name: "map", - type: "Map", - key: createMapKeyDefinition({ - name: "map", - type: "String", - required: true, - }), - value: createScalarDefinition({ - name: "map", - type: "Int", - required: true, - }), - }), - }, - ], - }), - }, - { - ...createMethodDefinition({ - name: "optionalValueArgs", - return: createMapPropertyDefinition({ - name: "optionalValueArgs", - type: "Map", - key: createMapKeyDefinition({ - name: "optionalValueArgs", - type: "String", - required: true, - }), - value: createScalarDefinition({ - name: "optionalValueArgs", - type: "Int", - }), - required: true, + value: createScalarDefinition({ + name: "map", + type: "Int", }), - arguments: [ - { - ...createMapPropertyDefinition({ - name: "map", - type: "Map", - key: createMapKeyDefinition({ - name: "map", - type: "String", - required: true, - }), - value: createScalarDefinition({ - name: "map", - type: "Int", - }), - required: true, - }), - }, - ], + required: true, }), - }, - ], - }, + ], + }), + ], + }), }; diff --git a/packages/test-cases/cases/compose/005-map-types/01-inherited/output/module.ts b/packages/test-cases/cases/compose/005-map-types/01-inherited/output/module.ts index 277d1572b9..7a6b084173 100644 --- a/packages/test-cases/cases/compose/005-map-types/01-inherited/output/module.ts +++ b/packages/test-cases/cases/compose/005-map-types/01-inherited/output/module.ts @@ -12,6 +12,7 @@ import { } from "@polywrap/schema-parse"; export const abi: WrapAbi = { + version: "0.1", objectTypes: [ { ...createObjectDefinition({ diff --git a/packages/test-cases/cases/compose/005-map-types/02-imported-inherited/output/module.ts b/packages/test-cases/cases/compose/005-map-types/02-imported-inherited/output/module.ts index 154fdf332f..8d589e5d55 100644 --- a/packages/test-cases/cases/compose/005-map-types/02-imported-inherited/output/module.ts +++ b/packages/test-cases/cases/compose/005-map-types/02-imported-inherited/output/module.ts @@ -12,6 +12,7 @@ import { } from "@polywrap/schema-parse"; export const abi: WrapAbi = { + version: "0.1", objectTypes: [ { ...createObjectDefinition({ diff --git a/packages/test-cases/cases/compose/005-map-types/03-external-import/imports-ext/external.eth/module.ts b/packages/test-cases/cases/compose/005-map-types/03-external-import/imports-ext/external.eth/module.ts new file mode 100644 index 0000000000..bb2a3accd8 --- /dev/null +++ b/packages/test-cases/cases/compose/005-map-types/03-external-import/imports-ext/external.eth/module.ts @@ -0,0 +1,109 @@ +import { WrapAbi } from "@polywrap/schema-parse"; + +export const abi: WrapAbi = { + version: "0.1", + "moduleType": { + "type": "Module", + "kind": 128, + "methods": [ + { + "type": "Method", + "name": "getMap", + "required": true, + "kind": 64, + "return": { + "type": "Map", + "name": "getMap", + "required": true, + "kind": 34, + "map": { + "type": "Map", + "name": "getMap", + "required": true, + "kind": 262146, + "scalar": { + "type": "Int", + "name": "getMap", + "kind": 4 + }, + "key": { + "type": "String", + "name": "getMap", + "required": true, + "kind": 4 + }, + "value": { + "type": "Int", + "name": "getMap", + "kind": 4 + } + } + } + }, + { + "type": "Method", + "name": "updateMap", + "required": true, + "kind": 64, + "arguments": [ + { + "type": "Map", + "name": "map", + "required": true, + "kind": 34, + "map": { + "type": "Map", + "name": "map", + "required": true, + "kind": 262146, + "scalar": { + "type": "Int", + "name": "map", + "kind": 4 + }, + "key": { + "type": "String", + "name": "map", + "required": true, + "kind": 4 + }, + "value": { + "type": "Int", + "name": "map", + "kind": 4 + } + } + } + ], + "return": { + "type": "Map", + "name": "updateMap", + "required": true, + "kind": 34, + "map": { + "type": "Map", + "name": "updateMap", + "required": true, + "kind": 262146, + "scalar": { + "type": "Int", + "name": "updateMap", + "kind": 4 + }, + "key": { + "type": "String", + "name": "updateMap", + "required": true, + "kind": 4 + }, + "value": { + "type": "Int", + "name": "updateMap", + "kind": 4 + } + } + } + } + ] + } +}; diff --git a/packages/test-cases/cases/compose/005-map-types/03-external-import/imports-ext/external.eth/schema.graphql b/packages/test-cases/cases/compose/005-map-types/03-external-import/imports-ext/external.eth/schema.graphql deleted file mode 100644 index 87f7f07153..0000000000 --- a/packages/test-cases/cases/compose/005-map-types/03-external-import/imports-ext/external.eth/schema.graphql +++ /dev/null @@ -1,45 +0,0 @@ -### Polywrap Header START ### -scalar UInt -scalar UInt8 -scalar UInt16 -scalar UInt32 -scalar Int -scalar Int8 -scalar Int16 -scalar Int32 -scalar Bytes -scalar BigInt -scalar BigNumber -scalar JSON -scalar Map - -directive @imported( - uri: String! - namespace: String! - nativeType: String! -) on OBJECT | ENUM - -directive @imports( - types: [String!]! -) on OBJECT - -directive @capability( - type: String! - uri: String! - namespace: String! -) repeatable on OBJECT - -directive @enabled_interface on OBJECT - -directive @annotate(type: String!) on FIELD - -directive @env(required: Boolean!) on FIELD_DEFINITION - -### Polywrap Header END ### - -type Module { - getMap: Map! @annotate(type: "Map!") - updateMap( - map: Map! @annotate(type: "Map!") - ): Map! @annotate(type: "Map!") -} diff --git a/packages/test-cases/cases/compose/005-map-types/03-external-import/output/module.ts b/packages/test-cases/cases/compose/005-map-types/03-external-import/output/module.ts index d5eff57333..25c2b662ef 100644 --- a/packages/test-cases/cases/compose/005-map-types/03-external-import/output/module.ts +++ b/packages/test-cases/cases/compose/005-map-types/03-external-import/output/module.ts @@ -10,6 +10,7 @@ import { } from "@polywrap/schema-parse"; export const abi: WrapAbi = { + version: "0.1", moduleType: { ...createModuleDefinition({}), diff --git a/packages/test-cases/cases/compose/005-map-types/04-external-import-inherited/imports-ext/base.eth/module.ts b/packages/test-cases/cases/compose/005-map-types/04-external-import-inherited/imports-ext/base.eth/module.ts new file mode 100644 index 0000000000..5cb37201a9 --- /dev/null +++ b/packages/test-cases/cases/compose/005-map-types/04-external-import-inherited/imports-ext/base.eth/module.ts @@ -0,0 +1,140 @@ +import { WrapAbi } from "@polywrap/schema-parse"; + +export const abi: WrapAbi = { + version: "0.1", + objectTypes: [ + { + type: "ImportedBaseType", + kind: 1, + properties: [ + { + type: "Map", + name: "requiredMap", + required: true, + kind: 34, + map: { + type: "Map", + name: "requiredMap", + required: true, + kind: 262146, + scalar: { + type: "Int", + name: "requiredMap", + required: true, + kind: 4 + }, + key: { + type: "String", + name: "requiredMap", + required: true, + kind: 4 + }, + value: { + type: "Int", + name: "requiredMap", + required: true, + kind: 4 + } + } + } + ], + interfaces: [] + }, + { + type: "ImportedDerivedType", + kind: 1, + properties: [ + { + type: "Map", + name: "mapOfValueArr", + required: true, + kind: 34, + map: { + type: "Map", + name: "mapOfValueArr", + required: true, + kind: 262146, + array: { + type: "[Int]", + name: "mapOfValueArr", + required: true, + kind: 18, + scalar: { + type: "Int", + name: "mapOfValueArr", + required: true, + kind: 4 + }, + item: { + type: "Int", + name: "mapOfValueArr", + required: true, + kind: 4 + } + }, + key: { + type: "String", + name: "mapOfValueArr", + required: true, + kind: 4 + }, + value: { + type: "[Int]", + name: "mapOfValueArr", + required: true, + kind: 18, + scalar: { + type: "Int", + name: "mapOfValueArr", + required: true, + kind: 4 + }, + item: { + type: "Int", + name: "mapOfValueArr", + required: true, + kind: 4 + } + } + } + }, + { + type: "Map", + name: "requiredMap", + required: true, + kind: 34, + map: { + type: "Map", + name: "requiredMap", + required: true, + kind: 262146, + scalar: { + type: "Int", + name: "requiredMap", + required: true, + kind: 4 + }, + key: { + type: "String", + name: "requiredMap", + required: true, + kind: 4 + }, + value: { + type: "Int", + name: "requiredMap", + required: true, + kind: 4 + } + }, + } + ], + interfaces: [ + { + type: "ImportedBaseType", + kind: 2048 + } + ] + } + ] +}; diff --git a/packages/test-cases/cases/compose/005-map-types/04-external-import-inherited/imports-ext/base.eth/schema.graphql b/packages/test-cases/cases/compose/005-map-types/04-external-import-inherited/imports-ext/base.eth/schema.graphql deleted file mode 100644 index 45ba692294..0000000000 --- a/packages/test-cases/cases/compose/005-map-types/04-external-import-inherited/imports-ext/base.eth/schema.graphql +++ /dev/null @@ -1,37 +0,0 @@ -### Polywrap Header START ### -scalar UInt -scalar UInt8 -scalar UInt16 -scalar UInt32 -scalar Int -scalar Int8 -scalar Int16 -scalar Int32 -scalar Bytes -scalar BigInt -scalar BigNumber -scalar JSON -scalar Map - -directive @imported( - uri: String! - namespace: String! - nativeType: String! -) on OBJECT | ENUM - -directive @imports( - types: [String!]! -) on OBJECT - -directive @env(required: Boolean!) on FIELD_DEFINITION - -### Polywrap Header END ### - -type ImportedBaseType { - requiredMap: Map! @annotate(type: "Map!") -} - -type ImportedDerivedType implements ImportedBaseType { - mapOfValueArr: Map! @annotate(type: "Map!>!") - requiredMap: Map! @annotate(type: "Map!") -} \ No newline at end of file diff --git a/packages/test-cases/cases/compose/005-map-types/04-external-import-inherited/imports-ext/derived.eth/module.ts b/packages/test-cases/cases/compose/005-map-types/04-external-import-inherited/imports-ext/derived.eth/module.ts new file mode 100644 index 0000000000..8dfcfb475c --- /dev/null +++ b/packages/test-cases/cases/compose/005-map-types/04-external-import-inherited/imports-ext/derived.eth/module.ts @@ -0,0 +1,139 @@ +import { WrapAbi } from "@polywrap/schema-parse"; + +export const abi: WrapAbi = { + version: "0.1", + objectTypes: [ + { + type: "ImportedBaseType", + kind: 1, + properties: [ + { + type: "Map", + name: "requiredMap", + required: true, + kind: 34, + map: { + type: "Map", + name: "requiredMap", + required: true, + kind: 262146, + scalar: { + type: "Int", + name: "requiredMap", + required: true, + kind: 4 + }, + key: { + type: "String", + name: "requiredMap", + required: true, + kind: 4 + }, + value: { + type: "Int", + name: "requiredMap", + required: true, + kind: 4 + } + } + } + ] + }, + { + type: "ImportedDerivedType", + kind: 1, + properties: [ + { + type: "Map", + name: "mapOfValueArr", + required: true, + kind: 34, + map: { + type: "Map", + name: "mapOfValueArr", + required: true, + kind: 262146, + array: { + type: "[Int]", + name: "mapOfValueArr", + required: true, + kind: 18, + scalar: { + type: "Int", + name: "mapOfValueArr", + required: true, + kind: 4 + }, + item: { + type: "Int", + name: "mapOfValueArr", + required: true, + kind: 4 + } + }, + key: { + type: "String", + name: "mapOfValueArr", + required: true, + kind: 4 + }, + value: { + type: "[Int]", + name: "mapOfValueArr", + required: true, + kind: 18, + scalar: { + type: "Int", + name: "mapOfValueArr", + required: true, + kind: 4 + }, + item: { + type: "Int", + name: "mapOfValueArr", + required: true, + kind: 4 + } + } + } + }, + { + type: "Map", + name: "requiredMap", + required: true, + kind: 34, + map: { + type: "Map", + name: "requiredMap", + required: true, + kind: 262146, + scalar: { + type: "Int", + name: "requiredMap", + required: true, + kind: 4 + }, + key: { + type: "String", + name: "requiredMap", + required: true, + kind: 4 + }, + value: { + type: "Int", + name: "requiredMap", + required: true, + kind: 4 + } + } + } + ], + interfaces: [ + { + type: "ImportedBaseType", + kind: 2048 + } + ] + } + ] +}; diff --git a/packages/test-cases/cases/compose/005-map-types/04-external-import-inherited/imports-ext/derived.eth/schema.graphql b/packages/test-cases/cases/compose/005-map-types/04-external-import-inherited/imports-ext/derived.eth/schema.graphql deleted file mode 100644 index 45ba692294..0000000000 --- a/packages/test-cases/cases/compose/005-map-types/04-external-import-inherited/imports-ext/derived.eth/schema.graphql +++ /dev/null @@ -1,37 +0,0 @@ -### Polywrap Header START ### -scalar UInt -scalar UInt8 -scalar UInt16 -scalar UInt32 -scalar Int -scalar Int8 -scalar Int16 -scalar Int32 -scalar Bytes -scalar BigInt -scalar BigNumber -scalar JSON -scalar Map - -directive @imported( - uri: String! - namespace: String! - nativeType: String! -) on OBJECT | ENUM - -directive @imports( - types: [String!]! -) on OBJECT - -directive @env(required: Boolean!) on FIELD_DEFINITION - -### Polywrap Header END ### - -type ImportedBaseType { - requiredMap: Map! @annotate(type: "Map!") -} - -type ImportedDerivedType implements ImportedBaseType { - mapOfValueArr: Map! @annotate(type: "Map!>!") - requiredMap: Map! @annotate(type: "Map!") -} \ No newline at end of file diff --git a/packages/test-cases/cases/compose/005-map-types/04-external-import-inherited/output/module.ts b/packages/test-cases/cases/compose/005-map-types/04-external-import-inherited/output/module.ts index a0b4c81499..d699dc2a5c 100644 --- a/packages/test-cases/cases/compose/005-map-types/04-external-import-inherited/output/module.ts +++ b/packages/test-cases/cases/compose/005-map-types/04-external-import-inherited/output/module.ts @@ -13,6 +13,7 @@ import { } from "@polywrap/schema-parse"; export const abi: WrapAbi = { + version: "0.1", objectTypes: [ { ...createObjectDefinition({ diff --git a/packages/test-cases/cases/compose/006-env-types/00-sanity/output/module.ts b/packages/test-cases/cases/compose/006-env-types/00-sanity/output/module.ts index 3084b631a6..5528bfb807 100644 --- a/packages/test-cases/cases/compose/006-env-types/00-sanity/output/module.ts +++ b/packages/test-cases/cases/compose/006-env-types/00-sanity/output/module.ts @@ -7,6 +7,7 @@ import { } from "@polywrap/schema-parse"; export const abi: WrapAbi = { + version: "0.1", envType: createEnvDefinition({ properties: [ createScalarPropertyDefinition({ name: "prop", type: "String", required: true }), diff --git a/packages/test-cases/cases/compose/sanity/imports-ext/just.module.eth/module.ts b/packages/test-cases/cases/compose/sanity/imports-ext/just.module.eth/module.ts new file mode 100644 index 0000000000..37066bca30 --- /dev/null +++ b/packages/test-cases/cases/compose/sanity/imports-ext/just.module.eth/module.ts @@ -0,0 +1,67 @@ +import { WrapAbi } from "@polywrap/schema-parse"; + +export const abi: WrapAbi = { + version: "0.1", + moduleType: { + type: "Module", + kind: 128, + methods: [ + { + type: "Method", + name: "method", + required: true, + kind: 64, + arguments: [ + { + type: "[String]", + name: "arg", + required: true, + kind: 34, + array: { + type: "[String]", + name: "arg", + required: true, + kind: 18, + scalar: { + type: "String", + name: "arg", + required: true, + kind: 4 + }, + item: { + type: "String", + name: "arg", + required: true, + kind: 4 + } + } + } + ], + return: { + type: "[Int32]", + name: "method", + required: true, + kind: 34, + array: { + type: "[Int32]", + name: "method", + required: true, + kind: 18, + scalar: { + type: "Int32", + name: "method", + required: true, + kind: 4 + }, + item: { + type: "Int32", + name: "method", + required: true, + kind: 4 + } + } + } + } + ] + } +} \ No newline at end of file diff --git a/packages/test-cases/cases/compose/sanity/imports-ext/just.module.eth/schema.graphql b/packages/test-cases/cases/compose/sanity/imports-ext/just.module.eth/schema.graphql deleted file mode 100644 index 0027b34bd2..0000000000 --- a/packages/test-cases/cases/compose/sanity/imports-ext/just.module.eth/schema.graphql +++ /dev/null @@ -1,44 +0,0 @@ -### Polywrap Header START ### -scalar UInt -scalar UInt8 -scalar UInt16 -scalar UInt32 -scalar Int -scalar Int8 -scalar Int16 -scalar Int32 -scalar Bytes -scalar BigInt -scalar BigNumber -scalar JSON -scalar Map - -directive @imported( - uri: String! - namespace: String! - nativeType: String! -) on OBJECT | ENUM - -directive @imports( - types: [String!]! -) on OBJECT - -directive @capability( - type: String! - uri: String! - namespace: String! -) repeatable on OBJECT - -directive @enabled_interface on OBJECT - -directive @annotate(type: String!) on FIELD - -directive @env(required: Boolean!) on FIELD_DEFINITION - -### Polywrap Header END ### - -type Module { - method( - arg: [String!]! - ): [Int32!]! -} diff --git a/packages/test-cases/cases/compose/sanity/imports-ext/test-interface.eth/module.ts b/packages/test-cases/cases/compose/sanity/imports-ext/test-interface.eth/module.ts new file mode 100644 index 0000000000..4da16fcd1c --- /dev/null +++ b/packages/test-cases/cases/compose/sanity/imports-ext/test-interface.eth/module.ts @@ -0,0 +1,209 @@ +import { WrapAbi } from "@polywrap/schema-parse"; + +export const abi: WrapAbi = { + version: "0.1", + objectTypes: [ + { + type: "ModuleInterfaceArgument", + kind: 1, + properties: [ + { + type: "String", + name: "str", + required: true, + kind: 34, + scalar: { + type: "String", + name: "str", + required: true, + kind: 4 + } + }, + { + type: "UInt8", + name: "uint8", + required: true, + kind: 34, + scalar: { + type: "UInt8", + name: "uint8", + required: true, + kind: 4 + }, + comment: "uint8 comment" + } + ], + interfaces: [ + { + type: "NestedModuleInterfaceArgument", + kind: 2048 + } + ], + comment: "ModuleInterfaceArgument comment" + }, + { + type: "NestedModuleInterfaceArgument", + kind: 1, + properties: [ + { + type: "UInt8", + name: "uint8", + required: true, + kind: 34, + scalar: { + type: "UInt8", + name: "uint8", + required: true, + kind: 4 + } + } + ], + comment: "NestedModuleInterfaceArgument comment" + }, + { + type: "InterfaceObject1", + kind: 1, + properties: [ + { + type: "String", + name: "str", + required: true, + kind: 34, + scalar: { + type: "String", + name: "str", + required: true, + kind: 4 + } + }, + { + type: "UInt8", + name: "uint8", + required: true, + kind: 34, + scalar: { + type: "UInt8", + name: "uint8", + required: true, + kind: 4 + }, + comment: "InterfaceObject1_uint8 comment" + } + ], + comment: "InterfaceObject1 comment" + }, + { + type: "InterfaceObject2", + kind: 1, + properties: [ + { + type: "String", + name: "str2", + required: true, + kind: 34, + scalar: { + type: "String", + name: "str2", + required: true, + kind: 4 + } + }, + { + type: "Object", + name: "object", + kind: 34, + object: { + type: "Object", + name: "object", + kind: 8192 + } + } + ], + interfaces: [ + { + type: "NestedInterfaceObject", + kind: 2048 + } + ], + comment: "InterfaceObject2 comment" + }, + { + type: "NestedInterfaceObject", + kind: 1, + properties: [ + { + type: "Object", + name: "object", + kind: 34, + object: { + type: "Object", + name: "object", + kind: 8192 + }, + comment: "object comment" + } + ], + comment: "NestedInterfaceObject comment" + }, + { + type: "Object", + kind: 1, + properties: [ + { + type: "UInt8", + name: "uint8", + required: true, + kind: 34, + scalar: { + type: "UInt8", + name: "uint8", + required: true, + kind: 4 + } + } + ], + comment: "Object comment" + } + ], + moduleType: { + type: "Module", + kind: 128, + methods: [ + { + type: "Method", + name: "abstractModuleMethod", + required: true, + kind: 64, + arguments: [ + { + type: "ModuleInterfaceArgument", + name: "arg", + required: true, + kind: 34, + object: { + type: "ModuleInterfaceArgument", + name: "arg", + required: true, + kind: 8192 + }, + comment: "arg comment" + } + ], + return: { + type: "InterfaceObject2", + name: "abstractModuleMethod", + required: true, + kind: 34, + object: { + type: "InterfaceObject2", + name: "abstractModuleMethod", + required: true, + kind: 8192 + } + }, + comment: "abstractModuleMethod comment" + } + ], + comment: "Module comment" + } +}; diff --git a/packages/test-cases/cases/compose/sanity/imports-ext/test-interface.eth/schema.graphql b/packages/test-cases/cases/compose/sanity/imports-ext/test-interface.eth/schema.graphql deleted file mode 100644 index 9af03354e6..0000000000 --- a/packages/test-cases/cases/compose/sanity/imports-ext/test-interface.eth/schema.graphql +++ /dev/null @@ -1,107 +0,0 @@ -### Polywrap Header START ### -scalar UInt -scalar UInt8 -scalar UInt16 -scalar UInt32 -scalar Int -scalar Int8 -scalar Int16 -scalar Int32 -scalar Bytes -scalar BigInt -scalar BigNumber -scalar JSON -scalar Map - -directive @imported( - uri: String! - namespace: String! - nativeType: String! -) on OBJECT | ENUM - -directive @imports( - types: [String!]! -) on OBJECT - -directive @capability( - type: String! - uri: String! - namespace: String! -) repeatable on OBJECT - -directive @enabled_interface on OBJECT - -directive @annotate(type: String!) on FIELD - -directive @env(required: Boolean!) on FIELD_DEFINITION - -### Polywrap Header END ### - -""" -Module comment -""" -type Module { -""" -abstractModuleMethod comment -""" - abstractModuleMethod( -""" -arg comment -""" - arg: ModuleInterfaceArgument! - ): InterfaceObject2! -} - -""" -ModuleInterfaceArgument comment -""" -type ModuleInterfaceArgument implements NestedModuleInterfaceArgument { - str: String! -""" -uint8 comment -""" - uint8: UInt8! -} - -""" -NestedModuleInterfaceArgument comment -""" -type NestedModuleInterfaceArgument { - uint8: UInt8! -} - -""" -InterfaceObject1 comment -""" -type InterfaceObject1 { - str: String! -""" -InterfaceObject1_uint8 comment -""" - uint8: UInt8! -} - -""" -InterfaceObject2 comment -""" -type InterfaceObject2 implements NestedInterfaceObject { - str2: String! - object: Object -} - -""" -NestedInterfaceObject comment -""" -type NestedInterfaceObject { -""" -object comment -""" - object: Object -} - -""" -Object comment -""" -type Object { - uint8: UInt8! -} \ No newline at end of file diff --git a/packages/test-cases/cases/compose/sanity/imports-ext/test.eth/module.ts b/packages/test-cases/cases/compose/sanity/imports-ext/test.eth/module.ts new file mode 100644 index 0000000000..73761bdb04 --- /dev/null +++ b/packages/test-cases/cases/compose/sanity/imports-ext/test.eth/module.ts @@ -0,0 +1,1133 @@ +import { WrapAbi } from "@polywrap/schema-parse"; + +export const abi: WrapAbi = { + version: "0.1", + objectTypes: [ + { + type: "CustomType", + kind: 1, + properties: [ + { + type: "String", + name: "str", + required: true, + kind: 34, + scalar: { + type: "String", + name: "str", + required: true, + kind: 4 + } + }, + { + type: "String", + name: "optStr", + kind: 34, + scalar: { + type: "String", + name: "optStr", + kind: 4 + } + }, + { + type: "UInt", + name: "u", + required: true, + kind: 34, + scalar: { + type: "UInt", + name: "u", + required: true, + kind: 4 + } + }, + { + type: "UInt", + name: "optU", + kind: 34, + scalar: { + type: "UInt", + name: "optU", + kind: 4 + } + }, + { + type: "UInt8", + name: "u8", + required: true, + kind: 34, + scalar: { + type: "UInt8", + name: "u8", + required: true, + kind: 4 + } + }, + { + type: "UInt16", + name: "u16", + required: true, + kind: 34, + scalar: { + type: "UInt16", + name: "u16", + required: true, + kind: 4 + } + }, + { + type: "UInt32", + name: "u32", + required: true, + kind: 34, + scalar: { + type: "UInt32", + name: "u32", + required: true, + kind: 4 + } + }, + { + type: "Int", + name: "i", + required: true, + kind: 34, + scalar: { + type: "Int", + name: "i", + required: true, + kind: 4 + } + }, + { + type: "Int8", + name: "i8", + required: true, + kind: 34, + scalar: { + type: "Int8", + name: "i8", + required: true, + kind: 4 + } + }, + { + type: "Int16", + name: "i16", + required: true, + kind: 34, + scalar: { + type: "Int16", + name: "i16", + required: true, + kind: 4 + } + }, + { + type: "Int32", + name: "i32", + required: true, + kind: 34, + scalar: { + type: "Int32", + name: "i32", + required: true, + kind: 4 + } + }, + { + type: "Bytes", + name: "bytes", + required: true, + kind: 34, + scalar: { + type: "Bytes", + name: "bytes", + required: true, + kind: 4 + } + }, + { + type: "[UInt]", + name: "uArray", + required: true, + kind: 34, + array: { + type: "[UInt]", + name: "uArray", + required: true, + kind: 18, + scalar: { + type: "UInt", + name: "uArray", + required: true, + kind: 4 + }, + item: { + type: "UInt", + name: "uArray", + required: true, + kind: 4 + } + } + }, + { + type: "[UInt]", + name: "uOptArray", + kind: 34, + array: { + type: "[UInt]", + name: "uOptArray", + kind: 18, + scalar: { + type: "UInt", + name: "uOptArray", + required: true, + kind: 4 + }, + item: { + type: "UInt", + name: "uOptArray", + required: true, + kind: 4 + } + } + }, + { + type: "[UInt]", + name: "optUOptArray", + kind: 34, + array: { + type: "[UInt]", + name: "optUOptArray", + kind: 18, + scalar: { + type: "UInt", + name: "optUOptArray", + kind: 4 + }, + item: { + type: "UInt", + name: "optUOptArray", + kind: 4 + } + } + }, + { + type: "[String]", + name: "optStrOptArray", + kind: 34, + array: { + type: "[String]", + name: "optStrOptArray", + kind: 18, + scalar: { + type: "String", + name: "optStrOptArray", + kind: 4 + }, + item: { + type: "String", + name: "optStrOptArray", + kind: 4 + } + } + }, + { + type: "[[UInt]]", + name: "uArrayArray", + required: true, + kind: 34, + array: { + type: "[[UInt]]", + name: "uArrayArray", + required: true, + kind: 18, + array: { + type: "[UInt]", + name: "uArrayArray", + required: true, + kind: 18, + scalar: { + type: "UInt", + name: "uArrayArray", + required: true, + kind: 4 + }, + item: { + type: "UInt", + name: "uArrayArray", + required: true, + kind: 4 + } + }, + item: { + type: "[UInt]", + name: "uArrayArray", + required: true, + kind: 18, + scalar: { + type: "UInt", + name: "uArrayArray", + required: true, + kind: 4 + }, + item: { + type: "UInt", + name: "uArrayArray", + required: true, + kind: 4 + } + } + } + }, + { + type: "[[UInt32]]", + name: "uOptArrayOptArray", + required: true, + kind: 34, + array: { + type: "[[UInt32]]", + name: "uOptArrayOptArray", + required: true, + kind: 18, + array: { + type: "[UInt32]", + name: "uOptArrayOptArray", + kind: 18, + scalar: { + type: "UInt32", + name: "uOptArrayOptArray", + kind: 4 + }, + item: { + type: "UInt32", + name: "uOptArrayOptArray", + kind: 4 + } + }, + item: { + type: "[UInt32]", + name: "uOptArrayOptArray", + kind: 18, + scalar: { + type: "UInt32", + name: "uOptArrayOptArray", + kind: 4 + }, + item: { + type: "UInt32", + name: "uOptArrayOptArray", + kind: 4 + } + } + } + }, + { + type: "[[[UInt32]]]", + name: "uArrayOptArrayArray", + required: true, + kind: 34, + array: { + type: "[[[UInt32]]]", + name: "uArrayOptArrayArray", + required: true, + kind: 18, + array: { + type: "[[UInt32]]", + name: "uArrayOptArrayArray", + kind: 18, + array: { + type: "[UInt32]", + name: "uArrayOptArrayArray", + required: true, + kind: 18, + scalar: { + type: "UInt32", + name: "uArrayOptArrayArray", + required: true, + kind: 4 + }, + item: { + type: "UInt32", + name: "uArrayOptArrayArray", + required: true, + kind: 4 + } + }, + item: { + type: "[UInt32]", + name: "uArrayOptArrayArray", + required: true, + kind: 18, + scalar: { + type: "UInt32", + name: "uArrayOptArrayArray", + required: true, + kind: 4 + }, + item: { + type: "UInt32", + name: "uArrayOptArrayArray", + required: true, + kind: 4 + } + } + }, + item: { + type: "[[UInt32]]", + name: "uArrayOptArrayArray", + kind: 18, + array: { + type: "[UInt32]", + name: "uArrayOptArrayArray", + required: true, + kind: 18, + scalar: { + type: "UInt32", + name: "uArrayOptArrayArray", + required: true, + kind: 4 + }, + item: { + type: "UInt32", + name: "uArrayOptArrayArray", + required: true, + kind: 4 + } + }, + item: { + type: "[UInt32]", + name: "uArrayOptArrayArray", + required: true, + kind: 18, + scalar: { + type: "UInt32", + name: "uArrayOptArrayArray", + required: true, + kind: 4 + }, + item: { + type: "UInt32", + name: "uArrayOptArrayArray", + required: true, + kind: 4 + } + } + } + } + }, + { + type: "[[[[UInt32]]]]", + name: "crazyArray", + kind: 34, + array: { + type: "[[[[UInt32]]]]", + name: "crazyArray", + kind: 18, + array: { + type: "[[[UInt32]]]", + name: "crazyArray", + kind: 18, + array: { + type: "[[UInt32]]", + name: "crazyArray", + required: true, + kind: 18, + array: { + type: "[UInt32]", + name: "crazyArray", + kind: 18, + scalar: { + type: "UInt32", + name: "crazyArray", + required: true, + kind: 4 + }, + item: { + type: "UInt32", + name: "crazyArray", + required: true, + kind: 4 + } + }, + item: { + type: "[UInt32]", + name: "crazyArray", + kind: 18, + scalar: { + type: "UInt32", + name: "crazyArray", + required: true, + kind: 4 + }, + item: { + type: "UInt32", + name: "crazyArray", + required: true, + kind: 4 + } + } + }, + item: { + type: "[[UInt32]]", + name: "crazyArray", + required: true, + kind: 18, + array: { + type: "[UInt32]", + name: "crazyArray", + kind: 18, + scalar: { + type: "UInt32", + name: "crazyArray", + required: true, + kind: 4 + }, + item: { + type: "UInt32", + name: "crazyArray", + required: true, + kind: 4 + } + }, + item: { + type: "[UInt32]", + name: "crazyArray", + kind: 18, + scalar: { + type: "UInt32", + name: "crazyArray", + required: true, + kind: 4 + }, + item: { + type: "UInt32", + name: "crazyArray", + required: true, + kind: 4 + } + } + } + }, + item: { + type: "[[[UInt32]]]", + name: "crazyArray", + kind: 18, + array: { + type: "[[UInt32]]", + name: "crazyArray", + required: true, + kind: 18, + array: { + type: "[UInt32]", + name: "crazyArray", + kind: 18, + scalar: { + type: "UInt32", + name: "crazyArray", + required: true, + kind: 4 + }, + item: { + type: "UInt32", + name: "crazyArray", + required: true, + kind: 4 + } + }, + item: { + type: "[UInt32]", + name: "crazyArray", + kind: 18, + scalar: { + type: "UInt32", + name: "crazyArray", + required: true, + kind: 4 + }, + item: { + type: "UInt32", + name: "crazyArray", + required: true, + kind: 4 + } + } + }, + item: { + type: "[[UInt32]]", + name: "crazyArray", + required: true, + kind: 18, + array: { + type: "[UInt32]", + name: "crazyArray", + kind: 18, + scalar: { + type: "UInt32", + name: "crazyArray", + required: true, + kind: 4 + }, + item: { + type: "UInt32", + name: "crazyArray", + required: true, + kind: 4 + } + }, + item: { + type: "[UInt32]", + name: "crazyArray", + kind: 18, + scalar: { + type: "UInt32", + name: "crazyArray", + required: true, + kind: 4 + }, + item: { + type: "UInt32", + name: "crazyArray", + required: true, + kind: 4 + } + } + } + } + } + }, + { + type: "ObjectType", + name: "object", + required: true, + kind: 34, + object: { + type: "ObjectType", + name: "object", + required: true, + kind: 8192 + } + }, + { + type: "ObjectType", + name: "optObject", + kind: 34, + object: { + type: "ObjectType", + name: "optObject", + kind: 8192 + } + }, + { + type: "NestedObjectType", + name: "nestedObject", + required: true, + kind: 34, + object: { + type: "NestedObjectType", + name: "nestedObject", + required: true, + kind: 8192 + } + }, + { + type: "NestedObjectType", + name: "optNestedObject", + kind: 34, + object: { + type: "NestedObjectType", + name: "optNestedObject", + kind: 8192 + } + }, + { + type: "[NestedObjectType]", + name: "optNestedObjectArray", + required: true, + kind: 34, + array: { + type: "[NestedObjectType]", + name: "optNestedObjectArray", + required: true, + kind: 18, + object: { + type: "NestedObjectType", + name: "optNestedObjectArray", + kind: 8192 + }, + item: { + type: "NestedObjectType", + name: "optNestedObjectArray", + kind: 8192 + } + } + }, + { + type: "Imported_NestedObjectType", + name: "importedNestedObject", + required: true, + kind: 34, + object: { + type: "Imported_NestedObjectType", + name: "importedNestedObject", + required: true, + kind: 8192 + } + }, + { + type: "[Imported_NestedObjectType]", + name: "optImportedNestedObjectArray", + required: true, + kind: 34, + array: { + type: "[Imported_NestedObjectType]", + name: "optImportedNestedObjectArray", + required: true, + kind: 18, + object: { + type: "Imported_NestedObjectType", + name: "optImportedNestedObjectArray", + kind: 8192 + }, + item: { + type: "Imported_NestedObjectType", + name: "optImportedNestedObjectArray", + kind: 8192 + } + } + }, + { + type: "CustomEnum", + name: "enum", + required: true, + kind: 34, + enum: { + type: "CustomEnum", + name: "enum", + required: true, + kind: 16384 + } + }, + { + type: "CustomEnum", + name: "optEnum", + kind: 34, + enum: { + type: "CustomEnum", + name: "optEnum", + kind: 16384 + } + }, + { + type: "Imported_Enum", + name: "importedEnum", + required: true, + kind: 34, + enum: { + type: "Imported_Enum", + name: "importedEnum", + required: true, + kind: 16384 + } + }, + { + type: "Imported_Enum", + name: "optImportedEnum", + kind: 34, + enum: { + type: "Imported_Enum", + name: "optImportedEnum", + kind: 16384 + }, + comment: "optImportedEnum comment" + } + ], + comment: "CustomType comment" + }, + { + type: "NestedObjectType", + kind: 1, + properties: [ + { + type: "ObjectType", + name: "nestedObject", + required: true, + kind: 34, + object: { + type: "ObjectType", + name: "nestedObject", + required: true, + kind: 8192 + } + } + ] + }, + { + type: "ObjectType", + kind: 1, + properties: [ + { + type: "String", + name: "prop", + required: true, + kind: 34, + scalar: { + type: "String", + name: "prop", + required: true, + kind: 4 + } + } + ] + } + ], + enumTypes: [ + { + type: "CustomEnum", + kind: 8, + constants: [ + "STRING", + "BYTES" + ] + } + ], + importedObjectTypes: [ + { + type: "Imported_NestedObjectType", + kind: 1025, + properties: [ + { + type: "Imported_ObjectType", + name: "nestedObject", + required: true, + kind: 34, + object: { + type: "Imported_ObjectType", + name: "nestedObject", + required: true, + kind: 8192 + } + } + ], + comment: "Imported_NestedObjectType comment", + uri: "imported.eth", + namespace: "Imported", + nativeType: "NestedObjectType" + }, + { + type: "Imported_ObjectType", + kind: 1025, + properties: [ + { + type: "String", + name: "prop", + required: true, + kind: 34, + scalar: { + type: "String", + name: "prop", + required: true, + kind: 4 + } + } + ], + uri: "imported.eth", + namespace: "Imported", + nativeType: "ObjectType" + } + ], + importedEnumTypes: [ + { + type: "Imported_Enum", + kind: 520, + constants: [ + "STRING", + "BYTES" + ], + comment: "Imported_Enum comment", + uri: "imported.eth", + namespace: "Imported", + nativeType: "ImportedEnum" + } + ], + moduleType: { + type: "Module", + kind: 128, + methods: [ + { + type: "Method", + name: "method1", + required: true, + kind: 64, + arguments: [ + { + type: "String", + name: "str", + required: true, + kind: 34, + scalar: { + type: "String", + name: "str", + required: true, + kind: 4 + } + }, + { + type: "String", + name: "optStr", + kind: 34, + scalar: { + type: "String", + name: "optStr", + kind: 4 + } + }, + { + type: "UInt", + name: "u", + required: true, + kind: 34, + scalar: { + type: "UInt", + name: "u", + required: true, + kind: 4 + } + }, + { + type: "UInt", + name: "optU", + kind: 34, + scalar: { + type: "UInt", + name: "optU", + kind: 4 + } + }, + { + type: "[[UInt]]", + name: "uArrayArray", + required: true, + kind: 34, + array: { + type: "[[UInt]]", + name: "uArrayArray", + required: true, + kind: 18, + array: { + type: "[UInt]", + name: "uArrayArray", + kind: 18, + scalar: { + type: "UInt", + name: "uArrayArray", + kind: 4 + }, + item: { + type: "UInt", + name: "uArrayArray", + kind: 4 + } + }, + item: { + type: "[UInt]", + name: "uArrayArray", + kind: 18, + scalar: { + type: "UInt", + name: "uArrayArray", + kind: 4 + }, + item: { + type: "UInt", + name: "uArrayArray", + kind: 4 + } + } + } + } + ], + return: { + type: "String", + name: "method1", + required: true, + kind: 34, + scalar: { + type: "String", + name: "method1", + required: true, + kind: 4 + } + } + }, + { + type: "Method", + name: "method2", + required: true, + kind: 64, + arguments: [ + { + type: "[String]", + name: "arg", + required: true, + kind: 34, + array: { + type: "[String]", + name: "arg", + required: true, + kind: 18, + scalar: { + type: "String", + name: "arg", + required: true, + kind: 4 + }, + item: { + type: "String", + name: "arg", + required: true, + kind: 4 + } + }, + comment: "arg comment" + } + ], + return: { + type: "[Int32]", + name: "method2", + required: true, + kind: 34, + array: { + type: "[Int32]", + name: "method2", + required: true, + kind: 18, + scalar: { + type: "Int32", + name: "method2", + required: true, + kind: 4 + }, + item: { + type: "Int32", + name: "method2", + required: true, + kind: 4 + } + } + }, + comment: "method2 comment" + }, + { + type: "Method", + name: "localObjects", + required: true, + kind: 64, + arguments: [ + { + type: "NestedObjectType", + name: "nestedLocalObject", + kind: 34, + object: { + type: "NestedObjectType", + name: "nestedLocalObject", + kind: 8192 + }, + }, + { + type: "[NestedObjectType]", + name: "localObjectArray", + kind: 34, + array: { + type: "[NestedObjectType]", + name: "localObjectArray", + kind: 18, + object: { + type: "NestedObjectType", + name: "localObjectArray", + required: true, + kind: 8192 + }, + item: { + type: "NestedObjectType", + name: "localObjectArray", + required: true, + kind: 8192 + } + } + } + ], + return: { + type: "NestedObjectType", + name: "localObjects", + kind: 34, + object: { + type: "NestedObjectType", + name: "localObjects", + kind: 8192 + } + } + }, + { + type: "Method", + name: "importedObjects", + required: true, + kind: 64, + arguments: [ + { + type: "Imported_NestedObjectType", + name: "nestedLocalObject", + kind: 34, + object: { + type: "Imported_NestedObjectType", + name: "nestedLocalObject", + kind: 8192 + } + }, + { + type: "[Imported_NestedObjectType]", + name: "localObjectArray", + kind: 34, + array: { + type: "[Imported_NestedObjectType]", + name: "localObjectArray", + kind: 18, + object: { + type: "Imported_NestedObjectType", + name: "localObjectArray", + required: true, + kind: 8192 + }, + item: { + type: "Imported_NestedObjectType", + name: "localObjectArray", + required: true, + kind: 8192 + } + } + } + ], + return: { + type: "Imported_NestedObjectType", + name: "importedObjects", + kind: 34, + object: { + type: "Imported_NestedObjectType", + name: "importedObjects", + kind: 8192 + } + } + } + ], + imports: [ + { + type: "Imported_NestedObjectType" + }, + { + type: "Imported_ObjectType" + } + ], + comment: "Module comment" + } +}; diff --git a/packages/test-cases/cases/compose/sanity/imports-ext/test.eth/schema.graphql b/packages/test-cases/cases/compose/sanity/imports-ext/test.eth/schema.graphql deleted file mode 100644 index 1227024452..0000000000 --- a/packages/test-cases/cases/compose/sanity/imports-ext/test.eth/schema.graphql +++ /dev/null @@ -1,160 +0,0 @@ -### Polywrap Header START ### -scalar UInt -scalar UInt8 -scalar UInt16 -scalar UInt32 -scalar Int -scalar Int8 -scalar Int16 -scalar Int32 -scalar Bytes -scalar BigInt -scalar BigNumber -scalar JSON -scalar Map - -directive @imported( - uri: String! - namespace: String! - nativeType: String! -) on OBJECT | ENUM - -directive @imports( - types: [String!]! -) on OBJECT - -directive @capability( - type: String! - uri: String! - namespace: String! -) repeatable on OBJECT - -directive @enabled_interface on OBJECT - -directive @annotate(type: String!) on FIELD - -directive @env(required: Boolean!) on FIELD_DEFINITION - -### Polywrap Header END ### - -enum CustomEnum { - STRING - BYTES -} - -""" -Module comment -""" -type Module @imports( - types: [ - "Imported_NestedObjectType", - "Imported_ObjectType" - ] -) { - method1( - str: String! - optStr: String - u: UInt! - optU: UInt - uArrayArray: [[UInt]]! - ): String! - -""" -method2 comment -""" - method2( -""" -arg comment -""" - arg: [String!]! - ): [Int32!]! - - localObjects( - nestedLocalObject: NestedObjectType - localObjectArray: [NestedObjectType!] - ): NestedObjectType - - importedObjects( - nestedLocalObject: Imported_NestedObjectType - localObjectArray: [Imported_NestedObjectType!] - ): Imported_NestedObjectType -} - -""" -CustomType comment -""" -type CustomType { - str: String! - optStr: String - u: UInt! - optU: UInt - u8: UInt8! - u16: UInt16! - u32: UInt32! - i: Int! - i8: Int8! - i16: Int16! - i32: Int32! - bytes: Bytes! - uArray: [UInt!]! - uOptArray: [UInt!] - optUOptArray: [UInt] - optStrOptArray: [String] - uArrayArray: [[UInt!]!]! - uOptArrayOptArray: [[UInt32]]! - uArrayOptArrayArray: [[[UInt32!]!]]! - crazyArray: [[[[UInt32!]]!]] - object: ObjectType! - optObject: ObjectType - nestedObject: NestedObjectType! - optNestedObject: NestedObjectType - optNestedObjectArray: [NestedObjectType]! - importedNestedObject: Imported_NestedObjectType! - optImportedNestedObjectArray: [Imported_NestedObjectType]! - enum: CustomEnum! - optEnum: CustomEnum - importedEnum: Imported_Enum! -""" -optImportedEnum comment -""" - optImportedEnum: Imported_Enum -} - -type NestedObjectType { - nestedObject: ObjectType! -} - -type ObjectType { - prop: String! -} - -""" -Imported_NestedObjectType comment -""" -type Imported_NestedObjectType @imported( - uri: "imported.eth", - namespace: "Imported", - nativeType: "NestedObjectType" -) { - nestedObject: Imported_ObjectType! -} - -type Imported_ObjectType @imported( - uri: "imported.eth", - namespace: "Imported", - nativeType: "ObjectType" -) { - prop: String! -} - -""" -Imported_Enum comment -""" -enum Imported_Enum @imported( - namespace: "Imported", - uri: "imported.eth", - nativeType: "ImportedEnum" -) { - STRING - BYTES -} diff --git a/packages/test-cases/cases/compose/sanity/output/module.ts b/packages/test-cases/cases/compose/sanity/output/module.ts index 03489d0589..ea5605be51 100644 --- a/packages/test-cases/cases/compose/sanity/output/module.ts +++ b/packages/test-cases/cases/compose/sanity/output/module.ts @@ -21,6 +21,7 @@ import { } from "@polywrap/schema-parse"; export const abi: WrapAbi = { + version: "0.1", envType: createEnvDefinition({ properties: [ createScalarPropertyDefinition({ @@ -42,8 +43,8 @@ export const abi: WrapAbi = { }, }), ], - moduleType: { - ...createModuleDefinition({ comment: "Module comment" }), + moduleType: createModuleDefinition({ + comment: "Module comment", imports: [ { type: "Namespace_Module" }, { type: "Namespace_NestedObjectType" }, @@ -66,16 +67,14 @@ export const abi: WrapAbi = { createInterfaceImplementedDefinition({ type: "Interface_Module" }), ], methods: [ - { - ...createMethodDefinition({ + createMethodDefinition({ + name: "method1", + return: createScalarPropertyDefinition({ name: "method1", - return: createScalarPropertyDefinition({ - name: "method1", - type: "String", - required: true, - }), - comment: "method1 comment", + type: "String", + required: true, }), + comment: "method1 comment", arguments: [ createScalarPropertyDefinition({ name: "str", @@ -130,20 +129,18 @@ export const abi: WrapAbi = { required: true, }), ], - }, - { - ...createMethodDefinition({ + }), + createMethodDefinition({ + name: "method2", + comment: "method2 comment", + return: createArrayPropertyDefinition({ name: "method2", - comment: "method2 comment", - return: createArrayPropertyDefinition({ + type: "[Int32]", + required: true, + item: createScalarDefinition({ name: "method2", - type: "[Int32]", required: true, - item: createScalarDefinition({ - name: "method2", - required: true, - type: "Int32", - }), + type: "Int32", }), }), arguments: [ @@ -158,15 +155,13 @@ export const abi: WrapAbi = { }), }), ], - }, - { - ...createMethodDefinition({ + }), + createMethodDefinition({ + name: "abstractModuleMethod", + return: createObjectPropertyDefinition({ name: "abstractModuleMethod", - return: createObjectPropertyDefinition({ - name: "abstractModuleMethod", - type: "Interface_InterfaceObject2", - required: true, - }), + type: "Interface_InterfaceObject2", + required: true, }), arguments: [ createObjectPropertyDefinition({ @@ -175,15 +170,13 @@ export const abi: WrapAbi = { type: "Interface_ModuleInterfaceArgument", }), ], - }, + }), ], - }, + }), objectTypes: [ - { - ...createObjectDefinition({ - type: "CustomModuleType", - comment: "CustomModuleType multi-line comment\nline 2", - }), + createObjectDefinition({ + type: "CustomModuleType", + comment: "CustomModuleType multi-line comment\nline 2", properties: [ createScalarPropertyDefinition({ name: "str", @@ -300,15 +293,15 @@ export const abi: WrapAbi = { comment: "customType comment", }), ], - }, - { - ...createObjectDefinition({ type: "AnotherModuleType" }), + }), + createObjectDefinition({ + type: "AnotherModuleType", properties: [ createScalarPropertyDefinition({ name: "prop", type: "String" }), ], - }, - { - ...createObjectDefinition({ type: "TypeFromInterface" }), + }), + createObjectDefinition({ + type: "TypeFromInterface", interfaces: [ createInterfaceImplementedDefinition({ type: "AnotherModuleType" }), ], @@ -320,20 +313,18 @@ export const abi: WrapAbi = { }), createScalarPropertyDefinition({ name: "prop", type: "String" }), ], - }, - { - ...createObjectDefinition({ - type: "ImplementationObject", - interfaces: [ - createInterfaceImplementedDefinition({ - type: "Interface_InterfaceObject1", - }), - createInterfaceImplementedDefinition({ - type: "Interface_InterfaceObject2", - }), - ], - comment: "ImplementationObject comment", - }), + }), + createObjectDefinition({ + type: "ImplementationObject", + interfaces: [ + createInterfaceImplementedDefinition({ + type: "Interface_InterfaceObject1", + }), + createInterfaceImplementedDefinition({ + type: "Interface_InterfaceObject2", + }), + ], + comment: "ImplementationObject comment", properties: [ createScalarPropertyDefinition({ name: "anotherProp", @@ -360,16 +351,14 @@ export const abi: WrapAbi = { type: "Interface_Object", }), ], - }, - { - ...createObjectDefinition({ - type: "LocalImplementationObject", - interfaces: [ - createInterfaceImplementedDefinition({ - type: "LocalInterfaceObject", - }), - ], - }), + }), + createObjectDefinition({ + type: "LocalImplementationObject", + interfaces: [ + createInterfaceImplementedDefinition({ + type: "LocalInterfaceObject", + }), + ], properties: [ createScalarPropertyDefinition({ name: "uint8", @@ -382,11 +371,9 @@ export const abi: WrapAbi = { required: true, }), ], - }, - { - ...createObjectDefinition({ - type: "LocalInterfaceObject", - }), + }), + createObjectDefinition({ + type: "LocalInterfaceObject", properties: [ createScalarPropertyDefinition({ name: "str", @@ -394,12 +381,10 @@ export const abi: WrapAbi = { required: true, }), ], - }, - { - ...createObjectDefinition({ - type: "CommonType", - comment: "CommonType comment", - }), + }), + createObjectDefinition({ + type: "CommonType", + comment: "CommonType comment", properties: [ createScalarPropertyDefinition({ name: "prop", @@ -431,12 +416,10 @@ export const abi: WrapAbi = { required: true, }), ], - }, - { - ...createObjectDefinition({ - type: "NestedType", - comment: "NestedType comment", - }), + }), + createObjectDefinition({ + type: "NestedType", + comment: "NestedType comment", properties: [ createScalarPropertyDefinition({ name: "prop", @@ -444,12 +427,10 @@ export const abi: WrapAbi = { required: true, }), ], - }, - { - ...createObjectDefinition({ - type: "ArrayObject", - comment: "ArrayObject comment", - }), + }), + createObjectDefinition({ + type: "ArrayObject", + comment: "ArrayObject comment", properties: [ createScalarPropertyDefinition({ name: "prop", @@ -457,11 +438,9 @@ export const abi: WrapAbi = { required: true, }), ], - }, - { - ...createObjectDefinition({ - type: "AnotherLocal", - }), + }), + createObjectDefinition({ + type: "AnotherLocal", properties: [ createScalarPropertyDefinition({ name: "prop", @@ -469,26 +448,22 @@ export const abi: WrapAbi = { required: true, }), ], - }, + }), ], importedModuleTypes: [ - { - ...createImportedModuleDefinition({ - uri: "test.eth", - namespace: "Namespace", - nativeType: "Module", - isInterface: true, - comment: "Module comment", - }), + createImportedModuleDefinition({ + uri: "test.eth", + namespace: "Namespace", + nativeType: "Module", + isInterface: true, + comment: "Module comment", methods: [ - { - ...createMethodDefinition({ + createMethodDefinition({ + name: "method1", + return: createScalarPropertyDefinition({ name: "method1", - return: createScalarPropertyDefinition({ - name: "method1", - type: "String", - required: true, - }), + type: "String", + required: true, }), arguments: [ createScalarPropertyDefinition({ @@ -523,20 +498,18 @@ export const abi: WrapAbi = { }), }), ], - }, - { - ...createMethodDefinition({ + }), + createMethodDefinition({ + name: "method2", + comment: "method2 comment", + return: createArrayPropertyDefinition({ name: "method2", - comment: "method2 comment", - return: createArrayPropertyDefinition({ + type: "[Int32]", + required: true, + item: createScalarDefinition({ name: "method2", - type: "[Int32]", required: true, - item: createScalarDefinition({ - name: "method2", - required: true, - type: "Int32", - }), + type: "Int32", }), }), arguments: [ @@ -552,14 +525,12 @@ export const abi: WrapAbi = { }), }), ], - }, - { - ...createMethodDefinition({ + }), + createMethodDefinition({ + name: "localObjects", + return: createObjectPropertyDefinition({ name: "localObjects", - return: createObjectPropertyDefinition({ - name: "localObjects", - type: "Namespace_NestedObjectType", - }), + type: "Namespace_NestedObjectType", }), arguments: [ createObjectPropertyDefinition({ @@ -576,14 +547,12 @@ export const abi: WrapAbi = { }), }), ], - }, - { - ...createMethodDefinition({ + }), + createMethodDefinition({ + name: "importedObjects", + return: createObjectPropertyDefinition({ name: "importedObjects", - return: createObjectPropertyDefinition({ - name: "importedObjects", - type: "Namespace_Imported_NestedObjectType", - }), + type: "Namespace_Imported_NestedObjectType", }), arguments: [ createObjectPropertyDefinition({ @@ -600,29 +569,25 @@ export const abi: WrapAbi = { }), }), ], - }, + }), ], - }, - { - ...createImportedModuleDefinition({ - uri: "just.module.eth", - namespace: "JustModule", - isInterface: false, - nativeType: "Module", - }), + }), + createImportedModuleDefinition({ + uri: "just.module.eth", + namespace: "JustModule", + isInterface: false, + nativeType: "Module", methods: [ - { - ...createMethodDefinition({ + createMethodDefinition({ + name: "method", + return: createArrayPropertyDefinition({ name: "method", - return: createArrayPropertyDefinition({ + type: "[Int32]", + required: true, + item: createScalarDefinition({ name: "method", - type: "[Int32]", + type: "Int32", required: true, - item: createScalarDefinition({ - name: "method", - type: "Int32", - required: true, - }), }), }), arguments: [ @@ -637,27 +602,23 @@ export const abi: WrapAbi = { }), }), ], - }, + }), ], - }, - { - ...createImportedModuleDefinition({ - uri: "test-interface.eth", - namespace: "Interface", - nativeType: "Module", - isInterface: false, - comment: "Module comment", - }), + }), + createImportedModuleDefinition({ + uri: "test-interface.eth", + namespace: "Interface", + nativeType: "Module", + isInterface: false, + comment: "Module comment", methods: [ - { - ...createMethodDefinition({ + createMethodDefinition({ + name: "abstractModuleMethod", + comment: "abstractModuleMethod comment", + return: createObjectPropertyDefinition({ name: "abstractModuleMethod", - comment: "abstractModuleMethod comment", - return: createObjectPropertyDefinition({ - name: "abstractModuleMethod", - type: "Interface_InterfaceObject2", - required: true, - }), + type: "Interface_InterfaceObject2", + required: true, }), arguments: [ createObjectPropertyDefinition({ @@ -667,18 +628,16 @@ export const abi: WrapAbi = { type: "Interface_ModuleInterfaceArgument", }), ], - }, + }), ], - }, + }), ], importedObjectTypes: [ - { - ...createImportedObjectDefinition({ - uri: "test.eth", - namespace: "Namespace", - nativeType: "NestedObjectType", - type: "Namespace_NestedObjectType", - }), + createImportedObjectDefinition({ + uri: "test.eth", + namespace: "Namespace", + nativeType: "NestedObjectType", + type: "Namespace_NestedObjectType", properties: [ createObjectPropertyDefinition({ name: "nestedObject", @@ -686,14 +645,12 @@ export const abi: WrapAbi = { required: true, }), ], - }, - { - ...createImportedObjectDefinition({ - uri: "test.eth", - namespace: "Namespace", - nativeType: "ObjectType", - type: "Namespace_ObjectType", - }), + }), + createImportedObjectDefinition({ + uri: "test.eth", + namespace: "Namespace", + nativeType: "ObjectType", + type: "Namespace_ObjectType", properties: [ createScalarPropertyDefinition({ name: "prop", @@ -701,15 +658,13 @@ export const abi: WrapAbi = { required: true, }), ], - }, - { - ...createImportedObjectDefinition({ - uri: "test.eth", - namespace: "Namespace", - nativeType: "Imported_NestedObjectType", - type: "Namespace_Imported_NestedObjectType", - comment: "Imported_NestedObjectType comment", - }), + }), + createImportedObjectDefinition({ + uri: "test.eth", + namespace: "Namespace", + nativeType: "Imported_NestedObjectType", + type: "Namespace_Imported_NestedObjectType", + comment: "Imported_NestedObjectType comment", properties: [ createObjectPropertyDefinition({ name: "nestedObject", @@ -717,14 +672,12 @@ export const abi: WrapAbi = { required: true, }), ], - }, - { - ...createImportedObjectDefinition({ - uri: "test.eth", - namespace: "Namespace", - nativeType: "Imported_ObjectType", - type: "Namespace_Imported_ObjectType", - }), + }), + createImportedObjectDefinition({ + uri: "test.eth", + namespace: "Namespace", + nativeType: "Imported_ObjectType", + type: "Namespace_Imported_ObjectType", properties: [ createScalarPropertyDefinition({ name: "prop", @@ -732,15 +685,13 @@ export const abi: WrapAbi = { required: true, }), ], - }, - { - ...createImportedObjectDefinition({ - uri: "test.eth", - namespace: "Namespace", - nativeType: "CustomType", - type: "Namespace_CustomType", - comment: "CustomType comment", - }), + }), + createImportedObjectDefinition({ + uri: "test.eth", + namespace: "Namespace", + nativeType: "CustomType", + type: "Namespace_CustomType", + comment: "CustomType comment", properties: [ createScalarPropertyDefinition({ name: "str", @@ -965,15 +916,13 @@ export const abi: WrapAbi = { comment: "optImportedEnum comment", }), ], - }, - { - ...createImportedObjectDefinition({ - uri: "test-interface.eth", - namespace: "Interface", - nativeType: "InterfaceObject1", - type: "Interface_InterfaceObject1", - comment: "InterfaceObject1 comment", - }), + }), + createImportedObjectDefinition({ + uri: "test-interface.eth", + namespace: "Interface", + nativeType: "InterfaceObject1", + type: "Interface_InterfaceObject1", + comment: "InterfaceObject1 comment", properties: [ createScalarPropertyDefinition({ name: "str", @@ -987,15 +936,13 @@ export const abi: WrapAbi = { comment: "InterfaceObject1_uint8 comment", }), ], - }, - { - ...createImportedObjectDefinition({ - uri: "test-interface.eth", - namespace: "Interface", - nativeType: "InterfaceObject2", - type: "Interface_InterfaceObject2", - comment: "InterfaceObject2 comment", - }), + }), + createImportedObjectDefinition({ + uri: "test-interface.eth", + namespace: "Interface", + nativeType: "InterfaceObject2", + type: "Interface_InterfaceObject2", + comment: "InterfaceObject2 comment", interfaces: [ createInterfaceImplementedDefinition({ type: "Interface_NestedInterfaceObject", @@ -1012,15 +959,13 @@ export const abi: WrapAbi = { type: "Interface_Object", }), ], - }, - { - ...createImportedObjectDefinition({ - uri: "test-interface.eth", - namespace: "Interface", - nativeType: "Object", - type: "Interface_Object", - comment: "Object comment", - }), + }), + createImportedObjectDefinition({ + uri: "test-interface.eth", + namespace: "Interface", + nativeType: "Object", + type: "Interface_Object", + comment: "Object comment", properties: [ createScalarPropertyDefinition({ name: "uint8", @@ -1028,15 +973,13 @@ export const abi: WrapAbi = { required: true, }), ], - }, - { - ...createImportedObjectDefinition({ - uri: "test-interface.eth", - namespace: "Interface", - nativeType: "NestedInterfaceObject", - type: "Interface_NestedInterfaceObject", - comment: "NestedInterfaceObject comment", - }), + }), + createImportedObjectDefinition({ + uri: "test-interface.eth", + namespace: "Interface", + nativeType: "NestedInterfaceObject", + type: "Interface_NestedInterfaceObject", + comment: "NestedInterfaceObject comment", properties: [ createObjectPropertyDefinition({ name: "object", @@ -1044,15 +987,13 @@ export const abi: WrapAbi = { comment: "object comment", }), ], - }, - { - ...createImportedObjectDefinition({ - uri: "test-interface.eth", - namespace: "Interface", - nativeType: "ModuleInterfaceArgument", - type: "Interface_ModuleInterfaceArgument", - comment: "ModuleInterfaceArgument comment", - }), + }), + createImportedObjectDefinition({ + uri: "test-interface.eth", + namespace: "Interface", + nativeType: "ModuleInterfaceArgument", + type: "Interface_ModuleInterfaceArgument", + comment: "ModuleInterfaceArgument comment", interfaces: [ createInterfaceImplementedDefinition({ type: "Interface_NestedModuleInterfaceArgument", @@ -1071,15 +1012,13 @@ export const abi: WrapAbi = { comment: "uint8 comment", }), ], - }, - { - ...createImportedObjectDefinition({ - uri: "test-interface.eth", - namespace: "Interface", - nativeType: "NestedModuleInterfaceArgument", - type: "Interface_NestedModuleInterfaceArgument", - comment: "NestedModuleInterfaceArgument comment", - }), + }), + createImportedObjectDefinition({ + uri: "test-interface.eth", + namespace: "Interface", + nativeType: "NestedModuleInterfaceArgument", + type: "Interface_NestedModuleInterfaceArgument", + comment: "NestedModuleInterfaceArgument comment", properties: [ createScalarPropertyDefinition({ name: "uint8", @@ -1087,27 +1026,23 @@ export const abi: WrapAbi = { required: true, }), ], - }, + }), ], importedEnumTypes: [ - { - ...createImportedEnumDefinition({ - uri: "test.eth", - namespace: "Namespace", - nativeType: "CustomEnum", - type: "Namespace_CustomEnum", - constants: ["STRING", "BYTES"], - }), - }, - { - ...createImportedEnumDefinition({ - uri: "test.eth", - namespace: "Namespace", - nativeType: "Imported_Enum", - type: "Namespace_Imported_Enum", - constants: ["STRING", "BYTES"], - comment: "Imported_Enum comment", - }), - }, + createImportedEnumDefinition({ + uri: "test.eth", + namespace: "Namespace", + nativeType: "CustomEnum", + type: "Namespace_CustomEnum", + constants: ["STRING", "BYTES"], + }), + createImportedEnumDefinition({ + uri: "test.eth", + namespace: "Namespace", + nativeType: "Imported_Enum", + type: "Namespace_Imported_Enum", + constants: ["STRING", "BYTES"], + comment: "Imported_Enum comment", + }), ], }; diff --git a/packages/test-cases/cases/parse/map-type/input.graphql b/packages/test-cases/cases/parse/map-type/input.graphql new file mode 100644 index 0000000000..dbef039428 --- /dev/null +++ b/packages/test-cases/cases/parse/map-type/input.graphql @@ -0,0 +1,18 @@ +scalar Map + +type CustomType { + map: Map! @annotate(type: "Map!") + mapOfArr: Map! @annotate(type: "Map!") + mapOfObj: Map! @annotate(type: "Map!") + mapOfArrOfObj: Map! @annotate(type: "Map!") +} + +type AnotherType { + prop: String +} + +type Module { + transformMap( + map: Map @annotate(type: "Map") + ): Map @annotate(type: "Map") +} diff --git a/packages/test-cases/cases/parse/map-type/output.json b/packages/test-cases/cases/parse/map-type/output.json new file mode 100644 index 0000000000..7f68ea1f6d --- /dev/null +++ b/packages/test-cases/cases/parse/map-type/output.json @@ -0,0 +1,357 @@ +{ + "moduleType": { + "kind": 128, + "methods": [ + { + "arguments": [ + { + "key": { + "kind": 4, + "name": "map", + "required": true, + "type": "String" + }, + "kind": 34, + "map": { + "key": { + "kind": 4, + "name": "map", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "map", + "scalar": { + "kind": 4, + "name": "map", + "required": true, + "type": "Int" + }, + "type": "Map", + "value": { + "kind": 4, + "name": "map", + "required": true, + "type": "Int" + } + }, + "name": "map", + "type": "Map", + "value": { + "kind": 4, + "name": "map", + "required": true, + "type": "Int" + } + } + ], + "kind": 64, + "name": "transformMap", + "required": true, + "return": { + "key": { + "kind": 4, + "name": "transformMap", + "required": true, + "type": "String" + }, + "kind": 34, + "map": { + "key": { + "kind": 4, + "name": "transformMap", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "transformMap", + "scalar": { + "kind": 4, + "name": "transformMap", + "required": true, + "type": "Int" + }, + "type": "Map", + "value": { + "kind": 4, + "name": "transformMap", + "required": true, + "type": "Int" + } + }, + "name": "transformMap", + "type": "Map", + "value": { + "kind": 4, + "name": "transformMap", + "required": true, + "type": "Int" + } + }, + "type": "Method" + } + ], + "type": "Module" + }, + "objectTypes": [ + { + "kind": 1, + "properties": [ + { + "key": { + "kind": 4, + "name": "map", + "required": true, + "type": "String" + }, + "kind": 34, + "map": { + "key": { + "kind": 4, + "name": "map", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "map", + "required": true, + "scalar": { + "kind": 4, + "name": "map", + "type": "Int" + }, + "type": "Map", + "value": { + "kind": 4, + "name": "map", + "type": "Int" + } + }, + "name": "map", + "required": true, + "type": "Map", + "value": { + "kind": 4, + "name": "map", + "type": "Int" + } + }, + { + "key": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "String" + }, + "kind": 34, + "map": { + "array": { + "item": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "Int" + }, + "kind": 18, + "name": "mapOfArr", + "required": true, + "scalar": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "Int" + }, + "type": "[Int]" + }, + "key": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "mapOfArr", + "required": true, + "type": "Map", + "value": { + "item": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "Int" + }, + "kind": 18, + "name": "mapOfArr", + "required": true, + "scalar": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "Int" + }, + "type": "[Int]" + } + }, + "name": "mapOfArr", + "required": true, + "type": "Map", + "value": { + "item": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "Int" + }, + "kind": 18, + "name": "mapOfArr", + "required": true, + "scalar": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "Int" + }, + "type": "[Int]" + } + }, + { + "key": { + "kind": 4, + "name": "mapOfObj", + "required": true, + "type": "String" + }, + "kind": 34, + "map": { + "key": { + "kind": 4, + "name": "mapOfObj", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "mapOfObj", + "object": { + "kind": 8192, + "name": "mapOfObj", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "Map", + "value": { + "kind": 8192, + "name": "mapOfObj", + "required": true, + "type": "AnotherType" + } + }, + "name": "mapOfObj", + "required": true, + "type": "Map", + "value": { + "kind": 8192, + "name": "mapOfObj", + "required": true, + "type": "AnotherType" + } + }, + { + "key": { + "kind": 4, + "name": "mapOfArrOfObj", + "required": true, + "type": "String" + }, + "kind": 34, + "map": { + "array": { + "item": { + "kind": 8192, + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType" + }, + "kind": 18, + "name": "mapOfArrOfObj", + "object": { + "kind": 8192, + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "[AnotherType]" + }, + "key": { + "kind": 4, + "name": "mapOfArrOfObj", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "mapOfArrOfObj", + "required": true, + "type": "Map", + "value": { + "item": { + "kind": 8192, + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType" + }, + "kind": 18, + "name": "mapOfArrOfObj", + "object": { + "kind": 8192, + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "[AnotherType]" + } + }, + "name": "mapOfArrOfObj", + "required": true, + "type": "Map", + "value": { + "item": { + "kind": 8192, + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType" + }, + "kind": 18, + "name": "mapOfArrOfObj", + "object": { + "kind": 8192, + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "[AnotherType]" + } + } + ], + "type": "CustomType" + }, + { + "kind": 1, + "properties": [ + { + "kind": 34, + "name": "prop", + "scalar": { + "kind": 4, + "name": "prop", + "type": "String" + }, + "type": "String" + } + ], + "type": "AnotherType" + } + ] +} \ No newline at end of file diff --git a/packages/test-cases/cases/parse/map-type/output.ts b/packages/test-cases/cases/parse/map-type/output.ts new file mode 100644 index 0000000000..09fe73b1fd --- /dev/null +++ b/packages/test-cases/cases/parse/map-type/output.ts @@ -0,0 +1,114 @@ +import { + createArrayDefinition, + createMapKeyDefinition, + createMapPropertyDefinition, + createMethodDefinition, + createModuleDefinition, + createObjectDefinition, + createObjectRef, + createScalarDefinition, + createScalarPropertyDefinition, + WrapAbi, +} from "../../../../schema/parse/src/abi"; + +export const abi: WrapAbi = { + version: "0.1", + objectTypes: [ + { + ...createObjectDefinition({ + type: "CustomType", + }), + properties: [ + createMapPropertyDefinition({ + name: "map", + type: "Map", + key: createMapKeyDefinition({ name: "map", type: "String", required: true }), + value: createScalarDefinition({ name: "map", type: "Int" }), + required: true + }), + createMapPropertyDefinition({ + name: "mapOfArr", + type: "Map", + key: createMapKeyDefinition({ name: "mapOfArr", type: "String", required: true }), + value: createArrayDefinition({ + name: "mapOfArr", + type: "[Int]", + item: createScalarDefinition({ name: "mapOfArr", type: "Int", required: true }), + required: true + }), + required: true + }), + createMapPropertyDefinition({ + name: "mapOfObj", + type: "Map", + key: createMapKeyDefinition({ name: "mapOfObj", type: "String", required: true }), + value: createObjectRef({ name: "mapOfObj", type: "AnotherType", required: true }), + required: true + }), + createMapPropertyDefinition({ + name: "mapOfArrOfObj", + type: "Map", + key: createMapKeyDefinition({ name: "mapOfArrOfObj", type: "String", required: true }), + value: createArrayDefinition({ + name: "mapOfArrOfObj", + type: "[AnotherType]", + item: createObjectRef({ name: "mapOfArrOfObj", type: "AnotherType", required: true }), + required: true + }), + required: true + }), + ], + }, + { + ...createObjectDefinition({ + type: "AnotherType" + }), + properties: [ + createScalarPropertyDefinition({ + name: "prop", + type: "String" + }), + ], + }, + ], + moduleType: { + ...createModuleDefinition({}), + methods: [ + { + ...createMethodDefinition({ + name: "transformMap", + return: createMapPropertyDefinition({ + name: "transformMap", + type: "Map", + key: createMapKeyDefinition({ + name: "transformMap", + type: "String", + required: true, + }), + value: createScalarDefinition({ + name: "transformMap", + type: "Int", + required: true, + }), + }), + }), + arguments: [ + createMapPropertyDefinition({ + name: "map", + type: "Map", + key: createMapKeyDefinition({ + name: "map", + type: "String", + required: true, + }), + value: createScalarDefinition({ + name: "map", + type: "Int", + required: true, + }), + }), + ], + }, + ], + }, +}; diff --git a/packages/test-cases/cases/parse/map-type/result.json b/packages/test-cases/cases/parse/map-type/result.json new file mode 100644 index 0000000000..e21122de6e --- /dev/null +++ b/packages/test-cases/cases/parse/map-type/result.json @@ -0,0 +1,262 @@ +{ + "moduleType": { + "kind": 128, + "methods": [ + { + "arguments": [ + { + "kind": 34, + "map": { + "key": { + "kind": 4, + "name": "map", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "map", + "scalar": { + "kind": 4, + "name": "map", + "required": true, + "type": "Int" + }, + "type": "Map", + "value": { + "kind": 4, + "name": "map", + "required": true, + "type": "Int" + } + }, + "name": "map", + "type": "Map" + } + ], + "kind": 64, + "name": "transformMap", + "required": true, + "return": { + "kind": 34, + "map": { + "key": { + "kind": 4, + "name": "transformMap", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "transformMap", + "scalar": { + "kind": 4, + "name": "transformMap", + "required": true, + "type": "Int" + }, + "type": "Map", + "value": { + "kind": 4, + "name": "transformMap", + "required": true, + "type": "Int" + } + }, + "name": "transformMap", + "type": "Map" + }, + "type": "Method" + } + ], + "type": "Module" + }, + "objectTypes": [ + { + "kind": 1, + "properties": [ + { + "kind": 34, + "map": { + "key": { + "kind": 4, + "name": "map", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "map", + "required": true, + "scalar": { + "kind": 4, + "name": "map", + "type": "Int" + }, + "type": "Map", + "value": { + "kind": 4, + "name": "map", + "type": "Int" + } + }, + "name": "map", + "required": true, + "type": "Map" + }, + { + "kind": 34, + "map": { + "array": { + "item": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "Int" + }, + "kind": 18, + "name": "mapOfArr", + "required": true, + "scalar": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "Int" + }, + "type": "[Int]" + }, + "key": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "mapOfArr", + "required": true, + "type": "Map", + "value": { + "item": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "Int" + }, + "kind": 18, + "name": "mapOfArr", + "required": true, + "scalar": { + "kind": 4, + "name": "mapOfArr", + "required": true, + "type": "Int" + }, + "type": "[Int]" + } + }, + "name": "mapOfArr", + "required": true, + "type": "Map" + }, + { + "kind": 34, + "map": { + "key": { + "kind": 4, + "name": "mapOfObj", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "mapOfObj", + "object": { + "kind": 8192, + "name": "mapOfObj", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "Map", + "value": { + "kind": 8192, + "name": "mapOfObj", + "required": true, + "type": "AnotherType" + } + }, + "name": "mapOfObj", + "required": true, + "type": "Map" + }, + { + "kind": 34, + "map": { + "array": { + "item": { + "kind": 8192, + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType" + }, + "kind": 18, + "name": "mapOfArrOfObj", + "object": { + "kind": 8192, + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "[AnotherType]" + }, + "key": { + "kind": 4, + "name": "mapOfArrOfObj", + "required": true, + "type": "String" + }, + "kind": 262146, + "name": "mapOfArrOfObj", + "required": true, + "type": "Map", + "value": { + "item": { + "kind": 8192, + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType" + }, + "kind": 18, + "name": "mapOfArrOfObj", + "object": { + "kind": 8192, + "name": "mapOfArrOfObj", + "required": true, + "type": "AnotherType" + }, + "required": true, + "type": "[AnotherType]" + } + }, + "name": "mapOfArrOfObj", + "required": true, + "type": "Map" + } + ], + "type": "CustomType" + }, + { + "kind": 1, + "properties": [ + { + "kind": 34, + "name": "prop", + "scalar": { + "kind": 4, + "name": "prop", + "type": "String" + }, + "type": "String" + } + ], + "type": "AnotherType" + } + ] +} \ No newline at end of file diff --git a/packages/test-cases/cases/parse/recursive-properties/output.ts b/packages/test-cases/cases/parse/recursive-properties/output.ts index 88f9ba2e0d..3a23078c58 100644 --- a/packages/test-cases/cases/parse/recursive-properties/output.ts +++ b/packages/test-cases/cases/parse/recursive-properties/output.ts @@ -7,6 +7,7 @@ import { } from "../../../../schema/parse/src/abi"; export const abi: WrapAbi = { + version: "0.1", objectTypes: [ { ...createObjectDefinition({ type: "Object" }), diff --git a/packages/test-cases/cases/parse/sanity/output.ts b/packages/test-cases/cases/parse/sanity/output.ts index 67c46ccf12..53e662e5ec 100644 --- a/packages/test-cases/cases/parse/sanity/output.ts +++ b/packages/test-cases/cases/parse/sanity/output.ts @@ -25,6 +25,7 @@ import { } from "../../../../schema/parse/src/abi"; export const abi: WrapAbi = { + version: "0.1", interfaceTypes: [ createInterfaceDefinition({ type: "TestImport", @@ -644,7 +645,7 @@ export const abi: WrapAbi = { ...createMethodDefinition({ name: "methodOptionalEnv", env: { - required: undefined, + required: false, }, return: createObjectPropertyDefinition({ name: "methodOptionalEnv", @@ -975,7 +976,6 @@ export const abi: WrapAbi = { ...createImportedEnvDefinition({ uri: "testimport.uri.eth", namespace: "TestImport", - type: "TestImport_Env", nativeType: "Env", comment: "TestImport_Env comment", }), diff --git a/packages/test-cases/cases/wrappers/wasm-as/asyncify/abis/memory-storage.graphql b/packages/test-cases/cases/wrappers/wasm-as/asyncify/abis/memory-storage.graphql new file mode 100644 index 0000000000..c10ae67370 --- /dev/null +++ b/packages/test-cases/cases/wrappers/wasm-as/asyncify/abis/memory-storage.graphql @@ -0,0 +1,5 @@ +type Module { + getData: Int32! + + setData(value: Int32!): Boolean! +} diff --git a/packages/test-cases/cases/wrappers/wasm-as/asyncify/package.json b/packages/test-cases/cases/wrappers/wasm-as/asyncify/package.json index 4391eaaff9..02e489ea33 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/asyncify/package.json +++ b/packages/test-cases/cases/wrappers/wasm-as/asyncify/package.json @@ -2,7 +2,7 @@ "name": "test-case-asyncify", "private": true, "dependencies": { - "@polywrap/wasm-as": "0.1.0", + "@polywrap/wasm-as": "0.3.0", "assemblyscript": "0.19.5" } } \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-as/asyncify/plugin.graphql b/packages/test-cases/cases/wrappers/wasm-as/asyncify/plugin.graphql deleted file mode 100644 index df63b97a79..0000000000 --- a/packages/test-cases/cases/wrappers/wasm-as/asyncify/plugin.graphql +++ /dev/null @@ -1,7 +0,0 @@ -type Module { - getData: Int! - - setData( - value: Int! - ): Boolean! -} \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-as/asyncify/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-as/asyncify/polywrap.yaml index 460c83a152..9f77aeda05 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/asyncify/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-as/asyncify/polywrap.yaml @@ -1,9 +1,9 @@ -format: 0.1.0 +format: "0.2" name: Asyncify build: ./polywrap.build.yaml language: wasm/assemblyscript schema: ./schema.graphql module: ./src/index.ts -import_redirects: +import_abis: - uri: "ens/memory-storage.polywrap.eth" - schema: ./plugin.graphql \ No newline at end of file + abi: ./abis/memory-storage.graphql diff --git a/packages/test-cases/cases/wrappers/wasm-as/bigint-type/package.json b/packages/test-cases/cases/wrappers/wasm-as/bigint-type/package.json index 99e7c69eef..4d9e800622 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/bigint-type/package.json +++ b/packages/test-cases/cases/wrappers/wasm-as/bigint-type/package.json @@ -2,7 +2,7 @@ "name": "test-case-bigint-type", "private": true, "dependencies": { - "@polywrap/wasm-as": "0.1.0", + "@polywrap/wasm-as": "0.3.0", "assemblyscript": "0.19.5" } } \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-as/bigint-type/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-as/bigint-type/polywrap.yaml index 3fcb197664..4ce4f9f3bb 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/bigint-type/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-as/bigint-type/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: BigInt build: ./polywrap.build.yaml language: wasm/assemblyscript diff --git a/packages/test-cases/cases/wrappers/wasm-as/bignumber-type/package.json b/packages/test-cases/cases/wrappers/wasm-as/bignumber-type/package.json index b7af8f8f31..7b58132d31 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/bignumber-type/package.json +++ b/packages/test-cases/cases/wrappers/wasm-as/bignumber-type/package.json @@ -2,7 +2,7 @@ "name": "test-case-bignumber-type", "private": true, "dependencies": { - "@polywrap/wasm-as": "0.1.0", + "@polywrap/wasm-as": "0.3.0", "assemblyscript": "0.19.1" } } \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-as/bignumber-type/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-as/bignumber-type/polywrap.yaml index 7dffbaa55b..07a79ea1f7 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/bignumber-type/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-as/bignumber-type/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: BigNumber build: ./polywrap.build.yaml language: wasm/assemblyscript diff --git a/packages/test-cases/cases/wrappers/wasm-as/bytes-type/package.json b/packages/test-cases/cases/wrappers/wasm-as/bytes-type/package.json index 7816806b24..c41bc18bb5 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/bytes-type/package.json +++ b/packages/test-cases/cases/wrappers/wasm-as/bytes-type/package.json @@ -2,7 +2,7 @@ "name": "test-case-bytes-type", "private": true, "dependencies": { - "@polywrap/wasm-as": "0.1.0", + "@polywrap/wasm-as": "0.3.0", "assemblyscript": "0.19.5" } } \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-as/bytes-type/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-as/bytes-type/polywrap.yaml index 3ab5b18f2a..d51988ad84 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/bytes-type/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-as/bytes-type/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: BytesType build: ./polywrap.build.yaml language: wasm/assemblyscript diff --git a/packages/test-cases/cases/wrappers/wasm-as/enum-types/package.json b/packages/test-cases/cases/wrappers/wasm-as/enum-types/package.json index 93bf0d01cf..51c5a42aa4 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/enum-types/package.json +++ b/packages/test-cases/cases/wrappers/wasm-as/enum-types/package.json @@ -2,7 +2,7 @@ "name": "test-case-enum-types", "private": true, "dependencies": { - "@polywrap/wasm-as": "0.1.0", + "@polywrap/wasm-as": "0.3.0", "assemblyscript": "0.19.5" } } \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-as/enum-types/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-as/enum-types/polywrap.yaml index b9168753f7..443b2c350e 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/enum-types/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-as/enum-types/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: EnumTypes build: ./polywrap.build.yaml language: wasm/assemblyscript diff --git a/packages/test-cases/cases/wrappers/wasm-as/env-types/external/package.json b/packages/test-cases/cases/wrappers/wasm-as/env-types/external/package.json index b439f9c396..3bc2c41260 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/env-types/external/package.json +++ b/packages/test-cases/cases/wrappers/wasm-as/env-types/external/package.json @@ -2,7 +2,7 @@ "name": "test-case-complex-env-types", "private": true, "dependencies": { - "@polywrap/wasm-as": "0.1.0", + "@polywrap/wasm-as": "0.3.0", "assemblyscript": "0.19.5" } } diff --git a/packages/test-cases/cases/wrappers/wasm-as/env-types/external/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-as/env-types/external/polywrap.yaml index 611dea4d59..9120a20fd1 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/env-types/external/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-as/env-types/external/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: EnvTypeExternal language: wasm/assemblyscript build: ./polywrap.build.yaml diff --git a/packages/test-cases/cases/wrappers/wasm-as/env-types/main/package.json b/packages/test-cases/cases/wrappers/wasm-as/env-types/main/package.json index b439f9c396..3bc2c41260 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/env-types/main/package.json +++ b/packages/test-cases/cases/wrappers/wasm-as/env-types/main/package.json @@ -2,7 +2,7 @@ "name": "test-case-complex-env-types", "private": true, "dependencies": { - "@polywrap/wasm-as": "0.1.0", + "@polywrap/wasm-as": "0.3.0", "assemblyscript": "0.19.5" } } diff --git a/packages/test-cases/cases/wrappers/wasm-as/env-types/main/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-as/env-types/main/polywrap.yaml index 01d739bb96..429b2fe754 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/env-types/main/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-as/env-types/main/polywrap.yaml @@ -1,9 +1,9 @@ -format: 0.1.0 +format: "0.2" name: EnvType language: wasm/assemblyscript build: ./polywrap.build.yaml schema: ./src/schema.graphql module: ./src/index.ts -import_redirects: +import_abis: - uri: "ens/externalenv.polywrap.eth" - schema: ../external/build/schema.graphql + abi: ../external/build/wrap.info diff --git a/packages/test-cases/cases/wrappers/wasm-as/implementations/test-interface/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-as/implementations/test-interface/polywrap.yaml index d6f5b8a82d..00a7c96f03 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/implementations/test-interface/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-as/implementations/test-interface/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: TestInterface language: interface schema: ./schema.graphql diff --git a/packages/test-cases/cases/wrappers/wasm-as/implementations/test-use-getImpl/package.json b/packages/test-cases/cases/wrappers/wasm-as/implementations/test-use-getImpl/package.json index 81006ed52a..3f4c69310d 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/implementations/test-use-getImpl/package.json +++ b/packages/test-cases/cases/wrappers/wasm-as/implementations/test-use-getImpl/package.json @@ -2,7 +2,7 @@ "name": "test-case-implementation", "private": true, "dependencies": { - "@polywrap/wasm-as": "0.1.0", + "@polywrap/wasm-as": "0.3.0", "assemblyscript": "0.19.5" } } \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-as/implementations/test-use-getImpl/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-as/implementations/test-use-getImpl/polywrap.yaml index bf161c4dc2..6e491cda59 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/implementations/test-use-getImpl/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-as/implementations/test-use-getImpl/polywrap.yaml @@ -1,9 +1,9 @@ -format: 0.1.0 +format: "0.2" name: TestUseGetImpl build: ./polywrap.build.yaml language: wasm/assemblyscript schema: ./schema.graphql module: ./src/index.ts -import_redirects: +import_abis: - uri: wrap://ens/interface.eth - schema: ../test-interface/build/schema.graphql \ No newline at end of file + abi: ../test-interface/build/wrap.info \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-as/implementations/test-wrapper/package.json b/packages/test-cases/cases/wrappers/wasm-as/implementations/test-wrapper/package.json index 81006ed52a..3f4c69310d 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/implementations/test-wrapper/package.json +++ b/packages/test-cases/cases/wrappers/wasm-as/implementations/test-wrapper/package.json @@ -2,7 +2,7 @@ "name": "test-case-implementation", "private": true, "dependencies": { - "@polywrap/wasm-as": "0.1.0", + "@polywrap/wasm-as": "0.3.0", "assemblyscript": "0.19.5" } } \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-as/implementations/test-wrapper/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-as/implementations/test-wrapper/polywrap.yaml index 95bc6af117..e08c77953a 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/implementations/test-wrapper/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-as/implementations/test-wrapper/polywrap.yaml @@ -1,9 +1,9 @@ -format: 0.1.0 +format: "0.2" name: TestWrapper build: ./polywrap.build.yaml language: wasm/assemblyscript schema: ./schema.graphql module: ./src/index.ts -import_redirects: +import_abis: - uri: wrap://ens/interface.eth - schema: ../test-interface/build/schema.graphql + abi: ../test-interface/build/wrap.info diff --git a/packages/test-cases/cases/wrappers/wasm-as/interface-invoke/test-implementation/package.json b/packages/test-cases/cases/wrappers/wasm-as/interface-invoke/test-implementation/package.json index 8b110f16ec..9019af61bc 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/interface-invoke/test-implementation/package.json +++ b/packages/test-cases/cases/wrappers/wasm-as/interface-invoke/test-implementation/package.json @@ -2,7 +2,7 @@ "name": "test-case-interface-invoke", "private": true, "dependencies": { - "@polywrap/wasm-as": "0.1.0", + "@polywrap/wasm-as": "0.3.0", "assemblyscript": "0.19.5" } } \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-as/interface-invoke/test-implementation/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-as/interface-invoke/test-implementation/polywrap.yaml index fb4262b68e..fc17190b9f 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/interface-invoke/test-implementation/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-as/interface-invoke/test-implementation/polywrap.yaml @@ -1,9 +1,9 @@ -format: 0.1.0 +format: "0.2" name: TestImplementation build: ./polywrap.build.yaml language: wasm/assemblyscript schema: ./schema.graphql module: ./src/index.ts -import_redirects: +import_abis: - uri: wrap://ens/interface.eth - schema: ../test-interface/build/schema.graphql \ No newline at end of file + abi: ../test-interface/build/wrap.info \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-as/interface-invoke/test-interface/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-as/interface-invoke/test-interface/polywrap.yaml index d6f5b8a82d..00a7c96f03 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/interface-invoke/test-interface/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-as/interface-invoke/test-interface/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: TestInterface language: interface schema: ./schema.graphql diff --git a/packages/test-cases/cases/wrappers/wasm-as/interface-invoke/test-wrapper/package.json b/packages/test-cases/cases/wrappers/wasm-as/interface-invoke/test-wrapper/package.json index 8b110f16ec..9019af61bc 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/interface-invoke/test-wrapper/package.json +++ b/packages/test-cases/cases/wrappers/wasm-as/interface-invoke/test-wrapper/package.json @@ -2,7 +2,7 @@ "name": "test-case-interface-invoke", "private": true, "dependencies": { - "@polywrap/wasm-as": "0.1.0", + "@polywrap/wasm-as": "0.3.0", "assemblyscript": "0.19.5" } } \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-as/interface-invoke/test-wrapper/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-as/interface-invoke/test-wrapper/polywrap.yaml index 11269c20f8..d3926f3e7f 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/interface-invoke/test-wrapper/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-as/interface-invoke/test-wrapper/polywrap.yaml @@ -1,9 +1,9 @@ -format: 0.1.0 +format: "0.2" name: TestWrapper build: ./polywrap.build.yaml language: wasm/assemblyscript schema: ./schema.graphql module: ./src/index.ts -import_redirects: +import_abis: - uri: wrap://ens/interface.eth - schema: ../test-interface/build/schema.graphql \ No newline at end of file + abi: ../test-interface/build/wrap.info \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-as/invalid-types/package.json b/packages/test-cases/cases/wrappers/wasm-as/invalid-types/package.json index 83f222747f..f6012c63b2 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/invalid-types/package.json +++ b/packages/test-cases/cases/wrappers/wasm-as/invalid-types/package.json @@ -2,7 +2,7 @@ "name": "test-case-invalid-types", "private": true, "dependencies": { - "@polywrap/wasm-as": "0.1.0", + "@polywrap/wasm-as": "0.3.0", "assemblyscript": "0.19.5" } } \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-as/invalid-types/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-as/invalid-types/polywrap.yaml index f7ece16902..d9351c0b87 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/invalid-types/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-as/invalid-types/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: InvalidTypes build: ./polywrap.build.yaml language: wasm/assemblyscript diff --git a/packages/test-cases/cases/wrappers/wasm-as/json-type/package.json b/packages/test-cases/cases/wrappers/wasm-as/json-type/package.json index fff1549a28..d56a579825 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/json-type/package.json +++ b/packages/test-cases/cases/wrappers/wasm-as/json-type/package.json @@ -2,7 +2,7 @@ "name": "test-case-json-type", "private": true, "dependencies": { - "@polywrap/wasm-as": "0.1.0", + "@polywrap/wasm-as": "0.3.0", "assemblyscript": "0.19.5" } } diff --git a/packages/test-cases/cases/wrappers/wasm-as/json-type/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-as/json-type/polywrap.yaml index 33357797eb..fe4ab1d690 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/json-type/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-as/json-type/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: JsonType build: ./polywrap.build.yaml language: wasm/assemblyscript diff --git a/packages/test-cases/cases/wrappers/wasm-as/large-types/package.json b/packages/test-cases/cases/wrappers/wasm-as/large-types/package.json index c5efbcf500..5de9a3d52f 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/large-types/package.json +++ b/packages/test-cases/cases/wrappers/wasm-as/large-types/package.json @@ -2,7 +2,7 @@ "name": "test-case-large-types", "private": true, "dependencies": { - "@polywrap/wasm-as": "0.1.0", + "@polywrap/wasm-as": "0.3.0", "assemblyscript": "0.19.5" } } \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-as/large-types/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-as/large-types/polywrap.yaml index 3dc32fcba1..418aa6c0f7 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/large-types/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-as/large-types/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: LargeTypes build: ./polywrap.build.yaml language: wasm/assemblyscript diff --git a/packages/test-cases/cases/wrappers/wasm-as/map-type/package.json b/packages/test-cases/cases/wrappers/wasm-as/map-type/package.json index ed0799f22d..7756e243a4 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/map-type/package.json +++ b/packages/test-cases/cases/wrappers/wasm-as/map-type/package.json @@ -2,7 +2,7 @@ "name": "test-case-map-type", "private": true, "dependencies": { - "@polywrap/wasm-as": "0.1.0", + "@polywrap/wasm-as": "0.3.0", "assemblyscript": "0.19.1" } } \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-as/map-type/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-as/map-type/polywrap.yaml index 3ab5b18f2a..d51988ad84 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/map-type/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-as/map-type/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: BytesType build: ./polywrap.build.yaml language: wasm/assemblyscript diff --git a/packages/test-cases/cases/wrappers/wasm-as/number-types/package.json b/packages/test-cases/cases/wrappers/wasm-as/number-types/package.json index 6d57ce5275..1b1fece24b 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/number-types/package.json +++ b/packages/test-cases/cases/wrappers/wasm-as/number-types/package.json @@ -2,7 +2,7 @@ "name": "test-case-number-types", "private": true, "dependencies": { - "@polywrap/wasm-as": "0.1.0", + "@polywrap/wasm-as": "0.3.0", "assemblyscript": "0.19.5" } } \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-as/number-types/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-as/number-types/polywrap.yaml index 646f682ca5..e8e031d358 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/number-types/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-as/number-types/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: NumberTypes build: ./polywrap.build.yaml language: wasm/assemblyscript diff --git a/packages/test-cases/cases/wrappers/wasm-as/object-types/package.json b/packages/test-cases/cases/wrappers/wasm-as/object-types/package.json index 4baea5fbb4..bdab090fc3 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/object-types/package.json +++ b/packages/test-cases/cases/wrappers/wasm-as/object-types/package.json @@ -2,7 +2,7 @@ "name": "test-case-object-types", "private": true, "dependencies": { - "@polywrap/wasm-as": "0.1.0", + "@polywrap/wasm-as": "0.3.0", "assemblyscript": "0.19.5" } } \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-as/object-types/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-as/object-types/polywrap.yaml index 5cac75d904..e62b8002ad 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/object-types/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-as/object-types/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: ObjectTypes build: ./polywrap.build.yaml language: wasm/assemblyscript diff --git a/packages/test-cases/cases/wrappers/wasm-as/reserved-words/package.json b/packages/test-cases/cases/wrappers/wasm-as/reserved-words/package.json index 8146de1eb1..4ead5ba342 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/reserved-words/package.json +++ b/packages/test-cases/cases/wrappers/wasm-as/reserved-words/package.json @@ -2,7 +2,7 @@ "name": "test-case-reserved-words", "private": true, "dependencies": { - "@polywrap/wasm-as": "0.1.0", + "@polywrap/wasm-as": "0.3.0", "assemblyscript": "0.19.5" } } \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-as/reserved-words/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-as/reserved-words/polywrap.yaml index 688bd0aa70..1194bec31d 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/reserved-words/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-as/reserved-words/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: ReservedWords build: ./polywrap.build.yaml language: wasm/assemblyscript diff --git a/packages/test-cases/cases/wrappers/wasm-as/simple-calculator/package.json b/packages/test-cases/cases/wrappers/wasm-as/simple-calculator/package.json index 2e7eed2dd7..7f0141e6bc 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/simple-calculator/package.json +++ b/packages/test-cases/cases/wrappers/wasm-as/simple-calculator/package.json @@ -2,7 +2,7 @@ "name": "test-case-simple-calculator", "private": true, "dependencies": { - "@polywrap/wasm-as": "0.1.0", + "@polywrap/wasm-as": "0.3.0", "assemblyscript": "0.19.1" } } diff --git a/packages/test-cases/cases/wrappers/wasm-as/simple-calculator/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-as/simple-calculator/polywrap.yaml index c0061dd46d..7fbf515923 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/simple-calculator/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-as/simple-calculator/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: simple-calculator language: wasm/assemblyscript build: ./polywrap.build.yaml diff --git a/packages/test-cases/cases/wrappers/wasm-as/simple-env-types/package.json b/packages/test-cases/cases/wrappers/wasm-as/simple-env-types/package.json index 3754c9fc5e..310c311e12 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/simple-env-types/package.json +++ b/packages/test-cases/cases/wrappers/wasm-as/simple-env-types/package.json @@ -2,7 +2,7 @@ "name": "test-case-simple-env-types", "private": true, "dependencies": { - "@polywrap/wasm-as": "0.1.0", + "@polywrap/wasm-as": "0.3.0", "assemblyscript": "0.19.1" } } diff --git a/packages/test-cases/cases/wrappers/wasm-as/simple-env-types/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-as/simple-env-types/polywrap.yaml index 7487910b2f..1d6a5dd80c 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/simple-env-types/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-as/simple-env-types/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: SimpleEnvTypes language: wasm/assemblyscript build: ./polywrap.build.yaml diff --git a/packages/test-cases/cases/wrappers/wasm-as/simple-fs-resolver/package.json b/packages/test-cases/cases/wrappers/wasm-as/simple-fs-resolver/package.json index ae53454d6d..54880cb264 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/simple-fs-resolver/package.json +++ b/packages/test-cases/cases/wrappers/wasm-as/simple-fs-resolver/package.json @@ -2,7 +2,7 @@ "name": "test-case-simple-fs-resolver", "private": true, "dependencies": { - "@polywrap/wasm-as": "0.2.0", + "@polywrap/wasm-as": "0.3.0", "assemblyscript": "0.19.1" } } diff --git a/packages/test-cases/cases/wrappers/wasm-as/simple-fs-resolver/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-as/simple-fs-resolver/polywrap.yaml index cfbfc0492c..b5fa83847f 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/simple-fs-resolver/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-as/simple-fs-resolver/polywrap.yaml @@ -1,9 +1,9 @@ -format: 0.1.0 +format: "0.2" name: SimpleFsResolver language: wasm/assemblyscript build: ./polywrap.build.yaml schema: ./schema.graphql module: ./src/index.ts -import_redirects: +import_abis: - uri: "ens/uri-resolver.core.polywrap.eth" - schema: ../../../../../interfaces/uri-resolver/src/schema.graphql \ No newline at end of file + abi: ../../../../../interfaces/uri-resolver/build-man/wrap.info \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-as/simple-memory/package.json b/packages/test-cases/cases/wrappers/wasm-as/simple-memory/package.json index 807b493681..50a9a1fcdc 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/simple-memory/package.json +++ b/packages/test-cases/cases/wrappers/wasm-as/simple-memory/package.json @@ -2,7 +2,7 @@ "name": "test-case-simple-memory", "private": true, "dependencies": { - "@polywrap/wasm-as": "0.1.0", + "@polywrap/wasm-as": "0.3.0", "assemblyscript": "0.19.1" } } diff --git a/packages/test-cases/cases/wrappers/wasm-as/simple-memory/plugin.graphql b/packages/test-cases/cases/wrappers/wasm-as/simple-memory/plugin.graphql deleted file mode 100644 index df63b97a79..0000000000 --- a/packages/test-cases/cases/wrappers/wasm-as/simple-memory/plugin.graphql +++ /dev/null @@ -1,7 +0,0 @@ -type Module { - getData: Int! - - setData( - value: Int! - ): Boolean! -} \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-as/simple-memory/plugin.wrap.info b/packages/test-cases/cases/wrappers/wasm-as/simple-memory/plugin.wrap.info new file mode 100644 index 0000000000..ce20b6b055 --- /dev/null +++ b/packages/test-cases/cases/wrappers/wasm-as/simple-memory/plugin.wrap.info @@ -0,0 +1 @@ +„¤name¦Plugin§version£0.1¤type¦plugin£abiˆ«objectTypes©enumTypes®interfaceTypes³importedObjectTypes³importedModuleTypes±importedEnumTypes°importedEnvTypesªmoduleType‡¤type¦Module¤nameÀ¨requiredÀ¤kindÌ€§methods’†¤type¦Method¤name§getData¨requiredäkind@©arguments¦returnŠ¤type£Int¤name§getData¨requiredäkind"¥arrayÀ£mapÀ¦scalar„¤type£Int¤name§getData¨requiredäkind¦objectÀ¤enumÀ¶unresolvedObjectOrEnumÀ†¤type¦Method¤name§setData¨requiredäkind@©arguments‘Š¤type£Int¤name¥value¨requiredäkind"¥arrayÀ£mapÀ¦scalar„¤type£Int¤name¥value¨requiredäkind¦objectÀ¤enumÀ¶unresolvedObjectOrEnumÀ¦returnŠ¤type§Boolean¤name§setData¨requiredäkind"¥arrayÀ£mapÀ¦scalar„¤type§Boolean¤name§setData¨requiredäkind¦objectÀ¤enumÀ¶unresolvedObjectOrEnumÀ§importsªinterfaces \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-as/simple-memory/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-as/simple-memory/polywrap.yaml index 7771164188..ff7158cd76 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/simple-memory/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-as/simple-memory/polywrap.yaml @@ -1,10 +1,10 @@ -format: 0.1.0 +format: "0.2" name: SimpleMemory language: wasm/assemblyscript build: ./polywrap.build.yaml schema: ./schema.graphql module: ./src/index.ts meta: ./polywrap.meta.yaml -import_redirects: +import_abis: - uri: "ens/memory-storage.polywrap.eth" - schema: ./plugin.graphql \ No newline at end of file + abi: ./plugin.wrap.info \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-as/simple-redirect-resolver/package.json b/packages/test-cases/cases/wrappers/wasm-as/simple-redirect-resolver/package.json index 15ecbabffb..26d41093fe 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/simple-redirect-resolver/package.json +++ b/packages/test-cases/cases/wrappers/wasm-as/simple-redirect-resolver/package.json @@ -2,7 +2,7 @@ "name": "test-case-simple-redirect-resolver", "private": true, "dependencies": { - "@polywrap/wasm-as": "0.2.0", + "@polywrap/wasm-as": "0.3.0", "assemblyscript": "0.19.1" } } diff --git a/packages/test-cases/cases/wrappers/wasm-as/simple-redirect-resolver/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-as/simple-redirect-resolver/polywrap.yaml index a4a3d98cfe..ef70fc18b1 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/simple-redirect-resolver/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-as/simple-redirect-resolver/polywrap.yaml @@ -1,9 +1,9 @@ -format: 0.1.0 +format: "0.2" name: SimpleRedirectResolver language: wasm/assemblyscript build: ./polywrap.build.yaml schema: ./schema.graphql module: ./src/index.ts -import_redirects: +import_abis: - uri: "ens/uri-resolver.core.polywrap.eth" - schema: ../../../../../interfaces/uri-resolver/src/schema.graphql \ No newline at end of file + abi: ../../../../../interfaces/uri-resolver/build-man/wrap.info \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-as/simple-storage/package.json b/packages/test-cases/cases/wrappers/wasm-as/simple-storage/package.json index c15ad4c071..d097d8b3d9 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/simple-storage/package.json +++ b/packages/test-cases/cases/wrappers/wasm-as/simple-storage/package.json @@ -1,8 +1,11 @@ { "name": "test-case-simple-storage", "private": true, + "scripts": { + "build": "../../../../../cli/bin/polywrap build" + }, "dependencies": { - "@polywrap/wasm-as": "0.1.0", + "@polywrap/wasm-as": "0.3.0", "assemblyscript": "0.19.5" } } \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-as/simple-storage/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-as/simple-storage/polywrap.yaml index ba44448b32..495d66faa5 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/simple-storage/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-as/simple-storage/polywrap.yaml @@ -1,7 +1,10 @@ -format: 0.1.0 +format: "0.2" name: SimpleStorage language: wasm/assemblyscript build: ./polywrap.build.yaml meta: ./polywrap.meta.yaml schema: ./schema.graphql module: ./src/index.ts +import_abis: + - uri: "wrap://ens/ethereum.polywrap.eth" + abi: ../../../../../js/plugins/ethereum/build/wrap.info diff --git a/packages/test-cases/cases/wrappers/wasm-as/simple/package.json b/packages/test-cases/cases/wrappers/wasm-as/simple/package.json index b1cf366f2b..0c89b0f08e 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/simple/package.json +++ b/packages/test-cases/cases/wrappers/wasm-as/simple/package.json @@ -2,7 +2,7 @@ "name": "test-case-simple", "private": true, "dependencies": { - "@polywrap/wasm-as": "0.1.0", + "@polywrap/wasm-as": "0.3.0", "assemblyscript": "0.19.1" } } diff --git a/packages/test-cases/cases/wrappers/wasm-as/simple/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-as/simple/polywrap.yaml index 6e140d227f..238f919551 100644 --- a/packages/test-cases/cases/wrappers/wasm-as/simple/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-as/simple/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: Simple language: wasm/assemblyscript build: ./polywrap.build.yaml diff --git a/packages/test-cases/cases/wrappers/wasm-rs/asyncify/plugin.graphql b/packages/test-cases/cases/wrappers/wasm-rs/asyncify/plugin.graphql deleted file mode 100644 index df63b97a79..0000000000 --- a/packages/test-cases/cases/wrappers/wasm-rs/asyncify/plugin.graphql +++ /dev/null @@ -1,7 +0,0 @@ -type Module { - getData: Int! - - setData( - value: Int! - ): Boolean! -} \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-rs/asyncify/plugin.wrap.info b/packages/test-cases/cases/wrappers/wasm-rs/asyncify/plugin.wrap.info new file mode 100644 index 0000000000..ce20b6b055 --- /dev/null +++ b/packages/test-cases/cases/wrappers/wasm-rs/asyncify/plugin.wrap.info @@ -0,0 +1 @@ +„¤name¦Plugin§version£0.1¤type¦plugin£abiˆ«objectTypes©enumTypes®interfaceTypes³importedObjectTypes³importedModuleTypes±importedEnumTypes°importedEnvTypesªmoduleType‡¤type¦Module¤nameÀ¨requiredÀ¤kindÌ€§methods’†¤type¦Method¤name§getData¨requiredäkind@©arguments¦returnŠ¤type£Int¤name§getData¨requiredäkind"¥arrayÀ£mapÀ¦scalar„¤type£Int¤name§getData¨requiredäkind¦objectÀ¤enumÀ¶unresolvedObjectOrEnumÀ†¤type¦Method¤name§setData¨requiredäkind@©arguments‘Š¤type£Int¤name¥value¨requiredäkind"¥arrayÀ£mapÀ¦scalar„¤type£Int¤name¥value¨requiredäkind¦objectÀ¤enumÀ¶unresolvedObjectOrEnumÀ¦returnŠ¤type§Boolean¤name§setData¨requiredäkind"¥arrayÀ£mapÀ¦scalar„¤type§Boolean¤name§setData¨requiredäkind¦objectÀ¤enumÀ¶unresolvedObjectOrEnumÀ§importsªinterfaces \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-rs/asyncify/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-rs/asyncify/polywrap.yaml index a9737df33f..d7c4f9592f 100644 --- a/packages/test-cases/cases/wrappers/wasm-rs/asyncify/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-rs/asyncify/polywrap.yaml @@ -1,9 +1,9 @@ -format: 0.1.0 +format: "0.2" name: Asyncify language: wasm/rust build: ./polywrap.build.yaml schema: ./schema.graphql module: ./Cargo.toml -import_redirects: +import_abis: - uri: "ens/memory-storage.polywrap.eth" - schema: ./plugin.graphql \ No newline at end of file + abi: ./plugin.wrap.info diff --git a/packages/test-cases/cases/wrappers/wasm-rs/benchmarks/polywrap-current.yaml b/packages/test-cases/cases/wrappers/wasm-rs/benchmarks/polywrap-current.yaml index 7aaef9a573..bb009ddcfd 100644 --- a/packages/test-cases/cases/wrappers/wasm-rs/benchmarks/polywrap-current.yaml +++ b/packages/test-cases/cases/wrappers/wasm-rs/benchmarks/polywrap-current.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: Benchmark language: wasm/rust build: ./polywrap-current.build.yaml diff --git a/packages/test-cases/cases/wrappers/wasm-rs/benchmarks/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-rs/benchmarks/polywrap.yaml index ff6d4389da..6cc79c2e2e 100644 --- a/packages/test-cases/cases/wrappers/wasm-rs/benchmarks/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-rs/benchmarks/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: Benchmark language: wasm/rust build: ./polywrap.build.yaml diff --git a/packages/test-cases/cases/wrappers/wasm-rs/bigint-type/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-rs/bigint-type/polywrap.yaml index cd0ec0630c..7f06a0324c 100644 --- a/packages/test-cases/cases/wrappers/wasm-rs/bigint-type/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-rs/bigint-type/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: BigInt language: wasm/rust build: ./polywrap.build.yaml diff --git a/packages/test-cases/cases/wrappers/wasm-rs/bignumber-type/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-rs/bignumber-type/polywrap.yaml index e11bb7b112..1cb5fea463 100644 --- a/packages/test-cases/cases/wrappers/wasm-rs/bignumber-type/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-rs/bignumber-type/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: BigNumber language: wasm/rust build: ./polywrap.build.yaml diff --git a/packages/test-cases/cases/wrappers/wasm-rs/bytes-type/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-rs/bytes-type/polywrap.yaml index 853147ce23..b47c2269e9 100644 --- a/packages/test-cases/cases/wrappers/wasm-rs/bytes-type/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-rs/bytes-type/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: Bytes language: wasm/rust build: ./polywrap.build.yaml diff --git a/packages/test-cases/cases/wrappers/wasm-rs/enum-types/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-rs/enum-types/polywrap.yaml index 4c77d301c0..677e29ba39 100644 --- a/packages/test-cases/cases/wrappers/wasm-rs/enum-types/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-rs/enum-types/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: Enum language: wasm/rust build: ./polywrap.build.yaml diff --git a/packages/test-cases/cases/wrappers/wasm-rs/env-types/external/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-rs/env-types/external/polywrap.yaml index d35f63fde9..62566af5a2 100644 --- a/packages/test-cases/cases/wrappers/wasm-rs/env-types/external/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-rs/env-types/external/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: EnvTypeExternal language: wasm/rust build: ./polywrap.build.yaml diff --git a/packages/test-cases/cases/wrappers/wasm-rs/env-types/main/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-rs/env-types/main/polywrap.yaml index e37240c372..64df57d42b 100644 --- a/packages/test-cases/cases/wrappers/wasm-rs/env-types/main/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-rs/env-types/main/polywrap.yaml @@ -1,9 +1,9 @@ -format: 0.1.0 +format: "0.2" name: EnvType language: wasm/rust build: ./polywrap.build.yaml schema: ./schema.graphql module: ./Cargo.toml -import_redirects: +import_abis: - uri: "ens/externalenv.polywrap.eth" - schema: ../external/build/schema.graphql \ No newline at end of file + abi: ../external/build/wrap.info \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-rs/implementations/test-interface/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-rs/implementations/test-interface/polywrap.yaml index d6f5b8a82d..00a7c96f03 100644 --- a/packages/test-cases/cases/wrappers/wasm-rs/implementations/test-interface/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-rs/implementations/test-interface/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: TestInterface language: interface schema: ./schema.graphql diff --git a/packages/test-cases/cases/wrappers/wasm-rs/implementations/test-use-getImpl/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-rs/implementations/test-use-getImpl/polywrap.yaml index 53d8f70c0a..b8cf8f6700 100644 --- a/packages/test-cases/cases/wrappers/wasm-rs/implementations/test-use-getImpl/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-rs/implementations/test-use-getImpl/polywrap.yaml @@ -1,9 +1,9 @@ -format: 0.1.0 +format: "0.2" name: TestUseGetImpl build: ./polywrap.build.yaml language: wasm/rust schema: ./schema.graphql module: ./Cargo.toml -import_redirects: +import_abis: - uri: wrap://ens/interface.eth - schema: ../test-interface/build/schema.graphql \ No newline at end of file + abi: ../test-interface/build/wrap.info \ No newline at end of file diff --git a/packages/test-cases/cases/wrappers/wasm-rs/implementations/test-wrapper/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-rs/implementations/test-wrapper/polywrap.yaml index b1abe639c2..ec5f181511 100644 --- a/packages/test-cases/cases/wrappers/wasm-rs/implementations/test-wrapper/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-rs/implementations/test-wrapper/polywrap.yaml @@ -1,9 +1,9 @@ -format: 0.1.0 +format: "0.2" name: TestWrapper language: wasm/rust build: ./polywrap.build.yaml schema: ./schema.graphql module: ./Cargo.toml -import_redirects: +import_abis: - uri: wrap://ens/interface.eth - schema: ../test-interface/build/schema.graphql + abi: ../test-interface/build/wrap.info diff --git a/packages/test-cases/cases/wrappers/wasm-rs/invalid-types/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-rs/invalid-types/polywrap.yaml index e1f36939af..87f81d30b1 100644 --- a/packages/test-cases/cases/wrappers/wasm-rs/invalid-types/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-rs/invalid-types/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: InvalidTypes language: wasm/rust build: ./polywrap.build.yaml diff --git a/packages/test-cases/cases/wrappers/wasm-rs/json-type/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-rs/json-type/polywrap.yaml index 565f670668..cfac87e412 100644 --- a/packages/test-cases/cases/wrappers/wasm-rs/json-type/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-rs/json-type/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: JsonType language: wasm/rust build: ./polywrap.build.yaml diff --git a/packages/test-cases/cases/wrappers/wasm-rs/large-types/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-rs/large-types/polywrap.yaml index e36a2c0721..d381fd474c 100644 --- a/packages/test-cases/cases/wrappers/wasm-rs/large-types/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-rs/large-types/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: LargeTypes language: wasm/rust build: ./polywrap.build.yaml diff --git a/packages/test-cases/cases/wrappers/wasm-rs/map-type/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-rs/map-type/polywrap.yaml index 29fa1f5283..f3c77a68c2 100644 --- a/packages/test-cases/cases/wrappers/wasm-rs/map-type/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-rs/map-type/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: MapType language: wasm/rust build: ./polywrap.build.yaml diff --git a/packages/test-cases/cases/wrappers/wasm-rs/number-types/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-rs/number-types/polywrap.yaml index 6fc8e27e1c..115c557815 100644 --- a/packages/test-cases/cases/wrappers/wasm-rs/number-types/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-rs/number-types/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: NumberTypes language: wasm/rust build: ./polywrap.build.yaml diff --git a/packages/test-cases/cases/wrappers/wasm-rs/object-types/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-rs/object-types/polywrap.yaml index 085ec48617..380a4d4b9c 100644 --- a/packages/test-cases/cases/wrappers/wasm-rs/object-types/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-rs/object-types/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: ObjectTypes language: wasm/rust build: ./polywrap.build.yaml diff --git a/packages/test-cases/cases/wrappers/wasm-rs/simple-env-types/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-rs/simple-env-types/polywrap.yaml index d35f63fde9..62566af5a2 100644 --- a/packages/test-cases/cases/wrappers/wasm-rs/simple-env-types/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-rs/simple-env-types/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: EnvTypeExternal language: wasm/rust build: ./polywrap.build.yaml diff --git a/packages/test-cases/cases/wrappers/wasm-rs/simple-storage/polywrap.yaml b/packages/test-cases/cases/wrappers/wasm-rs/simple-storage/polywrap.yaml index 0976d649be..c4a24818e3 100644 --- a/packages/test-cases/cases/wrappers/wasm-rs/simple-storage/polywrap.yaml +++ b/packages/test-cases/cases/wrappers/wasm-rs/simple-storage/polywrap.yaml @@ -1,4 +1,4 @@ -format: 0.1.0 +format: "0.2" name: SimpleStorage language: wasm/rust build: ./polywrap.build.yaml diff --git a/yarn.lock b/yarn.lock index 6ed07260b6..1f5691a023 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2102,6 +2102,13 @@ optionalDependencies: node-notifier "^8.0.0" +"@jest/schemas@^28.1.3": + version "28.1.3" + resolved "https://registry.yarnpkg.com/@jest/schemas/-/schemas-28.1.3.tgz#ad8b86a66f11f33619e3d7e1dcddd7f2d40ff905" + integrity sha512-/l/VWsdt/aBXgjshLWOFyFt3IVdYypu5y2Wn2rOO1un6nkqIn8SLXzgIMYXFyYsRWDyF5EthmKJMIdJvk08grg== + dependencies: + "@sinclair/typebox" "^0.24.1" + "@jest/source-map@^24.3.0", "@jest/source-map@^24.9.0": version "24.9.0" resolved "https://registry.yarnpkg.com/@jest/source-map/-/source-map-24.9.0.tgz#0e263a94430be4b41da683ccc1e6bffe2a191714" @@ -2266,9 +2273,9 @@ integrity sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw== "@jridgewell/trace-mapping@^0.3.9": - version "0.3.14" - resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.14.tgz#b231a081d8f66796e475ad588a1ef473112701ed" - integrity sha512-bJWEfQ9lPTvm3SneWwRFVLzrh6nhjwqw7TUFFBEMzwvg7t7PCDenf2lDwqo4NQXzdpgBXyFgDWnQA+2vkruksQ== + version "0.3.15" + resolved "https://registry.yarnpkg.com/@jridgewell/trace-mapping/-/trace-mapping-0.3.15.tgz#aba35c48a38d3fd84b37e66c9c0423f9744f9774" + integrity sha512-oWZNOULl+UbhsgB51uuZzglikfIKSUBO/M9W2OfEjn7cmqoAiCgmv9lyACTUacZwBz0ITnJ2NqjU8Tx0DHL88g== dependencies: "@jridgewell/resolve-uri" "^3.0.3" "@jridgewell/sourcemap-codec" "^1.4.10" @@ -3299,6 +3306,11 @@ "@opentelemetry/semantic-conventions" "0.20.0" "@opentelemetry/tracing" "0.20.0" +"@sinclair/typebox@^0.24.1": + version "0.24.28" + resolved "https://registry.yarnpkg.com/@sinclair/typebox/-/typebox-0.24.28.tgz#15aa0b416f82c268b1573ab653e4413c965fe794" + integrity sha512-dgJd3HLOkLmz4Bw50eZx/zJwtBq65nms3N9VBYu5LTjJ883oBFkTyXRlCB/ZGGwqYpJJHA5zW2Ibhl5ngITfow== + "@sinonjs/commons@^1.7.0": version "1.8.3" resolved "https://registry.yarnpkg.com/@sinonjs/commons/-/commons-1.8.3.tgz#3802ddd21a50a949b6721ddd72da36e67e7f1b2d" @@ -3650,9 +3662,9 @@ integrity sha512-0d5Wd09ItQWH1qFbEyQ7oTQ3GZrMfth5JkbN3EvTKLXcHLRDSXeLnlvlOn0wvxVIwK5o2M8JzP/OWz7T3NRsbw== "@types/lodash@^4.14.182": - version "4.14.182" - resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.182.tgz#05301a4d5e62963227eaafe0ce04dd77c54ea5c2" - integrity sha512-/THyiqyQAP9AfARo4pF+aCGcyiQ94tX/Is2I7HofNRqoYLgN1PBoOWu2/zTA5zMxzP5EFutMtWtGAFRKUe961Q== + version "4.14.183" + resolved "https://registry.yarnpkg.com/@types/lodash/-/lodash-4.14.183.tgz#1173e843e858cff5b997c234df2789a4a54c2374" + integrity sha512-UXavyuxzXKMqJPEpFPri6Ku5F9af6ZJXUneHhvQJxavrEjuHkFp2YnDWHcxJiG7hk8ZkWqjcyNeW1s/smZv5cw== "@types/minimatch@*", "@types/minimatch@^3.0.3": version "3.0.5" @@ -3670,9 +3682,9 @@ integrity sha512-wH6Tu9mbiOt0n5EvdoWy0VGQaJMHfLIxY/6wS0xLC7CV1taM6gESEzcYy0ZlWvxxiiljYvfDIvz4hHbUUDRlhw== "@types/node@*": - version "18.6.4" - resolved "https://registry.yarnpkg.com/@types/node/-/node-18.6.4.tgz#fd26723a8a3f8f46729812a7f9b4fc2d1608ed39" - integrity sha512-I4BD3L+6AWiUobfxZ49DlU43gtI+FTHSv9pE2Zekg6KjMpre4ByusaljW3vYSLJrvQ1ck1hUaeVu8HVlY3vzHg== + version "18.7.6" + resolved "https://registry.yarnpkg.com/@types/node/-/node-18.7.6.tgz#31743bc5772b6ac223845e18c3fc26f042713c83" + integrity sha512-EdxgKRXgYsNITy5mjjXjVE/CS8YENSdhiagGrLqjG0pvA2owgJ6i4l7wy/PFZGC0B1/H20lWKN7ONVDNYDZm7A== "@types/node@12.12.26": version "12.12.26" @@ -5080,11 +5092,16 @@ big.js@^5.2.2: resolved "https://registry.yarnpkg.com/big.js/-/big.js-5.2.2.tgz#65f0af382f578bcdc742bd9c281e9cb2d7768328" integrity sha512-vyL2OymJxmarO8gxMr0mhChsO9QGwhynfuu4+MHTAW6czfq9humCB7rKpUjDd9YUiDPU4mzpyupFSvOClAwbmQ== -bignumber.js@9.0.2, bignumber.js@^9.0.0: +bignumber.js@9.0.2: version "9.0.2" resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.0.2.tgz#71c6c6bed38de64e24a65ebe16cfcf23ae693673" integrity sha512-GAcQvbpsM0pUb0zw1EI0KhQEZ+lRwR5fYaAp3vPOYuP7aDvGy6cVN6XHLauvF8SOga2y0dcLcjt3iQDTSEliyw== +bignumber.js@^9.0.0: + version "9.1.0" + resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.0.tgz#8d340146107fe3a6cb8d40699643c302e8773b62" + integrity sha512-4LwHK4nfDOraBCtst+wOWIHbu1vhvAPJK8g8nROd4iuc3PSEjWif/qwbkh8jwCJz6yDBvtU4KPynETgrfh7y3A== + binary-extensions@^1.0.0: version "1.13.1" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-1.13.1.tgz#598afe54755b2868a5330d2aff9d4ebb53209b65" @@ -5615,9 +5632,9 @@ caniuse-api@^3.0.0: lodash.uniq "^4.5.0" caniuse-lite@^1.0.0, caniuse-lite@^1.0.30000981, caniuse-lite@^1.0.30001035, caniuse-lite@^1.0.30001109, caniuse-lite@^1.0.30001370: - version "1.0.30001374" - resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001374.tgz#3dab138e3f5485ba2e74bd13eca7fe1037ce6f57" - integrity sha512-mWvzatRx3w+j5wx/mpFN5v5twlPrabG8NqX2c6e45LCpymdoGqNvRkRutFUqpRTXKFQFNQJasvK0YT7suW6/Hw== + version "1.0.30001378" + resolved "https://registry.yarnpkg.com/caniuse-lite/-/caniuse-lite-1.0.30001378.tgz#3d2159bf5a8f9ca093275b0d3ecc717b00f27b67" + integrity sha512-JVQnfoO7FK7WvU4ZkBRbPjaot4+YqxogSDosHv0Hv5mWpUESmN+UubMU6L/hGz8QlQ2aY5U0vR6MOs6j/CXpNA== capture-exit@^2.0.0: version "2.0.0" @@ -6827,9 +6844,9 @@ decamelize@^1.1.0, decamelize@^1.2.0: integrity sha512-z2S+W9X73hAUUki+N+9Za2lBlun89zigOyGrsax+KUQ6wKW4ZoWpEYBkGhQjwAjjDCkWxhY0VKEhk8wzY7F5cA== decimal.js@^10.2.1: - version "10.3.1" - resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.3.1.tgz#d8c3a444a9c6774ba60ca6ad7261c3a94fd5e783" - integrity sha512-V0pfhfr8suzyPGOx3nmq4aHqabehUZn6Ch9kyFpV79TGDTWFmHqUqXdabR7QHqxzrYolF4+tVmJhUG4OURg5dQ== + version "10.4.0" + resolved "https://registry.yarnpkg.com/decimal.js/-/decimal.js-10.4.0.tgz#97a7448873b01e92e5ff9117d89a7bca8e63e0fe" + integrity sha512-Nv6ENEzyPQ6AItkGwLE2PGKinZZ9g59vSh2BeH6NqPu0OTKZ5ruJsVqh/orbAnqXc9pBbgXAIrc2EyaCj8NpGg== decode-uri-component@^0.2.0: version "0.2.0" @@ -7025,6 +7042,11 @@ diff-sequences@^27.5.1: resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-27.5.1.tgz#eaecc0d327fd68c8d9672a1e64ab8dccb2ef5327" integrity sha512-k1gCAXAsNgLwEL+Y8Wvl+M6oEFj5bgazfZULpS5CneoPPXRaCCW7dm+q21Ky2VEE5X+VeRDBVg1Pcvvsr4TtNQ== +diff-sequences@^28.1.1: + version "28.1.1" + resolved "https://registry.yarnpkg.com/diff-sequences/-/diff-sequences-28.1.1.tgz#9989dc731266dc2903457a70e996f3a041913ac6" + integrity sha512-FU0iFaH/E23a+a718l8Qa/19bF9p06kgE0KipMOMadwa3SjnaElKzPaUC0vnibs6/B/9ni97s61mcejk8W1fQw== + diff@^4.0.1: version "4.0.2" resolved "https://registry.yarnpkg.com/diff/-/diff-4.0.2.tgz#60f3aecb89d5fae520c11aa19efc2bb982aade7d" @@ -7285,9 +7307,9 @@ electron-fetch@^1.7.2: encoding "^0.1.13" electron-to-chromium@^1.3.378, electron-to-chromium@^1.4.202: - version "1.4.211" - resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.211.tgz#afaa8b58313807501312d598d99b953568d60f91" - integrity sha512-BZSbMpyFQU0KBJ1JG26XGeFI3i4op+qOYGxftmZXFZoHkhLgsSv4DHDJfl8ogII3hIuzGt51PaZ195OVu0yJ9A== + version "1.4.222" + resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.222.tgz#2ba24bef613fc1985dbffea85df8f62f2dec6448" + integrity sha512-gEM2awN5HZknWdLbngk4uQCVfhucFAfFzuchP3wM3NN6eow1eDU0dFy2kts43FB20ZfhVFF0jmFSTb1h5OhyIg== elliptic@6.5.4, elliptic@^6.5.3: version "6.5.4" @@ -7590,12 +7612,11 @@ eslint-loader@3.0.3: schema-utils "^2.6.1" eslint-module-utils@^2.4.1, eslint-module-utils@^2.6.0: - version "2.7.3" - resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.7.3.tgz#ad7e3a10552fdd0642e1e55292781bd6e34876ee" - integrity sha512-088JEC7O3lDZM9xGe0RerkOMd0EjFl+Yvd1jPWIkMT5u3H9+HC34mWWPnqPrN13gieT9pBOO+Qt07Nb/6TresQ== + version "2.7.4" + resolved "https://registry.yarnpkg.com/eslint-module-utils/-/eslint-module-utils-2.7.4.tgz#4f3e41116aaf13a20792261e61d3a2e7e0583974" + integrity sha512-j4GT+rqzCoRKHwURX7pddtIPGySnX9Si/cgMI5ztrcqOPtk5dDEeZ34CQVPphnqkJytlc97Vuk05Um2mJ3gEQA== dependencies: debug "^3.2.7" - find-up "^2.1.0" eslint-plugin-flowtype@4.6.0: version "4.6.0" @@ -8385,7 +8406,7 @@ find-up@^1.0.0: path-exists "^2.0.0" pinkie-promise "^2.0.0" -find-up@^2.0.0, find-up@^2.1.0: +find-up@^2.0.0: version "2.1.0" resolved "https://registry.yarnpkg.com/find-up/-/find-up-2.1.0.tgz#45d1b7e506c717ddd482775a2b77920a3c0c57a7" integrity sha512-NWzkk0jSJtTt08+FBFMvXoeZnOJD+jTtsRmBYbAIzJdX6l7dLgR7CTubCM5/eDdPUBvLCeVasP1brfVR/9/EZQ== @@ -10610,6 +10631,16 @@ jest-config@^26.6.3: micromatch "^4.0.2" pretty-format "^26.6.2" +jest-diff@28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-28.1.3.tgz#948a192d86f4e7a64c5264ad4da4877133d8792f" + integrity sha512-8RqP1B/OXzjjTWkqMX67iqgwBVJRgCyKD3L9nq+6ZqJMdvjE8RgHktqZ6jNrkdMT+dJuYNI3rhQpxaz7drJHfw== + dependencies: + chalk "^4.0.0" + diff-sequences "^28.1.1" + jest-get-type "^28.0.2" + pretty-format "^28.1.3" + jest-diff@^24.9.0: version "24.9.0" resolved "https://registry.yarnpkg.com/jest-diff/-/jest-diff-24.9.0.tgz#931b7d0d5778a1baf7452cb816e325e3724055da" @@ -10766,6 +10797,11 @@ jest-get-type@^27.5.1: resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-27.5.1.tgz#3cd613c507b0f7ace013df407a1c1cd578bcb4f1" integrity sha512-2KY95ksYSaK7DMBWQn6dQz3kqAf3BB64y2udeG+hv4KfSOb9qwcYQstTJc1KCbsix+wLZWZYN8t7nwX3GOBLRw== +jest-get-type@^28.0.2: + version "28.0.2" + resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-28.0.2.tgz#34622e628e4fdcd793d46db8a242227901fcf203" + integrity sha512-ioj2w9/DxSYHfOm5lJKCdcAmPJzQXmbM/Url3rhlghrPvT3tt+7a/+oXc9azkKmLvoiXjtV83bEWqi+vs5nlPA== + jest-haste-map@^24.9.0: version "24.9.0" resolved "https://registry.yarnpkg.com/jest-haste-map/-/jest-haste-map-24.9.0.tgz#b38a5d64274934e21fa417ae9a9fbeb77ceaac7d" @@ -13308,9 +13344,9 @@ object-visit@^1.0.0: isobject "^3.0.0" object.assign@^4.1.0, object.assign@^4.1.2: - version "4.1.3" - resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.3.tgz#d36b7700ddf0019abb6b1df1bb13f6445f79051f" - integrity sha512-ZFJnX3zltyjcYJL0RoCJuzb+11zWGyaDbjgxZbdV7rFEcHQuYxrZqhow67aA7xpes6LhojyFDaBKAFfogQrikA== + version "4.1.4" + resolved "https://registry.yarnpkg.com/object.assign/-/object.assign-4.1.4.tgz#9673c7c7c351ab8c4d0b516f4343ebf4dfb7799f" + integrity sha512-1mxKf0e58bvyjSCtKYY4sRe9itRk3PJpquJOjeIkz885CczcI4IvJJDLPS72oowuSh+pBxUFROpX+TU++hxhZQ== dependencies: call-bind "^1.0.2" define-properties "^1.1.4" @@ -14008,9 +14044,9 @@ pnp-webpack-plugin@1.6.4: ts-pnp "^1.1.6" portfinder@^1.0.25: - version "1.0.29" - resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.29.tgz#d06ff886f4ff91274ed3e25c7e6b0c68d2a0735a" - integrity sha512-Z5+DarHWCKlufshB9Z1pN95oLtANoY5Wn9X3JGELGyQ6VhEcBfT2t+1fGUBq7MwUant6g/mqowH+4HifByPbiQ== + version "1.0.32" + resolved "https://registry.yarnpkg.com/portfinder/-/portfinder-1.0.32.tgz#2fe1b9e58389712429dc2bea5beb2146146c7f81" + integrity sha512-on2ZJVVDXRADWE6jnQaX0ioEylzgBpQk8r55NE4wjXW1ZxO+BgDlY6DXwj20i0V8eB4SenDQ00WEaxfiIQPcxg== dependencies: async "^2.6.4" debug "^3.2.7" @@ -14762,6 +14798,16 @@ pretty-format@^27.0.0, pretty-format@^27.5.1: ansi-styles "^5.0.0" react-is "^17.0.1" +pretty-format@^28.1.3: + version "28.1.3" + resolved "https://registry.yarnpkg.com/pretty-format/-/pretty-format-28.1.3.tgz#c9fba8cedf99ce50963a11b27d982a9ae90970d5" + integrity sha512-8gFb/To0OmxHR9+ZTb14Df2vNxdGCX8g1xWGUTqUw5TiZvcQf5sHKObd5UcPyLLyowNwDAMTF3XWOG1B6mxl1Q== + dependencies: + "@jest/schemas" "^28.1.3" + ansi-regex "^5.0.1" + ansi-styles "^5.0.0" + react-is "^18.0.0" + process-nextick-args@~1.0.6: version "1.0.7" resolved "https://registry.yarnpkg.com/process-nextick-args/-/process-nextick-args-1.0.7.tgz#150e20b756590ad3f91093f25a4f2ad8bff30ba3" @@ -15161,6 +15207,11 @@ react-is@^17.0.1: resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0" integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w== +react-is@^18.0.0: + version "18.2.0" + resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b" + integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w== + react-lottie@1.2.3: version "1.2.3" resolved "https://registry.yarnpkg.com/react-lottie/-/react-lottie-1.2.3.tgz#8544b96939e088658072eea5e12d912cdaa3acc1" @@ -17433,9 +17484,9 @@ typescript@^4.0: integrity sha512-C0WQT0gezHuw6AdY1M2jxUO83Rjf0HP7Sk1DtXj6j1EwkQNZrHAg2XPWlq62oqEhYvONq5pkC2Y9oPljWToLmQ== uglify-js@^3.1.4: - version "3.16.3" - resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.16.3.tgz#94c7a63337ee31227a18d03b8a3041c210fd1f1d" - integrity sha512-uVbFqx9vvLhQg0iBaau9Z75AxWJ8tqM9AV890dIZCLApF4rTcyHwmAvLeEdYRs+BzYWu8Iw81F79ah0EfTXbaw== + version "3.17.0" + resolved "https://registry.yarnpkg.com/uglify-js/-/uglify-js-3.17.0.tgz#55bd6e9d19ce5eef0d5ad17cd1f587d85b180a85" + integrity sha512-aTeNPVmgIMPpm1cxXr2Q/nEbvkmV8yq66F3om7X3P/cvOXQ0TMQ64Wk63iyT1gPlmdmGzjGpyLh1f3y8MZWXGg== uid-number@0.0.6: version "0.0.6" @@ -17829,9 +17880,9 @@ vscode-languageserver-types@^3.16.0: integrity sha512-zHhCWatviizPIq9B7Vh9uvrH6x3sK8itC84HkamnBWoDFJtzBf7SWlpLCZUit72b3os45h6RWQNC9xHRDF8dRA== vscode-nls@^5.0.0: - version "5.0.1" - resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.0.1.tgz#ba23fc4d4420d25e7f886c8e83cbdcec47aa48b2" - integrity sha512-hHQV6iig+M21lTdItKPkJAaWrxALQb/nqpVffakO4knJOh3DrU2SXOMzUzNgo1eADPzu3qSsJY1weCzvR52q9A== + version "5.1.0" + resolved "https://registry.yarnpkg.com/vscode-nls/-/vscode-nls-5.1.0.tgz#443b301a7465d88c81c0f4e1914f9857f0dce1e4" + integrity sha512-37Ha44QrLFwR2IfSSYdOArzUvOyoWbOYTwQC+wS0NfqKjhW7s0WQ1lMy5oJXgSZy9sAiZS5ifELhbpXodeMR8w== vscode-uri@^3.0.3: version "3.0.3" @@ -18627,8 +18678,8 @@ zen-observable@^0.8.0: integrity sha512-PQ2PC7R9rslx84ndNBZB/Dkv8V8fZEpk83RLgXtYd0fwUgEjseMn1Dgajh2x6S8QbZAFa9p2qVCEuYZNgve0dQ== zone.js@^0.11.0: - version "0.11.7" - resolved "https://registry.yarnpkg.com/zone.js/-/zone.js-0.11.7.tgz#262194267c7b964e8da77ce16b9fba9bea23cfdc" - integrity sha512-e39K2EdK5JfA3FDuUTVRvPlYV4aBfnOOcGuILhQAT7nzeV12uSrLBzImUM9CDVoncDSX4brR/gwqu0heQ3BQ0g== + version "0.11.8" + resolved "https://registry.yarnpkg.com/zone.js/-/zone.js-0.11.8.tgz#40dea9adc1ad007b5effb2bfed17f350f1f46a21" + integrity sha512-82bctBg2hKcEJ21humWIkXRlLBBmrc3nN7DFh5LGGhcyycO2S7FN8NmdvlcKaGFDNVL4/9kFLmwmInTavdJERA== dependencies: tslib "^2.3.0"